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

JShell: Annotation on public method does not work if annotation is placed before public modifier

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • 9
    • tools


      JShell verison: kulla-0.610-20150709005843 (also reproducible on kulla-0.710)

      ——

      Summary: Using an annotation on a public method does not work if the annotation is placed before the public modifier, but it works if the annotation is placed after the public modifier.

      Reproduction steps:

      -> @interface MyTest {}
      | Added annotation interface MyTest

      -> @MyTest void boo() {}
      | Added method boo()

      -> @MyTest public void foo() {}
      | Error:
      | repeated modifier
      | @MyTest public void foo() {}
      | ^
      | Warning:
      | Modifier 'public' not permitted in top-level declarations, ignored
      | @MyTest public void foo() {}
      | ^------------^

      -> public @MyPublic void foo() {}
      | Warning:
      | Modifier 'public' not permitted in top-level declarations, ignored
      | public @MyPublic void foo() {}
      | ^--------------^
      | Added method foo(), however, it cannot be referenced until class MyPublic is declared

      ->

      - Alex Borisov

            rfield Robert Field (Inactive)
            rfield Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: