accept type arguments on raw types for > 1.6 javac

This commit is contained in:
anna
2013-10-01 21:42:31 +02:00
parent 52fea51bc4
commit e6ea7bc88c
3 changed files with 9 additions and 6 deletions
@@ -1128,9 +1128,12 @@ public class GenericsHighlightUtil {
if (element instanceof PsiMethod) {
if (((PsiMethod)element).findSuperMethods().length > 0) return null;
if (qualifier instanceof PsiReferenceExpression){
final PsiClass typeParameter = PsiUtil.resolveClassInType(((PsiReferenceExpression)qualifier).getType());
final PsiType type = ((PsiReferenceExpression)qualifier).getType();
final boolean isJavac7 = JavaVersionService.getInstance().isAtLeast(containingClass, JavaSdkVersion.JDK_1_7);
if (type instanceof PsiClassType && isJavac7 && ((PsiClassType)type).isRaw()) return null;
final PsiClass typeParameter = PsiUtil.resolveClassInType(type);
if (typeParameter instanceof PsiTypeParameter) {
if (JavaVersionService.getInstance().isAtLeast(containingClass, JavaSdkVersion.JDK_1_7)) return null;
if (isJavac7) return null;
for (PsiClassType classType : typeParameter.getExtendsListTypes()) {
final PsiClass resolve = classType.resolve();
if (resolve != null) {
@@ -15,7 +15,7 @@ abstract class B<S> {
public abstract <T extends Iterable<String>> void foo();
<T extends B> void bar(T x){
B a = null;
a.<error descr="Type arguments given on a raw method"><Iterable<String>></error> foo();
a.<Iterable<String>> foo();
x.<Iterable<String>> foo();
}
}
@@ -37,7 +37,7 @@ abstract class B1<S> {
public abstract <T extends Iterable<String>> void foo();
<T extends B1 & I1> void bar(T x){
B1 a = null;
a.<error descr="Type arguments given on a raw method"><Iterable<String>></error> foo();
a.<Iterable<String>> foo();
x.<Iterable<String>> foo();
}
}
@@ -15,7 +15,7 @@ abstract class B<S> {
public abstract <T extends Iterable<String>> void foo();
<T extends B> void bar(T x){
B a = null;
a.<error descr="Type arguments given on a raw method"><Iterable<String>></error> foo();
a.<Iterable<String>> foo();
x.<Iterable<String>> foo();
}
}
@@ -37,7 +37,7 @@ abstract class B1<S> {
public abstract <T extends Iterable<String>> void foo();
<T extends B1 & I1> void bar(T x){
B1 a = null;
a.<error descr="Type arguments given on a raw method"><Iterable<String>></error> foo();
a.<Iterable<String>> foo();
x.<Iterable<String>> foo();
}
}