- 
    Bug 
- 
    Resolution: Not an Issue
- 
     P2 P2
- 
    14
                    Consider the following code sample:
import java.lang.annotation.*;
public class Bug01 {
@Target({ElementType.RECORD_COMPONENT, ElementType.TYPE_USE}) @interface Anno { }
record Rec(@Anno java.lang.reflect.RecordComponent rc) {}
}
When compiling it with jdk14b27
javac --enable-preview --release 14 Bug01.java
the following error occurs:
Bug01.java:4: error: scoping construct cannot be annotated with type-use annotation: @Bug01.Anno
record Rec(@Anno java.lang.reflect.RecordComponent rc) {}
^
Note: Bug01.java uses preview language features.
Note: Recompile with -Xlint:preview for details.
1 error
            
import java.lang.annotation.*;
public class Bug01 {
@Target({ElementType.RECORD_COMPONENT, ElementType.TYPE_USE}) @interface Anno { }
record Rec(@Anno java.lang.reflect.RecordComponent rc) {}
}
When compiling it with jdk14b27
javac --enable-preview --release 14 Bug01.java
the following error occurs:
Bug01.java:4: error: scoping construct cannot be annotated with type-use annotation: @Bug01.Anno
record Rec(@Anno java.lang.reflect.RecordComponent rc) {}
^
Note: Bug01.java uses preview language features.
Note: Recompile with -Xlint:preview for details.
1 error