#6433 closed defect (fixed)

Java support fails to build: error: annotations are not supported in -source 1.4

Reported by: Bas Couwenberg Owned by: Even Rouault
Priority: normal Milestone: 2.1.0
Component: JavaBindings Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

GDAL 2.1.0-beta1 fails to build due to an error building the Java bindings:

compile:
    [mkdir] Created dir: /build/gdal-2.1.0~beta1+dfsg/swig/java/build/classes
    [javac] Compiling 62 source files to /build/gdal-2.1.0~beta1+dfsg/swig/java/build/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.4
    [javac] warning: [options] source value 1.4 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.4 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    [javac] /build/gdal-2.1.0~beta1+dfsg/swig/java/org/gdal/gnm/SWIGTYPE_p_GIntBig.java:14: error: annotations are not supported in -source 1.4
    [javac]   protected SWIGTYPE_p_GIntBig(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
    [javac]                                            ^
    [javac]   (use -source 5 or higher to enable annotations)
    [javac] /build/gdal-2.1.0~beta1+dfsg/swig/java/org/gdal/gnm/SWIGTYPE_p_OGRErr.java:14: error: annotations are not supported in -source 1.4
    [javac]   protected SWIGTYPE_p_OGRErr(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
    [javac]                                           ^
    [javac]   (use -source 5 or higher to enable annotations)
    [javac] /build/gdal-2.1.0~beta1+dfsg/swig/java/org/gdal/gnm/SWIGTYPE_p_OGRFeatureShadow.java:14: error: annotations are not supported in -source 1.4
    [javac]   protected SWIGTYPE_p_OGRFeatureShadow(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
    [javac]                                                     ^
    [javac]   (use -source 5 or higher to enable annotations)
    [javac] /build/gdal-2.1.0~beta1+dfsg/swig/java/org/gdal/gnm/SWIGTYPE_p_OGRLayerShadow.java:14: error: annotations are not supported in -source 1.4
    [javac]   protected SWIGTYPE_p_OGRLayerShadow(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
    [javac]                                                   ^
    [javac]   (use -source 5 or higher to enable annotations)
    [javac] /build/gdal-2.1.0~beta1+dfsg/swig/java/org/gdal/gnm/SWIGTYPE_p_OGRwkbGeometryType.java:14: error: annotations are not supported in -source 1.4
    [javac]   protected SWIGTYPE_p_OGRwkbGeometryType(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
    [javac]                                                       ^
    [javac]   (use -source 5 or higher to enable annotations)
    [javac] /build/gdal-2.1.0~beta1+dfsg/swig/java/org/gdal/gnm/SWIGTYPE_p_OSRSpatialReferenceShadow.java:14: error: annotations are not supported in -source 1.4
    [javac]   protected SWIGTYPE_p_OSRSpatialReferenceShadow(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
    [javac]                                                              ^
    [javac]   (use -source 5 or higher to enable annotations)
    [javac] /build/gdal-2.1.0~beta1+dfsg/swig/java/org/gdal/gnm/SWIGTYPE_p_p_char.java:14: error: annotations are not supported in -source 1.4
    [javac]   protected SWIGTYPE_p_p_char(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
    [javac]                                           ^
    [javac]   (use -source 5 or higher to enable annotations)
    [javac] 7 errors
    [javac] 4 warnings

With the deprecation of Java 7, I think it's a good idea to bump the source and target versions in swig/java/build.xml to 1.8. At least 1.5 should be used for annotations.

Attachments (1)

java-version.patch (704 bytes) - added by Bas Couwenberg 15 months ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 15 months ago by Even Rouault

I guess the annotations are put by the SWIG version you are using. Which one is it ? I don't get them with my ancient SWIG. But probably bumping to 1.5 could be appropriate indeed !

comment:2 Changed 15 months ago by Bas Couwenberg

The Debian package build uses SWIG 3.0.7 from Debian unstable.

The attached patch updates the source and target version to 1.5 which allows the build to succeed.

Changed 15 months ago by Bas Couwenberg

Attachment: java-version.patch added

comment:3 Changed 15 months ago by Even Rouault

Resolution: fixed
Status: newclosed

trunk r33866 "Java bindings: bump minimal java version to 1.5 in case SWIG generates anotations (#6433, patch by Bas Couwenberg)"

Although the fundamental problem raised by the warnings is #6434, and thus the aboe commit r33866 isn't strictly needed after r33867

Note: See TracTickets for help on using tickets.