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

Javac reports wrong error offset for unknown identifier of annotation element/value pair

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8
    • tools
    • b36
    • Verified

        Code:
        @MyAnnotation( value=5, foo=6 )
        public class Class2 {
        }
        @interface MyAnnotation {
            int value();
        }

        The error is marked at the value '6', not the identifier 'foo':
        Class2.java:1: error: cannot find symbol
        @MyAnnotation( value=5, foo=6 )
                                                     ^
          symbol: method foo()
          location: @interface MyAnnotation
        1 error

        This worked fine in JDK7 but is broken in JDK8

              jlahoda Jan Lahoda
              kbronkho Keimpe Bronkhorst (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: