();
- accumulator.put(declaringClassName, nodes);
- }
- nodes.add(node);
- }
- }
- }
- }
-
- }
-
- /**
- * @return true if the class node is either a GString or the LUB of String and GString.
- */
- public static boolean isGStringOrGStringStringLUB(ClassNode node) {
- return GSTRING_TYPE.equals(node) || GSTRING_STRING_CLASSNODE.equals(node);
- }
-
- /**
- * @param node the node to be tested
- * @return true if the node is using generics types and one of those types is a gstring or string/gstring lub
- */
- public static boolean isParameterizedWithGStringOrGStringString(ClassNode node) {
- if (node.isArray()) return isParameterizedWithGStringOrGStringString(node.getComponentType());
- if (node.isUsingGenerics()) {
- GenericsType[] genericsTypes = node.getGenericsTypes();
- if (genericsTypes != null) {
- for (GenericsType genericsType : genericsTypes) {
- if (isGStringOrGStringStringLUB(genericsType.getType())) return true;
- }
- }
- }
- return node.getSuperClass() != null && isParameterizedWithGStringOrGStringString(node.getUnresolvedSuperClass());
- }
-
- /**
- * @param node the node to be tested
- * @return true if the node is using generics types and one of those types is a string
- */
- public static boolean isParameterizedWithString(ClassNode node) {
- if (node.isArray()) return isParameterizedWithString(node.getComponentType());
- if (node.isUsingGenerics()) {
- GenericsType[] genericsTypes = node.getGenericsTypes();
- if (genericsTypes != null) {
- for (GenericsType genericsType : genericsTypes) {
- if (STRING_TYPE.equals(genericsType.getType())) return true;
- }
- }
- }
- return node.getSuperClass() != null && isParameterizedWithString(node.getUnresolvedSuperClass());
- }
-
- public static boolean missesGenericsTypes(ClassNode cn) {
- if (cn.isArray()) return missesGenericsTypes(cn.getComponentType());
- GenericsType[] cnTypes = cn.getGenericsTypes();
- GenericsType[] rnTypes = cn.redirect().getGenericsTypes();
- if (rnTypes != null && cnTypes == null) return true;
- if (cnTypes != null) {
- for (GenericsType genericsType : cnTypes) {
- if (genericsType.isPlaceholder()) return true;
- }
- }
- return false;
- }
-
- /**
- * A helper method that can be used to evaluate expressions as found in annotation
- * parameters. For example, it will evaluate a constant, be it referenced directly as
- * an integer or as a reference to a field.
- *
- * If this method throws an exception, then the expression cannot be evaluated on its own.
- *
- * @param expr the expression to be evaluated
- * @param config the compiler configuration
- * @return the result of the expression
- */
- public static Object evaluateExpression(Expression expr, CompilerConfiguration config) {
- String className = "Expression$" + UUID.randomUUID().toString().replace('-', '$');
- ClassNode node = new ClassNode(className, Opcodes.ACC_PUBLIC, OBJECT_TYPE);
- ReturnStatement code = new ReturnStatement(expr);
- node.addMethod(new MethodNode("eval", Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC, OBJECT_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, code));
- CompilerConfiguration copyConf = new CompilerConfiguration(config);
- CompilationUnit cu = new CompilationUnit(copyConf);
- cu.addClassNode(node);
- cu.compile(Phases.CLASS_GENERATION);
- List classes = (List) cu.getClasses();
- Class aClass = cu.getClassLoader().defineClass(className, classes.get(0).getBytes());
- try {
- return aClass.getMethod("eval").invoke(null);
- } catch (IllegalAccessException e) {
- throw new GroovyBugError(e);
- } catch (InvocationTargetException e) {
- throw new GroovyBugError(e);
- } catch (NoSuchMethodException e) {
- throw new GroovyBugError(e);
- }
- }
-
- /**
- * Collects all interfaces of a class node, including those defined by the
- * super class.
- *
- * @param node a class for which we want to retrieve all interfaces
- * @return a set of interfaces implemented by this class node
- */
- public static Set collectAllInterfaces(ClassNode node) {
- Set result = new HashSet();
- collectAllInterfaces(node, result);
- return result;
- }
-
- /**
- * Collects all interfaces of a class node, including those defined by the
- * super class.
- *
- * @param node a class for which we want to retrieve all interfaces
- * @param out the set where to collect interfaces
- */
- private static void collectAllInterfaces(final ClassNode node, final Set out) {
- if (node == null) return;
- Set allInterfaces = node.getAllInterfaces();
- out.addAll(allInterfaces);
- collectAllInterfaces(node.getSuperClass(), out);
- }
-
- /**
- * Returns true if the class node represents a the class node for the Class class
- * and if the parametrized type is a neither a placeholder or a wildcard. For example,
- * the class node Class<Foo> where Foo is a class would return true, but the class
- * node for Class<?> would return false.
- *
- * @param classNode a class node to be tested
- * @return true if it is the class node for Class and its generic type is a real class
- */
- public static boolean isClassClassNodeWrappingConcreteType(ClassNode classNode) {
- GenericsType[] genericsTypes = classNode.getGenericsTypes();
- return CLASS_Type.equals(classNode)
- && classNode.isUsingGenerics()
- && genericsTypes != null
- && !genericsTypes[0].isPlaceholder()
- && !genericsTypes[0].isWildcard();
- }
-
- public static List findSetters(ClassNode cn, String setterName, boolean voidOnly) {
- List result = null;
- for (MethodNode method : cn.getDeclaredMethods(setterName)) {
- if (setterName.equals(method.getName())
- && (!voidOnly || VOID_TYPE == method.getReturnType())
- && method.getParameters().length == 1) {
- if (result == null) {
- result = new LinkedList();
- }
- result.add(method);
- }
- }
- if (result == null) {
- ClassNode parent = cn.getSuperClass();
- if (parent != null) {
- return findSetters(parent, setterName, voidOnly);
- }
- return Collections.emptyList();
- }
- return result;
- }
-
- public static ClassNode isTraitSelf(VariableExpression vexp) {
- if (Traits.THIS_OBJECT.equals(vexp.getName())) {
- Variable accessedVariable = vexp.getAccessedVariable();
- ClassNode type = accessedVariable != null ? accessedVariable.getType() : null;
- if (accessedVariable instanceof Parameter
- && Traits.isTrait(type)) {
- return type;
- }
- }
- return null;
- }
-}
diff --git a/base/org.codehaus.groovy26/.checkstyle b/base/org.codehaus.groovy30/.checkstyle
similarity index 97%
rename from base/org.codehaus.groovy26/.checkstyle
rename to base/org.codehaus.groovy30/.checkstyle
index a3e78be317..82acf81d11 100644
--- a/base/org.codehaus.groovy26/.checkstyle
+++ b/base/org.codehaus.groovy30/.checkstyle
@@ -25,7 +25,6 @@
-
@@ -33,6 +32,7 @@
+
@@ -40,6 +40,7 @@
+
@@ -72,7 +73,6 @@
-
diff --git a/base/org.codehaus.groovy26/.classpath b/base/org.codehaus.groovy30/.classpath
similarity index 68%
rename from base/org.codehaus.groovy26/.classpath
rename to base/org.codehaus.groovy30/.classpath
index d22d959068..b6fa83c870 100644
--- a/base/org.codehaus.groovy26/.classpath
+++ b/base/org.codehaus.groovy30/.classpath
@@ -6,17 +6,17 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/base/org.codehaus.groovy26/.externalToolBuilders/Antlr2 Builder.launch b/base/org.codehaus.groovy30/.externalToolBuilders/Antlr2 Builder.launch
similarity index 93%
rename from base/org.codehaus.groovy26/.externalToolBuilders/Antlr2 Builder.launch
rename to base/org.codehaus.groovy30/.externalToolBuilders/Antlr2 Builder.launch
index 85953ebc4e..7b83fbc438 100644
--- a/base/org.codehaus.groovy26/.externalToolBuilders/Antlr2 Builder.launch
+++ b/base/org.codehaus.groovy30/.externalToolBuilders/Antlr2 Builder.launch
@@ -4,14 +4,14 @@
-
+
-
+
diff --git a/base/org.codehaus.groovy26/.externalToolBuilders/Antlr4 Builder.launch b/base/org.codehaus.groovy30/.externalToolBuilders/Antlr4 Builder.launch
similarity index 89%
rename from base/org.codehaus.groovy26/.externalToolBuilders/Antlr4 Builder.launch
rename to base/org.codehaus.groovy30/.externalToolBuilders/Antlr4 Builder.launch
index efa5d9a456..9b814ec8b7 100644
--- a/base/org.codehaus.groovy26/.externalToolBuilders/Antlr4 Builder.launch
+++ b/base/org.codehaus.groovy30/.externalToolBuilders/Antlr4 Builder.launch
@@ -4,14 +4,14 @@
-
+
-
+
diff --git a/base/org.codehaus.groovy26/.gitignore b/base/org.codehaus.groovy30/.gitignore
similarity index 100%
rename from base/org.codehaus.groovy26/.gitignore
rename to base/org.codehaus.groovy30/.gitignore
diff --git a/base/org.codehaus.groovy26/.project b/base/org.codehaus.groovy30/.project
similarity index 98%
rename from base/org.codehaus.groovy26/.project
rename to base/org.codehaus.groovy30/.project
index 07fea37a7f..7bc3b69f03 100644
--- a/base/org.codehaus.groovy26/.project
+++ b/base/org.codehaus.groovy30/.project
@@ -1,7 +1,7 @@
- org.codehaus.groovy26
+ org.codehaus.groovy30
org.eclipse.ui.externaltools.ExternalToolBuilder
diff --git a/base/org.codehaus.groovy26/.settings/org.eclipse.core.resources.prefs b/base/org.codehaus.groovy30/.settings/org.eclipse.core.resources.prefs
similarity index 100%
rename from base/org.codehaus.groovy26/.settings/org.eclipse.core.resources.prefs
rename to base/org.codehaus.groovy30/.settings/org.eclipse.core.resources.prefs
diff --git a/base/org.codehaus.groovy26/.settings/org.eclipse.core.runtime.prefs b/base/org.codehaus.groovy30/.settings/org.eclipse.core.runtime.prefs
similarity index 100%
rename from base/org.codehaus.groovy26/.settings/org.eclipse.core.runtime.prefs
rename to base/org.codehaus.groovy30/.settings/org.eclipse.core.runtime.prefs
diff --git a/base/org.codehaus.groovy26/.settings/org.eclipse.jdt.core.prefs b/base/org.codehaus.groovy30/.settings/org.eclipse.jdt.core.prefs
similarity index 100%
rename from base/org.codehaus.groovy26/.settings/org.eclipse.jdt.core.prefs
rename to base/org.codehaus.groovy30/.settings/org.eclipse.jdt.core.prefs
diff --git a/base/org.codehaus.groovy26/.settings/org.eclipse.jdt.groovy.core.prefs b/base/org.codehaus.groovy30/.settings/org.eclipse.jdt.groovy.core.prefs
similarity index 100%
rename from base/org.codehaus.groovy26/.settings/org.eclipse.jdt.groovy.core.prefs
rename to base/org.codehaus.groovy30/.settings/org.eclipse.jdt.groovy.core.prefs
diff --git a/base/org.codehaus.groovy26/.settings/org.eclipse.jdt.ui.prefs b/base/org.codehaus.groovy30/.settings/org.eclipse.jdt.ui.prefs
similarity index 100%
rename from base/org.codehaus.groovy26/.settings/org.eclipse.jdt.ui.prefs
rename to base/org.codehaus.groovy30/.settings/org.eclipse.jdt.ui.prefs
diff --git a/base/org.codehaus.groovy30/META-INF/MANIFEST.MF b/base/org.codehaus.groovy30/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..c94353ff58
--- /dev/null
+++ b/base/org.codehaus.groovy30/META-INF/MANIFEST.MF
@@ -0,0 +1,112 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.codehaus.groovy
+Automatic-Module-Name: org.codehaus.groovy
+Bundle-Name: Groovy Runtime
+Bundle-Vendor: Pivotal Software, Inc.
+Bundle-Version: 3.0.0.qualifier
+Bundle-ClassPath: eclipse-trace.jar,
+ groovy-eclipse.jar,
+ lib/ivy-2.4.0.jar,
+ lib/groovy-3.0.0-indy.jar,
+ lib/groovy-test-3.0.0-indy.jar
+Export-Package: groovy.beans;version="3.0.0",
+ groovy.cli;version="3.0.0",
+ groovy.grape;version="3.0.0",
+ groovy.inspect;version="3.0.0",
+ groovy.io;version="3.0.0",
+ groovy.lang;version="3.0.0",
+ groovy.lang.groovydoc;version="3.0.0",
+ groovy.mock.interceptor;version="3.0.0",
+ groovy.security;version="3.0.0",
+ groovy.test;version="3.0.0",
+ groovy.time;version="3.0.0",
+ groovy.transform;version="3.0.0",
+ groovy.transform.builder;version="3.0.0",
+ groovy.transform.options;version="3.0.0",
+ groovy.transform.stc;version="3.0.0",
+ groovy.ui;version="3.0.0",
+ groovy.util;version="3.0.0",
+ groovy.util.logging;version="3.0.0",
+ groovy.xml;version="3.0.0",
+ groovyjarjarantlr;x-internal:=true,
+ groovyjarjarasm.asm;x-internal:=true,
+ org.apache.groovy.ast.tools;version="3.0.0",
+ org.apache.groovy.internal.metaclass;version="3.0.0",
+ org.apache.groovy.internal.util;version="3.0.0",
+ org.apache.groovy.io;version="3.0.0",
+ org.apache.groovy.lang.annotation;version="3.0.0",
+ org.apache.groovy.metaclass;version="3.0.0",
+ org.apache.groovy.parser;version="3.0.0",
+ org.apache.groovy.parser.antlr4;version="3.0.0",
+ org.apache.groovy.parser.antlr4.util;version="3.0.0",
+ org.apache.groovy.plugin;version="3.0.0",
+ org.apache.groovy.util;version="3.0.0",
+ org.apache.groovy.util.concurrentlinkedhashmap;version="3.0.0",
+ org.codehaus.greclipse;x-internal:=true,
+ org.codehaus.groovy;version="3.0.0",
+ org.codehaus.groovy.activator,
+ org.codehaus.groovy.antlr;version="3.0.0",
+ org.codehaus.groovy.antlr.java;version="3.0.0",
+ org.codehaus.groovy.antlr.parser;version="3.0.0",
+ org.codehaus.groovy.antlr.treewalker;version="3.0.0",
+ org.codehaus.groovy.ast;version="3.0.0",
+ org.codehaus.groovy.ast.builder;version="3.0.0",
+ org.codehaus.groovy.ast.decompiled;version="3.0.0",
+ org.codehaus.groovy.ast.expr;version="3.0.0",
+ org.codehaus.groovy.ast.stmt;version="3.0.0",
+ org.codehaus.groovy.ast.tools;version="3.0.0",
+ org.codehaus.groovy.classgen;version="3.0.0",
+ org.codehaus.groovy.classgen.asm;version="3.0.0",
+ org.codehaus.groovy.classgen.asm.indy;version="3.0.0",
+ org.codehaus.groovy.classgen.asm.indy.sc;version="3.0.0",
+ org.codehaus.groovy.classgen.asm.sc;version="3.0.0",
+ org.codehaus.groovy.classgen.asm.util;version="3.0.0",
+ org.codehaus.groovy.control;version="3.0.0",
+ org.codehaus.groovy.control.customizers;version="3.0.0",
+ org.codehaus.groovy.control.customizers.builder;version="3.0.0",
+ org.codehaus.groovy.control.io;version="3.0.0",
+ org.codehaus.groovy.control.messages;version="3.0.0",
+ org.codehaus.groovy.eclipse,
+ org.codehaus.groovy.plugin;version="3.0.0",
+ org.codehaus.groovy.reflection;version="3.0.0",
+ org.codehaus.groovy.reflection.android;version="3.0.0",
+ org.codehaus.groovy.reflection.stdclasses;version="3.0.0",
+ org.codehaus.groovy.reflection.v7;version="3.0.0",
+ org.codehaus.groovy.runtime;version="3.0.0",
+ org.codehaus.groovy.runtime.callsite;version="3.0.0",
+ org.codehaus.groovy.runtime.dgmimpl;version="3.0.0",
+ org.codehaus.groovy.runtime.dgmimpl.arrays;version="3.0.0",
+ org.codehaus.groovy.runtime.m12n;version="3.0.0",
+ org.codehaus.groovy.runtime.memoize;version="3.0.0",
+ org.codehaus.groovy.runtime.metaclass;version="3.0.0",
+ org.codehaus.groovy.runtime.powerassert;version="3.0.0",
+ org.codehaus.groovy.runtime.typehandling;version="3.0.0",
+ org.codehaus.groovy.runtime.wrappers;version="3.0.0",
+ org.codehaus.groovy.syntax;version="3.0.0",
+ org.codehaus.groovy.tools;version="3.0.0",
+ org.codehaus.groovy.tools.ast;version="3.0.0",
+ org.codehaus.groovy.tools.gse;version="3.0.0",
+ org.codehaus.groovy.tools.javac;version="3.0.0",
+ org.codehaus.groovy.tools.shell;version="3.0.0",
+ org.codehaus.groovy.tools.shell.util;version="3.0.0",
+ org.codehaus.groovy.transform;version="3.0.0",
+ org.codehaus.groovy.transform.sc;version="3.0.0",
+ org.codehaus.groovy.transform.sc.transformers;version="3.0.0",
+ org.codehaus.groovy.transform.stc;version="3.0.0",
+ org.codehaus.groovy.transform.tailrec;version="3.0.0",
+ org.codehaus.groovy.transform.trait;version="3.0.0",
+ org.codehaus.groovy.util;version="3.0.0",
+ org.codehaus.groovy.vmplugin;version="3.0.0",
+ org.codehaus.groovy.vmplugin.v5;version="3.0.0",
+ org.codehaus.groovy.vmplugin.v6;version="3.0.0",
+ org.codehaus.groovy.vmplugin.v7;version="3.0.0",
+ org.codehaus.groovy.vmplugin.v8;version="3.0.0",
+ org.codehaus.groovy.vmplugin.v9;version="3.0.0"
+Require-Bundle: org.eclipse.core.runtime,
+ org.apache.ant;resolution:=optional,
+ org.junit;resolution:=optional
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.codehaus.groovy.activator.GroovyActivator
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Eclipse-BundleShape: dir
diff --git a/base/org.codehaus.groovy30/VERSION b/base/org.codehaus.groovy30/VERSION
new file mode 100644
index 0000000000..74c9a97812
--- /dev/null
+++ b/base/org.codehaus.groovy30/VERSION
@@ -0,0 +1 @@
+2018-12-31: GROOVY_3_0_0_ALPHA_4
diff --git a/base/org.codehaus.groovy26/about.html b/base/org.codehaus.groovy30/about.html
similarity index 85%
rename from base/org.codehaus.groovy26/about.html
rename to base/org.codehaus.groovy30/about.html
index b849e061e3..e301a13011 100644
--- a/base/org.codehaus.groovy26/about.html
+++ b/base/org.codehaus.groovy30/about.html
@@ -24,12 +24,12 @@ License
Third Party Content
-groovy-2.6.0-indy.jar
-groovy-test-2.6.0-indy.jar
+groovy-3.0.0-indy.jar
+groovy-test-3.0.0-indy.jar
-- Obtained from: https://dist.apache.org/repos/dist/dev/groovy/2.6.0/distribution/apache-groovy-binary-2.6.0.zip
-- Sources available at: https://dist.apache.org/repos/dist/dev/groovy/2.6.0/sources/apache-groovy-src-2.6.0.zip
+- Obtained from: https://dist.apache.org/repos/dist/dev/groovy/3.0.0/distribution/apache-groovy-binary-3.0.0.zip
+- Sources available at: https://dist.apache.org/repos/dist/dev/groovy/3.0.0/sources/apache-groovy-src-3.0.0.zip
- License kind: ASL
- License URL: http://www.apache.org/licenses/LICENSE-2.0.html
- License text: asl-v20.txt
diff --git a/base/org.codehaus.groovy26/about_files/antlr2-license.txt b/base/org.codehaus.groovy30/about_files/antlr2-license.txt
similarity index 100%
rename from base/org.codehaus.groovy26/about_files/antlr2-license.txt
rename to base/org.codehaus.groovy30/about_files/antlr2-license.txt
diff --git a/base/org.codehaus.groovy26/about_files/antlr4-license.txt b/base/org.codehaus.groovy30/about_files/antlr4-license.txt
similarity index 100%
rename from base/org.codehaus.groovy26/about_files/antlr4-license.txt
rename to base/org.codehaus.groovy30/about_files/antlr4-license.txt
diff --git a/base/org.codehaus.groovy26/about_files/asl2-license.txt b/base/org.codehaus.groovy30/about_files/asl2-license.txt
similarity index 100%
rename from base/org.codehaus.groovy26/about_files/asl2-license.txt
rename to base/org.codehaus.groovy30/about_files/asl2-license.txt
diff --git a/base/org.codehaus.groovy26/about_files/asm-license.txt b/base/org.codehaus.groovy30/about_files/asm-license.txt
similarity index 100%
rename from base/org.codehaus.groovy26/about_files/asm-license.txt
rename to base/org.codehaus.groovy30/about_files/asm-license.txt
diff --git a/base/org.codehaus.groovy26/build.antlr2x b/base/org.codehaus.groovy30/build.antlr2x
similarity index 89%
rename from base/org.codehaus.groovy26/build.antlr2x
rename to base/org.codehaus.groovy30/build.antlr2x
index 11b73c533c..f3b0bacea0 100644
--- a/base/org.codehaus.groovy26/build.antlr2x
+++ b/base/org.codehaus.groovy30/build.antlr2x
@@ -1,7 +1,7 @@
-
+
diff --git a/base/org.codehaus.groovy26/build.antlr4x b/base/org.codehaus.groovy30/build.antlr4x
similarity index 100%
rename from base/org.codehaus.groovy26/build.antlr4x
rename to base/org.codehaus.groovy30/build.antlr4x
diff --git a/base/org.codehaus.groovy26/build.properties b/base/org.codehaus.groovy30/build.properties
similarity index 100%
rename from base/org.codehaus.groovy26/build.properties
rename to base/org.codehaus.groovy30/build.properties
diff --git a/base/org.codehaus.groovy26/lib/groovy-2.6.0-indy.jar b/base/org.codehaus.groovy30/lib/groovy-3.0.0-indy.jar
similarity index 59%
rename from base/org.codehaus.groovy26/lib/groovy-2.6.0-indy.jar
rename to base/org.codehaus.groovy30/lib/groovy-3.0.0-indy.jar
index a8f43a2fdc..ebb1e52df9 100644
Binary files a/base/org.codehaus.groovy26/lib/groovy-2.6.0-indy.jar and b/base/org.codehaus.groovy30/lib/groovy-3.0.0-indy.jar differ
diff --git a/base/org.codehaus.groovy30/lib/groovy-3.0.0-javadoc.jar b/base/org.codehaus.groovy30/lib/groovy-3.0.0-javadoc.jar
new file mode 100644
index 0000000000..e4291fc1f2
Binary files /dev/null and b/base/org.codehaus.groovy30/lib/groovy-3.0.0-javadoc.jar differ
diff --git a/base/org.codehaus.groovy26/lib/groovy-2.6.0-sources.jar b/base/org.codehaus.groovy30/lib/groovy-3.0.0-sources.jar
similarity index 62%
rename from base/org.codehaus.groovy26/lib/groovy-2.6.0-sources.jar
rename to base/org.codehaus.groovy30/lib/groovy-3.0.0-sources.jar
index 585fb4aed5..709b77c082 100644
Binary files a/base/org.codehaus.groovy26/lib/groovy-2.6.0-sources.jar and b/base/org.codehaus.groovy30/lib/groovy-3.0.0-sources.jar differ
diff --git a/base/org.codehaus.groovy30/lib/groovy-test-3.0.0-indy.jar b/base/org.codehaus.groovy30/lib/groovy-test-3.0.0-indy.jar
new file mode 100644
index 0000000000..0dcedaf8a0
Binary files /dev/null and b/base/org.codehaus.groovy30/lib/groovy-test-3.0.0-indy.jar differ
diff --git a/base/org.codehaus.groovy30/lib/groovy-test-3.0.0-javadoc.jar b/base/org.codehaus.groovy30/lib/groovy-test-3.0.0-javadoc.jar
new file mode 100644
index 0000000000..9666999584
Binary files /dev/null and b/base/org.codehaus.groovy30/lib/groovy-test-3.0.0-javadoc.jar differ
diff --git a/base/org.codehaus.groovy26/lib/groovy-test-2.6.0-sources.jar b/base/org.codehaus.groovy30/lib/groovy-test-3.0.0-sources.jar
similarity index 89%
rename from base/org.codehaus.groovy26/lib/groovy-test-2.6.0-sources.jar
rename to base/org.codehaus.groovy30/lib/groovy-test-3.0.0-sources.jar
index 4d3f58e579..e24d176c14 100644
Binary files a/base/org.codehaus.groovy26/lib/groovy-test-2.6.0-sources.jar and b/base/org.codehaus.groovy30/lib/groovy-test-3.0.0-sources.jar differ
diff --git a/base/org.codehaus.groovy26/lib/ivy-2.4.0-javadoc.jar b/base/org.codehaus.groovy30/lib/ivy-2.4.0-javadoc.jar
similarity index 100%
rename from base/org.codehaus.groovy26/lib/ivy-2.4.0-javadoc.jar
rename to base/org.codehaus.groovy30/lib/ivy-2.4.0-javadoc.jar
diff --git a/base/org.codehaus.groovy26/lib/ivy-2.4.0-sources.jar b/base/org.codehaus.groovy30/lib/ivy-2.4.0-sources.jar
similarity index 100%
rename from base/org.codehaus.groovy26/lib/ivy-2.4.0-sources.jar
rename to base/org.codehaus.groovy30/lib/ivy-2.4.0-sources.jar
diff --git a/base/org.codehaus.groovy26/lib/ivy-2.4.0.jar b/base/org.codehaus.groovy30/lib/ivy-2.4.0.jar
similarity index 100%
rename from base/org.codehaus.groovy26/lib/ivy-2.4.0.jar
rename to base/org.codehaus.groovy30/lib/ivy-2.4.0.jar
diff --git a/base/org.codehaus.groovy26/plugin_dsld_support/dsld/basic_transforms.dsld b/base/org.codehaus.groovy30/plugin_dsld_support/dsld/basic_transforms.dsld
similarity index 100%
rename from base/org.codehaus.groovy26/plugin_dsld_support/dsld/basic_transforms.dsld
rename to base/org.codehaus.groovy30/plugin_dsld_support/dsld/basic_transforms.dsld
diff --git a/base/org.codehaus.groovy26/plugin_dsld_support/dsld/beans_transforms.dsld b/base/org.codehaus.groovy30/plugin_dsld_support/dsld/beans_transforms.dsld
similarity index 100%
rename from base/org.codehaus.groovy26/plugin_dsld_support/dsld/beans_transforms.dsld
rename to base/org.codehaus.groovy30/plugin_dsld_support/dsld/beans_transforms.dsld
diff --git a/base/org.codehaus.groovy26/plugin_dsld_support/dsld/builder_transform.dsld b/base/org.codehaus.groovy30/plugin_dsld_support/dsld/builder_transform.dsld
similarity index 100%
rename from base/org.codehaus.groovy26/plugin_dsld_support/dsld/builder_transform.dsld
rename to base/org.codehaus.groovy30/plugin_dsld_support/dsld/builder_transform.dsld
diff --git a/base/org.codehaus.groovy26/plugin_dsld_support/dsld/logging_transforms.dsld b/base/org.codehaus.groovy30/plugin_dsld_support/dsld/logging_transforms.dsld
similarity index 100%
rename from base/org.codehaus.groovy26/plugin_dsld_support/dsld/logging_transforms.dsld
rename to base/org.codehaus.groovy30/plugin_dsld_support/dsld/logging_transforms.dsld
diff --git a/base/org.codehaus.groovy26/plugin_dsld_support/dsld/meta_script.dsld b/base/org.codehaus.groovy30/plugin_dsld_support/dsld/meta_script.dsld
similarity index 100%
rename from base/org.codehaus.groovy26/plugin_dsld_support/dsld/meta_script.dsld
rename to base/org.codehaus.groovy30/plugin_dsld_support/dsld/meta_script.dsld
diff --git a/base/org.codehaus.groovy26/plugin_dsld_support/dsld/script_config.dsld b/base/org.codehaus.groovy30/plugin_dsld_support/dsld/script_config.dsld
similarity index 100%
rename from base/org.codehaus.groovy26/plugin_dsld_support/dsld/script_config.dsld
rename to base/org.codehaus.groovy30/plugin_dsld_support/dsld/script_config.dsld
diff --git a/base/org.codehaus.groovy26/plugin_dsld_support/dsld/swing_builder.dsld b/base/org.codehaus.groovy30/plugin_dsld_support/dsld/swing_builder.dsld
similarity index 100%
rename from base/org.codehaus.groovy26/plugin_dsld_support/dsld/swing_builder.dsld
rename to base/org.codehaus.groovy30/plugin_dsld_support/dsld/swing_builder.dsld
diff --git a/base/org.codehaus.groovy26/plugin_dsld_support/readme.txt b/base/org.codehaus.groovy30/plugin_dsld_support/readme.txt
similarity index 100%
rename from base/org.codehaus.groovy26/plugin_dsld_support/readme.txt
rename to base/org.codehaus.groovy30/plugin_dsld_support/readme.txt
diff --git a/base/org.codehaus.groovy26/pom.xml b/base/org.codehaus.groovy30/pom.xml
similarity index 96%
rename from base/org.codehaus.groovy26/pom.xml
rename to base/org.codehaus.groovy30/pom.xml
index 9d1f183e1a..f52894358e 100644
--- a/base/org.codehaus.groovy26/pom.xml
+++ b/base/org.codehaus.groovy30/pom.xml
@@ -8,7 +8,7 @@
org.codehaus.groovy.eclipse
org.codehaus.groovy
- 2.6.0-SNAPSHOT
+ 3.0.0-SNAPSHOT
eclipse-plugin
diff --git a/base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/DefaultGroovyLogger.java b/base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/DefaultGroovyLogger.java
similarity index 100%
rename from base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/DefaultGroovyLogger.java
rename to base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/DefaultGroovyLogger.java
diff --git a/base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/GroovyLogManager.java b/base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/GroovyLogManager.java
similarity index 100%
rename from base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/GroovyLogManager.java
rename to base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/GroovyLogManager.java
diff --git a/base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/IGroovyLogger.java b/base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/IGroovyLogger.java
similarity index 100%
rename from base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/IGroovyLogger.java
rename to base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/IGroovyLogger.java
diff --git a/base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/LoggerTest.java b/base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/LoggerTest.java
similarity index 100%
rename from base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/LoggerTest.java
rename to base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/LoggerTest.java
diff --git a/base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/TraceCategory.java b/base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/TraceCategory.java
similarity index 100%
rename from base/org.codehaus.groovy26/src-trace/org/codehaus/groovy/eclipse/TraceCategory.java
rename to base/org.codehaus.groovy30/src-trace/org/codehaus/groovy/eclipse/TraceCategory.java
diff --git a/base/org.codehaus.groovy26/src/GroovyLexer.g4 b/base/org.codehaus.groovy30/src/GroovyLexer.g4
similarity index 99%
rename from base/org.codehaus.groovy26/src/GroovyLexer.g4
rename to base/org.codehaus.groovy30/src/GroovyLexer.g4
index c296288892..1ca690fb67 100644
--- a/base/org.codehaus.groovy26/src/GroovyLexer.g4
+++ b/base/org.codehaus.groovy30/src/GroovyLexer.g4
@@ -317,14 +317,14 @@ mode DEFAULT_MODE;
// character in the double quotation string. e.g. "a"
fragment
DqStringCharacter
- : ~["\\$]
+ : ~["\r\n\\$]
| EscapeSequence
;
// character in the single quotation string. e.g. 'a'
fragment
SqStringCharacter
- : ~['\\]
+ : ~['\r\n\\]
| EscapeSequence
;
diff --git a/base/org.codehaus.groovy26/src/GroovyParser.g4 b/base/org.codehaus.groovy30/src/GroovyParser.g4
similarity index 95%
rename from base/org.codehaus.groovy26/src/GroovyParser.g4
rename to base/org.codehaus.groovy30/src/GroovyParser.g4
index 36155314fc..926fb5b38b 100644
--- a/base/org.codehaus.groovy26/src/GroovyParser.g4
+++ b/base/org.codehaus.groovy30/src/GroovyParser.g4
@@ -41,17 +41,14 @@ options {
@header {
import java.util.Map;
- import org.codehaus.groovy.util.ListHashMap;
import org.codehaus.groovy.ast.NodeMetaDataHandler;
- import org.codehaus.groovy.ast.NodeMetaDataHandlerHelper;
import org.apache.groovy.parser.antlr4.SemanticPredicates;
}
@members {
public static class GroovyParserRuleContext extends ParserRuleContext implements NodeMetaDataHandler {
- private Map, ?> metaDataMap = null;
- private NodeMetaDataHandlerHelper helper = new NodeMetaDataHandlerHelper(this);
+ private Map metaDataMap = null;
public GroovyParserRuleContext() {}
@@ -59,36 +56,6 @@ options {
super(parent, invokingStateNumber);
}
- @Override
- public T getNodeMetaData(Object key) {
- return helper.getNodeMetaData(key);
- }
-
- @Override
- public void copyNodeMetaData(NodeMetaDataHandler other) {
- helper.copyNodeMetaData(other);
- }
-
- @Override
- public void setNodeMetaData(Object key, Object value) {
- helper.setNodeMetaData(key, value);
- }
-
- @Override
- public Object putNodeMetaData(Object key, Object value) {
- return helper.putNodeMetaData(key, value);
- }
-
- @Override
- public void removeNodeMetaData(Object key) {
- helper.removeNodeMetaData(key);
- }
-
- @Override
- public Map, ?> getNodeMetaData() {
- return helper.getNodeMetaData();
- }
-
@Override
public Map, ?> getMetaDataMap() {
return this.metaDataMap;
@@ -801,14 +768,8 @@ enhancedStatementExpression
| standardLambdaExpression
;
-/**
- * In order to resolve the syntactic ambiguities, e.g. (String)'abc' can be parsed as a cast expression or a parentheses-less method call(method name: (String), arguments: 'abc')
- * try to match expression first.
- * If it is not a normal expression, then try to match the command expression
- */
statementExpression
- : expression #normalExprAlt
- | commandExpression #commandExprAlt
+ : commandExpression #commandExprAlt
;
postfixExpression
@@ -919,9 +880,9 @@ enhancedExpression
*/
commandExpression
- : pathExpression
+ : expression
(
- { SemanticPredicates.isFollowingMethodName($pathExpression.t) }?
+ { !SemanticPredicates.isFollowingArgumentsOrClosure($expression.ctx) }?
argumentList
|
/* if pathExpression is a method call, no need to have any more arguments */
@@ -984,7 +945,7 @@ pathElement returns [int t]
namePart
{ $t = 1; }
|
- DOT nls NEW creator[1]
+ nls DOT nls NEW creator[1]
{ $t = 6; }
| arguments
{ $t = 2; }
@@ -1046,7 +1007,7 @@ indexPropertyArgs
;
namedPropertyArgs
- : LBRACK mapEntryList RBRACK
+ : QUESTION? LBRACK (mapEntryList | COLON) RBRACK
;
primary
@@ -1178,6 +1139,10 @@ identifier
// if 'static' followed by DOT, we can treat them as identifiers, e.g. static.unused = { -> }
{ DOT == _input.LT(2).getType() }?
STATIC
+ | IN
+// | DEF
+ | TRAIT
+ | AS
;
builtInType
diff --git a/base/org.codehaus.groovy26/src/groovy/grape/GrabAnnotationTransformation.java b/base/org.codehaus.groovy30/src/groovy/grape/GrabAnnotationTransformation.java
similarity index 100%
rename from base/org.codehaus.groovy26/src/groovy/grape/GrabAnnotationTransformation.java
rename to base/org.codehaus.groovy30/src/groovy/grape/GrabAnnotationTransformation.java
diff --git a/base/org.codehaus.groovy26/src/groovy/grape/GrapeIvy.groovy b/base/org.codehaus.groovy30/src/groovy/grape/GrapeIvy.groovy
similarity index 79%
rename from base/org.codehaus.groovy26/src/groovy/grape/GrapeIvy.groovy
rename to base/org.codehaus.groovy30/src/groovy/grape/GrapeIvy.groovy
index e45a6714c3..a25b9e28a3 100644
--- a/base/org.codehaus.groovy26/src/groovy/grape/GrapeIvy.groovy
+++ b/base/org.codehaus.groovy30/src/groovy/grape/GrapeIvy.groovy
@@ -18,9 +18,11 @@
*/
package groovy.grape
+import groovy.transform.CompileStatic
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
@@ -41,6 +43,7 @@ import org.apache.ivy.plugins.matcher.ExactPatternMatcher
import org.apache.ivy.plugins.matcher.PatternMatcher
import org.apache.ivy.plugins.resolver.ChainResolver
import org.apache.ivy.plugins.resolver.IBiblioResolver
+import org.apache.ivy.plugins.resolver.ResolverSettings
import org.apache.ivy.util.DefaultMessageLogger
import org.apache.ivy.util.Message
import org.codehaus.groovy.reflection.CachedClass
@@ -84,7 +87,7 @@ class GrapeIvy implements GrapeEngine {
// we keep the settings so that addResolver can add to the resolver chain
IvySettings settings
- public GrapeIvy() {
+ GrapeIvy() {
// if we are already initialized, quit
if (enableGrapes) return
@@ -111,7 +114,7 @@ class GrapeIvy implements GrapeEngine {
settings.setVariable("ivy.default.configuration.m2compatible", "true")
ivyInstance = Ivy.newInstance(settings)
- org.apache.ivy.core.IvyContext.getContext().setIvy(ivyInstance);
+ IvyContext.getContext().setIvy(ivyInstance)
resolvedDependencies = []
downloadedArtifacts = []
@@ -120,7 +123,8 @@ class GrapeIvy implements GrapeEngine {
enableGrapes = true
}
- public File getGroovyRoot() {
+ @CompileStatic
+ File getGroovyRoot() {
String root = System.getProperty("groovy.root")
def groovyRoot
if (root == null) {
@@ -136,7 +140,8 @@ class GrapeIvy implements GrapeEngine {
return groovyRoot
}
- public File getLocalGrapeConfig() {
+ @CompileStatic
+ File getLocalGrapeConfig() {
String grapeConfig = System.getProperty("grape.config")
if(grapeConfig) {
return new File(grapeConfig)
@@ -144,7 +149,8 @@ class GrapeIvy implements GrapeEngine {
return new File(getGrapeDir(), 'grapeConfig.xml')
}
- public File getGrapeDir() {
+ @CompileStatic
+ File getGrapeDir() {
String root = System.getProperty("grape.root")
if(root == null) {
return getGroovyRoot()
@@ -158,7 +164,8 @@ class GrapeIvy implements GrapeEngine {
return grapeRoot
}
- public File getGrapeCacheDir() {
+ @CompileStatic
+ File getGrapeCacheDir() {
File cache = new File(getGrapeDir(), 'grapes')
if (!cache.exists()) {
cache.mkdirs()
@@ -168,12 +175,13 @@ class GrapeIvy implements GrapeEngine {
return cache
}
- public def chooseClassLoader(Map args) {
- def loader = args.classLoader
+ @CompileStatic
+ ClassLoader chooseClassLoader(Map args) {
+ ClassLoader loader = (ClassLoader) args.classLoader
if (!isValidTargetClassLoader(loader)) {
- loader = (args.refObject?.class
- ?:ReflectionUtils.getCallingClass(args.calleeDepth?:1)
- )?.classLoader
+ loader = ((Class) ((args.refObject?.class
+ ?: ReflectionUtils.getCallingClass((int) (args.calleeDepth ?: 1))
+ )))?.classLoader
while (loader && !isValidTargetClassLoader(loader)) {
loader = loader.parent
}
@@ -192,10 +200,12 @@ class GrapeIvy implements GrapeEngine {
return loader
}
+ @CompileStatic
private boolean isValidTargetClassLoader(loader) {
return isValidTargetClassLoaderClass(loader?.class)
}
+ @CompileStatic
private boolean isValidTargetClassLoaderClass(Class loaderClass) {
return (loaderClass != null) &&
(
@@ -205,7 +215,7 @@ class GrapeIvy implements GrapeEngine {
)
}
- public IvyGrabRecord createGrabRecord(Map deps) {
+ IvyGrabRecord createGrabRecord(Map deps) {
// parse the actual dependency arguments
String module = deps.module ?: deps.artifactId ?: deps.artifact
if (!module) {
@@ -235,16 +245,22 @@ class GrapeIvy implements GrapeEngine {
return new IvyGrabRecord(mrid:mrid, conf:conf, changing:changing, transitive:transitive, force:force, classifier:classifier, ext:ext, type:type)
}
- public grab(String endorsedModule) {
+ @Override
+ @CompileStatic
+ grab(String endorsedModule) {
return grab(group:'groovy.endorsed', module:endorsedModule, version:GroovySystem.version)
}
- public grab(Map args) {
+ @Override
+ @CompileStatic
+ grab(Map args) {
args.calleeDepth = args.calleeDepth?:DEFAULT_DEPTH + 1
return grab(args, args)
}
- public grab(Map args, Map... dependencies) {
+ @Override
+ @CompileStatic
+ grab(Map args, Map... dependencies) {
ClassLoader loader = null
grabRecordsForCurrDependencies.clear()
@@ -262,7 +278,7 @@ class GrapeIvy implements GrapeEngine {
def uris = resolve(loader, args, dependencies)
for (URI uri in uris) {
- loader.addURL(uri.toURL())
+ addURL(loader, uri)
}
boolean runnerServicesFound = false
for (URI uri in uris) {
@@ -291,27 +307,54 @@ class GrapeIvy implements GrapeEngine {
return null
}
+ private void addURL(ClassLoader loader, URI uri) {
+ loader.addURL(uri.toURL())
+ }
+
+ @CompileStatic
private processCategoryMethods(ClassLoader loader, File file) {
// register extension methods if jar
if (file.name.toLowerCase().endsWith(".jar")) {
def mcRegistry = GroovySystem.metaClassRegistry
if (mcRegistry instanceof MetaClassRegistryImpl) {
+ // GRECLIPSE edit
+ //try (JarFile jar = new JarFile(file)) {
+ JarFile jar = null
try {
- JarFile jar = new JarFile(file)
+ jar = new JarFile(file)
+ // GRECLIPSE end
def entry = jar.getEntry(ExtensionModuleScanner.MODULE_META_INF_FILE)
if (!entry) {
entry = jar.getEntry(ExtensionModuleScanner.LEGACY_MODULE_META_INF_FILE)
}
if (entry) {
Properties props = new Properties()
- props.load(jar.getInputStream(entry))
+ // GRECLIPSE edit
+ //try (InputStream is = jar.getInputStream(entry)) {
+ InputStream is = null
+ try {
+ is = jar.getInputStream(entry)
+ // GRECLIPSE end
+ props.load(is)
+ // GRECLIPSE add
+ } finally {
+ if (null != is) {
+ try {
+ is.close()
+ } catch (e) {
+ // ignore
+ }
+ }
+ // GRECLIPSE end
+ }
+
Map> metaMethods = new HashMap>()
mcRegistry.registerExtensionModuleFromProperties(props, loader, metaMethods)
// add old methods to the map
metaMethods.each { CachedClass c, List methods ->
// GROOVY-5543: if a module was loaded using grab, there are chances that subclasses
// have their own ClassInfo, and we must change them as well!
- Set classesToBeUpdated = [c]
+ Set classesToBeUpdated = [c].toSet()
ClassInfo.onAllClassInfo { ClassInfo info ->
if (c.theClass.isAssignableFrom(info.cachedClass.theClass)) {
classesToBeUpdated << info.cachedClass
@@ -320,14 +363,24 @@ class GrapeIvy implements GrapeEngine {
classesToBeUpdated*.addNewMopMethods(methods)
}
}
- }
- catch(ZipException zipException) {
+ } catch(ZipException zipException) {
throw new RuntimeException("Grape could not load jar '$file'", zipException)
+ // GRECLIPSE add
+ } finally {
+ if (null != jar) {
+ try {
+ jar.close()
+ } catch (e) {
+ // ignore
+ }
+ }
+ // GRECLIPSE end
}
}
}
}
+ @CompileStatic
void processOtherServices(ClassLoader loader, File f) {
processMetaInfServices(loader, f) // ignore result
}
@@ -340,22 +393,63 @@ class GrapeIvy implements GrapeEngine {
* @param f ZipFile in which to search for services
* @return a collection of service provider files that were found
*/
+ @CompileStatic
private Collection processMetaInfServices(ClassLoader loader, File f) {
List services = new ArrayList<>()
+ // GRECLIPSE edit
+ //try (ZipFile zf = new ZipFile(f)) {
+ ZipFile zf = null
try {
- ZipFile zf = new ZipFile(f)
+ zf = new ZipFile(f)
+ // GRECLIPSE end
String providerConfig = 'org.codehaus.groovy.runtime.SerializedCategoryMethods'
ZipEntry serializedCategoryMethods = zf.getEntry(METAINF_PREFIX + providerConfig)
if (serializedCategoryMethods != null) {
services.add(providerConfig)
- processSerializedCategoryMethods(zf.getInputStream(serializedCategoryMethods))
+
+ // GRECLIPSE edit
+ //try (InputStream is = zf.getInputStream(serializedCategoryMethods)) {
+ InputStream is = null
+ try {
+ is = zf.getInputStream(serializedCategoryMethods)
+ // GRECLIPSE end
+ processSerializedCategoryMethods(is)
+ // GRECLIPSE add
+ } finally {
+ if (null != is) {
+ try {
+ is.close()
+ } catch (e) {
+ // ignore
+ }
+ }
+ // GRECLIPSE end
+ }
}
// TODO: remove in a future release (replaced by GroovyRunnerRegistry)
providerConfig = 'org.codehaus.groovy.plugins.Runners'
ZipEntry pluginRunners = zf.getEntry(METAINF_PREFIX + providerConfig)
if (pluginRunners != null) {
services.add(providerConfig)
- processRunners(zf.getInputStream(pluginRunners), f.getName(), loader)
+
+ // GRFECLIPSE edit
+ //try (InputStream is = zf.getInputStream(pluginRunners)) {
+ InputStream is = null
+ try {
+ is = zf.getInputStream(pluginRunners)
+ // GRECLIPSE end
+ processRunners(is, f.getName(), loader)
+ // GRECLIPSE add
+ } finally {
+ if (null != is) {
+ try {
+ is.close()
+ } catch (e) {
+ // ignore
+ }
+ }
+ // GRECLIPSE end
+ }
}
// GroovyRunners are loaded per ClassLoader using a ServiceLoader so here
// it only needs to be indicated that the service provider file was found
@@ -365,28 +459,41 @@ class GrapeIvy implements GrapeEngine {
} catch(ZipException ignore) {
// ignore files we can't process, e.g. non-jar/zip artifacts
// TODO log a warning
+ // GRECLIPSE add
+ } finally {
+ if (null != zf) {
+ try {
+ zf.close()
+ } catch (e) {
+ // ignore
+ }
+ }
+ // GRECLIPSE end
}
return services
}
+ @CompileStatic
void processSerializedCategoryMethods(InputStream is) {
is.text.readLines().each {
println it.trim() // TODO implement this or delete it
}
}
+ @CompileStatic
void processRunners(InputStream is, String name, ClassLoader loader) {
GroovyRunnerRegistry registry = GroovyRunnerRegistry.getInstance()
- is.text.readLines()*.trim().findAll{ !it.isEmpty() && it[0] != '#' }.each {
+ is.text.readLines()*.trim().findAll{ String line -> !line.isEmpty() && line[0] != '#' }.each {
+ String line = (String) it
try {
- registry[name] = loader.loadClass(it).newInstance()
+ registry[name] = (GroovyRunner) loader.loadClass(line).newInstance()
} catch (Exception ex) {
throw new IllegalStateException("Error registering runner class '" + it + "'", ex)
}
}
}
- public ResolveReport getDependencies(Map args, IvyGrabRecord... grabRecords) {
+ ResolveReport getDependencies(Map args, IvyGrabRecord... grabRecords) {
ResolutionCacheManager cacheManager = ivyInstance.resolutionCacheManager
def millis = System.currentTimeMillis()
@@ -399,7 +506,7 @@ class GrapeIvy implements GrapeEngine {
for (IvyGrabRecord grabRecord : grabRecords) {
def conf = grabRecord.conf ?: ['*']
- DefaultDependencyDescriptor dd = md.dependencies.find {it.dependencyRevisionId.equals(grabRecord.mrid)}
+ DefaultDependencyDescriptor dd = (DefaultDependencyDescriptor) md.dependencies.find {it.dependencyRevisionId.equals(grabRecord.mrid)}
if (dd) {
createAndAddDependencyArtifactDescriptor(dd, grabRecord, conf)
} else {
@@ -412,10 +519,10 @@ class GrapeIvy implements GrapeEngine {
}
// resolve grab and dependencies
- ResolveOptions resolveOptions = new ResolveOptions()\
- .setConfs(['default'] as String[])\
- .setOutputReport(false)\
- .setValidate(args.containsKey('validate') ? args.validate : false)
+ ResolveOptions resolveOptions = new ResolveOptions()
+ .setConfs(['default'] as String[])
+ .setOutputReport(false)
+ .setValidate((boolean) (args.containsKey('validate') ? args.validate : false))
ivyInstance.settings.defaultResolver = args.autoDownload ? 'downloadGrapes' : 'cachedGrapes'
if (args.disableChecksums) {
@@ -423,26 +530,7 @@ class GrapeIvy implements GrapeEngine {
}
boolean reportDownloads = System.getProperty('groovy.grape.report.downloads', 'false') == 'true'
if (reportDownloads) {
- ivyInstance.eventManager.addIvyListener([progress:{ 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
- }
- }
- 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
- } } ] as IvyListener)
+ addIvyListener()
}
ResolveReport report = null
@@ -478,6 +566,32 @@ class GrapeIvy implements GrapeEngine {
return report
}
+ private addIvyListener() {
+ ivyInstance.eventManager.addIvyListener([progress: { 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
+ }
+ }
+ 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
+ }
+ }] as IvyListener)
+ }
+
+ @CompileStatic
private void createAndAddDependencyArtifactDescriptor(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
@@ -488,7 +602,7 @@ class GrapeIvy implements GrapeEngine {
}
}
- public void uninstallArtifact(String group, String module, String rev) {
+ void uninstallArtifact(String group, String module, String rev) {
// TODO consider transitive uninstall as an option
Pattern ivyFilePattern = ~/ivy-(.*)\.xml/ //TODO get pattern from ivy conf
grapeCacheDir.eachDir { File groupDir ->
@@ -503,9 +617,9 @@ class GrapeIvy implements GrapeEngine {
def db = dbf.newDocumentBuilder()
def root = db.parse(ivyFile).documentElement
def publis = root.getElementsByTagName('publications')
- for (int i=0; i>> enumerateGrapes() {
+ @Override
+ @CompileStatic
+ Map>> enumerateGrapes() {
Map>> bunches = [:]
Pattern ivyFilePattern = ~/ivy-(.*)\.xml/ //TODO get pattern from ivy conf
grapeCacheDir.eachDir {File groupDir ->
Map> grapes = [:]
bunches[groupDir.name] = grapes
groupDir.eachDir { File moduleDir ->
- def versions = []
+ List versions = []
moduleDir.eachFileMatch(ivyFilePattern) {File ivyFile ->
def m = ivyFilePattern.matcher(ivyFile.name)
if (m.matches()) versions += m.group(1)
@@ -557,13 +673,17 @@ class GrapeIvy implements GrapeEngine {
return bunches
}
- public URI[] resolve(Map args, Map ... dependencies) {
+ @Override
+ @CompileStatic
+ URI[] resolve(Map args, Map ... dependencies) {
resolve(args, null, dependencies)
}
- public URI[] resolve(Map args, List depsInfo, Map ... dependencies) {
+ @Override
+ @CompileStatic
+ URI[] resolve(Map args, List depsInfo, Map ... dependencies) {
// identify the target classloader early, so we fail before checking repositories
- def loader = chooseClassLoader(
+ ClassLoader loader = chooseClassLoader(
classLoader: args.remove('classLoader'),
refObject: args.remove('refObject'),
calleeDepth: args.calleeDepth ?: DEFAULT_DEPTH,
@@ -576,11 +696,12 @@ class GrapeIvy implements GrapeEngine {
resolve(loader, args, depsInfo, dependencies)
}
- URI [] resolve(ClassLoader loader, Map args, Map... dependencies) {
+ @CompileStatic
+ URI[] resolve(ClassLoader loader, Map args, Map... dependencies) {
return resolve(loader, args, null, dependencies)
}
- URI [] resolve(ClassLoader loader, Map args, List depsInfo, Map... dependencies) {
+ URI[] resolve(ClassLoader loader, Map args, List depsInfo, Map... dependencies) {
// check for mutually exclusive arguments
Set keys = args.keySet()
keys.each {a ->
@@ -637,6 +758,7 @@ class GrapeIvy implements GrapeEngine {
return results as URI[]
}
+ @CompileStatic
private Set getLoadedDepsForLoader(ClassLoader loader) {
Set localDeps = loadedDeps.get(loader)
if (localDeps == null) {
@@ -647,7 +769,8 @@ class GrapeIvy implements GrapeEngine {
return localDeps
}
- public Map[] listDependencies (ClassLoader classLoader) {
+ @Override
+ Map[] listDependencies (ClassLoader classLoader) {
if (loadedDeps.containsKey(classLoader)) {
List