do not apply substitutor twice (IDEA-101752)

This commit is contained in:
anna
2013-02-25 18:41:22 +01:00
parent b562064e02
commit 33a583584b
3 changed files with 33 additions and 1 deletions

View File

@@ -29,9 +29,18 @@ import java.util.List;
public abstract class HierarchicalMethodSignature extends MethodSignatureBackedByPsiMethod {
public HierarchicalMethodSignature(@NotNull MethodSignatureBackedByPsiMethod signature) {
super(signature.getMethod(), signature.getSubstitutor(), signature.isRaw(),
signature.getParameterTypes(), signature.getTypeParameters());
getParameterTypes(signature.getMethod()), signature.getTypeParameters());
}
private static PsiType[] getParameterTypes(PsiMethod method) {
final PsiParameter[] parameters = method.getParameterList().getParameters();
final PsiType[] paramTypes = new PsiType[parameters.length];
for (int i = 0; i < paramTypes.length; i++) {
paramTypes[i] = parameters[i].getType();
}
return paramTypes;
}
/**
* Returns the list of super method signatures for the specified signature.
*

View File

@@ -0,0 +1,22 @@
public interface Iso<T, R> {
T deply(R r);
default Iso<R, T> inverse() {
final Iso<T, R> z = this;
return new Iso<R, T>() {
@Override
public R deply(T t) {
throw null;
}
};
}
static <T, R> Iso<R, T> inverse(Iso<T, R> z) {
return new Iso<R, T>() {
@Override
public R deply(T t) {
throw null;
}
};
}
}

View File

@@ -29,6 +29,7 @@ public class Interface8MethodsHighlightingTest extends LightDaemonAnalyzerTestCa
public void testExtensionMethods() { doTest(false, false); }
public void testInheritDefaultMethodInInterface() { doTest(false, false); }
public void testStaticMethodsInFunctionalInterface() { doTest(false, false); }
public void testCyclicSubstitutor() { doTest(false, false); }
public void testExtensionMethodSyntax() {
enableInspectionTools(DeprecatedDefenderSyntaxInspection.class);