KT-2498 Bridge method is not generated for method when generic parameters are substituted in superclass
#KT-2498 Fixed generateBridgeIfNeeded() now works as follows: for a given method, find which declared methods does this method override via breadth-first search. For each such declared method, generate a bridge if and only if its signature is different. Keep different methods' signatures in a set to avoid duplicated bridge signatures.
This commit is contained in:
@@ -19,13 +19,119 @@ package org.jetbrains.jet.codegen;
|
||||
import org.jetbrains.jet.ConfigurationKind;
|
||||
|
||||
public class BridgeMethodGenTest extends CodegenTestCase {
|
||||
|
||||
public void testBridgeMethod () throws Exception {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridge.jet");
|
||||
}
|
||||
|
||||
|
||||
public void testKt1959() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("regressions/kt1959.kt");
|
||||
}
|
||||
|
||||
public void testDelegationToTraitImpl() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/delegationToTraitImpl.kt");
|
||||
}
|
||||
|
||||
public void testDiamond() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/diamond.kt");
|
||||
}
|
||||
|
||||
public void testLongChainOneBridge() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/longChainOneBridge.kt");
|
||||
}
|
||||
|
||||
public void testManyTypeArgumentsSubstitutedSuccessively() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/manyTypeArgumentsSubstitutedSuccessively.kt");
|
||||
}
|
||||
|
||||
public void testMethodFromTrait() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/methodFromTrait.kt");
|
||||
}
|
||||
|
||||
public void testSimple() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/simple.kt");
|
||||
}
|
||||
|
||||
public void testSimpleEnum() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/simpleEnum.kt");
|
||||
}
|
||||
|
||||
public void testSimpleGenericMethod() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/simpleGenericMethod.kt");
|
||||
}
|
||||
|
||||
public void testSimpleObject() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/simpleObject.kt");
|
||||
}
|
||||
|
||||
public void testSimpleReturnType() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/simpleReturnType.kt");
|
||||
}
|
||||
|
||||
public void testSimpleUpperBound() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/simpleUpperBound.kt");
|
||||
}
|
||||
|
||||
public void testSubstitutionInSuperClass() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/substitutionInSuperClass.kt");
|
||||
}
|
||||
|
||||
public void testSubstitutionInSuperClassAbstractFun() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/substitutionInSuperClassAbstractFun.kt");
|
||||
}
|
||||
|
||||
public void testSubstitutionInSuperClassBoundedTypeArguments() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/substitutionInSuperClassBoundedTypeArguments.kt");
|
||||
}
|
||||
|
||||
public void testSubstitutionInSuperClassEnum() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/substitutionInSuperClassEnum.kt");
|
||||
}
|
||||
|
||||
public void testSubstitutionInSuperClassGenericMethod() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/substitutionInSuperClassGenericMethod.kt");
|
||||
}
|
||||
|
||||
public void testSubstitutionInSuperClassObject() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/substitutionInSuperClassObject.kt");
|
||||
}
|
||||
|
||||
public void testSubstitutionInSuperClassUpperBound() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/substitutionInSuperClassUpperBound.kt");
|
||||
}
|
||||
|
||||
public void testTwoParentsWithDifferentMethodsTwoBridges() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/twoParentsWithDifferentMethodsTwoBridges.kt");
|
||||
}
|
||||
|
||||
public void testTwoParentsWithTheSameMethodOneBridge() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("bridges/twoParentsWithTheSameMethodOneBridge.kt");
|
||||
}
|
||||
|
||||
public void testKt2498() {
|
||||
createEnvironmentWithFullJdk();
|
||||
blackBoxFile("regressions/kt2498.kt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user