mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
forbid diamonds on non-parameterized types (javac should be fixed accordingly)
This commit is contained in:
+3
@@ -112,6 +112,9 @@ public class GenericsHighlightUtil {
|
||||
if (referenceParameterList != null) {
|
||||
referenceElements = referenceParameterList.getTypeParameterElements();
|
||||
if (referenceElements.length == 1 && referenceElements[0].getType() instanceof PsiDiamondType) {
|
||||
if (!typeParameterListOwner.hasTypeParameters()) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, referenceElements[0], "Diamond operator is not applicable for non-parameterized types");
|
||||
}
|
||||
inferenceResult = ((PsiDiamondType)referenceElements[0].getType()).resolveInferredTypes();
|
||||
final String errorMessage = inferenceResult.getErrorMessage();
|
||||
if (errorMessage != null) {
|
||||
|
||||
+6
@@ -67,3 +67,9 @@ class MyTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NonParameterized {
|
||||
void foo() {
|
||||
new NonParameterized<<error descr="Diamond operator is not applicable for non-parameterized types"></error>>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user