Skip to content

Commit 12e7ac3

Browse files
committed
GROOVY-10280, GROOVY-10283
1 parent 2b8eff5 commit 12e7ac3

File tree

5 files changed

+253
-137
lines changed

5 files changed

+253
-137
lines changed

base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java

+1-134
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static org.junit.Assume.assumeTrue;
2121

2222
import org.eclipse.jdt.groovy.core.tests.basic.GroovyCompilerTestSuite;
23-
import org.junit.Ignore;
2423
import org.junit.Test;
2524

2625
/**
@@ -3567,138 +3566,6 @@ public void testCompileStatic9063() {
35673566
runConformTest(sources, "5");
35683567
}
35693568

3570-
@Test @Ignore("https://issues.apache.org/jira/browse/GROOVY-9074")
3571-
public void testCompileStatic9074() {
3572-
//@formatter:off
3573-
String[] sources = {
3574-
"Main.groovy",
3575-
"@groovy.transform.CompileStatic\n" +
3576-
"class Main {\n" +
3577-
" private static Collection<?> c = new ArrayList<String>()\n" +
3578-
" static main(args) {\n" +
3579-
" c.add(new Object())\n" +
3580-
" }\n" +
3581-
"}\n",
3582-
};
3583-
//@formatter:on
3584-
3585-
runNegativeTest(sources, "The method add(capture#1-of ?) in the type Collection<capture#1-of ?> is not applicable for the arguments (Object)");
3586-
}
3587-
3588-
@Test @Ignore("https://issues.apache.org/jira/browse/GROOVY-9074")
3589-
public void testCompileStatic9074a() {
3590-
//@formatter:off
3591-
String[] sources = {
3592-
"Main.groovy",
3593-
"import java.awt.Canvas\n" +
3594-
"abstract class Shape {\n" +
3595-
" abstract void draw(Canvas c)\n" +
3596-
"}\n" +
3597-
"class Circle extends Shape {\n" +
3598-
" private int x, y, radius\n" +
3599-
" @Override void draw(Canvas c) {}\n" +
3600-
"}\n" +
3601-
"class Rectangle extends Shape {\n" +
3602-
" private int x, y, width, height\n" +
3603-
" @Override void draw(Canvas c) {}\n" +
3604-
"}\n" +
3605-
"\n" +
3606-
"@groovy.transform.CompileStatic\n" +
3607-
"void addRectangle(List<? extends Shape> shapes) {\n" +
3608-
" shapes.add(0, new Rectangle()) // TODO: compile-time error!\n" +
3609-
"}\n",
3610-
};
3611-
//@formatter:on
3612-
3613-
runNegativeTest(sources, "The method add(capture#1-of ?) in the type List<capture#1-of ?> is not applicable for the arguments (Rectangle)");
3614-
}
3615-
3616-
@Test
3617-
public void testCompileStatic9074b() {
3618-
//@formatter:off
3619-
String[] sources = {
3620-
"Main.groovy",
3621-
"import java.awt.Canvas\n" +
3622-
"abstract class Shape {\n" +
3623-
" abstract void draw(Canvas c)\n" +
3624-
"}\n" +
3625-
"class Circle extends Shape {\n" +
3626-
" private int x, y, radius\n" +
3627-
" @Override void draw(Canvas c) {}\n" +
3628-
"}\n" +
3629-
"class Rectangle extends Shape {\n" +
3630-
" private int x, y, width, height\n" +
3631-
" @Override void draw(Canvas c) {}\n" +
3632-
"}\n" +
3633-
"\n" +
3634-
"@groovy.transform.CompileStatic\n" +
3635-
"void addRectangle(List<? super Shape> shapes) {\n" +
3636-
" shapes.add(0, new Rectangle())\n" +
3637-
"}\n",
3638-
};
3639-
//@formatter:on
3640-
3641-
runNegativeTest(sources, "");
3642-
}
3643-
3644-
@Test
3645-
public void testCompileStatic9074c() {
3646-
//@formatter:off
3647-
String[] sources = {
3648-
"Main.groovy",
3649-
"class Factory {\n" +
3650-
" public <T> T make(Class<T> type, ... args) {}\n" +
3651-
"}\n" +
3652-
"\n" +
3653-
"@groovy.transform.CompileStatic\n" +
3654-
"void test(Factory fact, Rule rule) {\n" +
3655-
" Type bean = fact.make(rule.type)\n" +
3656-
"}\n",
3657-
3658-
"Rule.java",
3659-
"public class Rule {\n" +
3660-
" public Class<? extends Type> getType() {\n" +
3661-
" return null;\n" +
3662-
" }\n" +
3663-
"}\n",
3664-
3665-
"Type.java",
3666-
"public interface Type {}\n",
3667-
};
3668-
//@formatter:on
3669-
3670-
runNegativeTest(sources, "");
3671-
}
3672-
3673-
@Test @Ignore("https://issues.apache.org/jira/browse/GROOVY-9074")
3674-
public void testCompileStatic9074d() {
3675-
//@formatter:off
3676-
String[] sources = {
3677-
"Main.groovy",
3678-
"class Factory {\n" +
3679-
" public <T> T make(Class<T> type, ... args) {}\n" +
3680-
"}\n" +
3681-
"\n" +
3682-
"@groovy.transform.CompileStatic\n" +
3683-
"void test(Factory fact, Rule rule) {\n" +
3684-
" Type bean = fact.make(rule.type)\n" +
3685-
"}\n",
3686-
3687-
"Rule.java",
3688-
"public class Rule {\n" +
3689-
" public Class<? super Type> getType() {\n" +
3690-
" return null;\n" +
3691-
" }\n" +
3692-
"}\n",
3693-
3694-
"Type.java",
3695-
"public interface Type {}\n",
3696-
};
3697-
//@formatter:on
3698-
3699-
runNegativeTest(sources, "cannot convert from capture#1-of ? super Type to Type");
3700-
}
3701-
37023569
@Test
37033570
public void testCompileStatic9086() {
37043571
//@formatter:off
@@ -5627,7 +5494,7 @@ public void testCompileStatic9737a() {
56275494
runConformTest(sources, "str");
56285495
}
56295496

5630-
@Test @Ignore
5497+
@Test(expected = AssertionError.class)
56315498
public void testCompileStatic9737b() {
56325499
//@formatter:off
56335500
String[] sources = {

0 commit comments

Comments
 (0)