Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6512707

"incompatible types" after (unrelated) annotation processing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 6, 6u10, 6u24
    • tools
    • b44
    • generic, x86
    • generic, linux, linux_ubuntu, windows, windows_xp
    • Verified

        FULL PRODUCT VERSION :
        java version "1.6.0"
        Java(TM) SE Runtime Environment (build 1.6.0-b105)
        Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]

        A DESCRIPTION OF THE PROBLEM :
        javac fails with "incompatible types" in combination with (unrelated) annotation processing.
        It seems that this only happens for defaults of annotation values.
        Effected are at least annotations (see example) and typed Classes (f.e. Class<? extends Enum>).


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. compile test/M.java and test/P.java into a directory "dir"

        2. compile test/A.java, test/D.java and test/V.java with
            -processor test.P
            -cp dir



        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        compile without errors
        ACTUAL -
        compiler error "incompatible types" test.V vs. test.V

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        C:\dev\jtools\research\src\test\test\A.java:20: incompatible types
        found : test.V
        required: test.V
        V value() default @V;
        ^
            [javac] 1 error


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        ---test/M.java---
        package test; public @interface M {}
        ---test/P.java---
        package test;
        import java.util.Set;
        import javax.annotation.processing.*;
        import javax.lang.model.SourceVersion;
        import javax.lang.model.element.TypeElement;
        @SupportedAnnotationTypes("test.M")
        @SupportedSourceVersion(SourceVersion.RELEASE_6)
        public class P extends AbstractProcessor {
            public boolean process(Set< ? extends TypeElement> arg0, RoundEnvironment arg1) {
                return false;
            }
        }
        ---test/A.java---
        package test;
        public @interface A {
            V value() default @V;
        }
        ---test/D.java
        package test;@M public interface D {}
        ---test/V.java
        package test; public @interface V {}

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        run processors separately.
        * javac -proc:only
        * javac -proc:none

        This is not adequate.

              jjg Jonathan Gibbons
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: