OpenJPA
  1. OpenJPA
  2. OPENJPA-1659

OpenJPA 2.0.0 annotation processor causes plain old Java compilation to fail

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: None
    • Environment:
      * javac 1.6.0_18 & 1.6.0_20 on Linux (Ubuntu 10.04 LTS)
      * javac 1.6.0_20 on Windows XP SP3

      Description

      Compiling the annotation whose source is below with openjpa-2.0.0.jar on the classpath fails with the following error; compiling without succeeds. If I remove the file META-INF/services/javax.annotation.processor.Processor from the openjpa-2.0.0.jar, compilation succeeds.

      =====================================
      Compilation log with OpenJPA on classpath:
      =====================================
      $ javac -d target/classes -classpath openjpa-2.0.0.jar src/main/java/ann/ValidatedTime.java -g -verbose -nowarn -target 1.6 -source 1.6
      [parsing started src/main/java/ann/ValidatedTime.java]
      [parsing completed 16ms]
      [search path for source files: openjpa-2.0.0.jar]
      [search path for class files: /home/madams/programs/java/jdk1.6.0_20/jre/lib/resources.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/rt.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/sunrsasign.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/jsse.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/jce.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/charsets.jar,/home/madams/programs/java/jdk1.6.0_20/jre/classes,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/localedata.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/dnsns.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/sunjce_provider.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/sunpkcs11.jar,openjpa-2.0.0.jar]
      [loading java/lang/annotation/ElementType.class(java/lang/annotation:ElementType.class)]
      [loading java/lang/annotation/Retention.class(java/lang/annotation:Retention.class)]
      [loading java/lang/annotation/RetentionPolicy.class(java/lang/annotation:RetentionPolicy.class)]
      [loading java/lang/annotation/Target.class(java/lang/annotation:Target.class)]
      [loading java/lang/annotation/Annotation.class(java/lang/annotation:Annotation.class)]
      [loading java/lang/Object.class(java/lang:Object.class)]
      [loading java/lang/Enum.class(java/lang:Enum.class)]
      [loading java/lang/Comparable.class(java/lang:Comparable.class)]
      [loading java/io/Serializable.class(java/io:Serializable.class)]
      [loading java/lang/String.class(java/lang:String.class)]
      Round 1:
      input files:

      {ann.ValidatedTime}

      annotations: [java.lang.annotation.Retention, java.lang.annotation.Target]
      last round: false
      Round 2:
      input files: {}
      annotations: []
      last round: true
      [search path for source files: openjpa-2.0.0.jar]
      [search path for class files: /home/madams/programs/java/jdk1.6.0_20/jre/lib/resources.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/rt.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/sunrsasign.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/jsse.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/jce.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/charsets.jar,/home/madams/programs/java/jdk1.6.0_20/jre/classes,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/localedata.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/dnsns.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/sunjce_provider.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/sunpkcs11.jar,openjpa-2.0.0.jar]
      [loading java/lang/annotation/ElementType.class(java/lang/annotation:ElementType.class)]
      [loading java/lang/annotation/Retention.class(java/lang/annotation:Retention.class)]
      [loading java/lang/annotation/RetentionPolicy.class(java/lang/annotation:RetentionPolicy.class)]
      [loading java/lang/annotation/Target.class(java/lang/annotation:Target.class)]
      [loading java/lang/annotation/Annotation.class(java/lang/annotation:Annotation.class)]
      [loading java/lang/Object.class(java/lang:Object.class)]
      [loading java/lang/Enum.class(java/lang:Enum.class)]
      [loading java/lang/Comparable.class(java/lang:Comparable.class)]
      [loading java/io/Serializable.class(java/io:Serializable.class)]
      [loading java/lang/String.class(java/lang:String.class)]
      src/main/java/ann/ValidatedTime.java:21: incompatible types
      found : ann.ValidatedTime.Precision
      required: ann.ValidatedTime.Precision
      Precision precision() default Precision.SECOND;
      ^
      [checking ann.ValidatedTime]
      [loading java/lang/CloneNotSupportedException.class(java/lang:CloneNotSupportedException.class)]
      [loading java/lang/Class.class(java/lang:Class.class)]
      [total 437ms]
      1 error

      =====================================
      Compilation log without OpenJPA on classpath:
      =====================================
      $ javac -d target/classes src/main/java/ann/ValidatedTime.java -g -verbose -nowarn -target 1.6 -source 1.6[parsing started src/main/java/ann/ValidatedTime.java]
      [parsing completed 16ms]
      [search path for source files: .]
      [search path for class files: /home/madams/programs/java/jdk1.6.0_20/jre/lib/resources.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/rt.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/sunrsasign.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/jsse.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/jce.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/charsets.jar,/home/madams/programs/java/jdk1.6.0_20/jre/classes,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/localedata.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/dnsns.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/sunjce_provider.jar,/home/madams/programs/java/jdk1.6.0_20/jre/lib/ext/sunpkcs11.jar,.]
      [loading java/lang/annotation/ElementType.class(java/lang/annotation:ElementType.class)]
      [loading java/lang/annotation/Retention.class(java/lang/annotation:Retention.class)]
      [loading java/lang/annotation/RetentionPolicy.class(java/lang/annotation:RetentionPolicy.class)]
      [loading java/lang/annotation/Target.class(java/lang/annotation:Target.class)]
      [loading java/lang/annotation/Annotation.class(java/lang/annotation:Annotation.class)]
      [loading java/lang/Object.class(java/lang:Object.class)]
      [loading java/lang/Enum.class(java/lang:Enum.class)]
      [loading java/lang/Comparable.class(java/lang:Comparable.class)]
      [loading java/io/Serializable.class(java/io:Serializable.class)]
      [loading java/lang/String.class(java/lang:String.class)]
      [checking ann.ValidatedTime]
      [loading java/lang/CloneNotSupportedException.class(java/lang:CloneNotSupportedException.class)]
      [loading java/lang/Class.class(java/lang:Class.class)]
      [wrote target/classes/ann/ValidatedTime$Precision.class]
      [wrote target/classes/ann/ValidatedTime.class]
      [total 352ms]

      =====================================
      Java source file src/main/java/ann/ValidatedTime.java
      =====================================
      package ann;

      import java.lang.annotation.ElementType;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;

      @Retention(RetentionPolicy.RUNTIME)
      @Target(ElementType.METHOD)
      public @interface ValidatedTime {
      Precision precision() default Precision.SECOND;

      public enum Precision

      { NANOSECOND, MILLISECOND, SECOND, MINUTE, HOUR }

      }

      1. javac_bug.zip
        5 kB
        Matthew T. Adams
      2. OPENJPA-1659-OffTheHook.zip
        3.67 MB
        Matthew T. Adams
      3. OPENJPA-1659-testcase.zip
        3.66 MB
        Matthew T. Adams

        Activity

        Hide
        Tim Boudreau added a comment -

        This is supposedly fixed in JDK 7's javac.

        A workaround can be found here:
        http://netbeans.org/bugzilla/show_bug.cgi?id=193952#c4
        (see the annotation processor sources linked from comment 4)

        Show
        Tim Boudreau added a comment - This is supposedly fixed in JDK 7's javac. A workaround can be found here: http://netbeans.org/bugzilla/show_bug.cgi?id=193952#c4 (see the annotation processor sources linked from comment 4)
        Hide
        Matthew T. Adams added a comment -

        I just added another bug report after discovering another scenario where javac fails:

        http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6954300

        It's not public yet either, but it includes another annotation that causes javac to fail with an annotation processor present.

        The attached zip file adds the annotation "RequiresMutability" to the testcase and supercedes all other test cases.

        Show
        Matthew T. Adams added a comment - I just added another bug report after discovering another scenario where javac fails: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6954300 It's not public yet either, but it includes another annotation that causes javac to fail with an annotation processor present. The attached zip file adds the annotation "RequiresMutability" to the testcase and supercedes all other test cases.
        Hide
        Matthew T. Adams added a comment -

        Here is the Sun bug link. As of this writing, it is not yet approved/visible, but at least folks know where it is.

        http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6951911

        Show
        Matthew T. Adams added a comment - Here is the Sun bug link. As of this writing, it is not yet approved/visible, but at least folks know where it is. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6951911
        Hide
        Rick Curtis added a comment -

        Will you post a link to the sun bug once you get it opened?

        Thanks,
        Rick

        Show
        Rick Curtis added a comment - Will you post a link to the sun bug once you get it opened? Thanks, Rick
        Hide
        Matthew T. Adams added a comment -

        This is a Java problem, not an OpenJPA one.

        Show
        Matthew T. Adams added a comment - This is a Java problem, not an OpenJPA one.
        Hide
        Matthew T. Adams added a comment -

        OpenJPA is off the hook. Attachment demonstrates bug in plain old Java. To demo, simply execute the compile-with-dummy-processor script in the OPENJPA-1659-testcase directory after unzipping.

        I'll file a bug with Sun.

        Show
        Matthew T. Adams added a comment - OpenJPA is off the hook. Attachment demonstrates bug in plain old Java. To demo, simply execute the compile-with-dummy-processor script in the OPENJPA-1659 -testcase directory after unzipping. I'll file a bug with Sun.
        Hide
        Matthew T. Adams added a comment -

        Created testcase project after testing with just openjpa-2.0.0.jar on the classpath and then just geronimo-jpa_2.0_spec-1.0.jar on the classpath. Fails with openjpa-2.0.0.jar, succeeds with geronimo-jpa_2.0_spec-1.0.jar and succeeds with the "-proc:none" compiler option and the openjpa-2.0.0.jar on the classpath. Also fails with both openjpa-2.0.0.jar and geronimo-jpa_2.0_spec-1.0.jar on the classpath.

        See compile scripts in root of project for more info.

        Show
        Matthew T. Adams added a comment - Created testcase project after testing with just openjpa-2.0.0.jar on the classpath and then just geronimo-jpa_2.0_spec-1.0.jar on the classpath. Fails with openjpa-2.0.0.jar, succeeds with geronimo-jpa_2.0_spec-1.0.jar and succeeds with the "-proc:none" compiler option and the openjpa-2.0.0.jar on the classpath. Also fails with both openjpa-2.0.0.jar and geronimo-jpa_2.0_spec-1.0.jar on the classpath. See compile scripts in root of project for more info.

          People

          • Assignee:
            Unassigned
            Reporter:
            Matthew T. Adams
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development