mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8370237: AssertionError in Annotate.fromAnnotations with -Xdoclint and type annotations
Reviewed-by: jlahoda
This commit is contained in:
parent
4ca88aa2e8
commit
8e3620a344
@ -211,6 +211,11 @@ public class ReferenceParser {
|
||||
if (p.token().kind != TokenKind.EOF) {
|
||||
throw new ParseException(beginIndex + p.token().pos, "dc.ref.unexpected.input");
|
||||
}
|
||||
Tree typeAnno = new TypeAnnotationFinder().scan(tree, null);
|
||||
if (typeAnno != null) {
|
||||
int annoPos = ((JCTree) typeAnno).getStartPosition();
|
||||
throw new ParseException(beginIndex + annoPos, "dc.ref.annotations.not.allowed");
|
||||
}
|
||||
checkDiags(dh, beginIndex);
|
||||
return tree;
|
||||
} finally {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
CrashInAnnotateTest.java:10:20: compiler.err.proc.messager: annotations not allowed
|
||||
CrashInAnnotateTest.java:11:37: compiler.err.proc.messager: syntax error in reference
|
||||
CrashInAnnotateTest.java:11:12: compiler.err.proc.messager: annotations not allowed
|
||||
CrashInAnnotateTest.java:16:39: compiler.err.proc.messager: annotations not allowed
|
||||
CrashInAnnotateTest.java:21:23: compiler.err.proc.messager: syntax error in reference
|
||||
CrashInAnnotateTest.java:24:54: compiler.err.proc.messager: syntax error in reference
|
||||
CrashInAnnotateTest.java:25:37: compiler.err.proc.messager: syntax error in reference
|
||||
6 errors
|
||||
CrashInAnnotateTest.java:21:12: compiler.err.proc.messager: annotations not allowed
|
||||
CrashInAnnotateTest.java:24:12: compiler.err.proc.messager: annotations not allowed
|
||||
CrashInAnnotateTest.java:25:12: compiler.err.proc.messager: annotations not allowed
|
||||
6 errors
|
||||
|
||||
21
test/langtools/tools/doclint/CrashInTypeAnnotateTest.java
Normal file
21
test/langtools/tools/doclint/CrashInTypeAnnotateTest.java
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8370237
|
||||
* @summary AssertionError in Annotate.fromAnnotations with -Xdoclint and type annotations
|
||||
* @compile/fail/ref=CrashInTypeAnnotateTest.out -Xdoclint:all,-missing -XDrawDiagnostics CrashInTypeAnnotateTest.java
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.TYPE_PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface A {}
|
||||
|
||||
/** {@link List<@A String>}
|
||||
*/
|
||||
class CrashInTypeAnnotateTest {
|
||||
}
|
||||
2
test/langtools/tools/doclint/CrashInTypeAnnotateTest.out
Normal file
2
test/langtools/tools/doclint/CrashInTypeAnnotateTest.out
Normal file
@ -0,0 +1,2 @@
|
||||
CrashInTypeAnnotateTest.java:18:17: compiler.err.proc.messager: annotations not allowed
|
||||
1 error
|
||||
Loading…
x
Reference in New Issue
Block a user