Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GSON Minimum Java version required

Tags:

java

gson

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

like image 318
Kris Avatar asked Jul 13 '26 07:07

Kris


2 Answers

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();
}
like image 167
stealthjong Avatar answered Jul 14 '26 20:07

stealthjong


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

like image 22
TheGabiRod Avatar answered Jul 14 '26 20:07

TheGabiRod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!