mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] fixes diamond type parsing (IDEA-155900)
This commit is contained in:
@@ -118,7 +118,13 @@ public class ReferenceParser {
|
||||
parseJavaCodeReference(builder, isSet(flags, EAT_LAST_DOT), true, false, false, false, isSet(flags, DIAMONDS), typeInfo);
|
||||
}
|
||||
else if (isSet(flags, DIAMONDS) && tokenType == JavaTokenType.GT) {
|
||||
emptyElement(builder, JavaElementType.DIAMOND_TYPE);
|
||||
if (anno == null) {
|
||||
emptyElement(builder, JavaElementType.DIAMOND_TYPE);
|
||||
}
|
||||
else {
|
||||
error(builder, JavaErrorMessages.message("expected.identifier"));
|
||||
typeInfo.hasErrors = true;
|
||||
}
|
||||
type.done(JavaElementType.TYPE);
|
||||
typeInfo.marker = type;
|
||||
return typeInfo;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
PsiJavaFile:Type10.java
|
||||
PsiTypeElement:Diamond<@TA>
|
||||
PsiJavaCodeReferenceElement:Diamond<@TA>
|
||||
PsiIdentifier:Diamond('Diamond')
|
||||
PsiReferenceParameterList
|
||||
PsiJavaToken:LT('<')
|
||||
PsiTypeElement:@TA
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:TA
|
||||
PsiIdentifier:TA('TA')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiErrorElement:Identifier expected
|
||||
<empty list>
|
||||
PsiJavaToken:GT('>')
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,6 +39,7 @@ public class ReferenceParserTest extends JavaParsingTestCase {
|
||||
public void testType7() { doTypeParserTest("Diamond<>"); }
|
||||
public void testType8() { doTypeParserTest("A|"); }
|
||||
public void testType9() { doTypeParserTest("A|B"); }
|
||||
public void testType10() { doTypeParserTest("Diamond<@TA>"); }
|
||||
|
||||
public void testTypeParams0() { doTypeParamsParserTest("<T>"); }
|
||||
public void testTypeParams1() { doTypeParamsParserTest("<T, U>"); }
|
||||
|
||||
Reference in New Issue
Block a user