Skip to content

Commit

Permalink
Update the Groovy plugin to 2.5.19
Browse files Browse the repository at this point in the history
for #1395
  • Loading branch information
eric-milles committed Sep 29, 2022
1 parent 015b004 commit 3e82b48
Show file tree
Hide file tree
Showing 89 changed files with 4,059 additions and 3,200 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ public void testCharLiteralAttributeValue() {

"Main.groovy",
"class Main {\n" +
" @Separator(';')\n" +
" @Separator((char)';')\n" +
" String tokens\n" +
"}\n",
};
Expand All @@ -709,9 +709,14 @@ public void testCharLiteralAttributeValue() {
runNegativeTest(sources,
"----------\n" +
"1. ERROR in Main.groovy (at line 2)\n" +
"\t@Separator(';')\n" +
"\t ^^^\n" +
"Groovy:Attribute 'value' should have type 'java.lang.Character'; but found type 'java.lang.String' in @Separator\n" +
"\t@Separator((char)';')\n" +
"\t ^^^^^^^^^\n" +
"Groovy:Expected '(char) ;' to be an inline constant of type char in @Separator\n" +
"----------\n" +
"2. ERROR in Main.groovy (at line 2)\n" +
"\t@Separator((char)';')\n" +
"\t ^^^^^^^^^\n" +
"Groovy:Attribute 'value' should have type 'java.lang.Character'; but found type 'java.lang.Object' in @Separator\n" +
"----------\n");
}
}
Expand Down Expand Up @@ -2631,7 +2636,7 @@ public void testAnnotationsTargetType13() {
"p/Main.groovy",
"package p;\n" +
"public class Main {\n" +
" void m(@Anno(\"x\") String s) {}\n" +
" void m(@Anno('x') String s) {}\n" +
" static main(args) {\n" +
" print getMethod('m', String).annotatedParameterTypes[0].annotations[0].value()\n" +
" }\n" +
Expand All @@ -2652,7 +2657,7 @@ public void testAnnotationsTargetType13() {
runNegativeTest(sources,
"----------\n" +
"1. ERROR in p\\Main.groovy (at line 3)\n" +
"\tvoid m(@Anno(\"x\") String s) {}\n" +
"\tvoid m(@Anno('x') String s) {}\n" +
"\t ^^^^^\n" +
"Groovy:Annotation @p.Anno is not allowed on element PARAMETER\n" +
"----------\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public void testParsingRecovery_IncompleteAnnotation10() {
//@formatter:off
String[] sources = {
"X.groovy",
"@A(foo=\"1\",)\n" +
"@A(foo='1',)\n" +
"class X {\n" +
"}\n",

Expand All @@ -387,7 +387,7 @@ public void testParsingRecovery_IncompleteAnnotation10() {
runNegativeTest(sources,
"----------\n" +
"1. ERROR in X.groovy (at line 1)\n" +
"\t@A(foo=\"1\",)\n" +
"\t@A(foo='1',)\n" +
"\t^^\n" +
"Groovy:No explicit/default value found for annotation attribute 'bar' in @A\n" +
"----------\n");
Expand All @@ -404,7 +404,7 @@ public void testParsingRecovery_IncompleteAnnotation11() {
//@formatter:off
String[] sources = {
"X.groovy",
"@A(foo=[\"1\",\"2\"],)\n" +
"@A(foo=['1','2'],)\n" +
"class X {\n" +
"}\n",

Expand All @@ -419,7 +419,7 @@ public void testParsingRecovery_IncompleteAnnotation11() {
runNegativeTest(sources,
"----------\n" +
"1. ERROR in X.groovy (at line 1)\n" +
"\t@A(foo=[\"1\",\"2\"],)\n" +
"\t@A(foo=['1','2'],)\n" +
"\t^^\n" +
"Groovy:No explicit/default value found for annotation attribute 'bar' in @A\n" +
"----------\n");
Expand All @@ -436,7 +436,7 @@ public void testParsingRecovery_IncompleteAnnotation12() {
//@formatter:off
String[] sources = {
"X.groovy",
"@A(foo=\"1\", b)\n" +
"@A(foo='1', b)\n" +
"class X {\n" +
"}\n",

Expand All @@ -454,7 +454,7 @@ public void testParsingRecovery_IncompleteAnnotation12() {
"The attribute b is undefined for the annotation type A\n" +
"----------\n" +
"2. ERROR in X.groovy (at line 1)\n" +
"\t@A(foo=\"1\", b)\n" +
"\t@A(foo='1', b)\n" +
"\t^^\n" +
"Groovy:No explicit/default value found for annotation attribute 'bar' in @A\n" +
"----------\n");
Expand All @@ -471,7 +471,7 @@ public void testParsingRecovery_IncompleteAnnotation13() {
//@formatter:off
String[] sources = {
"X.groovy",
"@A(foo=\"1\", bar=)\n" +
"@A(foo='1', bar=)\n" +
"class X {\n" +
"}\n",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected String[] getDefaultClassPaths() {
String[] cps = super.getDefaultClassPaths();
String[] newcps = Arrays.copyOf(cps, cps.length + 2);

String[] groovyVersions = {"4.0.5", "3.0.13-indy", "2.5.18-indy"};
String[] groovyVersions = {"4.0.5", "3.0.13-indy", "2.5.19-indy"};
String[] ivyVersions = {"2.5.0", "2.4.0"};
try {
URL groovyJar = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testNamedVariant2() {
"import groovy.transform.*\n" +
"\n" +
"@NamedVariant\n" +
"String m(@NamedDelegate Color color, @NamedParam(value=\"a\", required=true) int alpha) {\n" +
"String m(@NamedDelegate Color color, @NamedParam(value='a', required=true) int alpha) {\n" +
" return [color, alpha].join(' ')\n" +
"}\n" +
"\n" +
Expand All @@ -84,7 +84,7 @@ public void testNamedVariant3() {
"import groovy.transform.*\n" +
"\n" +
"@NamedVariant\n" +
"String m(@NamedDelegate Color color, @NamedParam(value=\"a\", type=Number) alpha) {\n" +
"String m(@NamedDelegate Color color, @NamedParam(value='a', type=Number) alpha) {\n" +
" return [color, alpha].join(' ')\n" +
"}\n" +
"print m(r:1, g:2, b:3, a: 0.0)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public void testTypeChecked19() {
//@formatter:off
String[] sources = {
"Main.groovy",
"def <T,U extends Configurable<T>> U configure(Class<U> type, @DelegatesTo(type=\"T\",strategy=Closure.DELEGATE_FIRST) Closure<?> spec) {\n" +
"def <T,U extends Configurable<T>> U configure(Class<U> type, @DelegatesTo(type='T',strategy=Closure.DELEGATE_FIRST) Closure<?> spec) {\n" +
" Configurable<T> obj = (Configurable<T>) type.newInstance()\n" +
" obj.configure(spec)\n" +
" obj\n" +
Expand Down Expand Up @@ -600,7 +600,7 @@ public void testTypeChecked25() {
"@groovy.transform.TupleConstructor(defaults=false)\n" +
"class Type<T,U> {\n" +
" final T value\n" +
" U map(@DelegatesTo(type=\"T\") Closure<U> producer) {\n" +
" U map(@DelegatesTo(type='T') Closure<U> producer) {\n" +
" producer.delegate = value\n" +
" producer()\n" +
" }\n" +
Expand Down Expand Up @@ -2107,8 +2107,8 @@ public void testTypeChecked8983d() {
"@groovy.transform.TypeChecked\n" +
"void test(Set<String> set) {\n" +
" def c = new C()\n" +
" c.x = m()" + (isAtLeastGroovy(40) ? "\n" : " as String[]\n") +
" c.x = set" + (isAtLeastGroovy(40) ? "\n" : " as String[]\n") +
" c.x = m()\n" +
" c.x = set\n" +
" print(c.list)\n" +
"}\n" +
"test(['bar'].toSet())\n",
Expand Down Expand Up @@ -3879,7 +3879,7 @@ public void testTypeChecked10027() {
"import groovy.transform.*\n" +
"int getAnswer() { return 42 }\n" +
"void m(@NamedParams([\n" +
" @NamedParam(value=\"n\", type=Number)\n" +
" @NamedParam(value='n', type=Number)\n" +
"]) Map<String,?> map) { print map.n }\n" +
"@TypeChecked\n" +
"void test() {\n" +
Expand Down Expand Up @@ -5983,6 +5983,58 @@ public void testTypeChecked10624() {
runConformTest(sources);
}

@Test
public void testTypeChecked10628() {
assumeTrue(isParrotParser());

//@formatter:off
String[] sources = {
"Main.groovy",
"class C {\n" +
" int getP() { print(4); return 0 }\n" +
" void setP(int p) { print(p) }\n" +
" @groovy.transform.TypeChecked\n" +
" void test() {\n" +
" this.p ?= 1\n" +
" }\n" +
"}\n" +
"@groovy.transform.TypeChecked\n" +
"void test() {\n" +
" def c = new C()\n" +
" c.p ?= 2\n" + // visited as "c.p = c.p ?: 2"; RHS is Ternary not Binary
"}\n" +
"test()\n",
};
//@formatter:on

runConformTest(sources, "42");
}

@Test
public void testTypeChecked10628a() {
//@formatter:off
String[] sources = {
"Main.groovy",
"class C {\n" +
" int getP() { print(4); return 0 }\n" +
" void setP(int p) { print(p) }\n" +
" @groovy.transform.TypeChecked\n" +
" void test() {\n" +
" this.p += 1\n" +
" }\n" +
"}\n" +
"@groovy.transform.TypeChecked\n" +
"void test() {\n" +
" def c = new C()\n" +
" c.p += 2\n" + // visited as "c.p = c.p + 42"
"}\n" +
"test()\n",
};
//@formatter:on

runConformTest(sources, "42");
}

@Test
public void testTypeChecked10633() {
//@formatter:off
Expand Down Expand Up @@ -6432,4 +6484,72 @@ public void testTypeChecked10749() {
runConformTest(sources);
}
}

@Test
public void testTypeChecked10756() {
//@formatter:off
String[] sources = {
"Main.groovy",
"import org.codehaus.groovy.ast.expr.*\n" +
"new Expression() {\n" +
" Expression transformExpression(ExpressionTransformer transformer) {\n" +
" }\n" +
" @groovy.transform.TypeChecked\n" +
" void whatever() {\n" +
" def expr = transformExpressions([], null, null)[0]\n" +
" expr.text\n" +
" }\n" +
"}\n",
};
//@formatter:on

runConformTest(sources);
}

@Test
public void testTypeChecked10765() {
//@formatter:off
String[] sources = {
"Main.groovy",
"import java.util.function.BiFunction\n" +
"def <X, Y, Z> Map<X, Z> transform(Map<X, Y> map, BiFunction<? super X, ? super Y, Z> transformer) {\n" +
" map.collectEntries { k, v -> [k, transformer.apply(k, v)] }\n" +
"}\n" +
"@groovy.transform.TypeChecked\n" +
"void test(Map<String, ? extends Object> input) {\n" +
" Map<String, Integer> hashes = transform(input) { k, v -> v.hashCode() }\n" +
"}\n" +
"test([:])\n",
};
//@formatter:on

runConformTest(sources);
}

@Test
public void testTypeChecked10767() {
//@formatter:off
String[] sources = {
"Main.groovy",
"trait A {\n" +
" void methodA() {\n" +
" }\n" +
"}\n" +
"@groovy.transform.TypeChecked\n" +
"@groovy.transform.SelfType(C)\n" +
"trait B implements A {\n" +
" void methodB() {\n" +
" methodA()\n" + // Cannot find matching method <UnionType:C+B>#methodA()
" }\n" +
"}\n" +
"class C {\n" +
" void methodC() {\n" +
" }\n" +
"}\n" +
"42\n",
};
//@formatter:on

runConformTest(sources);
}
}
5 changes: 1 addition & 4 deletions base/org.codehaus.groovy25/.checkstyle
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@
<file-match-pattern match-pattern="groovy/ast/Parameter.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/expr/ClassExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/expr/ConstantExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/expr/DeclarationExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/expr/EmptyExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/expr/(Static)?MethodCallExpression.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/tools/(Expression|General|Generics)Utils.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/tools/WideningCategories.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/AnnotationVisitor.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/AsmClassGenerator.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/EnumVisitor.java" include-pattern="false" />
Expand All @@ -60,15 +58,14 @@
<file-match-pattern match-pattern="groovy/transform/CategoryASTTransformation.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/FieldASTTransformation.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/LogASTTransformation.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/sc/transformers/(Binary|MethodCall)ExpressionTransformer.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/sc/transformers/(Binary|MethodCall|Variable)ExpressionTransformer.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/sc/transformers/StaticCompilationTransformer.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/stc/StaticTypeCheckingSupport.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/stc/StaticTypeCheckingVisitor.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/trait/SuperCallTraitTransformer.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/trait/TraitASTTransformation.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/trait/TraitComposer.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/trait/Traits.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/vmplugin/v5/Java5.java" include-pattern="false" />
</fileset>
<filter name="DerivedFiles" enabled="true" />
</fileset-config>
8 changes: 4 additions & 4 deletions base/org.codehaus.groovy25/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy25/lib/ivy-2.5.0-javadoc.jar!/" />
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/groovy-2.5.18-indy.jar" sourcepath="lib/groovy-2.5.18-sources.jar" exported="true">
<classpathentry kind="lib" path="lib/groovy-2.5.19-indy.jar" sourcepath="lib/groovy-2.5.19-sources.jar" exported="true">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy25/lib/groovy-2.5.18-javadoc.jar!/" />
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy25/lib/groovy-2.5.19-javadoc.jar!/" />
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/groovy-test-2.5.18-indy.jar" sourcepath="lib/groovy-test-2.5.18-sources.jar" exported="true">
<classpathentry kind="lib" path="lib/groovy-test-2.5.19-indy.jar" sourcepath="lib/groovy-test-2.5.19-sources.jar" exported="true">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy25/lib/groovy-test-2.5.18-javadoc.jar!/" />
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy25/lib/groovy-test-2.5.19-javadoc.jar!/" />
</attributes>
</classpathentry>

Expand Down
Loading

0 comments on commit 3e82b48

Please sign in to comment.