Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Automatic merge of jdk:master into master
- Loading branch information
|
@@ -2907,10 +2907,9 @@ public void validateTypeAnnotations(List<JCAnnotation> annotations, boolean isTy |
|
|
*/ |
|
|
private void validateAnnotation(JCAnnotation a, JCTree declarationTree, Symbol s) { |
|
|
validateAnnotationTree(a); |
|
|
boolean isRecordMember = (s.flags_field & RECORD) != 0 || s.enclClass() != null && s.enclClass().isRecord(); |
|
|
boolean isRecordMember = ((s.flags_field & RECORD) != 0 || s.enclClass() != null && s.enclClass().isRecord()); |
|
|
|
|
|
boolean isRecordField = isRecordMember && |
|
|
(s.flags_field & (Flags.PRIVATE | Flags.FINAL | Flags.GENERATED_MEMBER | Flags.RECORD)) != 0 && |
|
|
boolean isRecordField = (s.flags_field & RECORD) != 0 && |
|
|
declarationTree.hasTag(VARDEF) && |
|
|
s.owner.kind == TYP; |
|
|
|
|
|
|
@@ -1563,4 +1563,37 @@ record R(int i) { |
|
|
""" |
|
|
); |
|
|
} |
|
|
|
|
|
public void testNoNPEStaticAnnotatedFields() { |
|
|
assertOK( |
|
|
""" |
|
|
import java.lang.annotation.Native; |
|
|
record R() { |
|
|
@Native public static final int i = 0; |
|
|
} |
|
|
""" |
|
|
); |
|
|
assertOK( |
|
|
""" |
|
|
import java.lang.annotation.Native; |
|
|
class Outer { |
|
|
record R() { |
|
|
@Native public static final int i = 0; |
|
|
} |
|
|
} |
|
|
""" |
|
|
); |
|
|
assertOK( |
|
|
""" |
|
|
import java.lang.annotation.Native; |
|
|
class Outer { |
|
|
void m() { |
|
|
record R () { |
|
|
@Native public static final int i = 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
""" |
|
|
); |
|
|
} |
|
|
} |