Krishnam
Krishnam

Reputation: 849

GSON Minimum Java version required

What is the minimum version of Java/JDK required to use GSON API? And for gson-2.2.1.jar ?

Upvotes: 3

Views: 15359

Answers (6)

Venny Suya
Venny Suya

Reputation: 1

With jdk1.8 till gson 2.8.5 works fine. Later version till 2.10.1 are compiled fine but failed in deploying the application in jboss server with invalid constant type: 19

Upvotes: 0

vagovszkym
vagovszkym

Reputation: 1460

I can not find any "compatibility table" between Gson versions and JAVA versions. Is there any? I use Gson 2.8.5 and do not know if it is fully compatible with JAVA 1.7.

Upvotes: 2

TheGabiRod
TheGabiRod

Reputation: 418

I was facing some issues related with this, the latest version of GSon at the time is 2.8.5 this doesn't work with java 1.5(Minimun 1.6).

The last version of GSon compatible with Java 1.5 is GSon 2.4

Upvotes: 3

stealthjong
stealthjong

Reputation: 11093

Gson uses JDK 1.5 features heavily; that's the minimum version for Gson, specifically annotations and generics.

Check out this piece of GSON source code, where annotations are used

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface SerializedName {
    String value();
}

Upvotes: 4

Swapnil
Swapnil

Reputation: 8318

Gson uses generics, so you need to be using JDK 1.5+ while working with it.

Having said that, I don't see why you will not be using JDK 6 at least.

Upvotes: 0

Pradeep Simha
Pradeep Simha

Reputation: 18123

You need to have minimum of Java 1.5 because it uses java 1.5 features heavily like annotations.

Upvotes: 2

Related Questions