-
Sub-task
-
Resolution: Delivered
-
P2
-
9
-
Verified
javac was erroneously accepting receiver parameters in annotations methods. This implies that tests cases like the one below were being accepted:
```
@interface MethodRun {
int value(MethodRun this);
}
```
The JLS 8, see JLS8 9.6.1, doesn't allow any formal parameter in annotation methods, this extends to receiver parameters. More specifically, the grammar for annotation types does not allow arbitrary method declarations, instead allowing only AnnotationTypeElementDeclarations. The allowed syntax is:
```
AnnotationTypeElementDeclaration:
{AnnotationTypeElementModifier} UnannType Identifier ( ) [Dims] [DefaultValue];
```
Note that nothing is allowed between the parentheses.
```
@interface MethodRun {
int value(MethodRun this);
}
```
The JLS 8, see JLS8 9.6.1, doesn't allow any formal parameter in annotation methods, this extends to receiver parameters. More specifically, the grammar for annotation types does not allow arbitrary method declarations, instead allowing only AnnotationTypeElementDeclarations. The allowed syntax is:
```
AnnotationTypeElementDeclaration:
{AnnotationTypeElementModifier} UnannType Identifier ( ) [Dims] [DefaultValue];
```
Note that nothing is allowed between the parentheses.