-
Bug
-
Resolution: Duplicate
-
P4
-
9
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
- duplicates
-
JDK-8129559 JShell: compilation fails if class, method or field is annotated and has modifiers
-
- Closed
-