mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
prevent diamonds in reference parameter list other than <> -> invalid PsiDiamondType in substitutors
(cherry picked from commit 4f7cc7a)
This commit is contained in:
@@ -270,7 +270,7 @@ public class ReferenceParser {
|
||||
return false;
|
||||
}
|
||||
|
||||
final int flags = set(set(EAT_LAST_DOT, WILDCARD, wildcard), DIAMONDS, diamonds);
|
||||
int flags = set(set(EAT_LAST_DOT, WILDCARD, wildcard), DIAMONDS, diamonds);
|
||||
boolean isOk = true;
|
||||
while (true) {
|
||||
if (parseTypeInfo(builder, flags, true) == null) {
|
||||
@@ -290,6 +290,7 @@ public class ReferenceParser {
|
||||
isOk = false;
|
||||
break;
|
||||
}
|
||||
flags = set(flags, DIAMONDS, false);
|
||||
}
|
||||
|
||||
list.done(JavaElementType.REFERENCE_PARAMETER_LIST);
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Box<String> stringBox = new Box<String>("123");
|
||||
|
||||
stringBox.transform(new Fn<String,<error descr="Identifier expected"> </error>>() {});
|
||||
|
||||
}
|
||||
|
||||
static class Box<T> {
|
||||
T value;
|
||||
|
||||
Box(T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public <O> Box<O> transform(Fn<T, O> fn) {
|
||||
return new Box<O>(fn.apply(value));
|
||||
}
|
||||
}
|
||||
|
||||
interface Fn<A, B> {
|
||||
B apply(A value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
PsiJavaFile:New17.java
|
||||
PsiNewExpression:new Map<String, >()
|
||||
PsiKeyword:new('new')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Map<String, >
|
||||
PsiIdentifier:Map('Map')
|
||||
PsiReferenceParameterList
|
||||
PsiJavaToken:LT('<')
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
PsiIdentifier:String('String')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:GT('>')
|
||||
PsiExpressionList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
+5
-1
@@ -102,7 +102,11 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testHighlightInaccessibleFromClassModifierList() { doTest(false, false); }
|
||||
public void testInnerInTypeArguments() { doTest(false, false); }
|
||||
|
||||
public void testDynamicallyAddIgnoredAnnotations() {
|
||||
public void testIncompleteDiamonds() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDynamicallyAddIgnoredAnnotations() throws Exception {
|
||||
ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ExtensionPoints.DEAD_CODE_TOOL);
|
||||
EntryPoint extension = new EntryPoint() {
|
||||
@NotNull @Override public String getDisplayName() { return "duh"; }
|
||||
|
||||
+1
@@ -76,6 +76,7 @@ public class ExpressionParserTest extends JavaParsingTestCase {
|
||||
public void testNew14() { doParserTest("Q.new A()"); }
|
||||
public void testNew15() { doParserTest("new C<?>.B()"); }
|
||||
public void testNew16() { doParserTest("new C<>()"); }
|
||||
public void testNew17() { doParserTest("new Map<String, >()"); }
|
||||
|
||||
public void testExprList0() { doParserTest("f(1,2)"); }
|
||||
public void testExprList1() { doParserTest("f("); }
|
||||
|
||||
Reference in New Issue
Block a user