Skip to content

Commit 94bf735

Browse files
committed
GROOVY-5692, GROOVY-10006
1 parent d6c6b54 commit 94bf735

File tree

10 files changed

+2382
-3
lines changed

10 files changed

+2382
-3
lines changed

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

+44
Original file line numberDiff line numberDiff line change
@@ -2012,6 +2012,50 @@ public void testTypeChecked9998b() {
20122012
runConformTest(sources, "null");
20132013
}
20142014

2015+
@Test
2016+
public void testTypeChecked10006() {
2017+
//@formatter:off
2018+
String[] sources = {
2019+
"Main.groovy",
2020+
"def <T> void a(T one, T two) { }\n" +
2021+
"def <T> void b(T one, List<T> many) { }\n" +
2022+
"def <T> void c(T one, T two, T three) { }\n" +
2023+
"def <T extends Number> void d(T one, T two) { }\n" +
2024+
"@groovy.transform.TypeChecked\n" +
2025+
"void test() {\n" +
2026+
" a(1,'II')\n" +
2027+
" b(1,['II','III'])\n" +
2028+
" c(1,'II',Class)\n" +
2029+
" d(1L,2G)\n" +
2030+
"}\n",
2031+
};
2032+
//@formatter:on
2033+
2034+
runConformTest(sources, "");
2035+
}
2036+
2037+
@Test
2038+
public void testTypeChecked10006a() {
2039+
//@formatter:off
2040+
String[] sources = {
2041+
"Main.groovy",
2042+
"def <T extends Number> void d(T one, T two) { }\n" +
2043+
"@groovy.transform.TypeChecked\n" +
2044+
"void test() {\n" +
2045+
" d(1,'II')\n" +
2046+
"}\n",
2047+
};
2048+
//@formatter:on
2049+
2050+
runNegativeTest(sources,
2051+
"----------\n" +
2052+
"1. ERROR in Main.groovy (at line 4)\n" +
2053+
"\td(1,'II')\n" +
2054+
"\t^^^^^^^^^\n" +
2055+
"Groovy:[Static type checking] - Cannot find matching method Main#d(int, java.lang.String). Please check if the declared type is correct and if the method exists.\n" +
2056+
"----------\n");
2057+
}
2058+
20152059
@Test
20162060
public void testTypeChecked10010() {
20172061
//@formatter:off

base/org.codehaus.groovy25/.checkstyle

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@
3434
<file-match-pattern match-pattern="groovy/ast/expr/EmptyExpression.java" include-pattern="false" />
3535
<file-match-pattern match-pattern="groovy/ast/expr/FieldExpression.java" include-pattern="false" />
3636
<file-match-pattern match-pattern="groovy/ast/expr/(Static)?MethodCallExpression.java" include-pattern="false" />
37-
<file-match-pattern match-pattern="groovy/ast/tools/ExpressionUtils.java" include-pattern="false" />
38-
<file-match-pattern match-pattern="groovy/ast/tools/GeneralUtils.java" include-pattern="false" />
39-
<file-match-pattern match-pattern="groovy/ast/tools/GenericsUtils.java" include-pattern="false" />
37+
<file-match-pattern match-pattern="groovy/ast/tools/(Expression|General|Generics)Utils.java" include-pattern="false" />
38+
<file-match-pattern match-pattern="groovy/ast/tools/WideningCategories.java" include-pattern="false" />
4039
<file-match-pattern match-pattern="groovy/classgen/AnnotationVisitor.java" include-pattern="false" />
4140
<file-match-pattern match-pattern="groovy/classgen/AsmClassGenerator.java" include-pattern="false" />
4241
<file-match-pattern match-pattern="groovy/classgen/Enum(Completion)?Visitor.java" include-pattern="false" />

0 commit comments

Comments
 (0)