@@ -2076,7 +2076,7 @@ public void testReferencingFieldsGenerics_GreferingToJ() {
20762076 }
20772077
20782078 @ Test
2079- public void testAbstractCovariance_1 () {
2079+ public void testAbstractCovariance1 () {
20802080 //@formatter:off
20812081 String [] sources = {
20822082 "Foo.groovy" ,
@@ -2091,7 +2091,7 @@ public void testAbstractCovariance_1() {
20912091 }
20922092
20932093 @ Test
2094- public void testAbstractCovariance_2 () {
2094+ public void testAbstractCovariance2 () {
20952095 //@formatter:off
20962096 String [] sources = {
20972097 "Foo.groovy" ,
@@ -2110,25 +2110,19 @@ public void testAbstractCovariance_2() {
21102110 "----------\n " );
21112111 }
21122112
2113- @ Test
2114- public void testAbstractCovariance_3 () {
2113+ @ Test // https://issues.apache.org/jira/projects/GROOVY/issues/GROOVY-9059
2114+ public void testAbstractCovariance3 () {
21152115 //@formatter:off
21162116 String [] sources = {
2117- "Face1.java" ,
2118- "@FunctionalInterface\n " +
2119- "interface Face1<I, O> {\n " +
2120- " O apply(I in);\n " +
2121- "}\n " ,
2122-
2123- "Face2.java" ,
2124- "interface Face2<X, Y> extends Face1<X, Y> {\n " +
2125- " Object another();\n " +
2117+ "Face.java" ,
2118+ "interface Face<T> {\n " +
2119+ " <O extends T> O process(O o);\n " +
21262120 "}\n " ,
21272121
21282122 "Impl.groovy" ,
2129- "class Impl implements Face2<Number, String > {\n " +
2130- " @Override String apply(Number n) { '' } \n " +
2131- " @Override Object another( ) { null }\n " +
2123+ "class Impl implements Face<CharSequence > { \n " +
2124+ " @Override\n " +
2125+ " def <Chars extends CharSequence> Chars process(Chars chars ) { chars }\n " +
21322126 "}\n " ,
21332127 };
21342128 //@formatter:on
@@ -2137,7 +2131,7 @@ public void testAbstractCovariance_3() {
21372131 }
21382132
21392133 @ Test // https://issues.apache.org/jira/projects/GROOVY/issues/GROOVY-9059
2140- public void testAbstractCovariance_GROOVY9059 () {
2134+ public void testAbstractCovariance4 () {
21412135 //@formatter:off
21422136 String [] sources = {
21432137 "Face.java" ,
@@ -2146,9 +2140,9 @@ public void testAbstractCovariance_GROOVY9059() {
21462140 "}\n " ,
21472141
21482142 "Impl.groovy" ,
2149- "class Impl implements Face<CharSequence> { \n " +
2143+ "def impl = new Face<CharSequence>() { \n " +
21502144 " @Override\n " +
2151- " public <Chars extends CharSequence> Chars process(Chars chars) { chars }\n " +
2145+ " def <Chars extends CharSequence> Chars process(Chars chars) { chars }\n " +
21522146 "}\n " ,
21532147 };
21542148 //@formatter:on
@@ -2157,7 +2151,7 @@ public void testAbstractCovariance_GROOVY9059() {
21572151 }
21582152
21592153 @ Test // https://issues.apache.org/jira/projects/GROOVY/issues/GROOVY-9059
2160- public void testAbstractCovariance_GROOVY9059a () {
2154+ public void testAbstractCovariance5 () {
21612155 //@formatter:off
21622156 String [] sources = {
21632157 "Face.java" ,
@@ -2167,8 +2161,8 @@ public void testAbstractCovariance_GROOVY9059a() {
21672161
21682162 "Impl.groovy" ,
21692163 "def impl = new Face<CharSequence>() { \n " +
2170- " @Override\n " +
2171- " public <Chars extends CharSequence> Chars process(Chars chars) { chars }\n " +
2164+ " @Override @SuppressWarnings('unchecked') \n " +
2165+ " CharSequence process(CharSequence chars) { chars }\n " +
21722166 "}\n " ,
21732167 };
21742168 //@formatter:on
@@ -2177,7 +2171,7 @@ public void testAbstractCovariance_GROOVY9059a() {
21772171 }
21782172
21792173 @ Test // https://issues.apache.org/jira/projects/GROOVY/issues/GROOVY-9059
2180- public void testAbstractCovariance_GROOVY9059b () {
2174+ public void testAbstractCovariance6 () {
21812175 //@formatter:off
21822176 String [] sources = {
21832177 "Face.java" ,
@@ -2186,9 +2180,9 @@ public void testAbstractCovariance_GROOVY9059b() {
21862180 "}\n " ,
21872181
21882182 "Impl.groovy" ,
2189- "def impl = new Face<CharSequence >() { \n " +
2183+ "def impl = new Face<String >() { \n " +
21902184 " @Override @SuppressWarnings('unchecked')\n " +
2191- " public CharSequence process(CharSequence chars ) { chars }\n " +
2185+ " String process(String string ) { string }\n " +
21922186 "}\n " ,
21932187 };
21942188 //@formatter:on
@@ -2197,18 +2191,44 @@ public void testAbstractCovariance_GROOVY9059b() {
21972191 }
21982192
21992193 @ Test // https://issues.apache.org/jira/projects/GROOVY/issues/GROOVY-9059
2200- public void testAbstractCovariance_GROOVY9059c () {
2194+ public void testAbstractCovariance7 () {
22012195 //@formatter:off
22022196 String [] sources = {
2203- "Face.java " ,
2197+ "Face.groovy " ,
22042198 "interface Face<T> {\n " +
2205- " <O extends T> O process(O o); \n " +
2199+ " def <O extends T> O process(O o)\n " +
22062200 "}\n " ,
22072201
22082202 "Impl.groovy" ,
22092203 "def impl = new Face<String>() { \n " +
22102204 " @Override @SuppressWarnings('unchecked')\n " +
2211- " public String process(String string) { string }\n " +
2205+ " String process(String string) { string }\n " +
2206+ "}\n " ,
2207+ };
2208+ //@formatter:on
2209+
2210+ runWarningFreeTest (sources );
2211+ }
2212+
2213+ @ Test // https://issues.apache.org/jira/projects/GROOVY/issues/GROOVY-10675
2214+ public void testAbstractCovariance8 () {
2215+ //@formatter:off
2216+ String [] sources = {
2217+ "Face1.java" ,
2218+ "@FunctionalInterface\n " +
2219+ "interface Face1<I, O> {\n " +
2220+ " O apply(I in);\n " +
2221+ "}\n " ,
2222+
2223+ "Face2.java" ,
2224+ "interface Face2<X, Y> extends Face1<X, Y> {\n " +
2225+ " Object another();\n " +
2226+ "}\n " ,
2227+
2228+ "Impl.groovy" ,
2229+ "class Impl implements Face2<Number, String> {\n " +
2230+ " @Override String apply(Number n) { '' }\n " +
2231+ " @Override Object another() { null }\n " +
22122232 "}\n " ,
22132233 };
22142234 //@formatter:on
0 commit comments