diff --git a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovyCompilerTestSuite.java b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovyCompilerTestSuite.java
index 64371b8280..a4a4683c04 100644
--- a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovyCompilerTestSuite.java
+++ b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovyCompilerTestSuite.java
@@ -127,7 +127,7 @@ protected String[] getDefaultClassPaths() {
System.arraycopy(cps, 0, newcps, 0, cps.length);
String[] ivyVersions = {"2.5.0", "2.4.0"};
- String[] groovyVersions = {"3.0.0-indy", "2.5.8-indy", "2.4.18"};
+ String[] groovyVersions = {"3.0.0-indy", "2.5.9-indy", "2.4.18"};
try {
URL groovyJar = null;
for (String groovyVer : groovyVersions) {
diff --git a/base/org.codehaus.groovy24/src/org/codehaus/groovy/vmplugin/v5/Java5.java b/base/org.codehaus.groovy24/src/org/codehaus/groovy/vmplugin/v5/Java5.java
index b7b1e5c5fa..f8ab1f5469 100644
--- a/base/org.codehaus.groovy24/src/org/codehaus/groovy/vmplugin/v5/Java5.java
+++ b/base/org.codehaus.groovy24/src/org/codehaus/groovy/vmplugin/v5/Java5.java
@@ -419,7 +419,10 @@ public void configureClassNode(CompileUnit compileUnit, ClassNode classNode) {
for (Constructor ctor : constructors) {
Parameter[] params = makeParameters(compileUnit, ctor.getGenericParameterTypes(), ctor.getParameterTypes(), getConstructorParameterAnnotations(ctor), ctor);
ClassNode[] exceptions = makeClassNodes(compileUnit, ctor.getGenericExceptionTypes(), ctor.getExceptionTypes());
- classNode.addConstructor(ctor.getModifiers(), params, exceptions, null);
+ // GRECLIPSE add
+ setAnnotationMetaData(ctor.getAnnotations(),
+ // GRECLIPSE end
+ classNode.addConstructor(ctor.getModifiers(), params, exceptions, null));
}
Class sc = clazz.getSuperclass();
diff --git a/base/org.codehaus.groovy25/.checkstyle b/base/org.codehaus.groovy25/.checkstyle
index 226e7b4fb7..534bb72542 100644
--- a/base/org.codehaus.groovy25/.checkstyle
+++ b/base/org.codehaus.groovy25/.checkstyle
@@ -43,7 +43,6 @@
-
diff --git a/base/org.codehaus.groovy25/.classpath b/base/org.codehaus.groovy25/.classpath
index 0ef0283ea3..791d690de1 100644
--- a/base/org.codehaus.groovy25/.classpath
+++ b/base/org.codehaus.groovy25/.classpath
@@ -9,14 +9,14 @@
-
+
-
+
-
+
-
+
diff --git a/base/org.codehaus.groovy25/META-INF/MANIFEST.MF b/base/org.codehaus.groovy25/META-INF/MANIFEST.MF
index 455429c72e..d99b2de688 100644
--- a/base/org.codehaus.groovy25/META-INF/MANIFEST.MF
+++ b/base/org.codehaus.groovy25/META-INF/MANIFEST.MF
@@ -4,98 +4,98 @@ Bundle-SymbolicName: org.codehaus.groovy
Automatic-Module-Name: org.codehaus.groovy
Bundle-Name: Apache Groovy
Bundle-Vendor: Pivotal Software, Inc.
-Bundle-Version: 2.5.8.qualifier
+Bundle-Version: 2.5.9.qualifier
Bundle-ClassPath: eclipse-trace.jar,
groovy-eclipse.jar,
lib/ivy-2.4.0.jar,
- lib/groovy-2.5.8-indy.jar,
- lib/groovy-test-2.5.8-indy.jar
-Export-Package: groovy.beans;version="2.5.8",
- groovy.cli;version="2.5.8",
- groovy.grape;version="2.5.8",
- groovy.inspect;version="2.5.8",
- groovy.io;version="2.5.8",
- groovy.lang;version="2.5.8",
- groovy.mock.interceptor;version="2.5.8",
- groovy.security;version="2.5.8",
- groovy.test;version="2.5.8",
- groovy.time;version="2.5.8",
- groovy.transform;version="2.5.8",
- groovy.transform.builder;version="2.5.8",
- groovy.transform.options;version="2.5.8",
- groovy.transform.stc;version="2.5.8",
- groovy.ui;version="2.5.8",
- groovy.util;version="2.5.8",
- groovy.util.logging;version="2.5.8",
- groovy.xml;version="2.5.8",
+ lib/groovy-2.5.9-indy.jar,
+ lib/groovy-test-2.5.9-indy.jar
+Export-Package: groovy.beans;version="2.5.9",
+ groovy.cli;version="2.5.9",
+ groovy.grape;version="2.5.9",
+ groovy.inspect;version="2.5.9",
+ groovy.io;version="2.5.9",
+ groovy.lang;version="2.5.9",
+ groovy.mock.interceptor;version="2.5.9",
+ groovy.security;version="2.5.9",
+ groovy.test;version="2.5.9",
+ groovy.time;version="2.5.9",
+ groovy.transform;version="2.5.9",
+ groovy.transform.builder;version="2.5.9",
+ groovy.transform.options;version="2.5.9",
+ groovy.transform.stc;version="2.5.9",
+ groovy.ui;version="2.5.9",
+ groovy.util;version="2.5.9",
+ groovy.util.logging;version="2.5.9",
+ groovy.xml;version="2.5.9",
groovyjarjarantlr;x-friends:="org.codehaus.groovy.eclipse.refactoring",
- org.apache.groovy.ast.tools;version="2.5.8",
+ org.apache.groovy.ast.tools;version="2.5.9",
org.apache.groovy.internal.metaclass;x-internal:=true,
org.apache.groovy.internal.util;x-internal:=true,
- org.apache.groovy.io;version="2.5.8",
- org.apache.groovy.lang.annotation;version="2.5.8",
- org.apache.groovy.metaclass;version="2.5.8",
- org.apache.groovy.plugin;version="2.5.8",
- org.apache.groovy.util;version="2.5.8",
- org.apache.groovy.util.concurrentlinkedhashmap;version="2.5.8",
- org.codehaus.groovy;version="2.5.8",
- org.codehaus.groovy.antlr;version="2.5.8",
- org.codehaus.groovy.antlr.java;version="2.5.8",
- org.codehaus.groovy.antlr.parser;version="2.5.8",
- org.codehaus.groovy.antlr.treewalker;version="2.5.8",
- org.codehaus.groovy.ast;version="2.5.8",
- org.codehaus.groovy.ast.builder;version="2.5.8",
- org.codehaus.groovy.ast.decompiled;version="2.5.8",
- org.codehaus.groovy.ast.expr;version="2.5.8",
- org.codehaus.groovy.ast.stmt;version="2.5.8",
- org.codehaus.groovy.ast.tools;version="2.5.8",
- org.codehaus.groovy.classgen;version="2.5.8",
- org.codehaus.groovy.classgen.asm;version="2.5.8",
- org.codehaus.groovy.classgen.asm.indy;version="2.5.8",
- org.codehaus.groovy.classgen.asm.indy.sc;version="2.5.8",
- org.codehaus.groovy.classgen.asm.sc;version="2.5.8",
- org.codehaus.groovy.classgen.asm.util;version="2.5.8",
- org.codehaus.groovy.control;version="2.5.8",
- org.codehaus.groovy.control.customizers;version="2.5.8",
- org.codehaus.groovy.control.customizers.builder;version="2.5.8",
- org.codehaus.groovy.control.io;version="2.5.8",
- org.codehaus.groovy.control.messages;version="2.5.8",
+ org.apache.groovy.io;version="2.5.9",
+ org.apache.groovy.lang.annotation;version="2.5.9",
+ org.apache.groovy.metaclass;version="2.5.9",
+ org.apache.groovy.plugin;version="2.5.9",
+ org.apache.groovy.util;version="2.5.9",
+ org.apache.groovy.util.concurrentlinkedhashmap;version="2.5.9",
+ org.codehaus.groovy;version="2.5.9",
+ org.codehaus.groovy.antlr;version="2.5.9",
+ org.codehaus.groovy.antlr.java;version="2.5.9",
+ org.codehaus.groovy.antlr.parser;version="2.5.9",
+ org.codehaus.groovy.antlr.treewalker;version="2.5.9",
+ org.codehaus.groovy.ast;version="2.5.9",
+ org.codehaus.groovy.ast.builder;version="2.5.9",
+ org.codehaus.groovy.ast.decompiled;version="2.5.9",
+ org.codehaus.groovy.ast.expr;version="2.5.9",
+ org.codehaus.groovy.ast.stmt;version="2.5.9",
+ org.codehaus.groovy.ast.tools;version="2.5.9",
+ org.codehaus.groovy.classgen;version="2.5.9",
+ org.codehaus.groovy.classgen.asm;version="2.5.9",
+ org.codehaus.groovy.classgen.asm.indy;version="2.5.9",
+ org.codehaus.groovy.classgen.asm.indy.sc;version="2.5.9",
+ org.codehaus.groovy.classgen.asm.sc;version="2.5.9",
+ org.codehaus.groovy.classgen.asm.util;version="2.5.9",
+ org.codehaus.groovy.control;version="2.5.9",
+ org.codehaus.groovy.control.customizers;version="2.5.9",
+ org.codehaus.groovy.control.customizers.builder;version="2.5.9",
+ org.codehaus.groovy.control.io;version="2.5.9",
+ org.codehaus.groovy.control.messages;version="2.5.9",
org.codehaus.groovy.eclipse,
- org.codehaus.groovy.plugin;version="2.5.8",
- org.codehaus.groovy.reflection;version="2.5.8",
- org.codehaus.groovy.reflection.android;version="2.5.8",
- org.codehaus.groovy.reflection.stdclasses;version="2.5.8",
- org.codehaus.groovy.reflection.v7;version="2.5.8",
- org.codehaus.groovy.runtime;version="2.5.8",
- org.codehaus.groovy.runtime.callsite;version="2.5.8",
- org.codehaus.groovy.runtime.dgmimpl;version="2.5.8",
- org.codehaus.groovy.runtime.dgmimpl.arrays;version="2.5.8",
- org.codehaus.groovy.runtime.m12n;version="2.5.8",
- org.codehaus.groovy.runtime.memoize;version="2.5.8",
- org.codehaus.groovy.runtime.metaclass;version="2.5.8",
- org.codehaus.groovy.runtime.powerassert;version="2.5.8",
- org.codehaus.groovy.runtime.typehandling;version="2.5.8",
- org.codehaus.groovy.runtime.wrappers;version="2.5.8",
- org.codehaus.groovy.syntax;version="2.5.8",
- org.codehaus.groovy.tools;version="2.5.8",
- org.codehaus.groovy.tools.ast;version="2.5.8",
- org.codehaus.groovy.tools.gse;version="2.5.8",
- org.codehaus.groovy.tools.javac;version="2.5.8",
- org.codehaus.groovy.tools.shell;version="2.5.8",
- org.codehaus.groovy.tools.shell.util;version="2.5.8",
- org.codehaus.groovy.transform;version="2.5.8",
- org.codehaus.groovy.transform.sc;version="2.5.8",
- org.codehaus.groovy.transform.sc.transformers;version="2.5.8",
- org.codehaus.groovy.transform.stc;version="2.5.8",
- org.codehaus.groovy.transform.tailrec;version="2.5.8",
- org.codehaus.groovy.transform.trait;version="2.5.8",
- org.codehaus.groovy.util;version="2.5.8",
- org.codehaus.groovy.vmplugin;version="2.5.8",
- org.codehaus.groovy.vmplugin.v5;version="2.5.8",
- org.codehaus.groovy.vmplugin.v6;version="2.5.8",
- org.codehaus.groovy.vmplugin.v7;version="2.5.8",
- org.codehaus.groovy.vmplugin.v8;version="2.5.8",
- org.codehaus.groovy.vmplugin.v9;version="2.5.8"
+ org.codehaus.groovy.plugin;version="2.5.9",
+ org.codehaus.groovy.reflection;version="2.5.9",
+ org.codehaus.groovy.reflection.android;version="2.5.9",
+ org.codehaus.groovy.reflection.stdclasses;version="2.5.9",
+ org.codehaus.groovy.reflection.v7;version="2.5.9",
+ org.codehaus.groovy.runtime;version="2.5.9",
+ org.codehaus.groovy.runtime.callsite;version="2.5.9",
+ org.codehaus.groovy.runtime.dgmimpl;version="2.5.9",
+ org.codehaus.groovy.runtime.dgmimpl.arrays;version="2.5.9",
+ org.codehaus.groovy.runtime.m12n;version="2.5.9",
+ org.codehaus.groovy.runtime.memoize;version="2.5.9",
+ org.codehaus.groovy.runtime.metaclass;version="2.5.9",
+ org.codehaus.groovy.runtime.powerassert;version="2.5.9",
+ org.codehaus.groovy.runtime.typehandling;version="2.5.9",
+ org.codehaus.groovy.runtime.wrappers;version="2.5.9",
+ org.codehaus.groovy.syntax;version="2.5.9",
+ org.codehaus.groovy.tools;version="2.5.9",
+ org.codehaus.groovy.tools.ast;version="2.5.9",
+ org.codehaus.groovy.tools.gse;version="2.5.9",
+ org.codehaus.groovy.tools.javac;version="2.5.9",
+ org.codehaus.groovy.tools.shell;version="2.5.9",
+ org.codehaus.groovy.tools.shell.util;version="2.5.9",
+ org.codehaus.groovy.transform;version="2.5.9",
+ org.codehaus.groovy.transform.sc;version="2.5.9",
+ org.codehaus.groovy.transform.sc.transformers;version="2.5.9",
+ org.codehaus.groovy.transform.stc;version="2.5.9",
+ org.codehaus.groovy.transform.tailrec;version="2.5.9",
+ org.codehaus.groovy.transform.trait;version="2.5.9",
+ org.codehaus.groovy.util;version="2.5.9",
+ org.codehaus.groovy.vmplugin;version="2.5.9",
+ org.codehaus.groovy.vmplugin.v5;version="2.5.9",
+ org.codehaus.groovy.vmplugin.v6;version="2.5.9",
+ org.codehaus.groovy.vmplugin.v7;version="2.5.9",
+ org.codehaus.groovy.vmplugin.v8;version="2.5.9",
+ org.codehaus.groovy.vmplugin.v9;version="2.5.9"
Require-Bundle: org.eclipse.core.runtime,
org.apache.ant;resolution:=optional,
org.junit;resolution:=optional
diff --git a/base/org.codehaus.groovy25/VERSION b/base/org.codehaus.groovy25/VERSION
index 473b405672..65b38935a5 100644
--- a/base/org.codehaus.groovy25/VERSION
+++ b/base/org.codehaus.groovy25/VERSION
@@ -14,3 +14,4 @@
2019-02-04: GROOVY_2_5_6
2019-05-10: GROOVY_2_5_7
2019-08-07: GROOVY_2_5_8
+2020-01-14: GROOVY_2_5_9
diff --git a/base/org.codehaus.groovy25/about.html b/base/org.codehaus.groovy25/about.html
index 8fdb9306df..b085e355b8 100644
--- a/base/org.codehaus.groovy25/about.html
+++ b/base/org.codehaus.groovy25/about.html
@@ -24,12 +24,12 @@ License
Third Party Content
-groovy-2.5.8-indy.jar
-groovy-test-2.5.8-indy.jar
+groovy-2.5.9-indy.jar
+groovy-test-2.5.9-indy.jar
-- Obtained from: https://dist.apache.org/repos/dist/dev/groovy/2.5.8/distribution/apache-groovy-binary-2.5.8.zip
-- Sources available at: https://dist.apache.org/repos/dist/dev/groovy/2.5.8/sources/apache-groovy-src-2.5.8.zip
+- Obtained from: https://dist.apache.org/repos/dist/dev/groovy/2.5.9/distribution/apache-groovy-binary-2.5.9.zip
+- Sources available at: https://dist.apache.org/repos/dist/dev/groovy/2.5.9/sources/apache-groovy-src-2.5.9.zip
- License kind: ASL
- License URL: https://www.apache.org/licenses/LICENSE-2.0.html
- License text: asl-v20.txt
diff --git a/base/org.codehaus.groovy25/build.antlr2x b/base/org.codehaus.groovy25/build.antlr2x
index 1ab50e0119..152a18aad4 100644
--- a/base/org.codehaus.groovy25/build.antlr2x
+++ b/base/org.codehaus.groovy25/build.antlr2x
@@ -1,7 +1,7 @@
-
+
diff --git a/base/org.codehaus.groovy25/lib/groovy-2.5.8-javadoc.jar b/base/org.codehaus.groovy25/lib/groovy-2.5.8-javadoc.jar
deleted file mode 100644
index 12fc86c201..0000000000
Binary files a/base/org.codehaus.groovy25/lib/groovy-2.5.8-javadoc.jar and /dev/null differ
diff --git a/base/org.codehaus.groovy25/lib/groovy-2.5.8-indy.jar b/base/org.codehaus.groovy25/lib/groovy-2.5.9-indy.jar
similarity index 77%
rename from base/org.codehaus.groovy25/lib/groovy-2.5.8-indy.jar
rename to base/org.codehaus.groovy25/lib/groovy-2.5.9-indy.jar
index 16c724e907..ff5e5b2df2 100644
Binary files a/base/org.codehaus.groovy25/lib/groovy-2.5.8-indy.jar and b/base/org.codehaus.groovy25/lib/groovy-2.5.9-indy.jar differ
diff --git a/base/org.codehaus.groovy25/lib/groovy-2.5.9-javadoc.jar b/base/org.codehaus.groovy25/lib/groovy-2.5.9-javadoc.jar
new file mode 100644
index 0000000000..370d6b38bb
Binary files /dev/null and b/base/org.codehaus.groovy25/lib/groovy-2.5.9-javadoc.jar differ
diff --git a/base/org.codehaus.groovy25/lib/groovy-2.5.8-sources.jar b/base/org.codehaus.groovy25/lib/groovy-2.5.9-sources.jar
similarity index 76%
rename from base/org.codehaus.groovy25/lib/groovy-2.5.8-sources.jar
rename to base/org.codehaus.groovy25/lib/groovy-2.5.9-sources.jar
index 62e6863631..7c2bd37e60 100644
Binary files a/base/org.codehaus.groovy25/lib/groovy-2.5.8-sources.jar and b/base/org.codehaus.groovy25/lib/groovy-2.5.9-sources.jar differ
diff --git a/base/org.codehaus.groovy25/lib/groovy-test-2.5.8-indy.jar b/base/org.codehaus.groovy25/lib/groovy-test-2.5.8-indy.jar
deleted file mode 100644
index 4bac300a02..0000000000
Binary files a/base/org.codehaus.groovy25/lib/groovy-test-2.5.8-indy.jar and /dev/null differ
diff --git a/base/org.codehaus.groovy25/lib/groovy-test-2.5.9-indy.jar b/base/org.codehaus.groovy25/lib/groovy-test-2.5.9-indy.jar
new file mode 100644
index 0000000000..01fac7acdc
Binary files /dev/null and b/base/org.codehaus.groovy25/lib/groovy-test-2.5.9-indy.jar differ
diff --git a/base/org.codehaus.groovy25/lib/groovy-test-2.5.8-javadoc.jar b/base/org.codehaus.groovy25/lib/groovy-test-2.5.9-javadoc.jar
similarity index 65%
rename from base/org.codehaus.groovy25/lib/groovy-test-2.5.8-javadoc.jar
rename to base/org.codehaus.groovy25/lib/groovy-test-2.5.9-javadoc.jar
index 13573cb2a6..2b799a582b 100644
Binary files a/base/org.codehaus.groovy25/lib/groovy-test-2.5.8-javadoc.jar and b/base/org.codehaus.groovy25/lib/groovy-test-2.5.9-javadoc.jar differ
diff --git a/base/org.codehaus.groovy25/lib/groovy-test-2.5.8-sources.jar b/base/org.codehaus.groovy25/lib/groovy-test-2.5.9-sources.jar
similarity index 85%
rename from base/org.codehaus.groovy25/lib/groovy-test-2.5.8-sources.jar
rename to base/org.codehaus.groovy25/lib/groovy-test-2.5.9-sources.jar
index 60e3429249..75e4ec2be0 100644
Binary files a/base/org.codehaus.groovy25/lib/groovy-test-2.5.8-sources.jar and b/base/org.codehaus.groovy25/lib/groovy-test-2.5.9-sources.jar differ
diff --git a/base/org.codehaus.groovy25/pom.xml b/base/org.codehaus.groovy25/pom.xml
index 534fd7a8e4..ae847cc850 100644
--- a/base/org.codehaus.groovy25/pom.xml
+++ b/base/org.codehaus.groovy25/pom.xml
@@ -8,7 +8,7 @@
org.codehaus.groovy.eclipse
org.codehaus.groovy
- 2.5.8-SNAPSHOT
+ 2.5.9-SNAPSHOT
eclipse-plugin
diff --git a/base/org.codehaus.groovy25/src/groovy/grape/GrapeIvy.groovy b/base/org.codehaus.groovy25/src/groovy/grape/GrapeIvy.groovy
index c1a1332ba3..82e4961cae 100644
--- a/base/org.codehaus.groovy25/src/groovy/grape/GrapeIvy.groovy
+++ b/base/org.codehaus.groovy25/src/groovy/grape/GrapeIvy.groovy
@@ -23,8 +23,6 @@ import org.apache.groovy.plugin.GroovyRunner
import org.apache.groovy.plugin.GroovyRunnerRegistry
import org.apache.ivy.Ivy
import org.apache.ivy.core.IvyContext
-import org.apache.ivy.core.cache.ResolutionCacheManager
-import org.apache.ivy.core.event.IvyListener
import org.apache.ivy.core.event.download.PrepareDownloadEvent
import org.apache.ivy.core.event.resolve.StartResolveEvent
import org.apache.ivy.core.module.descriptor.Configuration
@@ -52,7 +50,6 @@ import org.codehaus.groovy.reflection.ReflectionUtils
import org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner
import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl
-import javax.xml.parsers.DocumentBuilderFactory
import java.util.jar.JarFile
import java.util.regex.Pattern
import java.util.zip.ZipEntry
@@ -97,6 +94,7 @@ class GrapeIvy implements GrapeEngine {
// start ivy
Message.defaultLogger = new DefaultMessageLogger(System.getProperty('ivy.message.logger.level', '-1') as int)
settings = new IvySettings()
+ settings.setVariable('user.home.url', new File(System.getProperty('user.home')).toURI().toURL() as String)
// configure settings
def grapeConfig = localGrapeConfig
@@ -107,9 +105,8 @@ class GrapeIvy implements GrapeEngine {
settings.load(grapeConfig) // exploit multi-methods for convenience
} catch (java.text.ParseException ex) {
def configLocation = grapeConfig instanceof File ? grapeConfig.canonicalPath : grapeConfig.toString()
- System.err.println "Local Ivy config file '$configLocation' appears corrupt - ignoring it and using default config instead\nError was: " + ex.message
- grapeConfig = GrapeIvy.getResource('defaultGrapeConfig.xml')
- settings.load(grapeConfig)
+ System.err.println "Local Ivy config file '$configLocation' appears corrupt - ignoring it and using default config instead\nError was: ${ex.message}"
+ settings.load(GrapeIvy.getResource('defaultGrapeConfig.xml'))
}
// set up the cache dirs
@@ -441,35 +438,22 @@ class GrapeIvy implements GrapeEngine {
}
ResolveReport getDependencies(Map args, IvyGrabRecord... grabRecords) {
- ResolutionCacheManager cacheManager = ivyInstance.resolutionCacheManager
-
+ def cacheManager = ivyInstance.resolutionCacheManager
def millis = System.currentTimeMillis()
- def md = new DefaultModuleDescriptor(ModuleRevisionId
- .newInstance('caller', 'all-caller', 'working' + millis.toString()[-2..-1]), 'integration', null, true)
+ def md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance('caller', 'all-caller', 'working' + millis.toString()[-2..-1]), 'integration', null, true)
md.addConfiguration(new Configuration('default'))
md.lastModified = millis
addExcludesIfNeeded(args, md)
for (IvyGrabRecord grabRecord : grabRecords) {
- def conf = grabRecord.conf ?: ['*']
+ def confs = grabRecord.conf ?: ['*']
DefaultDependencyDescriptor dd = (DefaultDependencyDescriptor) md.dependencies.find {
- it.dependencyRevisionId.equals(grabRecord.mrid)
+ it.dependencyRevisionId == grabRecord.mrid
}
- /* GRECLIPSE edit -- GROOVY-8372
- if (dd) {
- addDependencyArtifactDescriptor(dd, grabRecord, conf)
- } else {
- dd = new DefaultDependencyDescriptor(md, grabRecord.mrid, grabRecord.force,
- grabRecord.changing, grabRecord.transitive)
- conf.each { dd.addDependencyConfiguration('default', it) }
- addDependencyArtifactDescriptor(dd, grabRecord, conf)
- md.addDependency(dd)
- }
- */
if (!dd) {
dd = new DefaultDependencyDescriptor(md, grabRecord.mrid, grabRecord.force, grabRecord.changing, grabRecord.transitive)
- conf.each { dd.addDependencyConfiguration('default', it) }
+ confs.each { conf -> dd.addDependencyConfiguration('default', conf) }
md.addDependency(dd)
}
@@ -478,22 +462,21 @@ class GrapeIvy implements GrapeEngine {
|| (grabRecord.type != null && grabRecord.type != 'jar')) {
// add artifact descriptor to dependency descriptor
def dad = new DefaultDependencyArtifactDescriptor(dd, grabRecord.mrid.name, grabRecord.type ?: 'jar', grabRecord.ext ?: 'jar', null, grabRecord.classifier ? [classifier: grabRecord.classifier] : null)
- conf.each { dd.addDependencyArtifact(it, dad) }
+ confs.each { conf -> dd.addDependencyArtifact(conf, dad) }
}
- // GRECLIPSE end
}
// resolve grab and dependencies
- ResolveOptions resolveOptions = new ResolveOptions().tap {
- confs = DEF_CONFIG as String[]
- outputReport = false
- validate = (boolean) (args.containsKey('validate') ? args.validate : false)
- }
+ def resolveOptions = new ResolveOptions(
+ confs: DEF_CONFIG as String[],
+ outputReport: false,
+ validate: (boolean) (args.containsKey('validate') ? args.validate : false)
+ )
ivyInstance.settings.defaultResolver = args.autoDownload ? 'downloadGrapes' : 'cachedGrapes'
if (args.disableChecksums) {
ivyInstance.settings.setVariable('ivy.checksums', '')
}
- boolean reportDownloads = System.getProperty('groovy.grape.report.downloads', 'false') == 'true'
+ boolean reportDownloads = Boolean.getBoolean('groovy.grape.report.downloads')
if (reportDownloads) {
addIvyListener()
}
@@ -532,39 +515,27 @@ class GrapeIvy implements GrapeEngine {
}
private addIvyListener() {
- ivyInstance.eventManager.addIvyListener([progress: { ivyEvent ->
+ ivyInstance.eventManager.addIvyListener { ivyEvent ->
switch (ivyEvent) {
- case StartResolveEvent:
- ivyEvent.moduleDescriptor.dependencies.each { it ->
- def name = it.toString()
- if (!resolvedDependencies.contains(name)) {
- resolvedDependencies << name
- System.err.println "Resolving $name"
- }
+ case StartResolveEvent:
+ ivyEvent.moduleDescriptor.dependencies.each {
+ def name = it.toString()
+ if (!resolvedDependencies.contains(name)) {
+ resolvedDependencies << name
+ System.err.println "Resolving $name"
}
- break
- case PrepareDownloadEvent:
- ivyEvent.artifacts.each { it ->
- def name = it.toString()
- if (!downloadedArtifacts.contains(name)) {
- downloadedArtifacts << name
- System.err.println "Preparing to download artifact $name"
- }
+ }
+ break
+ case PrepareDownloadEvent:
+ ivyEvent.artifacts.each {
+ def name = it.toString()
+ if (!downloadedArtifacts.contains(name)) {
+ downloadedArtifacts << name
+ System.err.println "Preparing to download artifact $name"
}
- break
+ }
+ break
}
- }] as IvyListener)
- }
-
- @CompileStatic
- private void addDependencyArtifactDescriptor(DefaultDependencyDescriptor dd, IvyGrabRecord grabRecord, List conf) {
- // TODO: find out "unknown" reason and change comment below - also, confirm conf[0] check vs conf.contains('optional')
- if (conf[0] != 'optional' || grabRecord.classifier) {
- // for some unknown reason optional dependencies should not have an artifactDescriptor
- def dad = new DefaultDependencyArtifactDescriptor(dd,
- grabRecord.mrid.name, grabRecord.type ?: 'jar', grabRecord.ext ?: 'jar', null, grabRecord.classifier ? [classifier: grabRecord.classifier] : null)
- conf.each { dad.addConfiguration(it) }
- dd.addDependencyArtifact('default', dad)
}
}
@@ -579,8 +550,7 @@ class GrapeIvy implements GrapeEngine {
// TODO handle other types? e.g. 'dlls'
def jardir = new File(moduleDir, 'jars')
if (!jardir.exists()) return
- def dbf = DocumentBuilderFactory.newInstance()
- def db = dbf.newDocumentBuilder()
+ def db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder()
def root = db.parse(ivyFile).documentElement
def publis = root.getElementsByTagName('publications')
for (int i = 0; i < publis.length; i++) {
@@ -823,20 +793,16 @@ class IvyGrabRecord {
}
@Override
- boolean equals(Object obj) {
- if (null == obj || obj.class != IvyGrabRecord) {
- return false
+ boolean equals(Object that) {
+ if (that instanceof IvyGrabRecord) {
+ return ((this.mrid == that.mrid)
+ && (this.conf == that.conf)
+ && (this.changing == that.changing)
+ && (this.transitive == that.transitive)
+ && (this.force == that.force)
+ && (this.classifier == that.classifier)
+ && (this.ext == that.ext)
+ && (this.type == that.type))
}
-
- IvyGrabRecord o = (IvyGrabRecord) obj
-
- ((changing == o.changing)
- && (transitive == o.transitive)
- && (force == o.force)
- && (mrid == o.mrid)
- && (conf == o.conf)
- && (classifier == o.classifier)
- && (ext == o.ext)
- && (type == o.type))
}
}
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java
index 5da86d8c88..3ea99545a2 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java
@@ -18,7 +18,6 @@
*/
package org.codehaus.groovy.antlr;
-import groovy.transform.Trait;
import groovyjarjarantlr.RecognitionException;
import groovyjarjarantlr.TokenStreamException;
import groovyjarjarantlr.TokenStreamRecognitionException;
@@ -130,20 +129,21 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+import static org.codehaus.groovy.ast.tools.GeneralUtils.nullX;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last;
/**
- * A parser plugin which adapts the JSR Antlr Parser to the Groovy runtime
+ * A parser plugin which adapts the JSR Antlr Parser to the Groovy runtime.
*/
public class AntlrParserPlugin extends ASTHelper implements ParserPlugin, GroovyTokenTypes {
private static class AnonymousInnerClassCarrier extends Expression {
ClassNode innerClass;
+ @Override
public Expression transformExpression(ExpressionTransformer transformer) {
return null;
}
@@ -182,22 +182,18 @@ public void setLastLineNumber(final int lineNumber) {
protected AST ast;
private ClassNode classNode;
private MethodNode methodNode;
- // GRECLIPSE private->protected
protected String[] tokenNames;
- /* GRECLIPSE edit -- GROOVY-9203
- private int innerClassCounter = 1;
- */
- private boolean enumConstantBeingDef = false;
- private boolean forStatementBeingDef = false;
- private boolean annotationBeingDef = false;
- private boolean firstParamIsVarArg = false;
- private boolean firstParam = false;
+ private boolean enumConstantBeingDef;
+ private boolean forStatementBeingDef;
+ private boolean annotationBeingDef;
+ private boolean firstParamIsVarArg;
+ private boolean firstParam;
// GRECLIPSE add
protected LocationSupport locations = LocationSupport.NO_LOCATIONS;
// GRECLIPSE end
- public /*final*/ Reduction parseCST(final SourceUnit sourceUnit, Reader reader) throws CompilationFailedException {
- final SourceBuffer sourceBuffer = new SourceBuffer();
+ public Reduction parseCST(SourceUnit sourceUnit, Reader reader) throws CompilationFailedException {
+ SourceBuffer sourceBuffer = new SourceBuffer();
transformCSTIntoAST(sourceUnit, reader, sourceBuffer);
processAST();
return outputAST(sourceUnit, sourceBuffer);
@@ -208,8 +204,6 @@ protected void transformCSTIntoAST(SourceUnit sourceUnit, Reader reader, SourceB
setController(sourceUnit);
- // TODO find a way to inject any GroovyLexer/GroovyRecognizer
-
UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader(reader, sourceBuffer);
UnicodeLexerSharedInputState inputState = new UnicodeLexerSharedInputState(unicodeReader);
GroovyLexer lexer = new GroovyLexer(inputState);
@@ -237,11 +231,9 @@ protected void transformCSTIntoAST(SourceUnit sourceUnit, Reader reader, SourceB
catch (TokenStreamException e) {
sourceUnit.addException(e);
}
-
// GRECLIPSE add
configureLocationSupport(sourceBuffer);
// GRECLIPSE end
-
ast = parser.getAST();
}
@@ -257,23 +249,24 @@ protected void processAST() {
}
public Reduction outputAST(final SourceUnit sourceUnit, final SourceBuffer sourceBuffer) {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ return AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
+ public Reduction run() {
outputASTInVariousFormsIfNeeded(sourceUnit, sourceBuffer);
return null;
}
});
-
- return null; //new Reduction(Tpken.EOF);
}
private void outputASTInVariousFormsIfNeeded(SourceUnit sourceUnit, SourceBuffer sourceBuffer) {
// straight xstream output of AST
String formatProp = System.getProperty("ANTLR.AST".toLowerCase()); // uppercase to hide from jarjar
+ /* GRECLIPSE edit
if ("xml".equals(formatProp)) {
- saveAsXML(sourceUnit.getName(), ast);
+ XStreamUtils.serialize(sourceUnit.getName() + ".antlr", ast);
}
+ */
// 'pretty printer' output of AST
if ("groovy".equals(formatProp)) {
@@ -316,7 +309,7 @@ private void outputASTInVariousFormsIfNeeded(SourceUnit sourceUnit, SourceBuffer
if ("html".equals(formatProp)) {
try {
PrintStream out = new PrintStream(new FileOutputStream(sourceUnit.getName() + ".html"));
- List v = new ArrayList();
+ List v = new ArrayList<>();
v.add(new NodeAsHTMLPrinter(out, tokenNames));
v.add(new SourcePrinter(out, tokenNames));
Visitor visitors = new CompositeVisitor(v);
@@ -328,18 +321,11 @@ private void outputASTInVariousFormsIfNeeded(SourceUnit sourceUnit, SourceBuffer
}
}
- private static void saveAsXML(String name, AST ast) {
- // GRECLIPSE edit
- //XStreamUtils.serialize(name+".antlr", ast);
- // GRECLIPSE end
- }
-
public ModuleNode buildAST(SourceUnit sourceUnit, ClassLoader classLoader, Reduction cst) throws ParserException {
setClassLoader(classLoader);
makeModule();
try {
convertGroovy(ast);
-
// GRECLIPSE add -- does it look broken (i.e. have we built a script for it containing rubbish)
if (looksBroken(output) && output.getMethods().isEmpty() && sourceUnit.getErrorCollector().hasErrors()) {
output.setEncounteredUnrecoverableError(true);
@@ -355,7 +341,6 @@ public ModuleNode buildAST(SourceUnit sourceUnit, ClassLoader classLoader, Reduc
}
// set the script source position
-
ClassNode scriptClassNode = output.getScriptClassDummy();
if (scriptClassNode != null) {
List statements = output.getStatementBlock().getStatements();
@@ -368,18 +353,14 @@ public ModuleNode buildAST(SourceUnit sourceUnit, ClassLoader classLoader, Reduc
scriptClassNode.setLastLineNumber(lastStatement.getLastLineNumber());
}
}
-
// GRECLIPSE add
fixModuleNodeLocations();
output.putNodeMetaData(LocationSupport.class, locations);
// GRECLIPSE end
- }
- catch (ASTRuntimeException e) {
+ } catch (ASTRuntimeException e) {
throw new ASTParserException(e.getMessage() + ". File: " + sourceUnit.getName(), e);
}
- // GRECLIPSE add
ast = null;
- // GRECLIPSE end
return output;
}
@@ -409,7 +390,7 @@ private static boolean looksBroken(ModuleNode moduleNode) {
// GRECLIPSE end
/**
- * Converts the Antlr AST to the Groovy AST
+ * Converts the Antlr AST to the Groovy AST.
*/
protected void convertGroovy(AST node) {
while (node != null) {
@@ -445,10 +426,8 @@ protected void convertGroovy(AST node) {
annotationDef(node);
break;
- default: {
- Statement statement = statement(node);
- output.addStatement(statement);
- }
+ default:
+ output.addStatement(statement(node));
}
node = node.getNextSibling();
}
@@ -458,15 +437,13 @@ protected void convertGroovy(AST node) {
//-------------------------------------------------------------------------
protected void packageDef(AST packageDef) {
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST node = packageDef.getFirstChild();
if (isType(ANNOTATIONS, node)) {
processAnnotations(annotations, node);
node = node.getNextSibling();
}
- String name = qualifiedName(node);
- // TODO should we check package node doesn't already exist? conflict?
- PackageNode packageNode = setPackage(name, annotations);
+ PackageNode packageNode = setPackage(qualifiedName(node), annotations);
// GRECLIPSE edit
//configureAST(packageNode, packageDef);
configureAST(packageNode, node);
@@ -479,7 +456,7 @@ protected void importDef(AST importNode) {
output.putNodeMetaData(ImportNode.class, ImportNode.class);
boolean isStatic = importNode.getType() == STATIC_IMPORT;
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST node = importNode.getFirstChild();
if (isType(ANNOTATIONS, node)) {
@@ -487,14 +464,13 @@ protected void importDef(AST importNode) {
node = node.getNextSibling();
}
+ ImportNode imp;
String alias = null;
- // GRECLIPSE add
AST aliasNode = null;
- // GRECLIPSE end
if (isType(LITERAL_as, node)) {
//import is like "import Foo as Bar"
node = node.getFirstChild();
- /*GRECLIPSE AST*/ aliasNode = node.getNextSibling();
+ aliasNode = node.getNextSibling();
alias = identifier(aliasNode);
}
@@ -509,8 +485,8 @@ protected void importDef(AST importNode) {
configureAST(type, "?".equals(name) ? importNode : node);
// GRECLIPSE end
addImport(type, name, alias, annotations);
- // GRECLIPSE add
- ImportNode imp = last(output.getImports());
+ imp = last(output.getImports());
+ // GRECLIPSE edit
configureAST(imp, importNode, node, null);
// GRECLIPSE end
return;
@@ -531,26 +507,22 @@ protected void importDef(AST importNode) {
configureAST(type, packageNode);
// GRECLIPSE end
addStaticStarImport(type, packageName, annotations);
- // GRECLIPSE add
- ImportNode imp = output.getStaticStarImports().get(packageName);
+ imp = output.getStaticStarImports().get(packageName);
+ // GRECLIPSE edit
configureAST(imp, importNode, packageNode, null);
// GRECLIPSE end
} else {
// import is like "import foo.*"
addStarImport(packageName, annotations);
- // GRECLIPSE add
- ImportNode imp = last(output.getStarImports());
+ imp = last(output.getStarImports());
+ // GRECLIPSE edit
configureAST(imp, importNode, packageNode, null);
// GRECLIPSE end
}
- if (alias != null) throw new GroovyBugError(
- "imports like 'import foo.* as Bar' are not " +
- "supported and should be caught by the grammar");
+ if (alias != null)
+ throw new GroovyBugError("imports like 'import foo.* as Bar' are not supported and should be caught by the grammar");
} else {
- // GRECLIPSE add
- ImportNode imp;
- // GRECLIPSE end
String name = identifier(nameNode);
if (isStatic) {
// import is like "import static foo.Bar.method"
@@ -563,8 +535,8 @@ protected void importDef(AST importNode) {
configureAST(type, packageNode);
// GRECLIPSE end
addStaticImport(type, name, alias, annotations);
- // GRECLIPSE add
imp = output.getStaticImports().get(alias == null ? name : alias);
+ // GRECLIPSE edit
imp.setFieldNameExpr(literalExpression(nameNode, name));
configureAST(imp, importNode, packageNode, nameNode);
// GRECLIPSE end
@@ -583,8 +555,8 @@ protected void importDef(AST importNode) {
type.setEnd(locations.findOffset(type.getLastLineNumber(), type.getLastColumnNumber()));
// GRECLIPSE end
addImport(type, name, alias, annotations);
- // GRECLIPSE add
imp = last(output.getImports());
+ // GRECLIPSE edit
configureAST(imp, importNode, packageNode, nameNode);
// GRECLIPSE end
}
@@ -598,7 +570,7 @@ protected void importDef(AST importNode) {
// we're using node metadata here in order to fix GROOVY-6094
// without breaking external APIs
Object node = output.getNodeMetaData(ImportNode.class);
- if (node!=null && node!=ImportNode.class) {
+ if (node != null && node != ImportNode.class) {
configureAST((ImportNode)node, importNode);
}
output.removeNodeMetaData(ImportNode.class);
@@ -615,7 +587,7 @@ private void processAnnotations(List annotations, AST node) {
}
protected void annotationDef(AST classDef) {
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST node = classDef.getFirstChild();
int modifiers = Opcodes.ACC_PUBLIC;
if (isType(MODIFIERS, node)) {
@@ -666,18 +638,12 @@ protected void annotationDef(AST classDef) {
}
protected void interfaceDef(AST classDef) {
- /* GRECLIPSE edit -- GROOVY-9203
- int oldInnerClassCounter = innerClassCounter;
- */
innerInterfaceDef(classDef);
classNode = null;
- /* GRECLIPSE edit -- GROOVY-9203
- innerClassCounter = oldInnerClassCounter;
- */
}
protected void innerInterfaceDef(AST classDef) {
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST node = classDef.getFirstChild();
int modifiers = Opcodes.ACC_PUBLIC;
if (isType(MODIFIERS, node)) {
@@ -727,29 +693,16 @@ protected void innerInterfaceDef(AST classDef) {
classNode.setNameEnd(nameEnd - 1);
// GRECLIPSE end
- /* GRECLIPSE edit -- GROOVY-9203
- int oldClassCount = innerClassCounter;
- */
-
assertNodeType(OBJBLOCK, node);
objectBlock(node);
output.addClass(classNode);
classNode = outerClass;
- /* GRECLIPSE edit -- GROOVY-9203
- innerClassCounter = oldClassCount;
- */
}
protected void classDef(AST classDef) {
- /* GRECLIPSE edit -- GROOVY-9203
- int oldInnerClassCounter = innerClassCounter;
- */
innerClassDef(classDef);
classNode = null;
- /* GRECLIPSE edit -- GROOVY-9203
- innerClassCounter = oldInnerClassCounter;
- */
}
private ClassNode getClassOrScript(ClassNode node) {
@@ -757,7 +710,6 @@ private ClassNode getClassOrScript(ClassNode node) {
return output.getScriptClassDummy();
}
- // GRECLIPSE add
private static int anonymousClassCount(ClassNode node) {
int count = 0;
for (Iterator it = node.getInnerClasses(); it.hasNext();) {
@@ -768,45 +720,37 @@ private static int anonymousClassCount(ClassNode node) {
}
return count;
}
- // GRECLIPSE end
protected Expression anonymousInnerClassDef(AST node) {
ClassNode oldNode = classNode;
ClassNode outerClass = getClassOrScript(oldNode);
- /* GRECLIPSE edit -- GROOVY-9203
- String fullName = outerClass.getName() + '$' + innerClassCounter;
- innerClassCounter++;
- */
- String fullName = outerClass.getName() + '$' + (anonymousClassCount(outerClass) + 1);
- // GRECLIPSE end
+ String innerClassName = outerClass.getName() + "$" + (anonymousClassCount(outerClass) + 1);
if (enumConstantBeingDef) {
- classNode = new EnumConstantClassNode(outerClass, fullName, Opcodes.ACC_PUBLIC, ClassHelper.OBJECT_TYPE);
+ classNode = new EnumConstantClassNode(outerClass, innerClassName, Opcodes.ACC_PUBLIC, ClassHelper.OBJECT_TYPE);
} else {
- classNode = new InnerClassNode(outerClass, fullName, /*GRECLIPSE Opcodes.ACC_PUBLIC*/0, ClassHelper.OBJECT_TYPE);
+ classNode = new InnerClassNode(outerClass, innerClassName, /*GRECLIPSE Opcodes.ACC_PUBLIC*/0, ClassHelper.OBJECT_TYPE);
}
((InnerClassNode) classNode).setAnonymous(true);
classNode.setEnclosingMethod(methodNode);
+ configureAST(classNode, node);
assertNodeType(OBJBLOCK, node);
objectBlock(node);
- output.addClass(classNode);
+
AnonymousInnerClassCarrier ret = new AnonymousInnerClassCarrier();
ret.innerClass = classNode;
- // GRECLIPSE add
- configureAST(classNode, node);
- // GRECLIPSE end
+ output.addClass(classNode);
classNode = oldNode;
-
return ret;
}
protected void innerClassDef(AST classDef) {
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
if (isType(TRAIT_DEF, classDef)) {
// GRECLIPSE edit
//annotations.add(new AnnotationNode(ClassHelper.make("groovy.transform.Trait")));
- annotations.add(makeAnnotationNode(Trait.class));
+ annotations.add(makeAnnotationNode(groovy.transform.Trait.class));
// GRECLIPSE end
}
@@ -874,10 +818,6 @@ protected void innerClassDef(AST classDef) {
// have here to ensure it won't be the inner class
output.addClass(classNode);
- /* GRECLIPSE edit -- GROOVY-9203
- int oldClassCount = innerClassCounter;
- */
-
// GRECLIPSE add
// a null node means the classbody is missing but the parser recovered
// an error will already have been recorded against the file
@@ -890,9 +830,6 @@ protected void innerClassDef(AST classDef) {
// GRECLIPSE end
classNode = outerClass;
- /* GRECLIPSE edit -- GROOVY-9203
- innerClassCounter = oldClassCount;
- */
}
protected void objectBlock(AST objectBlock) {
@@ -949,7 +886,7 @@ protected void objectBlock(AST objectBlock) {
protected void enumDef(AST enumNode) {
assertNodeType(ENUM_DEF, enumNode);
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST node = enumNode.getFirstChild();
int modifiers = Opcodes.ACC_PUBLIC;
@@ -974,19 +911,17 @@ protected void enumDef(AST enumNode) {
String enumName = (classNode != null ? name : dot(getPackageName(), name));
ClassNode enumClass = EnumHelper.makeEnumNode(enumName, modifiers, interfaces, classNode);
enumClass.setSyntheticPublic(syntheticPublic);
- ClassNode oldNode = classNode;
enumClass.addAnnotations(annotations);
- classNode = enumClass;
- // GRECLIPSE move
- //configureAST(classNode, enumNode);
+ // GRECLIPSE add
+ enumClass.setNameStart(nameStart);
+ enumClass.setNameEnd(nameEnd - 1);
// GRECLIPSE end
+ configureAST(enumClass, enumNode);
+
+ ClassNode oldNode = classNode;
+ classNode = enumClass;
assertNodeType(OBJBLOCK, node);
objectBlock(node);
- // GRECLIPSE add
- classNode.setNameStart(nameStart);
- classNode.setNameEnd(nameEnd - 1);
- configureAST(classNode, enumNode);
- // GRECLIPSE end
classNode = oldNode;
output.addClass(enumClass);
@@ -995,7 +930,7 @@ protected void enumDef(AST enumNode) {
protected void enumConstantDef(AST node) {
enumConstantBeingDef = true;
assertNodeType(ENUM_CONSTANT_DEF, node);
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST element = node.getFirstChild();
if (isType(ANNOTATIONS, element)) {
processAnnotations(annotations, element);
@@ -1084,7 +1019,7 @@ protected void throwsList(AST node, List list) {
protected void methodDef(AST methodDef) {
MethodNode oldNode = methodNode;
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST node = methodDef.getFirstChild();
GenericsType[] generics = null;
@@ -1145,7 +1080,7 @@ protected void methodDef(AST methodDef) {
if (isType(LITERAL_throws, node)) {
AST throwsNode = node.getFirstChild();
- List exceptionList = new ArrayList();
+ List exceptionList = new ArrayList<>();
throwsList(throwsNode, exceptionList);
exceptions = exceptionList.toArray(exceptions);
node = node.getNextSibling();
@@ -1159,31 +1094,17 @@ protected void methodDef(AST methodDef) {
methodNode = new MethodNode(name, modifiers, returnType, parameters, exceptions, code);
if ((modifiers & Opcodes.ACC_ABSTRACT) == 0) {
if (node == null) {
- /* GRECLIPSE edit
- throw new ASTRuntimeException(methodDef, "You defined a method without a body. Try adding a body, or declare it abstract.");
- }
- */
+ // GRECLIPSE edit
+ //throw new ASTRuntimeException(methodDef, "You defined a method without a body. Try adding a body, or declare it abstract.");
if (getController() != null) getController().addError(new SyntaxException(
"You defined a method without a body. Try adding a body, or declare it abstract.", methodDef.getLine(), methodDef.getColumn()));
// create a fake node that can pretend to be the body
code = statementListNoChild(null, methodDef);
+ // GRECLIPSE end
} else {
- // GRECLIPSE end
- assertNodeType(SLIST, node);
- code = statementList(node);
- // GRECLIPSE add
- }
- // GRECLIPSE end
- /* GRECLIPSE edit -- GROOVY-9141
- } else if (node != null && classNode.isAnnotationDefinition()) {
- code = statement(node);
- hasAnnotationDefault = true;
- } else if ((modifiers & Opcodes.ACC_ABSTRACT) > 0) {
- if (node != null) {
- throw new ASTRuntimeException(methodDef, "Abstract methods do not define a body.");
+ assertNodeType(SLIST, node);
+ code = statementList(node);
}
- }
- */
} else if (node != null) {
if (classNode != null && classNode.isAnnotationDefinition()) {
code = statement(node);
@@ -1192,7 +1113,6 @@ protected void methodDef(AST methodDef) {
throw new ASTRuntimeException(methodDef, "Abstract methods do not define a body.");
}
}
- // GRECLIPSE end
methodNode.setCode(code);
methodNode.addAnnotations(annotations);
methodNode.setGenericsTypes(generics);
@@ -1243,7 +1163,7 @@ protected void objectInit(AST init) {
}
protected void constructorDef(AST constructorDef) {
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST node = constructorDef.getFirstChild();
// GRECLIPSE add
// constructor name is not stored as an AST node
@@ -1278,7 +1198,7 @@ protected void constructorDef(AST constructorDef) {
ClassNode[] exceptions = ClassNode.EMPTY_ARRAY;
if (isType(LITERAL_throws, node)) {
AST throwsNode = node.getFirstChild();
- List exceptionList = new ArrayList();
+ List exceptionList = new ArrayList<>();
throwsList(throwsNode, exceptionList);
exceptions = exceptionList.toArray(exceptions);
node = node.getNextSibling();
@@ -1305,7 +1225,7 @@ protected void constructorDef(AST constructorDef) {
}
protected void fieldDef(AST fieldDef) {
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
AST node = fieldDef.getFirstChild();
// GRECLIPSE add
int nodeStart = locations.findOffset(node.getLine(), node.getColumn());
@@ -1407,6 +1327,8 @@ protected void fieldDef(AST fieldDef) {
}
public static Expression getDefaultValueForPrimitive(ClassNode type) {
+ if (type != null) type = type.redirect();
+
if (type == ClassHelper.int_TYPE) {
return new ConstantExpression(0);
}
@@ -1435,7 +1357,7 @@ public static Expression getDefaultValueForPrimitive(ClassNode type) {
}
protected ClassNode[] interfaces(AST node) {
- List interfaceList = new ArrayList();
+ List interfaceList = new ArrayList<>();
for (AST implementNode = node.getFirstChild(); implementNode != null; implementNode = implementNode.getNextSibling()) {
interfaceList.add(makeTypeWithArguments(implementNode));
}
@@ -1455,7 +1377,7 @@ protected Parameter[] parameters(AST parametersNode) {
if (isType(IMPLICIT_PARAMETERS, parametersNode)) return Parameter.EMPTY_ARRAY;
return null;
} else {
- List parameters = new ArrayList();
+ List parameters = new ArrayList<>();
AST firstParameterNode = null;
do {
firstParam = (firstParameterNode == null);
@@ -1483,7 +1405,7 @@ private void verifyParameters(List parameters, AST firstParameterNode
}
protected Parameter parameter(AST paramNode) {
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
boolean variableParameterDef = isType(VARIABLE_PARAMETER_DEF, paramNode);
AST node = paramNode.getFirstChild();
@@ -1496,13 +1418,8 @@ protected Parameter parameter(AST paramNode) {
ClassNode type = ClassHelper.DYNAMIC_TYPE;
if (isType(TYPE, node)) {
type = makeTypeWithArguments(node);
- // GRECLIPSE edit
- //if (variableParameterDef) type = type.makeArray();
- if (variableParameterDef) {
- type = type.makeArray();
- configureAST(type, node);
- }
- // GRECLIPSE end
+ if (variableParameterDef)
+ type = makeArray(type, node);
node = node.getNextSibling();
}
@@ -1638,8 +1555,7 @@ protected AnnotationNode annotation(AST annotationNode) {
annotationBeingDef = true;
AST node = annotationNode.getFirstChild();
/* GRECLIPSE edit
- String name = qualifiedName(node);
- AnnotationNode annotatedNode = new AnnotationNode(ClassHelper.make(name));
+ AnnotationNode annotatedNode = new AnnotationNode(ClassHelper.make(qualifiedName(node)));
*/
AnnotationNode annotatedNode = new AnnotationNode(makeType(annotationNode));
// GRECLIPSE end
@@ -1768,19 +1684,11 @@ protected Statement statementList(AST code) {
protected Statement statementListNoChild(AST node, AST alternativeConfigureNode) {
BlockStatement block = siblingsToBlockStatement(node);
// alternativeConfigureNode is used only to set the source position
- /* GRECLIPSE edit
- if (node != null) {
- configureAST(block, node);
- } else {
- configureAST(block, alternativeConfigureNode);
- }
- */
if (alternativeConfigureNode != null) {
configureAST(block, alternativeConfigureNode);
} else if (node != null) {
configureAST(block, node);
}
- // GRECLIPSE end
return block;
}
@@ -1801,7 +1709,7 @@ protected Statement assertStatement(AST assertNode) {
if (node != null) {
messageExpression = expression(node);
} else {
- messageExpression = ConstantExpression.NULL;
+ messageExpression = nullX();
}
AssertStatement assertStatement = new AssertStatement(booleanExpression, messageExpression);
configureAST(assertStatement, assertNode);
@@ -1924,7 +1832,7 @@ protected Statement methodCall(AST code) {
protected Expression declarationExpression(AST variableDef) {
AST node = variableDef.getFirstChild();
ClassNode type = null;
- List annotations = new ArrayList();
+ List annotations = new ArrayList<>();
int modifiers = 0;
if (isType(MODIFIERS, node)) {
// force check of modifier conflicts
@@ -1990,7 +1898,7 @@ protected Statement returnStatement(AST node) {
//if (exprNode == null) {
// exprNode = node.getNextSibling();
//}
- Expression expression = exprNode == null ? ConstantExpression.NULL : expression(exprNode);
+ Expression expression = exprNode == null ? nullX() : expression(exprNode);
ReturnStatement returnStatement = new ReturnStatement(expression);
configureAST(returnStatement, node);
return returnStatement;
@@ -2001,20 +1909,18 @@ protected Statement switchStatement(AST switchNode) {
Expression expression = expression(node);
Statement defaultStatement = EmptyStatement.INSTANCE;
- List list = new ArrayList();
+ List caseStatements = new ArrayList<>();
for (node = node.getNextSibling(); isType(CASE_GROUP, node); node = node.getNextSibling()) {
Statement tmpDefaultStatement;
AST child = node.getFirstChild();
if (isType(LITERAL_case, child)) {
- List cases = new LinkedList();
// default statement can be grouped with previous case
- tmpDefaultStatement = caseStatements(child, cases);
- list.addAll(cases);
+ tmpDefaultStatement = caseStatements(child, caseStatements);
} else {
tmpDefaultStatement = statement(child.getNextSibling());
}
- if (tmpDefaultStatement != EmptyStatement.INSTANCE) {
- if (defaultStatement == EmptyStatement.INSTANCE) {
+ if (!(tmpDefaultStatement instanceof EmptyStatement)) {
+ if (defaultStatement instanceof EmptyStatement) {
defaultStatement = tmpDefaultStatement;
} else {
throw new ASTRuntimeException(switchNode, "The default case is already defined.");
@@ -2024,13 +1930,13 @@ protected Statement switchStatement(AST switchNode) {
if (node != null) {
unknownAST(node);
}
- SwitchStatement switchStatement = new SwitchStatement(expression, list, defaultStatement);
+ SwitchStatement switchStatement = new SwitchStatement(expression, caseStatements, defaultStatement);
configureAST(switchStatement, switchNode);
return switchStatement;
}
- protected Statement caseStatements(AST node, List cases) {
- List expressions = new LinkedList();
+ protected Statement caseStatements(AST node, List cases) {
+ List expressions = new ArrayList<>();
Statement statement = EmptyStatement.INSTANCE;
Statement defaultStatement = EmptyStatement.INSTANCE;
AST nextSibling = node;
@@ -2047,10 +1953,9 @@ protected Statement caseStatements(AST node, List cases) {
statement = statement(nextSibling);
}
}
- Iterator iterator = expressions.iterator();
- while (iterator.hasNext()) {
- Expression expr = (Expression) iterator.next();
- Statement stmt;
+ for (Iterator iterator = expressions.iterator(); iterator.hasNext(); ) {
+ Expression expr = iterator.next();
+ CaseStatement stmt;
if (iterator.hasNext()) {
stmt = new CaseStatement(expr, EmptyStatement.INSTANCE);
} else {
@@ -2091,7 +1996,7 @@ protected Statement tryStatement(AST tryStatementNode) {
AST node = tryNode.getNextSibling();
// let's do the catch nodes
- List catches = new ArrayList();
+ List catches = new ArrayList<>();
for (; isType(LITERAL_catch, node); node = node.getNextSibling()) {
final List catchStatements = catchStatement(node);
catches.addAll(catchStatements);
@@ -2116,9 +2021,9 @@ protected Statement tryStatement(AST tryStatementNode) {
protected List catchStatement(AST catchNode) {
AST node = catchNode.getFirstChild();
- List catches = new LinkedList();
+ List catches = new ArrayList<>();
if (MULTICATCH == node.getType()) {
- final AST multicatches = node.getFirstChild();
+ AST multicatches = node.getFirstChild();
if (multicatches.getType() != MULTICATCH_TYPES) {
// catch (e)
// catch (def e)
@@ -2134,7 +2039,8 @@ protected List catchStatement(AST catchNode) {
catches.add(answer);
} else {
// catch (Exception e)
- // catch (Exception1 | Exception2 e)
+ // catch (java.lang.Exception e)
+ // catch (Exception1 | foo.bar.Exception2 e)
AST exceptionNodes = multicatches.getFirstChild();
String variable = identifier(multicatches.getNextSibling());
while (exceptionNodes != null) {
@@ -2212,9 +2118,9 @@ protected Expression expression(AST node, boolean convertToConstant) {
// GRECLIPSE end
}
}
- // GRECLIPSE edit -- each case of expressionSwitch does this already
- //configureAST(expression, node);
- // GRECLIPSE end
+ /* GRECLIPSE edit -- each case of expressionSwitch does this already
+ configureAST(expression, node);
+ */
return expression;
}
@@ -2222,16 +2128,15 @@ protected Expression expressionSwitch(AST node) {
int type = node.getType();
switch (type) {
case EXPR:
- // GRECLIPSE edit -- enclosing parentheses
- //return expression(node.getFirstChild());
Expression expression = expression(node.getFirstChild());
+ // GRECLIPSE add -- enclosing parentheses
int row = node.getLine(), col = node.getColumn();
int offset = locations.findOffset(row, col);
if (offset < expression.getStart()) {
configureAST(expression, node);
}
- return expression;
// GRECLIPSE end
+ return expression;
case ELIST:
return expressionList(node);
@@ -2292,10 +2197,6 @@ protected Expression expressionSwitch(AST node) {
case SPREAD_MAP_ARG:
return spreadMapExpression(node);
- // commented out of groovy.g due to non determinisms
- //case MEMBER_POINTER_DEFAULT:
- // return defaultMethodPointerExpression(node);
-
case MEMBER_POINTER:
return methodPointerExpression(node);
@@ -2311,14 +2212,15 @@ protected Expression expressionSwitch(AST node) {
case TYPECAST:
return castExpression(node);
- // literals
-
case LITERAL_true:
return literalExpression(node, Boolean.TRUE);
+
case LITERAL_false:
return literalExpression(node, Boolean.FALSE);
+
case LITERAL_null:
return literalExpression(node, null);
+
case STRING_LITERAL:
return literalExpression(node, node.getText());
@@ -2358,23 +2260,19 @@ protected Expression expressionSwitch(AST node) {
case UNARY_PLUS:
return unaryPlusExpression(node);
- // Prefix expressions
case INC:
return prefixExpression(node, Types.PLUS_PLUS);
case DEC:
return prefixExpression(node, Types.MINUS_MINUS);
- // Postfix expressions
case POST_INC:
return postfixExpression(node, Types.PLUS_PLUS);
case POST_DEC:
return postfixExpression(node, Types.MINUS_MINUS);
-
// Binary expressions
-
case ASSIGN:
return binaryExpression(Types.ASSIGN, node);
@@ -2405,18 +2303,6 @@ protected Expression expressionSwitch(AST node) {
case GE:
return binaryExpression(Types.COMPARE_GREATER_THAN_EQUAL, node);
- /**
- * TODO treble equal?
- return binaryExpression(Types.COMPARE_IDENTICAL, node);
-
- case ???:
- return binaryExpression(Types.LOGICAL_AND_EQUAL, node);
-
- case ???:
- return binaryExpression(Types.LOGICAL_OR_EQUAL, node);
-
- */
-
case LAND:
return binaryExpression(Types.LOGICAL_AND, node);
@@ -2441,42 +2327,36 @@ protected Expression expressionSwitch(AST node) {
case BXOR_ASSIGN:
return binaryExpression(Types.BITWISE_XOR_EQUAL, node);
-
case PLUS:
return binaryExpression(Types.PLUS, node);
case PLUS_ASSIGN:
return binaryExpression(Types.PLUS_EQUAL, node);
-
case MINUS:
return binaryExpression(Types.MINUS, node);
case MINUS_ASSIGN:
return binaryExpression(Types.MINUS_EQUAL, node);
-
case STAR:
return binaryExpression(Types.MULTIPLY, node);
case STAR_ASSIGN:
return binaryExpression(Types.MULTIPLY_EQUAL, node);
-
case STAR_STAR:
return binaryExpression(Types.POWER, node);
case STAR_STAR_ASSIGN:
return binaryExpression(Types.POWER_EQUAL, node);
-
case DIV:
return binaryExpression(Types.DIVIDE, node);
case DIV_ASSIGN:
return binaryExpression(Types.DIVIDE_EQUAL, node);
-
case MOD:
return binaryExpression(Types.MOD, node);
@@ -2511,7 +2391,6 @@ protected Expression expressionSwitch(AST node) {
case REGEX_MATCH:
return binaryExpression(Types.MATCH_REGEX, node);
-
// Ranges
case RANGE_INCLUSIVE:
return rangeExpression(node, true);
@@ -2526,12 +2405,9 @@ protected Expression expressionSwitch(AST node) {
return binaryExpression(Types.KEYWORD_IN, node);
case ANNOTATION:
- // GRECLIPSE edit
- //return new AnnotationConstantExpression(annotation(node));
expression = new AnnotationConstantExpression(annotation(node));
configureAST(expression, node);
return expression;
- // GRECLIPSE end
case CLOSURE_LIST:
return closureListExpression(node);
@@ -2567,7 +2443,7 @@ private TupleExpression tupleExpression(AST node) {
private ClosureListExpression closureListExpression(AST node) {
isClosureListExpressionAllowedHere(node);
AST exprNode = node.getFirstChild();
- List list = new LinkedList();
+ List list = new ArrayList<>();
while (exprNode != null) {
if (isType(EXPR, exprNode)) {
Expression expr = expression(exprNode);
@@ -2630,7 +2506,6 @@ protected Expression variableExpression(AST node) {
return variableExpression;
}
- // GRECLIPSE Expression->ConstantExpression
protected ConstantExpression literalExpression(AST node, Object value) {
ConstantExpression constantExpression = new ConstantExpression(value, value instanceof Boolean);
configureAST(constantExpression, node);
@@ -2690,7 +2565,7 @@ protected Expression methodPointerExpression(AST node) {
}
protected Expression listExpression(AST listNode) {
- List expressions = new ArrayList();
+ List expressions = new ArrayList<>();
AST elist = listNode.getFirstChild();
assertNodeType(ELIST, elist);
@@ -2712,7 +2587,7 @@ protected Expression listExpression(AST listNode) {
}
protected Expression mapExpression(AST mapNode) {
- List expressions = new ArrayList();
+ List entryExpressions = new ArrayList<>();
AST elist = mapNode.getFirstChild();
if (elist != null) { // totally empty in the case of [:]
assertNodeType(ELIST, elist);
@@ -2723,18 +2598,18 @@ protected Expression mapExpression(AST mapNode) {
break; // legal cases
case SPREAD_ARG:
assertNodeType(SPREAD_MAP_ARG, node);
- break; // helpful error
+ break;
default:
assertNodeType(LABELED_ARG, node);
- break; // helpful error
+ break;
}
- expressions.add(mapEntryExpression(node));
+ entryExpressions.add(mapEntryExpression(node));
}
}
- MapExpression mapExpression = new MapExpression(expressions);
+ MapExpression mapExpression = new MapExpression(entryExpressions);
configureAST(mapExpression, mapNode);
// GRECLIPSE-768 -- fix for empty map expressions
- if (expressions.isEmpty() && mapExpression.getLength() <= 1) {
+ if (entryExpressions.isEmpty() && mapExpression.getLength() <= 1) {
if (getController() != null) {
try (Reader r = getController().getSource().getReader()) {
r.skip(mapExpression.getStart());
@@ -2810,9 +2685,9 @@ protected Expression asExpression(AST node) {
AST rightNode = leftNode.getNextSibling();
ClassNode type = makeTypeWithArguments(rightNode);
- // GRECLIPSE edit -- set the sloc from the start of the target and the end of the type
- //return CastExpression.asExpression(type, leftExpression);
CastExpression asExpression = CastExpression.asExpression(type, leftExpression);
+ // GRECLIPSE edit -- set the sloc from the start of the target and the end of the type
+ //configureAST(asExpression, node);
asExpression.setStart(leftExpression.getStart());
asExpression.setLineNumber(leftExpression.getLineNumber());
asExpression.setColumnNumber(leftExpression.getColumnNumber());
@@ -2832,8 +2707,8 @@ protected Expression asExpression(AST node) {
// set the range of the type by itself
asExpression.setNameStart(typeStart);
asExpression.setNameEnd(asExpression.getEnd());
- return asExpression;
// GRECLIPSE end
+ return asExpression;
}
protected Expression castExpression(AST castNode) {
@@ -2992,9 +2867,7 @@ protected Expression dotExpression(AST node) {
if (property instanceof VariableExpression) {
VariableExpression ve = (VariableExpression) property;
property = new ConstantExpression(ve.getName());
- // GRECLIPSE add
property.setSourcePosition(ve);
- // GRECLIPSE end
}
PropertyExpression propertyExpression = new PropertyExpression(leftExpression, property, node.getType() != DOT);
@@ -3070,8 +2943,7 @@ protected Expression methodCallExpression(AST methodCallNode) {
objectExpression = VariableExpression.SUPER_EXPRESSION;
}
} else if (isPrimitiveTypeLiteral(selector)) {
- throw new ASTRuntimeException(selector, "Primitive type literal: " + selector.getText()
- + " cannot be used as a method name");
+ throw new ASTRuntimeException(selector, "Primitive type literal: " + selector.getText() + " cannot be used as a method name");
} else if (isType(SELECT_SLOT, selector)) {
Expression field = expression(selector.getFirstChild(), true);
AttributeExpression attributeExpression = new AttributeExpression(objectExpression, field, node.getType() != DOT);
@@ -3090,7 +2962,7 @@ protected Expression methodCallExpression(AST methodCallNode) {
objectExpression = expression(selector, true);
}
- // if node text is found to be "super"/"this" when a method call is being processed, it is a
+ // if node text is found to be "super"/"this" when a method call is being processed, it is a
// call like this(..)/super(..) after the first statement, which shouldn't be allowed. GROOVY-2836
if (selector.getText().equals("this") || selector.getText().equals("super")) {
if (!(annotationBeingDef && selector.getText().equals("super"))) {
@@ -3161,7 +3033,7 @@ protected Expression constructorCallExpression(AST node) {
if (expressionNode == null) {
throw new ASTRuntimeException(elist, "No expression for the array constructor call");
}
- List size = arraySizeExpression(expressionNode);
+ List size = arraySizeExpression(expressionNode);
ArrayExpression arrayExpression = new ArrayExpression(type, null, size);
configureAST(arrayExpression, constructorCallNode);
// GRECLIPSE add
@@ -3214,8 +3086,8 @@ private static ClassNode getAnonymousInnerClassNode(Expression arguments) {
return null;
}
- protected List arraySizeExpression(AST node) {
- List list;
+ protected List arraySizeExpression(AST node) {
+ List list;
Expression size = null;
if (isType(ARRAY_DECLARATOR, node)) {
AST right = node.getNextSibling();
@@ -3231,14 +3103,14 @@ protected List arraySizeExpression(AST node) {
list = arraySizeExpression(child);
} else {
size = expression(node);
- list = new ArrayList();
+ list = new ArrayList<>();
}
list.add(size);
return list;
}
protected Expression enumArguments(AST elist) {
- List expressionList = new ArrayList();
+ List expressionList = new ArrayList<>();
for (AST node = elist; node != null; node = node.getNextSibling()) {
Expression expression = expression(node);
expressionList.add(expression);
@@ -3249,7 +3121,7 @@ protected Expression enumArguments(AST elist) {
}
protected Expression arguments(AST elist) {
- List expressionList = new ArrayList();
+ List expressionList = new ArrayList<>();
// FIXME: all labeled arguments should follow any unlabeled arguments
boolean namedArguments = false;
for (AST node = elist; node != null; node = node.getNextSibling()) {
@@ -3266,7 +3138,7 @@ protected Expression arguments(AST elist) {
// let's remove any non-MapEntryExpression instances
// such as if the last expression is a ClosureExpression
// so let's wrap the named method calls in a Map expression
- List argumentList = new ArrayList();
+ List argumentList = new ArrayList<>();
for (Object next : expressionList) {
Expression expression = (Expression) next;
if (!(expression instanceof MapEntryExpression)) {
@@ -3301,19 +3173,17 @@ protected Expression arguments(AST elist) {
}
}
- private static void checkDuplicateNamedParams(AST elist, List expressionList) {
+ private static void checkDuplicateNamedParams(AST elist, List expressionList) {
if (expressionList.isEmpty()) return;
- Set namedArgumentNames = new HashSet();
- for (Object expression : expressionList) {
- MapEntryExpression meExp = (MapEntryExpression) expression;
+ Set namedArgumentNames = new HashSet<>();
+ for (MapEntryExpression meExp : expressionList) {
if (meExp.getKeyExpression() instanceof ConstantExpression) {
String argName = meExp.getKeyExpression().getText();
if (!namedArgumentNames.contains(argName)) {
namedArgumentNames.add(argName);
} else {
- throw new ASTRuntimeException(elist, "Duplicate named parameter '" + argName
- + "' found.");
+ throw new ASTRuntimeException(elist, "Duplicate named parameter '" + argName + "' found.");
}
}
}
@@ -3335,7 +3205,7 @@ protected boolean addArgumentExpression(AST node, List expressionLis
}
protected Expression expressionList(AST node) {
- List expressionList = new ArrayList();
+ List expressionList = new ArrayList<>();
for (AST child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
expressionList.add(expression(child));
}
@@ -3365,7 +3235,7 @@ protected ClosureExpression closureExpression(AST node) {
protected Expression blockExpression(AST node) {
AST codeNode = node.getFirstChild();
- if (codeNode == null) return ConstantExpression.NULL;
+ if (codeNode == null) return nullX();
if (codeNode.getType() == EXPR && codeNode.getNextSibling() == null) {
// Simplify common case of {expr} to expr.
return expression(codeNode);
@@ -3402,7 +3272,7 @@ protected Expression unaryMinusExpression(AST unaryMinusExpr) {
case NUM_BIG_INT:
case NUM_INT:
case NUM_LONG:
- ConstantExpression constantLongExpression = new ConstantExpression(Numbers.parseInteger(unaryMinusExpr,"-" + text));
+ ConstantExpression constantLongExpression = new ConstantExpression(Numbers.parseInteger("-" + text));
configureAST(constantLongExpression, unaryMinusExpr);
// GRECLIPSE add
setSourceEnd(constantLongExpression, expression(node));
@@ -3421,22 +3291,6 @@ protected Expression unaryMinusExpression(AST unaryMinusExpr) {
protected Expression unaryPlusExpression(AST unaryPlusExpr) {
AST node = unaryPlusExpr.getFirstChild();
- /* GRECLIPSE edit
- switch (node.getType()) {
- case NUM_DOUBLE:
- case NUM_FLOAT:
- case NUM_BIG_DECIMAL:
- case NUM_BIG_INT:
- case NUM_INT:
- case NUM_LONG:
- return expression(node);
-
- default:
- UnaryPlusExpression unaryPlusExpression = new UnaryPlusExpression(expression(node));
- configureAST(unaryPlusExpression, unaryPlusExpr);
- return unaryPlusExpression;
- }
- */
UnaryPlusExpression unaryPlusExpression = new UnaryPlusExpression(expression(node));
configureAST(unaryPlusExpression, unaryPlusExpr);
switch (node.getType()) {
@@ -3446,14 +3300,17 @@ protected Expression unaryPlusExpression(AST unaryPlusExpr) {
case NUM_BIG_INT:
case NUM_INT:
case NUM_LONG:
+ // GRECLIPSE add
setSourceStart(unaryPlusExpression.getExpression(), unaryPlusExpression);
+ // GRECLIPSE end
return unaryPlusExpression.getExpression();
default:
+ // GRECLIPSE add
setSourceEnd(unaryPlusExpression, unaryPlusExpression.getExpression());
+ // GRECLIPSE end
return unaryPlusExpression;
}
- // GRECLIPSE end
}
protected ConstantExpression decimalExpression(AST node) {
@@ -3467,7 +3324,7 @@ protected ConstantExpression decimalExpression(AST node) {
protected ConstantExpression integerExpression(AST node) {
String text = node.getText();
- Object number = Numbers.parseInteger(node, text);
+ Object number = Numbers.parseInteger(text);
boolean keepPrimitive = number instanceof Integer || number instanceof Long;
ConstantExpression constantExpression = new ConstantExpression(number, keepPrimitive);
configureAST(constantExpression, node);
@@ -3475,8 +3332,8 @@ protected ConstantExpression integerExpression(AST node) {
}
protected Expression gstring(AST gstringNode) {
- List strings = new ArrayList();
- List values = new ArrayList();
+ List strings = new ArrayList<>();
+ List values = new ArrayList<>();
StringBuilder buffer = new StringBuilder();
@@ -3513,12 +3370,6 @@ protected Expression gstring(AST gstringNode) {
return gStringExpression;
}
- protected ClassNode type(AST typeNode) {
- // TODO intern types?
- // TODO configureAST(...)
- return buildName(typeNode.getFirstChild());
- }
-
public static String qualifiedName(AST qualifiedNameNode) {
if (isType(IDENT, qualifiedNameNode)) {
return qualifiedNameNode.getText();
@@ -3605,7 +3456,7 @@ private ClassNode addTypeArguments(ClassNode basicType, AST node) {
private List getTypeArgumentsList(AST node) {
assertNodeType(TYPE_ARGUMENTS, node);
- List typeArgumentList = new LinkedList();
+ List typeArgumentList = new ArrayList<>();
AST typeArgument = node.getFirstChild();
while (typeArgument != null) {
@@ -3621,11 +3472,8 @@ private ClassNode[] makeGenericsBounds(AST rn, int boundType) {
AST boundsRoot = rn.getNextSibling();
if (boundsRoot == null) return null;
assertNodeType(boundType, boundsRoot);
- LinkedList bounds = new LinkedList();
- for (AST boundsNode = boundsRoot.getFirstChild();
- boundsNode != null;
- boundsNode = boundsNode.getNextSibling()
- ) {
+ List bounds = new ArrayList<>();
+ for (AST boundsNode = boundsRoot.getFirstChild(); boundsNode != null; boundsNode = boundsNode.getNextSibling()) {
ClassNode bound = makeTypeWithArguments(boundsNode);
/* GRECLIPSE edit -- exclude generics
configureAST(bound, boundsNode);
@@ -3633,36 +3481,31 @@ private ClassNode[] makeGenericsBounds(AST rn, int boundType) {
bounds.add(bound);
}
if (bounds.isEmpty()) return null;
- return (ClassNode[]) bounds.toArray(ClassNode.EMPTY_ARRAY);
+ return bounds.toArray(ClassNode.EMPTY_ARRAY);
}
protected GenericsType[] makeGenericsType(AST rootNode) {
AST typeParameter = rootNode.getFirstChild();
- LinkedList ret = new LinkedList();
+ List generics = new ArrayList<>();
assertNodeType(TYPE_PARAMETER, typeParameter);
while (isType(TYPE_PARAMETER, typeParameter)) {
- AST typeNode = typeParameter.getFirstChild();
- ClassNode type = makeType(typeParameter);
-
- GenericsType gt = new GenericsType(type, makeGenericsBounds(typeNode, TYPE_UPPER_BOUNDS), null);
+ GenericsType gt = new GenericsType(makeType(typeParameter), makeGenericsBounds(typeParameter.getFirstChild(), TYPE_UPPER_BOUNDS), null);
configureAST(gt, typeParameter);
+ generics.add(gt);
- ret.add(gt);
typeParameter = typeParameter.getNextSibling();
}
- return (GenericsType[]) ret.toArray(GenericsType.EMPTY_ARRAY);
+ return generics.toArray(GenericsType.EMPTY_ARRAY);
}
protected ClassNode makeType(AST typeNode) {
ClassNode answer = ClassHelper.DYNAMIC_TYPE;
AST node = typeNode.getFirstChild();
if (node != null) {
- if (isType(INDEX_OP, node) || isType(ARRAY_DECLARATOR, node)) {
- // GRECLIPSE edit -- retain generics
- //answer = makeType(node).makeArray();
- answer = makeTypeWithArguments(node).makeArray();
- configureAST(answer, node);
+ if (isType(ARRAY_DECLARATOR, node) || isType(INDEX_OP, node)) {
+ answer = makeArray(makeTypeWithArguments(node), node);
+ // GRECLIPSE add
if (getController() != null) {
// check for trailing whitespace
GroovySourceAST root = (GroovySourceAST) node;
@@ -3690,12 +3533,12 @@ protected ClassNode makeType(AST typeNode) {
answer = makeClassNode(qualifiedName(node));
// GRECLIPSE end
if (answer.isUsingGenerics()) {
- ClassNode newAnswer = ClassHelper.makeWithoutCaching(answer.getName());
- newAnswer.setRedirect(answer);
- answer = newAnswer;
+ ClassNode proxy = ClassHelper.makeWithoutCaching(answer.getName());
+ proxy.setRedirect(answer);
+ answer = proxy;
}
- // GRECLIPSE add
configureAST(answer, node);
+ // GRECLIPSE add
if (isType(DOT, node)) { // exclude generics from end position
GroovySourceAST type = (GroovySourceAST) node.getFirstChild().getNextSibling();
answer.setLastLineNumber(type.getLineLast());
@@ -3705,13 +3548,19 @@ protected ClassNode makeType(AST typeNode) {
}
// GRECLIPSE end
}
- /* GRECLIPSE edit
- configureAST(answer, node);
- */
}
return answer;
}
+ private ClassNode makeArray(ClassNode elementType, AST node) {
+ if (elementType.equals(ClassHelper.VOID_TYPE)) {
+ throw new ASTRuntimeException(node.getFirstChild(), "void[] is an invalid type");
+ }
+ ClassNode arrayType = elementType.makeArray();
+ configureAST(arrayType, node);
+ return arrayType;
+ }
+
private boolean checkTypeArgs(AST node, boolean seenTypeArgs) {
if (isType(IDENT, node) && seenTypeArgs) {
throw new ASTRuntimeException(node, "Unexpected type arguments found prior to: " + qualifiedName(node));
@@ -3727,33 +3576,22 @@ private boolean checkTypeArgs(AST node, boolean seenTypeArgs) {
return seenTypeArgs;
}
- /**
- * Extracts an identifier from the Antlr AST and then performs a name resolution
- * to see if the given name is a type from imports, aliases or newly created classes
- */
protected ClassNode buildName(AST node) {
if (isType(TYPE, node)) {
node = node.getFirstChild();
}
- ClassNode answer = null;
- if (isType(DOT, node) || isType(OPTIONAL_DOT, node)) {
- answer = ClassHelper.make(qualifiedName(node));
- } else if (isPrimitiveTypeLiteral(node)) {
- answer = ClassHelper.make(node.getText());
- } else if (isType(INDEX_OP, node) || isType(ARRAY_DECLARATOR, node)) {
- AST child = node.getFirstChild();
- answer = buildName(child).makeArray();
- configureAST(answer, node);
- return answer;
+ String name;
+ if (isType(ARRAY_DECLARATOR, node) || isType(INDEX_OP, node)) {
+ return makeArray(buildName(node.getFirstChild()), node);
+ } else if (isType(DOT, node) || isType(OPTIONAL_DOT, node)) {
+ name = qualifiedName(node);
} else {
- String identifier = node.getText();
- answer = ClassHelper.make(identifier);
+ name = node.getText();
}
+ ClassNode answer = ClassHelper.make(name);
AST nextSibling = node.getNextSibling();
- if (isType(INDEX_OP, nextSibling) || isType(ARRAY_DECLARATOR, node)) {
- answer = answer.makeArray();
- configureAST(answer, node);
- return answer;
+ if (isType(ARRAY_DECLARATOR, nextSibling) || isType(INDEX_OP, nextSibling)) {
+ return makeArray(answer, node);
} else {
configureAST(answer, node);
return answer;
@@ -3808,11 +3646,11 @@ protected void configureAST(ASTNode node, AST ast) {
if (ast == null)
throw new ASTRuntimeException(ast, "PARSER BUG: Tried to configure " + node.getClass().getName() + " with null AST");
/* GRECLIPSE edit
- node.setColumnNumber(ast.getColumn());
node.setLineNumber(ast.getLine());
+ node.setColumnNumber(ast.getColumn());
if (ast instanceof GroovySourceAST) {
- node.setLastColumnNumber(((GroovySourceAST) ast).getColumnLast());
node.setLastLineNumber(((GroovySourceAST) ast).getLineLast());
+ node.setLastColumnNumber(((GroovySourceAST) ast).getColumnLast());
}
*/
final int offset = locations.findOffset(ast.getLine(), ast.getColumn());
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java
index 4a86650938..f8e17e560f 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java
@@ -43,7 +43,6 @@
import org.codehaus.groovy.syntax.PreciseSyntaxException;
import org.codehaus.groovy.transform.ErrorCollecting;
-import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/GenericsType.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/GenericsType.java
index f1a7f83aef..5bc9bae96d 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/GenericsType.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/GenericsType.java
@@ -328,7 +328,7 @@ private boolean checkGenerics(final ClassNode classNode) {
}
if (lowerBound!=null) {
if (!lowerBound.redirect().isUsingGenerics()) {
- if (!compareGenericsWithBound(classNode, lowerBound)) return false;
+ return compareGenericsWithBound(classNode, lowerBound);
}
}
return true;
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/MethodNode.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/MethodNode.java
index 3f308a3055..bd96132665 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/MethodNode.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/MethodNode.java
@@ -32,34 +32,35 @@
public class MethodNode extends AnnotatedNode implements Opcodes {
public static final String SCRIPT_BODY_METHOD_KEY = "org.codehaus.groovy.ast.MethodNode.isScriptBody";
- private final String name;
+ private String name;
private int modifiers;
private boolean syntheticPublic;
private ClassNode returnType;
private Parameter[] parameters;
- private boolean hasDefaultValue = false;
+ private boolean hasDefaultValue;
private Statement code;
private boolean dynamicReturnType;
private VariableScope variableScope;
- private final ClassNode[] exceptions;
- private final boolean staticConstructor;
+ private ClassNode[] exceptions;
+ private boolean staticConstructor;
// type spec for generics
- private GenericsType[] genericsTypes = null;
+ private GenericsType[] genericsTypes;
private boolean hasDefault;
// cached data
String typeDescriptor;
+ protected MethodNode() {}
+
public MethodNode(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code) {
this.name = name;
this.modifiers = modifiers;
+ this.exceptions = exceptions;
this.code = code;
setReturnType(returnType);
setParameters(parameters);
- this.hasDefault = false;
- this.exceptions = exceptions;
- this.staticConstructor = (name != null && name.equals(""));
+ this.staticConstructor = "".equals(name);
}
/**
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ModuleNode.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ModuleNode.java
index a977c54a7a..ffa6fb1615 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ModuleNode.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ModuleNode.java
@@ -91,7 +91,7 @@ public List getMethods() {
public List getClasses() {
if (createClassForStatements && (!statementBlock.isEmpty() || !methods.isEmpty() || isPackageInfo())) {
ClassNode mainClass = createStatementsClass();
- mainClassName = mainClass.getName();
+ mainClassName = mainClass.getName();
createClassForStatements = false;
classes.add(0, mainClass);
mainClass.setModule(this);
@@ -184,7 +184,7 @@ public void addImport(String alias, ClassNode type, List annotat
}
public void addStarImport(String packageName) {
- addStarImport(packageName, Collections.EMPTY_LIST);
+ addStarImport(packageName, Collections.emptyList());
}
public void addStarImport(String packageName, List annotations) {
@@ -280,7 +280,7 @@ public ClassNode getScriptClassDummy() {
setScriptBaseClassFromConfig(scriptDummy);
return scriptDummy;
}
-
+
String name = getPackageName();
if (name == null) {
name = "";
@@ -320,13 +320,13 @@ private void setScriptBaseClassFromConfig(ClassNode cn) {
}
}
}
-
+
protected ClassNode createStatementsClass() {
ClassNode classNode = getScriptClassDummy();
if (classNode.getName().endsWith("package-info")) {
return classNode;
}
-
+
handleMainMethodIfPresent(methods);
// return new Foo(new ShellContext(args)).run()
@@ -393,7 +393,7 @@ protected ClassNode createStatementsClass() {
}
/*
- * If a main method is provided by user, account for it under run() as scripts generate their own 'main' so they can run.
+ * If a main method is provided by user, account for it under run() as scripts generate their own 'main' so they can run.
*/
private void handleMainMethodIfPresent(List methods) {
boolean found = false;
@@ -407,9 +407,8 @@ private void handleMainMethodIfPresent(List methods) {
argTypeMatches = (argType.equals(ClassHelper.OBJECT_TYPE) || argType.getName().contains("String[]"));
retTypeMatches = (retType == ClassHelper.VOID_TYPE || retType == ClassHelper.OBJECT_TYPE);
-
- if(retTypeMatches && argTypeMatches) {
- if(found) {
+ if (retTypeMatches && argTypeMatches) {
+ if (found) {
throw new RuntimeException("Repetitive main method found.");
} else {
found = true;
@@ -459,8 +458,8 @@ protected String extractClassFromFileDescription() {
public boolean isEmpty() {
return classes.isEmpty() && statementBlock.getStatements().isEmpty();
}
-
- public void sortClasses(){
+
+ public void sortClasses() {
if (isEmpty()) return;
List classes = getClasses();
LinkedList sorted = new LinkedList();
@@ -496,22 +495,19 @@ public Map getStaticStarImports() {
}
public void addStaticImport(ClassNode type, String fieldName, String alias) {
- addStaticImport(type, fieldName, alias, new ArrayList());
+ addStaticImport(type, fieldName, alias, Collections.emptyList());
}
public void addStaticImport(ClassNode type, String fieldName, String alias, List annotations) {
ImportNode node = new ImportNode(type, fieldName, alias);
node.addAnnotations(annotations);
- // GRECLIPSE edit
- //staticImports.put(alias, node);
ImportNode prev = staticImports.put(alias, node);
if (prev != null) staticImports.put(prev.toString(), prev);
- // GRECLIPSE end
storeLastAddedImportNode(node);
}
public void addStaticStarImport(String name, ClassNode type) {
- addStaticStarImport(name, type, new ArrayList());
+ addStaticStarImport(name, type, Collections.emptyList());
}
public void addStaticStarImport(String name, ClassNode type, List annotations) {
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/VariableScopeVisitor.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/VariableScopeVisitor.java
deleted file mode 100644
index f727e26320..0000000000
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/VariableScopeVisitor.java
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.classgen;
-
-import org.codehaus.groovy.GroovyBugError;
-import org.codehaus.groovy.ast.ASTNode;
-import org.codehaus.groovy.ast.ClassCodeVisitorSupport;
-import org.codehaus.groovy.ast.ClassHelper;
-import org.codehaus.groovy.ast.ClassNode;
-import org.codehaus.groovy.ast.DynamicVariable;
-import org.codehaus.groovy.ast.FieldNode;
-import org.codehaus.groovy.ast.InnerClassNode;
-import org.codehaus.groovy.ast.MethodNode;
-import org.codehaus.groovy.ast.Parameter;
-import org.codehaus.groovy.ast.PropertyNode;
-import org.codehaus.groovy.ast.Variable;
-import org.codehaus.groovy.ast.VariableScope;
-import org.codehaus.groovy.ast.expr.BinaryExpression;
-import org.codehaus.groovy.ast.expr.ClosureExpression;
-import org.codehaus.groovy.ast.expr.ConstantExpression;
-import org.codehaus.groovy.ast.expr.ConstructorCallExpression;
-import org.codehaus.groovy.ast.expr.DeclarationExpression;
-import org.codehaus.groovy.ast.expr.Expression;
-import org.codehaus.groovy.ast.expr.FieldExpression;
-import org.codehaus.groovy.ast.expr.MethodCallExpression;
-import org.codehaus.groovy.ast.expr.PropertyExpression;
-import org.codehaus.groovy.ast.expr.TupleExpression;
-import org.codehaus.groovy.ast.expr.VariableExpression;
-import org.codehaus.groovy.ast.stmt.BlockStatement;
-import org.codehaus.groovy.ast.stmt.CatchStatement;
-import org.codehaus.groovy.ast.stmt.ForStatement;
-import org.codehaus.groovy.ast.stmt.IfStatement;
-import org.codehaus.groovy.ast.stmt.Statement;
-import org.codehaus.groovy.control.SourceUnit;
-import org.codehaus.groovy.syntax.Types;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import static java.lang.reflect.Modifier.isFinal;
-import static org.apache.groovy.ast.tools.MethodNodeUtils.getPropertyName;
-
-/**
- * Goes through an AST and initializes the scopes.
- */
-public class VariableScopeVisitor extends ClassCodeVisitorSupport {
-
- private VariableScope currentScope = null;
- private final VariableScope headScope = new VariableScope();
- private ClassNode currentClass = null;
- private final SourceUnit source;
- private boolean isSpecialConstructorCall = false;
- private boolean inConstructor = false;
- private final boolean recurseInnerClasses;
-
- private final LinkedList stateStack = new LinkedList();
-
- private class StateStackElement {
- final VariableScope scope;
- final ClassNode clazz;
- final boolean inConstructor;
-
- StateStackElement() {
- scope = VariableScopeVisitor.this.currentScope;
- clazz = VariableScopeVisitor.this.currentClass;
- inConstructor = VariableScopeVisitor.this.inConstructor;
- }
- }
-
- public VariableScopeVisitor(SourceUnit source, boolean recurseInnerClasses) {
- this.source = source;
- currentScope = headScope;
- this.recurseInnerClasses = recurseInnerClasses;
- }
-
-
- public VariableScopeVisitor(SourceUnit source) {
- this(source, false);
- }
-
- // ------------------------------
- // helper methods
- //------------------------------
-
- private void pushState(boolean isStatic) {
- stateStack.add(new StateStackElement());
- currentScope = new VariableScope(currentScope);
- currentScope.setInStaticContext(isStatic);
- }
-
- private void pushState() {
- pushState(currentScope.isInStaticContext());
- }
-
- private void popState() {
- StateStackElement element = (StateStackElement) stateStack.removeLast();
- currentScope = element.scope;
- currentClass = element.clazz;
- inConstructor = element.inConstructor;
- }
-
- private void declare(Parameter[] parameters, ASTNode node) {
- for (Parameter parameter : parameters) {
- if (parameter.hasInitialExpression()) {
- parameter.getInitialExpression().visit(this);
- }
- declare(parameter, node);
- }
- }
-
- private void declare(VariableExpression vex) {
- vex.setInStaticContext(currentScope.isInStaticContext());
- declare(vex, vex);
- vex.setAccessedVariable(vex);
- }
-
- private void declare(Variable var, ASTNode expr) {
- String scopeType = "scope";
- String variableType = "variable";
-
- if (expr.getClass() == FieldNode.class) {
- scopeType = "class";
- variableType = "field";
- } else if (expr.getClass() == PropertyNode.class) {
- scopeType = "class";
- variableType = "property";
- }
-
- StringBuilder msg = new StringBuilder();
- msg.append("The current ").append(scopeType);
- msg.append(" already contains a ").append(variableType);
- msg.append(" of the name ").append(var.getName());
-
- if (currentScope.getDeclaredVariable(var.getName()) != null) {
- addError(msg.toString(), expr);
- return;
- }
-
- for (VariableScope scope = currentScope.getParent(); scope != null; scope = scope.getParent()) {
- // if we are in a class and no variable is declared until
- // now, then we can break the loop, because we are allowed
- // to declare a variable of the same name as a class member
- if (scope.getClassScope() != null && !isAnonymous(scope.getClassScope())) break;
-
- if (scope.getDeclaredVariable(var.getName()) != null) {
- // variable already declared
- addError(msg.toString(), expr);
- break;
- }
- }
- // declare the variable even if there was an error to allow more checks
- currentScope.putDeclaredVariable(var);
- }
-
- protected SourceUnit getSourceUnit() {
- return source;
- }
-
- private Variable findClassMember(ClassNode cn, String name) {
- if (cn == null) return null;
- if (cn.isScript()) {
- return new DynamicVariable(name, false);
- }
-
- for (FieldNode fn : cn.getFields()) {
- if (fn.getName().equals(name)) return fn;
- }
-
- for (MethodNode mn : cn.getMethods()) {
- String pName = getPropertyName(mn);
- if (name.equals(pName)) {
- PropertyNode property = new PropertyNode(name, mn.getModifiers(), ClassHelper.OBJECT_TYPE, cn, null, null, null);
- property.getField().setHasNoRealSourcePosition(true); property.getField().setSynthetic(true);
- property.getField().setDeclaringClass(cn);
- property.setDeclaringClass(cn);
- return property;
- }
- }
-
- for (PropertyNode pn : cn.getProperties()) {
- if (pn.getName().equals(name)) return pn;
- }
-
- Variable ret = findClassMember(cn.getSuperClass(), name);
- if (ret != null) return ret;
- if (isAnonymous(cn)) return null;
- return findClassMember(cn.getOuterClass(), name);
- }
-
- private static boolean isAnonymous(ClassNode node) {
- return (!node.isEnum() && node instanceof InnerClassNode && ((InnerClassNode) node).isAnonymous());
- }
-
- // -------------------------------
- // different Variable based checks
- // -------------------------------
-
- private Variable checkVariableNameForDeclaration(String name, Expression expression) {
- if ("super".equals(name) || "this".equals(name)) return null;
-
- VariableScope scope = currentScope;
- Variable var = new DynamicVariable(name, currentScope.isInStaticContext());
- Variable orig = var;
- // try to find a declaration of a variable
- boolean crossingStaticContext = false;
- while (true) {
- crossingStaticContext = crossingStaticContext || scope.isInStaticContext();
-
- Variable var1 = scope.getDeclaredVariable(var.getName());
- if (var1 != null) {
- var = var1;
- break;
- }
-
- var1 = scope.getReferencedLocalVariable(var.getName());
- if (var1 != null) {
- var = var1;
- break;
- }
-
- var1 = scope.getReferencedClassVariable(var.getName());
- if (var1 != null) {
- var = var1;
- break;
- }
-
- ClassNode classScope = scope.getClassScope();
- if (classScope != null) {
- Variable member = findClassMember(classScope, var.getName());
- if (member != null) {
- boolean staticScope = crossingStaticContext || isSpecialConstructorCall;
- boolean staticMember = member.isInStaticContext();
- // We don't allow a static context (e.g. a static method) to access
- // a non-static variable (e.g. a non-static field).
- if (!(staticScope && !staticMember))
- var = member;
- }
- // GROOVY-5961
- if (!isAnonymous(classScope))
- break;
- }
- scope = scope.getParent();
- }
- if (var == orig && crossingStaticContext) {
- var = new DynamicVariable(var.getName(), true);
- }
-
- VariableScope end = scope;
- // GRECLIPSE add -- GROOVY-9120
- boolean isClassVariable = (end.isClassScope() && !end.isReferencedLocalVariable(name))
- || (end.isReferencedClassVariable(name) && end.getDeclaredVariable(name) == null);
- // GRECLIPSE end
- scope = currentScope;
- while (scope != end) {
- /* GRECLIPSE edit
- if (end.isClassScope() ||
- (end.isReferencedClassVariable(name) && end.getDeclaredVariable(name) == null)) {
- */
- if (isClassVariable) {
- // GRECLIPSE end
- scope.putReferencedClassVariable(var);
- } else {
- scope.putReferencedLocalVariable(var);
- }
- scope = scope.getParent();
- }
-
- return var;
- }
-
- /**
- * a property on "this", like this.x is transformed to a
- * direct field access, so we need to check the
- * static context here
- *
- * @param pe the property expression to check
- */
- private void checkPropertyOnExplicitThis(PropertyExpression pe) {
- if (!currentScope.isInStaticContext()) return;
- Expression object = pe.getObjectExpression();
- if (!(object instanceof VariableExpression)) return;
- VariableExpression ve = (VariableExpression) object;
- if (!ve.getName().equals("this")) return;
- String name = pe.getPropertyAsString();
- if (name == null || name.equals("class")) return;
- Variable member = findClassMember(currentClass, name);
- if (member == null) return;
- checkVariableContextAccess(member, pe);
- }
-
- private void checkVariableContextAccess(Variable v, Expression expr) {
- if (v.isInStaticContext() || !currentScope.isInStaticContext()) return;
-
- String msg = v.getName() +
- " is declared in a dynamic context, but you tried to" +
- " access it from a static context.";
- addError(msg, expr);
-
- // declare a static variable to be able to continue the check
- DynamicVariable v2 = new DynamicVariable(v.getName(), currentScope.isInStaticContext());
- currentScope.putDeclaredVariable(v2);
- }
-
- // ------------------------------
- // code visit
- // ------------------------------
-
- public void visitBlockStatement(BlockStatement block) {
- pushState();
- block.setVariableScope(currentScope);
- super.visitBlockStatement(block);
- popState();
- }
-
- public void visitForLoop(ForStatement forLoop) {
- pushState();
- forLoop.setVariableScope(currentScope);
- Parameter p = forLoop.getVariable();
- p.setInStaticContext(currentScope.isInStaticContext());
- if (p != ForStatement.FOR_LOOP_DUMMY) declare(p, forLoop);
- super.visitForLoop(forLoop);
- popState();
- }
-
- public void visitIfElse(IfStatement ifElse) {
- ifElse.getBooleanExpression().visit(this);
- pushState();
- ifElse.getIfBlock().visit(this);
- popState();
- pushState();
- ifElse.getElseBlock().visit(this);
- popState();
- }
-
- public void visitDeclarationExpression(DeclarationExpression expression) {
- visitAnnotations(expression);
- // visit right side first to avoid the usage of a
- // variable before its declaration
- expression.getRightExpression().visit(this);
-
- if (expression.isMultipleAssignmentDeclaration()) {
- TupleExpression list = expression.getTupleExpression();
- for (Expression e : list.getExpressions()) {
- declare((VariableExpression) e);
- }
- } else {
- declare(expression.getVariableExpression());
- }
- }
-
- @Override
- public void visitBinaryExpression(BinaryExpression be) {
- super.visitBinaryExpression(be);
- switch (be.getOperation().getType()) {
- case Types.EQUAL: // = assignment
- case Types.BITWISE_AND_EQUAL:
- case Types.BITWISE_OR_EQUAL:
- case Types.BITWISE_XOR_EQUAL:
- case Types.PLUS_EQUAL:
- case Types.MINUS_EQUAL:
- case Types.MULTIPLY_EQUAL:
- case Types.DIVIDE_EQUAL:
- case Types.INTDIV_EQUAL:
- case Types.MOD_EQUAL:
- case Types.POWER_EQUAL:
- case Types.LEFT_SHIFT_EQUAL:
- case Types.RIGHT_SHIFT_EQUAL:
- case Types.RIGHT_SHIFT_UNSIGNED_EQUAL:
- checkFinalFieldAccess(be.getLeftExpression());
- break;
- default:
- break;
- }
- }
-
- private void checkFinalFieldAccess(Expression expression) {
- // currently not looking for PropertyExpression: dealt with at runtime using ReadOnlyPropertyException
- if (!(expression instanceof VariableExpression) && !(expression instanceof TupleExpression)) return;
- if (expression instanceof TupleExpression) {
- TupleExpression list = (TupleExpression) expression;
- for (Expression e : list.getExpressions()) {
- checkForFinal(expression, (VariableExpression) e);
- }
- } else {
- checkForFinal(expression, (VariableExpression) expression);
- }
- }
-
- // TODO handle local variables
- private void checkForFinal(final Expression expression, VariableExpression ve) {
- Variable v = ve.getAccessedVariable();
- if (v != null) {
- boolean isFinal = isFinal(v.getModifiers());
- boolean isParameter = v instanceof Parameter;
- if (isFinal && isParameter) {
- addError("Cannot assign a value to final variable '" + v.getName() + "'", expression);
- }
- }
- }
-
- public void visitVariableExpression(VariableExpression expression) {
- String name = expression.getName();
- Variable v = checkVariableNameForDeclaration(name, expression);
- if (v == null) return;
- expression.setAccessedVariable(v);
- checkVariableContextAccess(v, expression);
- }
-
- public void visitPropertyExpression(PropertyExpression expression) {
- expression.getObjectExpression().visit(this);
- expression.getProperty().visit(this);
- checkPropertyOnExplicitThis(expression);
- }
-
- public void visitClosureExpression(ClosureExpression expression) {
- pushState();
-
- expression.setVariableScope(currentScope);
-
- if (expression.isParameterSpecified()) {
- for (Parameter parameter : expression.getParameters()) {
- parameter.setInStaticContext(currentScope.isInStaticContext());
- if (parameter.hasInitialExpression()) {
- parameter.getInitialExpression().visit(this);
- }
- declare(parameter, expression);
- }
- } else if (expression.getParameters() != null) {
- Parameter var = new Parameter(ClassHelper.OBJECT_TYPE, "it");
- var.setInStaticContext(currentScope.isInStaticContext());
- currentScope.putDeclaredVariable(var);
- }
-
- super.visitClosureExpression(expression);
- markClosureSharedVariables();
-
- popState();
- }
-
- private void markClosureSharedVariables() {
- VariableScope scope = currentScope;
- for (Iterator it = scope.getReferencedLocalVariablesIterator(); it.hasNext(); ) {
- it.next().setClosureSharedVariable(true);
- }
- }
-
- public void visitCatchStatement(CatchStatement statement) {
- pushState();
- Parameter p = statement.getVariable();
- p.setInStaticContext(currentScope.isInStaticContext());
- declare(p, statement);
- super.visitCatchStatement(statement);
- popState();
- }
-
- public void visitFieldExpression(FieldExpression expression) {
- String name = expression.getFieldName();
- //TODO: change that to get the correct scope
- Variable v = checkVariableNameForDeclaration(name, expression);
- checkVariableContextAccess(v, expression);
- }
-
- // ------------------------------
- // class visit
- // ------------------------------
-
- public void visitClass(ClassNode node) {
- // AIC are already done, doing them here again will lead to wrong scopes
- if (isAnonymous(node)) return;
-
- pushState();
-
- prepareVisit(node);
-
- super.visitClass(node);
- if (recurseInnerClasses) {
- Iterator innerClasses = node.getInnerClasses();
- while (innerClasses.hasNext()) {
- visitClass(innerClasses.next());
- }
- }
- popState();
- }
-
- /**
- * Sets the current class node context.
- */
- public void prepareVisit(ClassNode node) {
- currentClass = node;
- currentScope.setClassScope(node);
- }
-
- protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) {
- pushState(node.isStatic());
- inConstructor = isConstructor;
- node.setVariableScope(currentScope);
- visitAnnotations(node);
-
- // GROOVY-2156
- Parameter[] parameters = node.getParameters();
- for (Parameter parameter : parameters) {
- visitAnnotations(parameter);
- }
-
- declare(node.getParameters(), node);
- visitClassCodeContainer(node.getCode());
-
- popState();
- }
-
- public void visitMethodCallExpression(MethodCallExpression call) {
- if (call.isImplicitThis() && call.getMethod() instanceof ConstantExpression) {
- ConstantExpression methodNameConstant = (ConstantExpression) call.getMethod();
- Object value = methodNameConstant.getText();
-
- if (!(value instanceof String)) {
- throw new GroovyBugError("tried to make a method call with a non-String constant method name.");
- }
-
- String methodName = (String) value;
- Variable v = checkVariableNameForDeclaration(methodName, call);
- if (v != null && !(v instanceof DynamicVariable)) {
- checkVariableContextAccess(v, call);
- }
-
- if (v instanceof VariableExpression || v instanceof Parameter) {
- VariableExpression object = new VariableExpression(v);
- object.setSourcePosition(methodNameConstant);
- call.setObjectExpression(object);
- ConstantExpression method = new ConstantExpression("call");
- method.setSourcePosition(methodNameConstant); // important for GROOVY-4344
- call.setImplicitThis(false);
- call.setMethod(method);
- }
-
- }
- super.visitMethodCallExpression(call);
- }
-
- public void visitConstructorCallExpression(ConstructorCallExpression call) {
- isSpecialConstructorCall = call.isSpecialCall();
- super.visitConstructorCallExpression(call);
- isSpecialConstructorCall = false;
- if (!call.isUsingAnonymousInnerClass()) return;
-
- pushState();
- InnerClassNode innerClass = (InnerClassNode) call.getType();
- innerClass.setVariableScope(currentScope);
- currentScope.setClassScope(innerClass);
- currentScope.setInStaticContext(false);
- for (MethodNode method : innerClass.getMethods()) {
- Parameter[] parameters = method.getParameters();
- if (parameters.length == 0) parameters = null; // null means no implicit "it"
- ClosureExpression cl = new ClosureExpression(parameters, method.getCode());
- visitClosureExpression(cl);
- }
-
- for (FieldNode field : innerClass.getFields()) {
- final Expression expression = field.getInitialExpression();
- pushState(field.isStatic());
- if (expression != null) {
- // GRECLIPSE add -- GROOVY-6996
- if (expression.isSynthetic())
- // GRECLIPSE end
- if (expression instanceof VariableExpression) {
- VariableExpression vexp = (VariableExpression) expression;
- if (vexp.getAccessedVariable() instanceof Parameter) {
- // workaround for GROOVY-6834: accessing a parameter which is not yet seen in scope
- popState();
- continue;
- }
- }
- expression.visit(this);
- }
- popState();
- }
-
- for (Statement statement : innerClass.getObjectInitializerStatements()) {
- statement.visit(this);
- }
- markClosureSharedVariables();
- popState();
- }
-
- public void visitProperty(PropertyNode node) {
- pushState(node.isStatic());
- super.visitProperty(node);
- popState();
- }
-
- public void visitField(FieldNode node) {
- pushState(node.isStatic());
- super.visitField(node);
- popState();
- }
-
- /* GRECLIPSE edit
- public void visitAnnotations(AnnotatedNode node) {
- List annotations = node.getAnnotations();
- if (annotations.isEmpty()) return;
- for (AnnotationNode an : annotations) {
- // skip built-in properties
- if (an.isBuiltIn()) continue;
- for (Map.Entry member : an.getMembers().entrySet()) {
- Expression annMemberValue = member.getValue();
- annMemberValue.visit(this);
- }
- }
- }
- */
-}
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/StatementWriter.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/StatementWriter.java
index 123a68d88f..f64bdcf88e 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/StatementWriter.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/StatementWriter.java
@@ -20,6 +20,7 @@
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
+import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.ast.Parameter;
import org.codehaus.groovy.ast.expr.ArgumentListExpression;
import org.codehaus.groovy.ast.expr.BooleanExpression;
@@ -92,8 +93,8 @@ public void writeBlockStatement(BlockStatement block) {
}
compileStack.pop();
- // GROOVY-7647
- if (block.getLastLineNumber() > 0) {
+ // GROOVY-7647, GROOVY-9126
+ if (block.getLastLineNumber() > 0 && !isMethodOrConstructorNonEmptyBlock(block)) {
MethodVisitor mv = controller.getMethodVisitor();
Label blockEnd = new Label(); mv.visitLabel(blockEnd);
mv.visitLineNumber(block.getLastLineNumber(), blockEnd);
@@ -102,6 +103,19 @@ public void writeBlockStatement(BlockStatement block) {
controller.getOperandStack().popDownTo(mark);
}
+ private boolean isMethodOrConstructorNonEmptyBlock(BlockStatement block) {
+ MethodNode methodNode = controller.getMethodNode();
+ if (null == methodNode) {
+ methodNode = controller.getConstructorNode();
+ }
+
+ if (null == methodNode || block != methodNode.getCode()) { // check if the block is method/constructor's code
+ return false;
+ }
+
+ return !block.getStatements().isEmpty();
+ }
+
public void writeForStatement(ForStatement loop) {
Parameter loopVar = loop.getVariable();
if (loopVar == ForStatement.FOR_LOOP_DUMMY) {
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
index 464436a808..cdf1298b73 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
@@ -75,6 +75,7 @@
import static org.codehaus.groovy.ast.ClassHelper.CLOSURE_TYPE;
import static org.codehaus.groovy.ast.ClassHelper.OBJECT_TYPE;
import static org.codehaus.groovy.ast.ClassHelper.getWrapper;
+import static org.codehaus.groovy.ast.tools.GeneralUtils.nullX;
import static org.codehaus.groovy.transform.sc.StaticCompilationMetadataKeys.PRIVATE_BRIDGE_METHODS;
import static groovyjarjarasm.asm.Opcodes.ACONST_NULL;
import static groovyjarjarasm.asm.Opcodes.ALOAD;
@@ -165,7 +166,7 @@ public void writeInvokeConstructor(final ConstructorCallExpression call) {
bridge = bridgeMethods != null ? bridgeMethods.get(cn) : null;
}
if (bridge instanceof ConstructorNode) {
- ArgumentListExpression newArgs = new ArgumentListExpression(new ConstantExpression(null));
+ ArgumentListExpression newArgs = new ArgumentListExpression(nullX());
for (Expression arg: args) {
newArgs.addExpression(arg);
}
@@ -257,7 +258,7 @@ protected boolean tryBridgeMethod(MethodNode target, Expression receiver, boolea
}
}
}
- ArgumentListExpression newArgs = new ArgumentListExpression(target.isStatic()?new ConstantExpression(null):fixedReceiver);
+ ArgumentListExpression newArgs = new ArgumentListExpression(target.isStatic() ? nullX() : fixedReceiver);
for (Expression expression : args.getExpressions()) {
newArgs.addExpression(expression);
}
@@ -281,10 +282,7 @@ protected boolean writeDirectMethodCall(final MethodNode target, final boolean i
if (emn.isStaticExtension()) {
// it's a static extension method
- // GRECLIPSE edit -- GROOVY-9153
- //argumentList.add(0, ConstantExpression.NULL);
- argumentList.add(0, new ConstantExpression(null));
- // GRECLIPSE end
+ argumentList.add(0, nullX());
} else {
ClassNode classNode = controller.getClassNode();
boolean isThisOrSuper = false;
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/sc/StaticPropertyAccessHelper.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/sc/StaticPropertyAccessHelper.java
index 9d7bb95377..04a826767b 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/sc/StaticPropertyAccessHelper.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/classgen/asm/sc/StaticPropertyAccessHelper.java
@@ -40,56 +40,50 @@
public abstract class StaticPropertyAccessHelper {
public static Expression transformToSetterCall(
- Expression receiver,
- MethodNode setterMethod,
- final Expression arguments,
- boolean implicitThis,
- boolean safe,
- boolean spreadSafe,
- boolean requiresReturnValue,
- Expression location) {
+ final Expression receiver,
+ final MethodNode setterMethod,
+ final Expression argument,
+ final boolean implicitThis,
+ final boolean safe,
+ final boolean spreadSafe,
+ final boolean requiresReturnValue,
+ final Expression propertyExpression) {
if (requiresReturnValue) {
- TemporaryVariableExpression tmp = new TemporaryVariableExpression(arguments);
+ TemporaryVariableExpression tmp = new TemporaryVariableExpression(argument);
PoppingMethodCallExpression call = new PoppingMethodCallExpression(receiver, setterMethod, tmp);
- call.setImplicitThis(implicitThis);
call.setSafe(safe);
call.setSpreadSafe(spreadSafe);
- call.setSourcePosition(location);
- PoppingListOfExpressionsExpression result = new PoppingListOfExpressionsExpression(tmp, call);
- result.setSourcePosition(location);
- return result;
- } else {
- MethodCallExpression call = new MethodCallExpression(
- receiver,
- setterMethod.getName(),
- arguments
- );
call.setImplicitThis(implicitThis);
+ call.setSourcePosition(propertyExpression);
+ PoppingListOfExpressionsExpression list = new PoppingListOfExpressionsExpression(tmp, call);
+ list.setSourcePosition(propertyExpression);
+ return list;
+ } else {
+ MethodCallExpression call = new MethodCallExpression(receiver, setterMethod.getName(), argument);
call.setSafe(safe);
call.setSpreadSafe(spreadSafe);
+ call.setImplicitThis(implicitThis);
call.setMethodTarget(setterMethod);
- call.setSourcePosition(location);
+ call.setSourcePosition(propertyExpression);
return call;
}
}
private static class PoppingListOfExpressionsExpression extends ListOfExpressionsExpression {
+
private final TemporaryVariableExpression tmp;
private final PoppingMethodCallExpression call;
public PoppingListOfExpressionsExpression(final TemporaryVariableExpression tmp, final PoppingMethodCallExpression call) {
- super(Arrays.asList(
- tmp,
- call
- ));
+ super(Arrays.asList(tmp, call));
this.tmp = tmp;
this.call = call;
}
@Override
public Expression transformExpression(final ExpressionTransformer transformer) {
- PoppingMethodCallExpression tcall = (PoppingMethodCallExpression) call.transformExpression(transformer);
- return new PoppingListOfExpressionsExpression(tcall.tmp, tcall);
+ PoppingMethodCallExpression call = (PoppingMethodCallExpression) this.call.transformExpression(transformer);
+ return new PoppingListOfExpressionsExpression(call.tmp, call);
}
@Override
@@ -102,8 +96,7 @@ public void visit(final GroovyCodeVisitor visitor) {
}
private static class PoppingMethodCallExpression extends MethodCallExpression {
- private final Expression receiver;
- private final MethodNode setter;
+
private final TemporaryVariableExpression tmp;
public PoppingMethodCallExpression(final Expression receiver, final MethodNode setterMethod, final TemporaryVariableExpression tmp) {
@@ -118,21 +111,19 @@ public String getText() {
}
}, tmp);
// GRECLIPSE end
- this.receiver = receiver;
- this.setter = setterMethod;
- this.tmp = tmp;
setMethodTarget(setterMethod);
+ this.tmp = tmp;
}
@Override
public Expression transformExpression(final ExpressionTransformer transformer) {
- PoppingMethodCallExpression trn = new PoppingMethodCallExpression(receiver.transformExpression(transformer), setter, (TemporaryVariableExpression) tmp.transformExpression(transformer));
- trn.copyNodeMetaData(this);
- trn.setSourcePosition(this);
- trn.setImplicitThis(isImplicitThis());
- trn.setSafe(isSafe());
- trn.setSpreadSafe(isSpreadSafe());
- return trn;
+ PoppingMethodCallExpression call = new PoppingMethodCallExpression(getObjectExpression().transformExpression(transformer), getMethodTarget(), (TemporaryVariableExpression) tmp.transformExpression(transformer));
+ call.copyNodeMetaData(this);
+ call.setSourcePosition(this);
+ call.setSafe(isSafe());
+ call.setSpreadSafe(isSpreadSafe());
+ call.setImplicitThis(isImplicitThis());
+ return call;
}
@Override
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/CompilationUnit.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/CompilationUnit.java
index 5aaa66c32f..cf1a4549a2 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/CompilationUnit.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/CompilationUnit.java
@@ -22,10 +22,10 @@
import groovy.lang.GroovyRuntimeException;
import groovy.transform.CompilationUnitAware;
import org.codehaus.groovy.GroovyBugError;
-import org.codehaus.groovy.ast.ASTNode;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.CompileUnit;
+import org.codehaus.groovy.ast.GroovyClassVisitor;
import org.codehaus.groovy.ast.InnerClassNode;
import org.codehaus.groovy.ast.ModuleNode;
import org.codehaus.groovy.classgen.AsmClassGenerator;
@@ -800,24 +800,29 @@ public void call(SourceUnit source, GeneratorContext context, ClassNode classNod
//
// Run the Verifier on the outer class
//
+ GroovyClassVisitor visitor = verifier;
try {
- verifier.visitClass(classNode);
+ visitor.visitClass(classNode);
} catch (GroovyRuntimeException rpe) {
- ASTNode node = rpe.getNode();
- getErrorCollector().addError(
- new SyntaxException(rpe.getMessage(), node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber()),
- source
- );
+ getErrorCollector().addError(new SyntaxException(rpe.getMessage(), rpe.getNode()), source);
}
- LabelVerifier lv = new LabelVerifier(source);
- lv.visitClass(classNode);
+ visitor = new LabelVerifier(source);
+ visitor.visitClass(classNode);
- ClassCompletionVerifier completionVerifier = new ClassCompletionVerifier(source);
- completionVerifier.visitClass(classNode);
+ visitor = new InstanceOfVerifier() {
+ @Override
+ protected SourceUnit getSourceUnit() {
+ return source;
+ }
+ };
+ visitor.visitClass(classNode);
+
+ visitor = new ClassCompletionVerifier(source);
+ visitor.visitClass(classNode);
- ExtendedVerifier xverifier = new ExtendedVerifier(source);
- xverifier.visitClass(classNode);
+ visitor = new ExtendedVerifier(source);
+ visitor.visitClass(classNode);
// because the class may be generated even if a error was found
// and that class may have an invalid format we fail here if needed
@@ -826,14 +831,14 @@ public void call(SourceUnit source, GeneratorContext context, ClassNode classNod
//
// Prep the generator machinery
//
- ClassVisitor visitor = createClassVisitor();
-
+ ClassVisitor classVisitor = createClassVisitor();
+
String sourceName = (source == null ? classNode.getModule().getDescription() : source.getName());
// only show the file name and its extension like javac does in its stacktraces rather than the full path
// also takes care of both \ and / depending on the host compiling environment
if (sourceName != null)
sourceName = sourceName.substring(Math.max(sourceName.lastIndexOf('\\'), sourceName.lastIndexOf('/')) + 1);
- AsmClassGenerator generator = new AsmClassGenerator(source, context, visitor, sourceName);
+ AsmClassGenerator generator = new AsmClassGenerator(source, context, classVisitor, sourceName);
// GRECLIPSE add -- if there are errors, don't generate code
// code gen can fail unexpectedly if there was an earlier error
@@ -845,14 +850,14 @@ public void call(SourceUnit source, GeneratorContext context, ClassNode classNod
//
generator.visitClass(classNode);
- byte[] bytes = ((ClassWriter) visitor).toByteArray();
+ byte[] bytes = ((ClassWriter) classVisitor).toByteArray();
generatedClasses.add(new GroovyClass(classNode.getName(), bytes/*GRECLIPSE add*/, classNode, source/*GRECLIPSE end*/));
//
// Handle any callback that's been set
//
if (CompilationUnit.this.classgenCallback != null) {
- classgenCallback.call(visitor, classNode);
+ classgenCallback.call(classVisitor, classNode);
}
//
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/ResolveVisitor.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/ResolveVisitor.java
index b927b1c42b..edc2c76774 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/ResolveVisitor.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/ResolveVisitor.java
@@ -709,10 +709,7 @@ private boolean resolveFromDefaultImports(ClassNode type) {
}
}
- if (resolveFromDefaultImports(type, DEFAULT_IMPORTS)) {
- return true;
- }
- return false;
+ return resolveFromDefaultImports(type, DEFAULT_IMPORTS);
}
private static final EvictableCache> DEFAULT_IMPORT_CLASS_AND_PACKAGES_CACHE = new ConcurrentCommonCache<>();
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/SourceUnit.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/SourceUnit.java
index 5c32634ca1..6fba55001d 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/SourceUnit.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/SourceUnit.java
@@ -256,8 +256,7 @@ public void convert() throws CompilationFailedException {
try {
this.ast = parserPlugin.buildAST(this, this.classLoader, this.cst);
this.ast.setDescription(this.name);
- }
- catch (SyntaxException e) {
+ } catch (SyntaxException e) {
if (this.ast == null) {
// create an empty ModuleNode to represent a failed parse, in case a later phase attempts to use the AST
this.ast = new ModuleNode(this);
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/StaticImportVisitor.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/StaticImportVisitor.java
index 358f857e13..310f884dc1 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/StaticImportVisitor.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/control/StaticImportVisitor.java
@@ -525,7 +525,7 @@ private Expression findStaticMethodImportFromModule(Expression method, Expressio
ImportNode importNode = starImports.get(currentClass.getName());
starImportType = importNode == null ? null : importNode.getType();
expression = findStaticMethod(starImportType, name, args);
- if (expression != null) return expression;
+ return expression;
} else {
for (ImportNode importNode : starImports.values()) {
starImportType = importNode == null ? null : importNode.getType();
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/ASTTransformationVisitor.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/ASTTransformationVisitor.java
index 6cc077a186..6e991afbbc 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/ASTTransformationVisitor.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/ASTTransformationVisitor.java
@@ -30,6 +30,7 @@
import org.codehaus.groovy.ast.MethodNode;
import org.codehaus.groovy.ast.PropertyNode;
import org.codehaus.groovy.ast.expr.DeclarationExpression;
+import org.codehaus.groovy.ast.expr.Expression;
import org.codehaus.groovy.classgen.GeneratorContext;
import org.codehaus.groovy.control.ASTTransformationsContext;
import org.codehaus.groovy.control.CompilationFailedException;
@@ -53,6 +54,7 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
@@ -215,15 +217,52 @@ public void visitClass(ClassNode classNode) {
*
* @param node the node to be processed
*/
- public void visitAnnotations(AnnotatedNode node) {
+ public void visitAnnotations(final AnnotatedNode node) {
super.visitAnnotations(node);
- for (AnnotationNode annotation : node.getAnnotations()) {
+ for (AnnotationNode annotation : distinctAnnotations(node)) {
if (transforms.containsKey(annotation)) {
targetNodes.add(new ASTNode[]{annotation, node});
}
}
}
+ private static final List COMPILEDYNAMIC_AND_COMPILESTATIC_AND_TYPECHECKED =
+ Arrays.asList("groovy.transform.CompileDynamic", "groovy.transform.CompileStatic", "groovy.transform.TypeChecked");
+
+ // GROOVY-9215
+ // `StaticTypeCheckingVisitor` visits multi-times because `node` has duplicated `CompileStatic` and `TypeChecked`
+ // If annotation with higher priority appears, annotation with lower priority will be ignored
+ // Priority: CompileDynamic > CompileStatic > TypeChecked
+ private List distinctAnnotations(AnnotatedNode node) {
+ List result = new LinkedList<>();
+ AnnotationNode resultAnnotationNode = null;
+ int resultIndex = -1;
+
+ for (AnnotationNode annotationNode : node.getAnnotations()) {
+ int index = COMPILEDYNAMIC_AND_COMPILESTATIC_AND_TYPECHECKED.indexOf(annotationNode.getClassNode().getName());
+ if (-1 != index) {
+ if (1 == index) { // CompileStatic
+ Expression value = annotationNode.getMember("value");
+ if (null != value && "groovy.transform.TypeCheckingMode.SKIP".equals(value.getText())) {
+ index = 0; // `CompileStatic` with "SKIP" `value` is actually `CompileDynamic`
+ }
+ }
+
+ if (null == resultAnnotationNode || index < resultIndex) {
+ resultAnnotationNode = annotationNode;
+ resultIndex = index;
+ }
+ continue;
+ }
+ result.add(annotationNode);
+ }
+
+ if (null != resultAnnotationNode) result.add(resultAnnotationNode);
+
+ return result;
+ }
+
+
public static void addPhaseOperations(final CompilationUnit compilationUnit) {
final ASTTransformationsContext context = compilationUnit.getASTTransformationsContext();
addGlobalTransforms(context);
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/FieldASTTransformation.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/FieldASTTransformation.java
index a24d3a4325..4d967bf704 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/FieldASTTransformation.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/FieldASTTransformation.java
@@ -36,7 +36,6 @@
import org.codehaus.groovy.ast.VariableScope;
import org.codehaus.groovy.ast.expr.ArgumentListExpression;
import org.codehaus.groovy.ast.expr.ClosureExpression;
-import org.codehaus.groovy.ast.expr.ConstantExpression;
import org.codehaus.groovy.ast.expr.ConstructorCallExpression;
import org.codehaus.groovy.ast.expr.DeclarationExpression;
import org.codehaus.groovy.ast.expr.Expression;
@@ -58,6 +57,7 @@
import static org.codehaus.groovy.ast.ClassHelper.make;
import static org.codehaus.groovy.ast.tools.GeneralUtils.assignX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.block;
+import static org.codehaus.groovy.ast.tools.GeneralUtils.nullX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.param;
import static org.codehaus.groovy.ast.tools.GeneralUtils.params;
import static org.codehaus.groovy.ast.tools.GeneralUtils.propX;
@@ -175,7 +175,7 @@ public Expression transform(Expression expr) {
// TODO make EmptyExpression work
// partially works but not if only thing in script
// return EmptyExpression.INSTANCE;
- return new ConstantExpression(null);
+ return nullX();
}
addError("Annotation " + MY_TYPE_NAME + " can only be used within a Script body.", expr);
return expr;
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/LazyASTTransformation.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/LazyASTTransformation.java
index 4ae9452689..6bddae08f7 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/LazyASTTransformation.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/LazyASTTransformation.java
@@ -54,6 +54,7 @@
import static org.codehaus.groovy.ast.tools.GeneralUtils.ifElseS;
import static org.codehaus.groovy.ast.tools.GeneralUtils.localVarX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.notNullX;
+import static org.codehaus.groovy.ast.tools.GeneralUtils.nullX;
import static org.codehaus.groovy.ast.tools.GeneralUtils.param;
import static org.codehaus.groovy.ast.tools.GeneralUtils.params;
import static org.codehaus.groovy.ast.tools.GeneralUtils.propX;
@@ -68,7 +69,7 @@
public class LazyASTTransformation extends AbstractASTTransformation {
private static final ClassNode SOFT_REF = makeWithoutCaching(SoftReference.class, false);
- private static final Expression NULL_EXPR = ConstantExpression.NULL;
+ private static final Expression NULL_EXPR = nullX();
public void visit(ASTNode[] nodes, SourceUnit source) {
init(nodes, source);
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java
index 1b2dc6c275..9b3ae06054 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java
@@ -469,9 +469,6 @@ public void visitForLoop(final ForStatement forLoop) {
componentType = inferLoopElementType(collectionType);
}
forLoop.getVariable().setType(componentType);
- // GRECLIPSE edit -- preserve origin type for code select
- //forLoop.getVariable().setOriginType(componentType);
- // GRECLIPSE end
}
}
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
index 90d04668a5..2328797ce7 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -263,7 +263,6 @@
import static org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.toMethodParametersString;
import static org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.typeCheckMethodArgumentWithGenerics;
import static org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.typeCheckMethodsWithGenerics;
-import static org.codehaus.groovy.transform.stc.StaticTypesMarker.DIRECT_METHOD_CALL_TARGET;
/**
* The main class code visitor responsible for static type checking. It will perform various inspections like checking
@@ -315,7 +314,6 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
protected final ReturnAdder.ReturnStatementListener returnListener = new ReturnAdder.ReturnStatementListener() {
public void returnStatementAdded(final ReturnStatement returnStatement) {
- if (returnStatement.getExpression() == ConstantExpression.NULL) return;
if (isNullConstant(returnStatement.getExpression())) return;
checkReturnType(returnStatement);
if (typeCheckingContext.getEnclosingClosure() != null) {
@@ -1482,7 +1480,7 @@ protected boolean existsProperty(final PropertyExpression pexp, final boolean re
return true;
}
// GRECLIPSE end
- LinkedList queue = new LinkedList();
+ LinkedList queue = new LinkedList<>();
queue.add(testClass);
if (isPrimitiveType(testClass)) {
queue.add(getWrapper(testClass));
@@ -1606,13 +1604,12 @@ protected boolean existsProperty(final PropertyExpression pexp, final boolean re
if (storeProperty(propertyNode, pexp, current, visitor, receiver.getData())) return true;
if (storeField(field, true, pexp, current, visitor, receiver.getData(), !readMode)) return true;
- // if the property expression is an attribute expression (o.@attr), then
- // we stop now, otherwise we must check the parent class
- if (/*!isAttributeExpression && */current.getSuperClass() != null) {
+ if (current.getSuperClass() != null) {
queue.add(current.getUnresolvedSuperClass());
}
}
- // GROOVY-5568, the property may be defined by DGM
+
+ // GROOVY-5568: the property may be defined by DGM
List dgmReceivers = new ArrayList(2);
dgmReceivers.add(testClass);
if (isPrimitiveType(testClass)) dgmReceivers.add(getWrapper(testClass));
@@ -1635,6 +1632,25 @@ protected boolean existsProperty(final PropertyExpression pexp, final boolean re
}
}
}
+
+ // GROOVY-7996: check if receiver implements get(String)/set(String,Object) or propertyMissing(String)
+ if (!testClass.isArray() && !isPrimitiveType(getUnwrapper(testClass))
+ && pexp.isImplicitThis() && typeCheckingContext.getEnclosingClosure() != null) {
+ MethodNode mopMethod;
+ if (readMode) {
+ mopMethod = testClass.getMethod("get", new Parameter[]{new Parameter(STRING_TYPE, "name")});
+ } else {
+ mopMethod = testClass.getMethod("set", new Parameter[]{new Parameter(STRING_TYPE, "name"), new Parameter(OBJECT_TYPE, "value")});
+ }
+ if (mopMethod == null) mopMethod = testClass.getMethod("propertyMissing", new Parameter[]{new Parameter(STRING_TYPE, "propertyName")});
+
+ if (mopMethod != null) {
+ pexp.putNodeMetaData(StaticTypesMarker.DYNAMIC_RESOLUTION, Boolean.TRUE);
+ pexp.removeNodeMetaData(StaticTypesMarker.DECLARATION_INFERRED_TYPE);
+ pexp.removeNodeMetaData(StaticTypesMarker.INFERRED_TYPE);
+ return true;
+ }
+ }
}
for (Receiver receiver : receivers) {
@@ -2270,11 +2286,11 @@ && findMethod(receiver, "", args).isEmpty()) {
Set methods = typeCheckingContext.methodsToBeVisited;
if (!methods.isEmpty()) { // indicates specific methods have STC
typeCheckingContext.methodsToBeVisited = Collections.emptySet();
-
+
ClassNode anonType = call.getType();
visitClass(anonType); // visit anon. inner class inline with method
anonType.putNodeMetaData(StaticTypeCheckingVisitor.class, Boolean.TRUE);
-
+
typeCheckingContext.methodsToBeVisited = methods;
}
}
diff --git a/base/org.codehaus.groovy25/src/org/codehaus/groovy/vmplugin/v5/Java5.java b/base/org.codehaus.groovy25/src/org/codehaus/groovy/vmplugin/v5/Java5.java
index 4daece2c53..7041eed0c0 100644
--- a/base/org.codehaus.groovy25/src/org/codehaus/groovy/vmplugin/v5/Java5.java
+++ b/base/org.codehaus.groovy25/src/org/codehaus/groovy/vmplugin/v5/Java5.java
@@ -24,6 +24,7 @@
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.CompileUnit;
+import org.codehaus.groovy.ast.ConstructorNode;
import org.codehaus.groovy.ast.FieldNode;
import org.codehaus.groovy.ast.GenericsType;
import org.codehaus.groovy.ast.MethodNode;
@@ -362,10 +363,7 @@ protected int getElementCode(ElementType value) {
}
private static void setMethodDefaultValue(MethodNode mn, Method m) {
- Object defaultValue = m.getDefaultValue();
- ConstantExpression cExp = ConstantExpression.NULL;
- if (defaultValue!=null) cExp = new ConstantExpression(defaultValue);
- mn.setCode(new ReturnStatement(cExp));
+ mn.setCode(new ReturnStatement(new ConstantExpression(m.getDefaultValue())));
mn.setAnnotationDefault(true);
}
@@ -410,7 +408,8 @@ public void configureClassNode(CompileUnit compileUnit, ClassNode classNode) {
Parameter[] params = makeParameters(compileUnit, ctor.getGenericParameterTypes(), ctor.getParameterTypes(), getConstructorParameterAnnotations(ctor), ctor);
// GRECLIPSE end
ClassNode[] exceptions = makeClassNodes(compileUnit, ctor.getGenericExceptionTypes(), ctor.getExceptionTypes());
- classNode.addConstructor(ctor.getModifiers(), params, exceptions, null);
+ ConstructorNode cn = classNode.addConstructor(ctor.getModifiers(), params, exceptions, null);
+ setAnnotationMetaData(ctor.getAnnotations(), cn);
}
Class sc = clazz.getSuperclass();
diff --git a/extras/groovy-eclipse-batch-builder/build.properties b/extras/groovy-eclipse-batch-builder/build.properties
index 6ed1a70216..9a1d33fdbc 100644
--- a/extras/groovy-eclipse-batch-builder/build.properties
+++ b/extras/groovy-eclipse-batch-builder/build.properties
@@ -1,6 +1,6 @@
# version numbers
version2.4=2.4.18-01
-version2.5=2.5.8-03
+version2.5=2.5.9-01
version3.0=3.0.0-01
# uncomment to do a particular build -- only one should be uncommented at a time
diff --git a/extras/groovy-eclipse-compiler-tests/pom.xml b/extras/groovy-eclipse-compiler-tests/pom.xml
index 9938eea53c..f6911bc433 100644
--- a/extras/groovy-eclipse-compiler-tests/pom.xml
+++ b/extras/groovy-eclipse-compiler-tests/pom.xml
@@ -8,9 +8,9 @@
- 2.5.8
+ 2.5.9
- 2.5.8-03
+ 2.5.9-01
3.6.2
diff --git a/extras/groovy-eclipse-maven-tests/pom.xml b/extras/groovy-eclipse-maven-tests/pom.xml
index efebb6f344..69e4499b13 100644
--- a/extras/groovy-eclipse-maven-tests/pom.xml
+++ b/extras/groovy-eclipse-maven-tests/pom.xml
@@ -34,7 +34,7 @@
org.codehaus.groovy
groovy-all
- 2.5.8
+ 2.5.9
pom
@@ -70,7 +70,7 @@
org.codehaus.groovy
groovy-eclipse-batch
- 2.5.8-SNAPSHOT
+ 2.5.9-SNAPSHOT
diff --git a/extras/groovy-eclipse-quickstart/src/main/resources/archetype-resources/pom.xml b/extras/groovy-eclipse-quickstart/src/main/resources/archetype-resources/pom.xml
index 61982bf8d2..a2b8176159 100755
--- a/extras/groovy-eclipse-quickstart/src/main/resources/archetype-resources/pom.xml
+++ b/extras/groovy-eclipse-quickstart/src/main/resources/archetype-resources/pom.xml
@@ -19,13 +19,13 @@
org.codehaus.groovy
groovy
- 2.5.8
+ 2.5.9
indy
org.codehaus.groovy
groovy-test
- 2.5.8
+ 2.5.9
indy
@@ -58,7 +58,7 @@
org.codehaus.groovy
groovy-eclipse-batch
- 2.5.8-03
+ 2.5.9-01
diff --git a/ide/Feature-org.codehaus.groovy25.feature/feature.xml b/ide/Feature-org.codehaus.groovy25.feature/feature.xml
index 8f2a819519..b3b9417654 100644
--- a/ide/Feature-org.codehaus.groovy25.feature/feature.xml
+++ b/ide/Feature-org.codehaus.groovy25.feature/feature.xml
@@ -22,7 +22,7 @@
id="org.codehaus.groovy"
download-size="0"
install-size="0"
- version="2.5.8.qualifier"
+ version="2.5.9.qualifier"
/>