Skip to content

Build failure with Java 21 #2501

@ebourg

Description

@ebourg

Gson fails to build with Java 21, for two reasons:

  1. The source/target level 7 is no longer supported:

     [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project gson: Fatal error compiling: error: release version 7 not supported -> [Help 1]
    
  2. If the level is changed to 8, compiler warnings appear and break the build:

     [INFO] -------------------------------------------------------------
     [WARNING] COMPILATION WARNING :
     [INFO] -------------------------------------------------------------
     [WARNING] gson/src/main/java/com/google/gson/internal/$Gson$Types.java:[500,24] non-transient instance field of a serializable class declared with a non-serializable type
     [WARNING] gson/src/main/java/com/google/gson/internal/$Gson$Types.java:[501,24] non-transient instance field of a serializable class declared with a non-serializable type
     [WARNING] gson/src/main/java/com/google/gson/internal/$Gson$Types.java:[502,26] non-transient instance field of a serializable class declared with an array having a non-serializable base component type java.lang.reflect.Type
     [WARNING] gson/src/main/java/com/google/gson/internal/$Gson$Types.java:[567,24] non-transient instance field of a serializable class declared with a non-serializable type
     [WARNING] gson/src/main/java/com/google/gson/internal/$Gson$Types.java:[601,24] non-transient instance field of a serializable class declared with a non-serializable type
     [WARNING] gson/src/main/java/com/google/gson/internal/$Gson$Types.java:[602,24] non-transient instance field of a serializable class declared with a non-serializable type
     [INFO] 6 warnings
     [INFO] -------------------------------------------------------------
     [INFO] -------------------------------------------------------------
     [ERROR] COMPILATION ERROR :
     [INFO] -------------------------------------------------------------
     [ERROR] gson/src/main/java/com/google/gson/internal/$Gson$Types.java: warnings found and -Werror specified
     [INFO] 1 error
     [INFO] -------------------------------------------------------------
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugjava8Issues related to making Java 8 the minimum supported version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions