@@ -2603,6 +2603,40 @@ public void testCompileStatic8686b() {
2603
2603
"----------\n " );
2604
2604
}
2605
2605
2606
+ @ Test (expected = AssertionError .class )
2607
+ public void testCompileStatic8693 () {
2608
+ //@formatter:off
2609
+ String [] sources = {
2610
+ "Main.groovy" ,
2611
+ "@groovy.transform.CompileStatic\n " +
2612
+ "class C extends p.A {\n " +
2613
+ " void m() {\n " +
2614
+ " super.m()\n " + // Cannot find matching method p.A#m()
2615
+ " }\n " +
2616
+ " void test() {\n " +
2617
+ " m()\n " +
2618
+ " }\n " +
2619
+ "}\n " +
2620
+ "new C().test()\n " ,
2621
+
2622
+ "p/A.java" ,
2623
+ "package p;\n " +
2624
+ "public abstract class A {\n " +
2625
+ "}\n " ,
2626
+
2627
+ "p/I.java" ,
2628
+ "package p;\n " +
2629
+ "public interface I {\n " +
2630
+ " default void m() {\n " +
2631
+ " System.out.print(\" works\" );\n " +
2632
+ " }\n " +
2633
+ "}\n " ,
2634
+ };
2635
+ //@formatter:on
2636
+
2637
+ runConformTest (sources , "works" );
2638
+ }
2639
+
2606
2640
@ Test
2607
2641
public void testCompileStatic8816 () {
2608
2642
//@formatter:off
@@ -6236,6 +6270,44 @@ public void testCompileStatic9893a() {
6236
6270
runConformTest (sources , "String" );
6237
6271
}
6238
6272
6273
+ @ Test (expected = AssertionError .class )
6274
+ public void testCompileStatic9909 () {
6275
+ //@formatter:off
6276
+ String [] sources = {
6277
+ "Main.groovy" ,
6278
+ "import p.*\n " +
6279
+ "@groovy.transform.CompileStatic\n " +
6280
+ "class C implements A, B {\n " +
6281
+ " void m() {\n " +
6282
+ " A.super.m()\n " +
6283
+ " }\n " +
6284
+ " void test() {\n " +
6285
+ " m()\n " +
6286
+ " }\n " +
6287
+ "}\n " +
6288
+ "new C().test()\n " ,
6289
+
6290
+ "p/A.java" ,
6291
+ "package p;\n " +
6292
+ "public interface A {\n " +
6293
+ " default void m() {\n " +
6294
+ " System.out.print(\" A\" );\n " +
6295
+ " }\n " +
6296
+ "}\n " ,
6297
+
6298
+ "p/B.java" ,
6299
+ "package p;\n " +
6300
+ "public interface B {\n " +
6301
+ " default void m() {\n " +
6302
+ " System.out.print(\" B\" );\n " +
6303
+ " }\n " +
6304
+ "}\n " ,
6305
+ };
6306
+ //@formatter:on
6307
+
6308
+ runConformTest (sources , "A" );
6309
+ }
6310
+
6239
6311
@ Test
6240
6312
public void testCompileStatic9918 () {
6241
6313
//@formatter:off
@@ -6752,4 +6824,107 @@ public void testCompileStatic10377() {
6752
6824
checkDisassemblyFor ("Main.class" , "if_acmpne" ); // ===
6753
6825
checkDisassemblyFor ("Main.class" , "if_acmpeq" ); // !==
6754
6826
}
6827
+
6828
+ @ Test
6829
+ public void testCompileStatic10379 () {
6830
+ //@formatter:off
6831
+ String [] sources = {
6832
+ "Main.groovy" ,
6833
+ "@groovy.transform.CompileStatic\n " +
6834
+ "class C extends p.A {\n " +
6835
+ " void test() {\n " +
6836
+ " m('')\n " +
6837
+ " }\n " +
6838
+ "}\n " +
6839
+ "new C().test()\n " ,
6840
+
6841
+ "p/A.groovy" ,
6842
+ "package p\n " +
6843
+ "abstract class A implements I {\n " +
6844
+ " static void m(Number n) {\n " +
6845
+ " print 'number'\n " +
6846
+ " }\n " +
6847
+ "}\n " ,
6848
+
6849
+ "p/I.java" ,
6850
+ "package p;\n " +
6851
+ "public interface I {\n " +
6852
+ " default void m(String s) {\n " +
6853
+ " System.out.print(\" string\" );\n " +
6854
+ " }\n " +
6855
+ "}\n " ,
6856
+ };
6857
+ //@formatter:on
6858
+
6859
+ runConformTest (sources , "string" );
6860
+ }
6861
+
6862
+ @ Test (expected = AssertionError .class )
6863
+ public void testCompileStatic10380 () {
6864
+ //@formatter:off
6865
+ String [] sources = {
6866
+ "Main.groovy" ,
6867
+ "@groovy.transform.CompileStatic\n " +
6868
+ "class C extends p.A {\n " +
6869
+ " void test() {\n " +
6870
+ " m()\n " + // IncompatibleClassChangeError: Found class C, but interface was expected
6871
+ " }\n " +
6872
+ "}\n " +
6873
+ "new C().test()\n " ,
6874
+
6875
+ "p/A.groovy" ,
6876
+ "package p\n " +
6877
+ "abstract class A implements I {\n " +
6878
+ "}\n " ,
6879
+
6880
+ "p/I.java" ,
6881
+ "package p;\n " +
6882
+ "interface I {\n " +
6883
+ " default void m() {\n " +
6884
+ " System.out.print(\" works\" );\n " +
6885
+ " }\n " +
6886
+ "}\n " ,
6887
+ };
6888
+ //@formatter:on
6889
+
6890
+ runConformTest (sources , "works" );
6891
+ }
6892
+
6893
+ @ Test
6894
+ public void testCompileStatic10381 () {
6895
+ //@formatter:off
6896
+ String [] sources = {
6897
+ "Main.groovy" ,
6898
+ "@groovy.transform.CompileStatic\n " +
6899
+ "class C implements p.A, p.B {\n " +
6900
+ " void test() {\n " +
6901
+ " m()\n " +
6902
+ " }\n " +
6903
+ "}\n " +
6904
+ "new C().test()\n " ,
6905
+
6906
+ "p/A.java" ,
6907
+ "package p;\n " +
6908
+ "public interface A {\n " +
6909
+ " default void m() {\n " +
6910
+ " }\n " +
6911
+ "}\n " ,
6912
+
6913
+ "p/B.java" ,
6914
+ "package p;\n " +
6915
+ "public interface B {\n " +
6916
+ " default void m() {\n " +
6917
+ " }\n " +
6918
+ "}\n " ,
6919
+ };
6920
+ //@formatter:on
6921
+
6922
+ runNegativeTest (sources ,
6923
+ "----------\n " +
6924
+ "1. ERROR in Main.groovy (at line 2)\n " +
6925
+ "\t class C implements p.A, p.B {\n " +
6926
+ "\t ^\n " +
6927
+ "Duplicate default methods named m with the parameters () and () are inherited from the types A and B\n " +
6928
+ "----------\n " );
6929
+ }
6755
6930
}
0 commit comments