File tree 4 files changed +40
-1
lines changed
org.codehaus.groovy25/src/org/codehaus/groovy/transform/stc
org.codehaus.groovy30/src/org/codehaus/groovy/transform/stc
org.codehaus.groovy40/src/org/codehaus/groovy/transform/stc
base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform
4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -6820,4 +6820,34 @@ public void testTypeChecked10890() {
6820
6820
6821
6821
runConformTest (sources );
6822
6822
}
6823
+
6824
+ @ Test
6825
+ public void testTypeChecked10897 () {
6826
+ //@formatter:off
6827
+ String [] sources = {
6828
+ "Main.groovy" ,
6829
+ "interface A {\n " +
6830
+ " def m()\n " +
6831
+ "}\n " +
6832
+ "interface B extends A {\n " +
6833
+ " @Override def m()\n " +
6834
+ "}\n " +
6835
+ "class C implements A {\n " +
6836
+ " @Override def m() { 'C' }\n " +
6837
+ "}\n " +
6838
+ "class D extends C implements B {\n " +
6839
+ "}\n " +
6840
+ "class E extends D {\n " +
6841
+ " @groovy.transform.TypeChecked\n " +
6842
+ " @Override\n " +
6843
+ " def m() {\n " +
6844
+ " 'E then ' + super.m()\n " +
6845
+ " }\n " +
6846
+ "}\n " +
6847
+ "print new E().m()\n " ,
6848
+ };
6849
+ //@formatter:on
6850
+
6851
+ runConformTest (sources , "E then C" );
6852
+ }
6823
6853
}
Original file line number Diff line number Diff line change @@ -1304,6 +1304,10 @@ private static List<MethodNode> removeCovariantsAndInterfaceEquivalents(final Co
1304
1304
}
1305
1305
} else if (!oneDC .equals (twoDC )) {
1306
1306
if (ParameterUtils .parametersEqual (one .getParameters (), two .getParameters ())) {
1307
+ // GRECLIPSE add -- GROOVY-10897
1308
+ if ( twoDC .isInterface () && !one .isAbstract () && !(two instanceof ExtensionMethodNode ) ) {
1309
+ toBeRemoved .add (two );
1310
+ } else
1307
1311
// GROOVY-6882, GROOVY-6970: drop overridden or interface equivalent method
1308
1312
if (twoDC .isInterface () ? oneDC .implementsInterface (twoDC ) : oneDC .isDerivedFrom (twoDC )) {
1309
1313
toBeRemoved .add (two );
Original file line number Diff line number Diff line change @@ -1236,6 +1236,10 @@ private static List<MethodNode> removeCovariantsAndInterfaceEquivalents(final Co
1236
1236
}
1237
1237
} else if (!oneDC .equals (twoDC )) {
1238
1238
if (ParameterUtils .parametersEqual (one .getParameters (), two .getParameters ())) {
1239
+ // GRECLIPSE add -- GROOVY-10897
1240
+ if ( twoDC .isInterface () && !one .isAbstract () && !(two instanceof ExtensionMethodNode ) ) {
1241
+ toBeRemoved .add (two );
1242
+ } else
1239
1243
// GROOVY-6882, GROOVY-6970: drop overridden or interface equivalent method
1240
1244
if (twoDC .isInterface () ? oneDC .implementsInterface (twoDC ) : oneDC .isDerivedFrom (twoDC )) {
1241
1245
toBeRemoved .add (two );
Original file line number Diff line number Diff line change @@ -1233,7 +1233,8 @@ private static List<MethodNode> removeCovariantsAndInterfaceEquivalents(final Co
1233
1233
} else if (!oneDC .equals (twoDC )) {
1234
1234
if (ParameterUtils .parametersEqual (one .getParameters (), two .getParameters ())) {
1235
1235
// GROOVY-6882, GROOVY-6970: drop overridden or interface equivalent method
1236
- if (twoDC .isInterface () ? oneDC .implementsInterface (twoDC ) : oneDC .isDerivedFrom (twoDC )) {
1236
+ if (!twoDC .isInterface () ? oneDC .isDerivedFrom (twoDC ) : oneDC .implementsInterface (twoDC ) || // GROOVY-10897: concrete vs. abstract
1237
+ (!disjoint && !one .isAbstract () && !(two instanceof ExtensionMethodNode ))) {
1237
1238
toBeRemoved .add (two );
1238
1239
} else if (oneDC .isInterface () ? (disjoint ? twoDC .implementsInterface (oneDC ) : twoDC .isInterface ()) : twoDC .isDerivedFrom (oneDC )) {
1239
1240
toBeRemoved .add (one );
You can’t perform that action at this time.
0 commit comments