revert (IDEA-152685)

This commit is contained in:
Anna Kozlova
2016-03-14 17:48:06 +01:00
parent 7cfcb1bb69
commit c00d3d7371
3 changed files with 34 additions and 3 deletions
@@ -23,7 +23,10 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class MethodSignatureUtil {
@@ -320,16 +323,20 @@ public class MethodSignatureUtil {
result = result.put(superTypeParameters[i], factory.createType(methodTypeParameter));
}
final PsiSubstitutor methodSubstitutor = methodSignature.getSubstitutor();
//check bounds
for (int i = 0; i < methodTypeParameters.length; i++) {
PsiTypeParameter methodTypeParameter = methodTypeParameters[i];
PsiTypeParameter superTypeParameter = superTypeParameters[i];
final Set<PsiType> methodSupers = new HashSet<PsiType>();
Collections.addAll(methodSupers, methodTypeParameter.getSuperTypes());
for (PsiClassType methodSuper : methodTypeParameter.getSuperTypes()) {
methodSupers.add(methodSubstitutor.substitute(methodSuper));
}
final Set<PsiType> superSupers = new HashSet<PsiType>();
for (PsiClassType superSuper : superTypeParameter.getSuperTypes()) {
superSupers.add(result.substitute(superSuper));
superSupers.add(methodSubstitutor.substitute(result.substitute(superSuper)));
}
methodSupers.remove(PsiType.getJavaLangObject(methodTypeParameter.getManager(), methodTypeParameter.getResolveScope()));
superSupers.remove(PsiType.getJavaLangObject(superTypeParameter.getManager(), superTypeParameter.getResolveScope()));
@@ -0,0 +1,20 @@
import java.io.Serializable;
import java.math.BigInteger;
class C extends B<String, BigInteger> {
@Override
public <S extends String> S save(S entity) {
return super.save(entity);
}
}
class B<T, ID extends Serializable> implements A<T, ID> {
public <S extends T> S save(S entity) {
return null;
}
}
interface A<T, ID extends Serializable> {
<S extends T> S save(S var1);
}
@@ -986,4 +986,8 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
public void testUncheckedWarningsInsideIncorporationPhase() throws Exception {
doTest();
}
public void testUnifiedSubstitutorUpInTheHierarchy() throws Exception {
doTest();
}
}