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

javac behaves incorrectly for annotations after method type parameters in some cases

    XMLWordPrintable

Details

    • b11
    • Verified

    Backports

      Description

        Consider these examples with the specified incorrect behavior of javac:
        ---
        public class Foo {
            <T> @DA Foo() { } //should be rejected, is accepted
            <T> @TA Foo(int i) { } //should be rejected, is accepted
            public <T> @DA int foo1() { return 0;}
            public <T> @DA void foo2() { } //should be accepted, is rejected
            public <T> @TA int foo3() { return 0;}
            public <T> @TA void foo4() { } //correctly rejected, but with suboptimal error message
        }
        @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
        @interface DA { }
        @Target(ElementType.TYPE_USE)
        @interface TA { }
        ---

        This is with:
        $ javac -fullversion
        javac full version "1.8.0-b132"

        See:
        http://mail.openjdk.java.net/pipermail/type-annotations-dev/2014-March/001678.html
        for more details.

        Attachments

          Issue Links

            Activity

              People

                jlahoda Jan Lahoda
                jlahoda Jan Lahoda
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: