diff --git a/plugins/groovy/resources/standardDsls/defaultMethods.gdsl b/plugins/groovy/resources/standardDsls/defaultMethods.gdsl index e269d2230dfa..b93896995b56 100644 --- a/plugins/groovy/resources/standardDsls/defaultMethods.gdsl +++ b/plugins/groovy/resources/standardDsls/defaultMethods.gdsl @@ -18,14 +18,12 @@ package standardDsls import com.intellij.psi.PsiType import com.intellij.psi.util.PsiUtil -import static standardDsls.Constants.NUMBER import static standardDsls.Constants.STRING /** * @author Maxim.Medvedev */ private interface Constants { - String NUMBER = "java.lang.Number" String STRING = "java.lang.String" String WILDCARD_PREFIX = "? extends " } @@ -61,22 +59,25 @@ contributor(ctype:"groovy.lang.GString") { delegatesTo(findClass("java.lang.String")) } -contributor(ctype:NUMBER) { - method name: "plus", type: NUMBER, params:[arg:NUMBER] - method name: "minus", type: NUMBER, params:[arg:NUMBER] - method name: "multiply", type: NUMBER, params:[arg:NUMBER] - method name: "power", type: NUMBER, params:[arg:NUMBER] - method name: "div", type: NUMBER, params:[arg:NUMBER] - method name: "mod", type: NUMBER, params:[arg:NUMBER] - method name: "or", type: NUMBER, params:[arg:NUMBER] - method name: "and", type: NUMBER, params:[arg:NUMBER] - method name: "xor", type: NUMBER, params:[arg:NUMBER] - method name: "next", type: removeWildcard(psiType.canonicalText) - method name: "previous", type: removeWildcard(psiType.canonicalText) - method name: "negative", type: removeWildcard(psiType.canonicalText) - method name: "positive", type: removeWildcard(psiType.canonicalText) +[Integer, Double, Float, Byte, Long, Short, Number].each { + def className = it.canonicalName + contributor(ctype: className) { + method name: "plus", type: className, params: [arg: className] + method name: "minus", type: className, params: [arg: className] + method name: "multiply", type: className, params: [arg: className] + method name: "power", type: className, params: [arg: className] + method name: "div", type: className, params: [arg: className] + method name: "mod", type: className, params: [arg: className] + method name: "or", type: className, params: [arg: className] + method name: "and", type: className, params: [arg: className] + method name: "xor", type: className, params: [arg: className] + method name: "next", type: className + method name: "previous", type: className + method name: "negative", type: className + method name: "positive", type: className - method name: "plus", type: STRING, params:[arg:STRING] + method name: "plus", type: STRING, params: [arg: STRING] + } } contributor(ctype: 'groovy.lang.MetaClass') { diff --git a/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/methodParamInClosureImplicitReturn.java b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/methodParamInClosureImplicitReturn.java index 94756942eaa3..f99657794bc8 100644 --- a/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/methodParamInClosureImplicitReturn.java +++ b/plugins/groovy/testdata/refactoring/convertGroovyToJava/file/methodParamInClosureImplicitReturn.java @@ -10,13 +10,13 @@ return null; public void foo(int x) { final groovy.lang.Reference i = new groovy.lang.Reference(x); -org.codehaus.groovy.runtime.DefaultGroovyMethods.each(new java.util.ArrayList(java.util.Arrays.asList(1, 2, 3)), new groovy.lang.Closure(this, this) { -public java.lang.Number doCall(java.lang.Object it) { +org.codehaus.groovy.runtime.DefaultGroovyMethods.each(new java.util.ArrayList(java.util.Arrays.asList(1, 2, 3)), new groovy.lang.Closure(this, this) { +public java.lang.Integer doCall(java.lang.Object it) { org.codehaus.groovy.runtime.DefaultGroovyMethods.print(this, i.get()); return setGroovyRef(i, i.get() + 1); } -public java.lang.Number doCall() { +public java.lang.Integer doCall() { return doCall(null); }