diff --git a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java index 5b7ccc0210..fdb206568b 100644 --- a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java +++ b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/StaticCompilationTests.java @@ -333,7 +333,7 @@ public void testCompileStatic12() { "1. ERROR in Main.groovy (at line 3)\n" + "\tdef list = new LinkedList([1,2,3])\n" + "\t ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Groovy:[Static type checking] - Cannot call java.util.LinkedList#(java.util.Collection ) with arguments [java.util.List ] \n" + + "Groovy:[Static type checking] - Cannot call java.util.LinkedList#(java.util.Collection) with arguments [java.util.List] \n" + "----------\n"); } @@ -1744,7 +1744,7 @@ public void testCompileStatic8310() { "1. ERROR in Main.groovy (at line 6)\n" + "\tbar {\n" + "\t^\n" + - "Groovy:[Static type checking] - Cannot find matching method Main#bar(groovy.lang.Closure ). Please check if the declared type is correct and if the method exists.\n" + + "Groovy:[Static type checking] - Cannot find matching method Main#bar(groovy.lang.Closure>). Please check if the declared type is correct and if the method exists.\n" + "----------\n"); } @@ -2004,7 +2004,7 @@ public void testCompileStatic8609c() { "1. ERROR in A.groovy (at line 11)\n" + "\tassert record.is(a.getFirstRecord(list))\n" + "\t ^^^^^^^^^^^^^^^^^^^^^^\n" + - "Groovy:[Static type checking] - Cannot find matching method A#getFirstRecord(java.util.ArrayList ). Please check if the declared type is correct and if the method exists.\n" + + "Groovy:[Static type checking] - Cannot find matching method A#getFirstRecord(java.util.ArrayList>). Please check if the declared type is correct and if the method exists.\n" + "----------\n"); } @@ -2034,7 +2034,7 @@ public void testCompileStatic8609d() { "1. ERROR in A.groovy (at line 11)\n" + "\tassert record.is(a.getFirstRecord(list))\n" + "\t ^^^^^^^^^^^^^^^^^^^^^^\n" + - "Groovy:[Static type checking] - Cannot find matching method A#getFirstRecord(java.util.ArrayList ). Please check if the declared type is correct and if the method exists.\n" + + "Groovy:[Static type checking] - Cannot find matching method A#getFirstRecord(java.util.ArrayList>). Please check if the declared type is correct and if the method exists.\n" + "----------\n"); } @@ -2064,7 +2064,7 @@ public void testCompileStatic8609e() { "1. ERROR in A.groovy (at line 11)\n" + "\tassert record.is(a.getFirstRecord(list))\n" + "\t ^^^^^^^^^^^^^^^^^^^^^^\n" + - "Groovy:[Static type checking] - Cannot find matching method A#getFirstRecord(java.util.ArrayList ). Please check if the declared type is correct and if the method exists.\n" + + "Groovy:[Static type checking] - Cannot find matching method A#getFirstRecord(java.util.ArrayList>). Please check if the declared type is correct and if the method exists.\n" + "----------\n"); } @@ -4551,7 +4551,7 @@ public void testCompileStatic9338() { "1. ERROR in Main.groovy (at line 7)\n" + "\tmeth(c)\n" + "\t^^^^^^^\n" + - "Groovy:[Static type checking] - Cannot call Main#meth(java.lang.Class ) with arguments [java.lang.Class ] \n" + + "Groovy:[Static type checking] - Cannot call Main#meth(java.lang.Class) with arguments [java.lang.Class] \n" + "----------\n"); } @@ -4577,7 +4577,7 @@ public void testCompileStatic9338a() { "1. ERROR in Main.groovy (at line 7)\n" + "\tmeth(c)\n" + "\t^^^^^^^\n" + - "Groovy:[Static type checking] - Cannot call Main#meth(java.lang.Class ) with arguments [java.lang.Class ] \n" + + "Groovy:[Static type checking] - Cannot call Main#meth(java.lang.Class) with arguments [java.lang.Class] \n" + "----------\n"); } @@ -5751,7 +5751,7 @@ public void testCompileStatic9883() { "\tjava.util.function.Supplier p = {\n" + "\t ^\n" + "Groovy:[Static type checking] - Incompatible generic argument types. " + - "Cannot assign java.util.function.Supplier to: java.util.function.Supplier \n" + + "Cannot assign java.util.function.Supplier to: java.util.function.Supplier\n" + "----------\n"); } diff --git a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/TypeCheckedTests.java b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/TypeCheckedTests.java index 25212e013e..440b76a111 100644 --- a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/TypeCheckedTests.java +++ b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/xform/TypeCheckedTests.java @@ -103,7 +103,7 @@ public void testTypeChecked3() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -234,7 +234,7 @@ public void testTypeChecked10() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -254,7 +254,7 @@ public void testTypeChecked6232() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -338,7 +338,7 @@ public void testTypeChecked6912() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -359,7 +359,7 @@ public void testTypeChecked6912a() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -375,13 +375,13 @@ public void testTypeChecked6938() { "@TypeChecked\n" + "class G extends J {\n" + " Integer doSomething() {\n" + - " @ASTTest(phase=CLASS_GENERATION, value={\n" + + " @ASTTest(phase=INSTRUCTION_SELECTION, value={\n" + " def expr = node.rightExpression\n" + " assert expr instanceof MethodCallExpression\n" + " assert expr.objectExpression.text == 'super'\n" + " def type = expr.objectExpression.getNodeMetaData(INFERRED_TYPE)\n" + - " assert type.toString(false) == 'J '\n" + // was "J" + " assert type.toString(false) == 'J'\n" + // was "J" " type = node.leftExpression.getNodeMetaData(INFERRED_TYPE)\n" + " assert type.toString(false) == 'java.lang.Integer'\n" + " })\n" + @@ -420,7 +420,7 @@ public void testTypeChecked7106() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -437,7 +437,7 @@ public void testTypeChecked7128() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -462,7 +462,7 @@ public void testTypeChecked7128a() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -482,7 +482,7 @@ public void testTypeChecked7128b() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } } @@ -504,7 +504,7 @@ public void testTypeChecked7128c() { "1. ERROR in Main.groovy (at line 3)\n" + "\tMap map = [1:2]\n" + "\t ^^^^^\n" + - "Groovy:[Static type checking] - Incompatible generic argument types. Cannot assign java.util.LinkedHashMap to: java.util.Map \n" + + "Groovy:[Static type checking] - Incompatible generic argument types. Cannot assign java.util.LinkedHashMap to: java.util.Map\n" + "----------\n"); } @@ -527,7 +527,7 @@ public void testTypeChecked7128d() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -545,7 +545,7 @@ public void testTypeChecked7274() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -624,7 +624,7 @@ public void testTypeChecked7945() { "1. ERROR in Test.groovy (at line 12)\n" + "\tsuper(Integer, String)\n" + "\t^^^^^^^^^^^^^^^^^^^^^^\n" + - "Groovy:[Static type checking] - Cannot call A#(java.lang.Class , java.lang.Class ) with arguments [java.lang.Class , java.lang.Class ] \n" + + "Groovy:[Static type checking] - Cannot call A#(java.lang.Class, java.lang.Class) with arguments [java.lang.Class, java.lang.Class] \n" + "----------\n"); } @@ -739,7 +739,7 @@ public void testTypeChecked8909() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -762,7 +762,7 @@ public void testTypeChecked8909a() { "1. ERROR in Main.groovy (at line 5)\n" + "\tm([1,2,3])\n" + "\t^^^^^^^^^^\n" + - "Groovy:[Static type checking] - Cannot find matching method Main#m(java.util.List ). Please check if the declared type is correct and if the method exists.\n" + + "Groovy:[Static type checking] - Cannot find matching method Main#m(java.util.List). Please check if the declared type is correct and if the method exists.\n" + "----------\n"); } @@ -862,12 +862,12 @@ public void testTypeChecked8984() { "1. ERROR in Main.groovy (at line 4)\n" + "\tCharSequence[] one = m()\n" + "\t ^^^\n" + - "Groovy:[Static type checking] - Cannot assign value of type java.util.List to variable of type java.lang.CharSequence[]\n" + + "Groovy:[Static type checking] - Cannot assign value of type java.util.List to variable of type java.lang.CharSequence[]\n" + "----------\n" + "2. ERROR in Main.groovy (at line 5)\n" + "\tCharSequence[] two = set\n" + "\t ^^^\n" + - "Groovy:[Static type checking] - Cannot assign value of type java.util.Set to variable of type java.lang.CharSequence[]\n" + + "Groovy:[Static type checking] - Cannot assign value of type java.util.Set to variable of type java.lang.CharSequence[]\n" + "----------\n"); } @@ -891,12 +891,12 @@ public void testTypeChecked8984a() { "1. ERROR in Main.groovy (at line 4)\n" + "\tNumber[] one = m()\n" + "\t ^^^\n" + - "Groovy:[Static type checking] - Cannot assign value of type java.util.List to variable of type java.lang.Number[]\n" + + "Groovy:[Static type checking] - Cannot assign value of type java.util.List to variable of type java.lang.Number[]\n" + "----------\n" + "2. ERROR in Main.groovy (at line 5)\n" + "\tNumber[] two = set\n" + "\t ^^^\n" + - "Groovy:[Static type checking] - Cannot assign value of type java.util.Set to variable of type java.lang.Number[]\n" + + "Groovy:[Static type checking] - Cannot assign value of type java.util.Set to variable of type java.lang.Number[]\n" + "----------\n"); } @@ -1474,7 +1474,7 @@ public void testTypeChecked9953() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -1496,7 +1496,7 @@ public void testTypeChecked9956() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -1520,7 +1520,7 @@ public void testTypeChecked9956a() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -1544,7 +1544,7 @@ public void testTypeChecked9956b() { "1. ERROR in Main.groovy (at line 7)\n" + "\tA ax = new C()\n" + "\t ^^^^^^^^^^^^^^^\n" + - "Groovy:[Static type checking] - Incompatible generic argument types. Cannot assign C to: A \n" + + "Groovy:[Static type checking] - Incompatible generic argument types. Cannot assign C to: A\n" + "----------\n"); } @@ -1621,7 +1621,7 @@ public void testTypeChecked9970() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -1744,7 +1744,7 @@ public void testTypeChecked9972c() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -1921,7 +1921,7 @@ public void testTypeChecked9996() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -1938,7 +1938,7 @@ public void testTypeChecked9997() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -2031,7 +2031,7 @@ public void testTypeChecked10006() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test @@ -2134,7 +2134,7 @@ public void testTypeChecked10011() { }; //@formatter:on - runConformTest(sources, ""); + runConformTest(sources); } @Test diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassNode.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassNode.java index c2005fa45e..9f6babd229 100644 --- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassNode.java +++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassNode.java @@ -1295,6 +1295,7 @@ public String toString(boolean showRedirect) { StringBuilder ret = new StringBuilder(!placeholder ? getName() : getUnresolvedName()); GenericsType[] genericsTypes = getGenericsTypes(); if (!placeholder && genericsTypes != null) { + /* GRECLIPSE edit -- GROOVY-9800 ret.append(" <"); for (int i = 0; i < genericsTypes.length; i++) { if (i != 0) ret.append(", "); @@ -1302,6 +1303,14 @@ public String toString(boolean showRedirect) { ret.append(genericTypeAsString(genericsType)); } ret.append(">"); + */ + ret.append('<'); + for (int i = 0, n = genericsTypes.length; i < n; i += 1) { + if (i != 0) ret.append(", "); + ret.append(genericsTypes[i]); + } + ret.append('>'); + // GRECLIPSE end } if (isRedirectNode() && showRedirect) { ret.append(" -> ").append(redirect.toString()); @@ -1309,40 +1318,6 @@ public String toString(boolean showRedirect) { return ret.toString(); } - /** - * This exists to avoid a recursive definition of toString. The default toString - * in GenericsType calls ClassNode.toString(), which calls GenericsType.toString(), etc. - * @param genericsType - * @return the string representing the generic type - */ - private String genericTypeAsString(GenericsType genericsType) { - /* GRECLIPSE edit - StringBuilder ret = new StringBuilder(genericsType.getName()); - */ - StringBuilder ret = new StringBuilder(genericsType.isWildcard() ? "?" : genericsType.getName()); - // GRECLIPSE end - if (genericsType.getUpperBounds() != null) { - ret.append(" extends "); - for (int i = 0; i < genericsType.getUpperBounds().length; i++) { - ClassNode classNode = genericsType.getUpperBounds()[i]; - if (classNode.equals(this)) { - ret.append(classNode.getName()); - } else { - ret.append(classNode.toString(false)); - } - if (i + 1 < genericsType.getUpperBounds().length) ret.append(" & "); - } - } else if (genericsType.getLowerBound() != null) { - ClassNode classNode = genericsType.getLowerBound(); - if (classNode.equals(this)) { - ret.append(" super ").append(classNode.getName()); - } else { - ret.append(" super ").append(classNode.toString(false)); - } - } - return ret.toString(); - } - /** * Determines if the type has a possibly-matching instance method with the given name and arguments. * diff --git a/base/org.codehaus.groovy30/src/org/codehaus/groovy/ast/ClassNode.java b/base/org.codehaus.groovy30/src/org/codehaus/groovy/ast/ClassNode.java index f2bd710dc6..b1a2d3412f 100644 --- a/base/org.codehaus.groovy30/src/org/codehaus/groovy/ast/ClassNode.java +++ b/base/org.codehaus.groovy30/src/org/codehaus/groovy/ast/ClassNode.java @@ -47,10 +47,9 @@ import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.stream.Collectors; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.toList; import static org.apache.groovy.ast.tools.MethodNodeUtils.getCodeAsBlock; /** @@ -454,7 +453,7 @@ public List getMethods() { */ public List getAbstractMethods() { return getDeclaredMethodsMap().values().stream() - .filter(MethodNode::isAbstract).collect(Collectors.toList()); + .filter(MethodNode::isAbstract).collect(toList()); } public List getAllDeclaredMethods() { @@ -1271,9 +1270,18 @@ public String toString(boolean showRedirect) { StringBuilder ret = new StringBuilder(!placeholder ? getName() : getUnresolvedName()); GenericsType[] genericsTypes = getGenericsTypes(); if (!placeholder && genericsTypes != null && genericsTypes.length > 0) { + /* GRECLIPSE edit -- GROOVY-9800 ret.append(" <"); ret.append(stream(genericsTypes).map(this::genericTypeAsString).collect(joining(", "))); ret.append(">"); + */ + ret.append('<'); + for (int i = 0, n = genericsTypes.length; i < n; i += 1) { + if (i != 0) ret.append(", "); + ret.append(genericsTypes[i]); + } + ret.append('>'); + // GRECLIPSE end } if (showRedirect && redirect != null) { ret.append(" -> ").append(redirect.toString()); @@ -1281,31 +1289,6 @@ public String toString(boolean showRedirect) { return ret.toString(); } - /** - * Avoids a recursive definition of toString. The default {@code toString} - * in {@link GenericsType} calls {@code ClassNode.toString()}, which would - * call {@code GenericsType.toString()} without this method. - */ - private String genericTypeAsString(GenericsType genericsType) { - String name = genericsType.getName(); - if (genericsType.getUpperBounds() != null) { - return name + " extends " + stream(genericsType.getUpperBounds()) - .map(this::toStringTerminal).collect(joining(" & ")); - } else if (genericsType.getLowerBound() != null) { - return name + " super " + toStringTerminal(genericsType.getLowerBound()); - } else { - return name; - } - } - - private String toStringTerminal(ClassNode classNode) { - if (classNode.equals(this)) { - return classNode.getName(); - } else { - return classNode.toString(false); - } - } - /** * Determines if the type has a possibly-matching instance method with the given name and arguments. * diff --git a/base/org.codehaus.groovy40/src/org/codehaus/groovy/ast/ClassNode.java b/base/org.codehaus.groovy40/src/org/codehaus/groovy/ast/ClassNode.java index 45fc5dd30d..065a57c6ca 100644 --- a/base/org.codehaus.groovy40/src/org/codehaus/groovy/ast/ClassNode.java +++ b/base/org.codehaus.groovy40/src/org/codehaus/groovy/ast/ClassNode.java @@ -46,10 +46,9 @@ import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.stream.Collectors; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.toList; import static org.apache.groovy.ast.tools.MethodNodeUtils.getCodeAsBlock; import static groovyjarjarasm.asm.Opcodes.ACC_ABSTRACT; import static groovyjarjarasm.asm.Opcodes.ACC_ANNOTATION; @@ -461,7 +460,7 @@ public List getMethods() { */ public List getAbstractMethods() { return getDeclaredMethodsMap().values().stream() - .filter(MethodNode::isAbstract).collect(Collectors.toList()); + .filter(MethodNode::isAbstract).collect(toList()); } public List getAllDeclaredMethods() { @@ -1281,9 +1280,18 @@ public String toString(boolean showRedirect) { StringBuilder ret = new StringBuilder(!placeholder ? getName() : getUnresolvedName()); GenericsType[] genericsTypes = getGenericsTypes(); if (!placeholder && genericsTypes != null && genericsTypes.length > 0) { + /* GRECLIPSE edit -- GROOVY-9800 ret.append(" <"); ret.append(stream(genericsTypes).map(this::genericTypeAsString).collect(joining(", "))); ret.append(">"); + */ + ret.append('<'); + for (int i = 0, n = genericsTypes.length; i < n; i += 1) { + if (i != 0) ret.append(", "); + ret.append(genericsTypes[i]); + } + ret.append('>'); + // GRECLIPSE end } if (showRedirect && redirect != null) { ret.append(" -> ").append(redirect.toString()); @@ -1291,31 +1299,6 @@ public String toString(boolean showRedirect) { return ret.toString(); } - /** - * Avoids a recursive definition of toString. The default {@code toString} - * in {@link GenericsType} calls {@code ClassNode.toString()}, which would - * call {@code GenericsType.toString()} without this method. - */ - private String genericTypeAsString(GenericsType genericsType) { - String name = genericsType.getName(); - if (genericsType.getUpperBounds() != null) { - return name + " extends " + stream(genericsType.getUpperBounds()) - .map(this::toStringTerminal).collect(joining(" & ")); - } else if (genericsType.getLowerBound() != null) { - return name + " super " + toStringTerminal(genericsType.getLowerBound()); - } else { - return name; - } - } - - private String toStringTerminal(ClassNode classNode) { - if (classNode.equals(this)) { - return classNode.getName(); - } else { - return classNode.toString(false); - } - } - /** * Determines if the type has a possibly-matching instance method with the given name and arguments. * diff --git a/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectGenericsTests.groovy b/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectGenericsTests.groovy index f6739ee16e..801ded35e7 100644 --- a/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectGenericsTests.groovy +++ b/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectGenericsTests.groovy @@ -135,7 +135,7 @@ final class CodeSelectGenericsTests extends BrowsingTestSuite { String contents = '[a: Number].keySet()' IJavaElement elem = assertCodeSelect([contents], 'keySet') MethodNode method = ((GroovyResolvedBinaryMethod) elem).inferredElement - assert method.returnType.toString(false) == 'java.util.Set ' + assert method.returnType.toString(false) == 'java.util.Set' } @Test @@ -143,7 +143,7 @@ final class CodeSelectGenericsTests extends BrowsingTestSuite { String contents = '[a: Number].values()' IJavaElement elem = assertCodeSelect([contents], 'values') MethodNode method = ((GroovyResolvedBinaryMethod) elem).inferredElement - assert method.returnType.toString(false) == 'java.util.Collection ' + assert method.returnType.toString(false) == 'java.util.Collection>' } @Test @@ -151,7 +151,7 @@ final class CodeSelectGenericsTests extends BrowsingTestSuite { String contents = '[a: Number].entrySet()' IJavaElement elem = assertCodeSelect([contents], 'entrySet') MethodNode method = ((GroovyResolvedBinaryMethod) elem).inferredElement - assert method.returnType.toString(false) == 'java.util.Set ' + assert method.returnType.toString(false) ==~ 'java.util.Set>>' } @Test // https://github.com/groovy/groovy-eclipse/issues/1213 @@ -160,7 +160,7 @@ final class CodeSelectGenericsTests extends BrowsingTestSuite { String usage = 'cmp = Comparator.comparing{ it.date }' IJavaElement elem = assertCodeSelect([types, usage], 'comparing') MethodNode method = ((GroovyResolvedBinaryMethod) elem).inferredElement - assert method.returnType.toString(false) == 'java.util.Comparator ' + assert method.returnType.toString(false) == 'java.util.Comparator' } @Test @@ -168,7 +168,7 @@ final class CodeSelectGenericsTests extends BrowsingTestSuite { String contents = '[a: Number].collect { k,v -> "" }' IJavaElement elem = assertCodeSelect([contents], 'collect') MethodNode method = ((GroovyResolvedBinaryMethod) elem).inferredElement - assert method.returnType.toString(false) == 'java.util.List ' + assert method.returnType.toString(false) == 'java.util.List' } @Test diff --git a/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectMethodsTests.groovy b/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectMethodsTests.groovy index cad7688bcd..1077ada8c0 100644 --- a/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectMethodsTests.groovy +++ b/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectMethodsTests.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -485,7 +485,7 @@ final class CodeSelectMethodsTests extends BrowsingTestSuite { void testCodeSelectStaticMethod4() { String contents = 'List empty = Collections.&emptyList' IJavaElement element = assertCodeSelect([contents], 'emptyList') - assert element.inferredElement.returnType.toString(false) == 'java.util.List ' // TODO: want T to be java.lang.String + assert element.inferredElement.returnType.toString(false) == 'java.util.List' // TODO: want T to be java.lang.String } @Test @@ -499,7 +499,7 @@ final class CodeSelectMethodsTests extends BrowsingTestSuite { | } |}'''.stripMargin() IJavaElement element = assertCodeSelect([contents], 'singletonList') - assert element.inferredElement.returnType.toString(false) == 'java.util.List ' + assert element.inferredElement.returnType.toString(false) == 'java.util.List' } @Test diff --git a/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/ui/OutlineExtenderTests.groovy b/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/ui/OutlineExtenderTests.groovy index 5433637f6d..0829ee1cab 100644 --- a/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/ui/OutlineExtenderTests.groovy +++ b/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/ui/OutlineExtenderTests.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -307,7 +307,7 @@ final class OutlineExtenderTests extends GroovyEclipseTestSuite { IJavaElement[] children = outline.outlineCompilationUnit.children assert children.tail()*.elementName == ['map', 'obj'] - assert children.tail()*.typeSignature == ['Qjava.util.Map;', 'Qjava.lang.Object;'] + assert children.tail()*.typeSignature == ['Qjava.util.Map;', 'Qjava.lang.Object;'] assert children*.elementType == [IJavaElement.IMPORT_CONTAINER, IJavaElement.FIELD, IJavaElement.FIELD] }