method signature: don't substitute twice during erasure (IDEA-167386)

This commit is contained in:
Anna.Kozlova
2017-02-01 15:33:39 +01:00
parent 5fb2be806e
commit e3352b820f
3 changed files with 15 additions and 1 deletions

View File

@@ -88,7 +88,7 @@ public class MethodSignatureUtil {
PsiSubstitutor substitutor = signature.getSubstitutor();
PsiType[] erasedTypes = PsiType.createArray(parameterTypes.length);
for (int i = 0; i < parameterTypes.length; i++) {
erasedTypes[i] = TypeConversionUtil.erasure(substitutor.substitute(parameterTypes[i]), substitutor);
erasedTypes[i] = TypeConversionUtil.erasure(parameterTypes[i], substitutor);
}
return erasedTypes;
}

View File

@@ -0,0 +1,10 @@
class Foo<T> {
void run(T param) {}
void anonymousClass() {
new Foo<T[]>() {
@Override
void run(T[] param) {}
};
}
}

View File

@@ -622,4 +622,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testNotErasedReturnValueUnderJdk7() throws Exception {
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_8, false);
}
public void testAvoidDblSubstitutionDuringErasureOfParameterTypesOfMethodSignature() throws Exception {
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_8, false);
}
}