diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/convertToJava/FileGenerationTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/convertToJava/FileGenerationTest.groovy index 4deb3ff07a75..838cf080d172 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/convertToJava/FileGenerationTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/convertToJava/FileGenerationTest.groovy @@ -66,4 +66,5 @@ class FileGenerationTest extends LightGroovyTestCase { void testMethodParamsInClosures() {doTest()} void testClosureParamInInnerClosure() {doTest()} void testMethodParamInClosureImplicitReturn() {doTest()} + void testField() {doTest()} } diff --git a/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/closureParamInInnerClosure.java b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/closureParamInInnerClosure.java index 331940d541e1..e2003c5f62df 100644 --- a/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/closureParamInInnerClosure.java +++ b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/closureParamInInnerClosure.java @@ -2,7 +2,7 @@ public class X extends groovy.lang.GroovyObjectSupport implements groovy.lang.Gr public groovy.lang.Closure getFoo() { return foo; } -public void setFoo(java.lang.Object foo) { +public void setFoo(groovy.lang.Closure foo) { this.foo = foo; } private groovy.lang.Closure foo = new groovy.lang.Closure(this, this) { diff --git a/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/field.groovy b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/field.groovy new file mode 100644 index 000000000000..45dcb86036e0 --- /dev/null +++ b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/field.groovy @@ -0,0 +1,8 @@ +class X { + def field = [1:2, 3:4] + def second = [1, 2, 3] + def a=5, b=3 + + def c=[1:2], d=5 + int x +} \ No newline at end of file diff --git a/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/field.java b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/field.java new file mode 100644 index 000000000000..c8c84edb5f22 --- /dev/null +++ b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/field.java @@ -0,0 +1,60 @@ +public class X extends groovy.lang.GroovyObjectSupport implements groovy.lang.GroovyObject { +public java.util.Map getField() { + return field; +} +public void setField(java.util.Map field) { +this.field = field; +} +public java.util.ArrayList getSecond() { + return second; +} +public void setSecond(java.util.ArrayList second) { +this.second = second; +} +public java.lang.Integer getA() { + return a; +} +public void setA(java.lang.Integer a) { +this.a = a; +} +public java.lang.Integer getB() { + return b; +} +public void setB(java.lang.Integer b) { +this.b = b; +} +public java.util.Map getC() { + return c; +} +public void setC(java.util.Map c) { +this.c = c; +} +public java.lang.Integer getD() { + return d; +} +public void setD(java.lang.Integer d) { +this.d = d; +} +public int getX() { + return x; +} +public void setX(int x) { +this.x = x; +} +{ +java.util.Map map = new java.util.Map(2); +map.put("1", 2); +map.put("3", 4); +field = map;} +private java.util.Map field; +private java.util.ArrayList second = new java.util.ArrayList(java.util.Arrays.asList(1, 2, 3)); +private java.lang.Integer a = 5; +private java.lang.Integer b = 3; +{ +java.util.Map map = new java.util.Map(1); +map.put("1", 2); +c = map;} +private java.util.Map c; +private java.lang.Integer d = 5; +private int x; +} diff --git a/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/staticProperty.java b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/staticProperty.java index 4b5419fca287..5cf1b6ba5be4 100644 --- a/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/staticProperty.java +++ b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/staticProperty.java @@ -6,7 +6,7 @@ org.codehaus.groovy.runtime.DefaultGroovyMethods.print(Foo.this, CONST); public static java.lang.Integer getCONST() { return CONST; } -public static void setCONST(java.lang.Object CONST) { +public static void setCONST(java.lang.Integer CONST) { Foo.CONST = CONST; } private static java.lang.Integer CONST = 5;