cls: compose raw substitutor if cls omits expected type arguments (IDEA-157254)

This commit is contained in:
Anna Kozlova
2016-06-14 11:34:32 +03:00
parent 79edaf45af
commit 30ee1d19c6
4 changed files with 22 additions and 2 deletions
@@ -172,8 +172,13 @@ public class ClsJavaCodeReferenceElementImpl extends ClsElementImpl implements P
final PsiType[] args = classParameters.length == 0 ? null : new ClsReferenceParameterListImpl(this, classParameters).getTypeArguments();
final PsiTypeParameter[] typeParameters = containingClass.getTypeParameters();
for (int i = 0; i < typeParameters.length; i++) {
if (args != null && i < args.length) {
substitutionMap.put(typeParameters[i], args[i]);
if (args != null) {
if (i < args.length) {
substitutionMap.put(typeParameters[i], args[i]);
}
}
else {
substitutionMap.put(typeParameters[i], null);
}
}
if (!containingClass.hasModifierProperty(PsiModifier.STATIC)) {
@@ -0,0 +1,11 @@
import p.AccountCalculator;
import p.ObjectParameterDescriptor;
import java.io.IOException;
class Test {
public static void calc(AccountCalculator calculator,
ObjectParameterDescriptor<String>.Holder holder) throws IOException{
calculator.getMetrics(holder);
}
}
@@ -35,6 +35,10 @@ public class ClsGenerics18HighlightingTest extends ClsGenericsHighlightingTest {
doTest();
}
public void testIDEA157254() throws Exception {
doTest();
}
public void testOuterClassTypeArgs() throws Exception {
doTest();
}