提交 70beb5a9 编写于 作者: M mcimadamore

7157165: Regression: code with disjunctive type crashes javac

Summary: Bad recovery logic in parser code that checks for generic cast
Reviewed-by: jjg
上级 fdb43455
......@@ -983,12 +983,13 @@ public class JavacParser implements Parser {
t = lambdaExpressionOrStatement(variableDeclaratorId(mods, t), pos);
break;
}
} else {
Assert.check((mode & EXPR) != 0);
} else if ((mode & EXPR) != 0) {
mode = EXPR;
JCExpression e = term2Rest(t1, TreeInfo.shiftPrec);
t = F.at(pos1).Binary(op, t, e);
t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
} else {
accept(GT);
}
} else if ((mode & TYPE) != 0 &&
(token.kind == IDENTIFIER || token.kind == ELLIPSIS)) {
......
/*
* @test /nodynamiccopyright/
* @bug 7157165
*
* @summary Regression: code with disjunctive type crashes javac
* @compile/fail/ref=T7157165.out -XDrawDiagnostics T7157165.java
*
*/
class T7157165 {
Foo<? extends A|B> foo1 = null;
}
T7157165.java:11:20: compiler.err.expected: >
T7157165.java:11:21: compiler.err.expected: ';'
T7157165.java:11:22: compiler.err.illegal.start.of.type
3 errors
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册