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

static import versus annotations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 5.0
    • 5.0
    • tools
    • b32
    • generic
    • solaris_8

      Static imports do not affect annotations:

      ====================$ cat -n T.java
           1 import java.lang.annotation.Retention;
           2 import static java.lang.annotation.RetentionPolicy.RUNTIME;
           3
           4 @Retention(RUNTIME)
           5 @interface T {
           6 }
      ====================$ newjavac T.java
      T.java:4: cannot find symbol
      symbol : variable RUNTIME
      location: @interface T
      @Retention(RUNTIME)
                 ^
      1 error
      ====================$

            gafter Neal Gafter (Inactive)
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: