mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
enable diamonds with anonymous (IDEA-139098)
This commit is contained in:
@@ -121,7 +121,7 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
|
||||
public static DiamondInferenceResult resolveInferredTypes(PsiNewExpression newExpression,
|
||||
PsiElement context) {
|
||||
final PsiAnonymousClass anonymousClass = newExpression.getAnonymousClass();
|
||||
if (anonymousClass != null) {
|
||||
if (anonymousClass != null && !PsiUtil.isLanguageLevel9OrHigher(newExpression)) {
|
||||
final PsiElement resolve = anonymousClass.getBaseClassReference().resolve();
|
||||
if (resolve instanceof PsiClass) {
|
||||
return PsiDiamondTypeImpl.DiamondInferenceResult.ANONYMOUS_INNER_RESULT;
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Pos {
|
||||
class Member<X> {}
|
||||
|
||||
static class Nested<X> {}
|
||||
|
||||
void testSimple() {
|
||||
Member<?> m1 = new Member<>() {};
|
||||
Nested<?> m2 = new Nested<>() {};
|
||||
}
|
||||
|
||||
void testQualified() {
|
||||
Member<?> m1 = this.new Member<>() {};
|
||||
Nested<?> m2 = new Pos.Nested<>() {};
|
||||
}
|
||||
}
|
||||
+2
@@ -48,5 +48,7 @@ public class LightAdvHighlightingJdk9Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testUnderscore() { doTest(false, false); }
|
||||
public void testTryWithResources() { doTest(false, false); }
|
||||
|
||||
public void testDiamondsWithAnonymous() { doTest(false, false);}
|
||||
|
||||
public void testValueTypes() { setLanguageLevel(LanguageLevel.JDK_X); doTest(false, false); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user