Skip to content

Commit

Permalink
refactor resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Jan 21, 2022
1 parent 62fedca commit 70b828e
Show file tree
Hide file tree
Showing 17 changed files with 396 additions and 290 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,8 @@ public void testGreclipse719() {
"----------\n" +
"1. ERROR in Script.groovy (at line 2)\n" +
"\tMethod[] methodArray = anInt.class.methods\n" +
"\t^^^^^^^^\n" +
"Groovy:unable to resolve class Method[]\n" +
"\t^^^^^^\n" +
"Groovy:unable to resolve class Method\n" +
"----------\n");
}

Expand All @@ -756,8 +756,8 @@ public void testGreclipse719_2() {
"----------\n" +
"1. ERROR in Script.groovy (at line 2)\n" +
"\tMethod[][] methodMethodArray = anInt.class.methods\n" +
"\t^^^^^^^^^^\n" +
"Groovy:unable to resolve class Method[][]\n" +
"\t^^^^^^\n" +
"Groovy:unable to resolve class Method\n" +
"----------\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@ public void testInnerTypeReferencing7() {
runConformTest(sources);
}

@Test // resolved through default imports
public void testInnerTypeReferencing8() {
//@formatter:off
String[] sources = {
"Script.groovy",
"Map.Entry e\n",
};
//@formatter:on

runConformTest(sources);
}

@Test
public void testInnerClass1() {
//@formatter:off
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2021 the original author or authors.
* Copyright 2009-2022 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.
Expand Down Expand Up @@ -35,7 +35,7 @@ public void testGrab() {
"}\n",

"Test.groovy",
"@Grab('joda-time:joda-time:2.10.10')\n" +
"@Grab('joda-time:joda-time:2.10.10;transitive=false')\n" +
"import org.joda.time.DateTime\n" +
"void printDate() {\n" +
" def now = new DateTime()\n" +
Expand All @@ -49,10 +49,10 @@ public void testGrab() {

/**
* This program has a broken grab. Without changes we get a 'general error'
* recorded on the first line of the source file (big juicy exception).
* General error during conversion: Error grabbing Grapes -- [unresolved dependency: org.aspectj#aspectjweaver;1.x: not found]
* recorded on the first line of the source file:
* <tt>General error during conversion: Error grabbing Grapes -- [unresolved dependency: org.aspectj#aspectjweaver;1.x: not found]</tt>
* <p>
* With grab improvements we get two errors - the missing dependency and the missing type (which is at the right version of that dependency!)
* With grab improvements we get two errors: the missing dependency and the missing type (which is at the right version of that dependency!)
*/
@Test // GRECLIPSE-1669
public void testGrabError() {
Expand All @@ -67,7 +67,7 @@ public void testGrabError() {

"Test.groovy",
"@Grapes([\n" +
" @Grab(group='joda-time', module='joda-time', version='2.10.10'),\n" +
" @Grab('joda-time:joda-time:2.10.10;transitive=false'),\n" +
" @Grab(group='org.aspectj', module='aspectjweaver', version='1.x')\n" +
"])\n" +
"class Test {\n" +
Expand Down Expand Up @@ -107,7 +107,7 @@ public void testGrabConfig() {

"Test.groovy",
"@GrabConfig(systemClassLoader=true)\n" +
"@Grab(group='mysql', module='mysql-connector-java', version='5.1.15')\n" +
"@Grab(group='mysql', module='mysql-connector-java', version='5.1.15', transitive=false)\n" +
"class Test {\n" +
"}\n",
};
Expand All @@ -129,7 +129,7 @@ public void testGrabResolver() {

"Test.groovy",
"@GrabResolver(name='restlet', root='https://maven.restlet.talend.com')\n" +
"@Grab(group='org.restlet.jse', module='org.restlet', version='2.4.3')\n" +
"@Grab(group='org.restlet.jse', module='org.restlet', version='2.4.3', transitive=false)\n" +
"import org.restlet.Restlet\n",
};
//@formatter:on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void setFieldNameExpr(Expression fieldNameExpr) {
}

public void setType(ClassNode type) {
this.type = type;
this.type = java.util.Objects.requireNonNull(type);
}

public String toString() {
Expand Down
Loading

0 comments on commit 70b828e

Please sign in to comment.