Reputation: 849
What is the minimum version of Java/JDK required to use GSON API? And for gson-2.2.1.jar ?
Upvotes: 3
Views: 15359
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
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
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
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
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
Reputation: 18123
You need to have minimum of Java 1.5 because it uses java 1.5 features heavily like annotations.
Upvotes: 2