[java] fixes NPE in type parser (EA-104664)

This commit is contained in:
Roman Shevchenko
2017-07-17 14:17:56 +02:00
parent 64c770a1f6
commit 57fe714c38
3 changed files with 10 additions and 0 deletions
@@ -133,6 +133,7 @@ public class ReferenceParser {
type.drop();
if (anno != null && isSet(flags, INCOMPLETE_ANNO)) {
error(builder, JavaErrorMessages.message("expected.type"));
typeInfo.marker = anno;
typeInfo.hasErrors = true;
return typeInfo;
}
@@ -0,0 +1,8 @@
PsiJavaFile:CorruptAnnoInCast.java
PsiParenthesizedExpression:(
PsiJavaToken:LPARENTH('(')
PsiErrorElement:Expression expected
<empty list>
PsiErrorElement:Unparsed tokens
PsiJavaToken:AT('@')
PsiJavaToken:AND('&')
@@ -105,6 +105,7 @@ public class ExpressionParserTest extends JavaParsingTestCase {
public void testIncompleteCast() { doParserTest("f((ArrayList<String>) )"); }
public void testShiftRight() { doParserTest("x >>= 2"); }
public void testCorruptAnnoInCast() { doParserTest("(@&"); }
public void testIllegalWildcard() { doParserTest("this.<?>foo()"); }
public void testIllegalBound() { doParserTest("C.<T extends S>foo()"); }