mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+20
-5
@@ -1005,17 +1005,32 @@ public class GenericsHighlightUtil {
|
||||
public static HighlightInfo checkClassObjectAccessExpression(PsiClassObjectAccessExpression expression) {
|
||||
PsiType type = expression.getOperand().getType();
|
||||
if (type instanceof PsiClassType) {
|
||||
PsiClass aClass = ((PsiClassType)type).resolve();
|
||||
if (aClass instanceof PsiTypeParameter) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR,
|
||||
expression.getOperand(),
|
||||
JavaErrorMessages.message("cannot.select.dot.class.from.type.variable"));
|
||||
return canSelectFrom((PsiClassType)type, expression.getOperand());
|
||||
} else if (type instanceof PsiArrayType) {
|
||||
final PsiType arrayComponentType = type.getDeepComponentType();
|
||||
if (arrayComponentType instanceof PsiClassType) {
|
||||
return canSelectFrom((PsiClassType)arrayComponentType, expression.getOperand());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static HighlightInfo canSelectFrom(PsiClassType type, PsiTypeElement operand) {
|
||||
PsiClass aClass = type.resolve();
|
||||
if (aClass instanceof PsiTypeParameter) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR,
|
||||
operand,
|
||||
JavaErrorMessages.message("cannot.select.dot.class.from.type.variable"));
|
||||
} else if (type.getParameters().length > 0) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR,
|
||||
operand,
|
||||
"Cannot select from parameterized type");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static HighlightInfo checkOverrideAnnotation(PsiMethod method) {
|
||||
PsiModifierList list = method.getModifierList();
|
||||
|
||||
@@ -616,7 +616,8 @@ public class HighlightUtil {
|
||||
boolean isIncorrect = false;
|
||||
if (variable instanceof PsiLocalVariable ||
|
||||
variable instanceof PsiParameter && ((PsiParameter)variable).getDeclarationScope() instanceof PsiCatchSection ||
|
||||
variable instanceof PsiParameter && ((PsiParameter)variable).getDeclarationScope() instanceof PsiForeachStatement) {
|
||||
variable instanceof PsiParameter && ((PsiParameter)variable).getDeclarationScope() instanceof PsiForeachStatement ||
|
||||
variable instanceof PsiParameter && ((PsiParameter)variable).getDeclarationScope() instanceof PsiLambdaExpression) {
|
||||
@SuppressWarnings("unchecked")
|
||||
PsiElement scope = PsiTreeUtil.getParentOfType(variable, PsiFile.class, PsiMethod.class, PsiClassInitializer.class, PsiResourceList.class);
|
||||
VariablesNotProcessor proc = new VariablesNotProcessor(variable, false) {
|
||||
|
||||
+13
@@ -1,3 +1,4 @@
|
||||
import java.lang.Object;
|
||||
import java.util.*;
|
||||
|
||||
class C<T,U> {
|
||||
@@ -125,4 +126,16 @@ class IDontCompile {
|
||||
|
||||
abstract class GenericTest99<E extends Enum<E>> {
|
||||
GenericTest99<<error descr="Type parameter 'java.lang.Enum' is not within its bound; should extend 'java.lang.Enum<java.lang.Enum>'">Enum</error>> local;
|
||||
}
|
||||
|
||||
class ClassLiteral<T> {
|
||||
{
|
||||
Object c1 = <error descr="Cannot select from a type variable">T</error>.class;
|
||||
Object c2 = <error descr="Cannot select from a type variable">T[]</error>.class;
|
||||
|
||||
Object c3 = <error descr="Cannot select from parameterized type">List<String></error>.class;
|
||||
Object c4 = <error descr="Cannot select from parameterized type">List<String>[]</error>.class;
|
||||
Object c5 = List[].class;
|
||||
Object c6 = List.class;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
{
|
||||
Object o = null;
|
||||
Comparable<String> c = <error descr="Variable 'o' is already defined in the scope">o</error> -> 42;
|
||||
}
|
||||
}
|
||||
+4
@@ -141,6 +141,10 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAlreadyUsedParamName() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user