Skip to content

Commit

Permalink
Update to Groovy 2.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
aclement committed Nov 6, 2014
1 parent 406ac22 commit 54dbbff
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected String[] getDefaultClassPaths() {
String[] newcps = new String[cps.length+2];
System.arraycopy(cps,0,newcps,0,cps.length);
try {
URL groovyJar = Platform.getBundle("org.codehaus.groovy").getEntry("lib/groovy-all-2.3.6.jar");
URL groovyJar = Platform.getBundle("org.codehaus.groovy").getEntry("lib/groovy-all-2.3.7.jar");
if (groovyJar==null) {
groovyJar = Platform.getBundle("org.codehaus.groovy").getEntry("lib/groovy-all-2.2.2.jar");
if (groovyJar==null) {
Expand Down
2 changes: 1 addition & 1 deletion base/org.codehaus.groovy23/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<classpathentry kind="src" path="script"/>
<classpathentry exported="true" kind="lib" path="lib/ivy-2.3.0.jar" sourcepath="lib/ivy-2.3.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/bsf-2.4.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/groovy-all-2.3.6.jar" sourcepath="lib/groovy-2.3.6-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/groovy-all-2.3.7.jar" sourcepath="lib/groovy-2.3.7-sources.jar"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="output" path="bin"/>
</classpath>
4 changes: 2 additions & 2 deletions base/org.codehaus.groovy23/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Groovy Runtime Plug-in
Bundle-SymbolicName: org.codehaus.groovy
Bundle-Version: 2.3.6.qualifier
Bundle-Version: 2.3.7.qualifier
Bundle-ClassPath: groovy-eclipse.jar,
lib/ivy-2.3.0.jar,
lib/bsf-2.4.0.jar,
lib/groovy-all-2.3.6.jar,
lib/groovy-all-2.3.7.jar,
eclipse-trace.jar
Groovy-Runtime-Jars: groovy.jar
Export-Package: groovy.beans,
Expand Down
1 change: 1 addition & 0 deletions base/org.codehaus.groovy23/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
09-Jul-14: GROOVY_2_3_4
24-Jul-14: GROOVY_2_3_5
29-Jul-14: GROOVY_2_3_6
05-Nov-14: GROOVY_2_3_7
10 changes: 5 additions & 5 deletions base/org.codehaus.groovy23/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ <h4>bsf-2.4.0.jar</h4>
<li>License text: <a href="about_files/asl-v20.txt">asl-v20.txt</a></li>
</ul>

<h4>groovy-all-2.3.6-sources.jar</h4>
<h4>groovy-all-2.3.7-sources.jar</h4>

<ul>
<li>Obtained from: <a href="http://dist.groovy.codehaus.org/distributions/groovy-src-2.3.6.zip">http://dist.groovy.codehaus.org/distributions/groovy-src-2.3.6.zip</a></li>
<li>Obtained from: <a href="http://dist.groovy.codehaus.org/distributions/groovy-src-2.3.7.zip">http://dist.groovy.codehaus.org/distributions/groovy-src-2.3.7.zip</a></li>
<li>Sources available at: This jar is a source jar</li>
<li>License kind: ASL</li>
<li>License URL: <a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a></li>
<li>License text: <a href="about_files/asl-v20.txt">asl-v20.txt</a></li>
</ul>

<h4>groovy-all-2.3.6.jar</h4>
<h4>groovy-all-2.3.7.jar</h4>

<ul>
<li>Obtained from: <a href="http://dist.groovy.codehaus.org/distributions/groovy-binary-2.3.6.zip">http://dist.groovy.codehaus.org/distributions/groovy-binary-2.3.6.zip</a></li>
<li>Sources available at: <a href="http://dist.groovy.codehaus.org/distributions/groovy-src-2.3.6.zip">http://dist.groovy.codehaus.org/distributions/groovy-src-2.3.6.zip</a></li>
<li>Obtained from: <a href="http://dist.groovy.codehaus.org/distributions/groovy-binary-2.3.7.zip">http://dist.groovy.codehaus.org/distributions/groovy-binary-2.3.7.zip</a></li>
<li>Sources available at: <a href="http://dist.groovy.codehaus.org/distributions/groovy-src-2.3.7.zip">http://dist.groovy.codehaus.org/distributions/groovy-src-2.3.7.zip</a></li>
<li>License kind: ASL</li>
<li>License URL: <a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a></li>
<li>License text: <a href="about_files/asl-v20.txt">asl-v20.txt</a></li>
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion base/org.codehaus.groovy23/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
</parent>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy</artifactId>
<version>2.3.6-SNAPSHOT</version>
<version>2.3.7-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
public class UpdateExportedPackages {

public static final String GROOVY_ALL_PATH = "lib/groovy-all-2.3.6.jar";
public static final String GROOVY_ALL_PATH = "lib/groovy-all-2.3.7.jar";
public static final String MANIFEST = "META-INF/MANIFEST.MF";

public static void main(String[] args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2013 the original author or authors.
* Copyright 2003-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,16 +43,22 @@
import org.codehaus.groovy.control.CompilationUnit;
import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.control.io.StringReaderSource;
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import org.codehaus.groovy.tools.GrapeUtil;
import org.codehaus.groovy.transform.ASTTransformation;
import org.codehaus.groovy.transform.ASTTransformationVisitor;
import org.codehaus.groovy.transform.GroovyASTTransformation;

import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.codehaus.groovy.transform.AbstractASTTransformation.getMemberStringValue;

/**
* Transformation for declarative dependency management.
*/
Expand Down Expand Up @@ -222,19 +228,12 @@ public void visit(ASTNode[] nodes, SourceUnit source) {
grabResolverAnnotationLoop:
for (AnnotationNode node : grabResolverAnnotations) {
Map<String, Object> grabResolverMap = new HashMap<String, Object>();
Expression value = node.getMember("value");
ConstantExpression ce = null;
if (value != null && value instanceof ConstantExpression) {
ce = (ConstantExpression) value;
}
String sval = null;
if (ce != null && ce.getValue() instanceof String) {
sval = (String) ce.getValue();
}
String sval = getMemberStringValue(node, "value");
if (sval != null && sval.length() > 0) {
for (String s : GRABRESOLVER_REQUIRED) {
Expression member = node.getMember(s);
if (member != null) {
String mval = getMemberStringValue(node, s);
if (mval != null && mval.isEmpty()) mval = null;
if (mval != null) {
addError("The attribute \"" + s + "\" conflicts with attribute 'value' in @" + node.getClassNode().getNameWithoutPackage() + " annotations", node);
continue grabResolverAnnotationLoop;
}
Expand All @@ -243,17 +242,47 @@ public void visit(ASTNode[] nodes, SourceUnit source) {
grabResolverMap.put("root", sval);
} else {
for (String s : GRABRESOLVER_REQUIRED) {
String mval = getMemberStringValue(node, s);
if (mval != null && mval.isEmpty()) mval = null;
Expression member = node.getMember(s);
if (member == null) {
if (member == null || mval == null) {
addError("The missing attribute \"" + s + "\" is required in @" + node.getClassNode().getNameWithoutPackage() + " annotations", node);
continue grabResolverAnnotationLoop;
} else if (member != null && !(member instanceof ConstantExpression)) {
addError("Attribute \"" + s + "\" has value " + member.getText() + " but should be an inline constant in @" + node.getClassNode().getNameWithoutPackage() + " annotations", node);
} else if (mval == null) {
addError("Attribute \"" + s + "\" has value " + member.getText() + " but should be an inline constant String in @" + node.getClassNode().getNameWithoutPackage() + " annotations", node);
continue grabResolverAnnotationLoop;
}
grabResolverMap.put(s, ((ConstantExpression) member).getValue());
grabResolverMap.put(s, mval);
}
}

// If no scheme is specified for the repository root,
// then turn it into a URI relative to that of the source file.
String root = (String) grabResolverMap.get("root");
if (root != null && !root.contains(":")) {
URI sourceURI = null;
// Since we use the data: scheme for StringReaderSources (which are fairly common)
// and those are not hierarchical we can't use them for making an absolute URI.
if (!(getSourceUnit().getSource() instanceof StringReaderSource)) {
// Otherwise let's trust the source to know where it is from.
// And actually InputStreamReaderSource doesn't know what to do and so returns null.
sourceURI = getSourceUnit().getSource().getURI();
}
// If source doesn't know how to get a reference to itself,
// then let's use the current working directory, since the repo can be relative to that.
if (sourceURI == null) {
sourceURI = new File(".").toURI();
}
try {
URI rootURI = sourceURI.resolve(new URI(root));
grabResolverMap.put("root", rootURI.toString());
} catch (URISyntaxException e) {
// We'll be silent here.
// If the URI scheme is unknown or not hierarchical, then we just can't help them and shouldn't cause any trouble either.
// addError("Attribute \"root\" has value '" + root + "' which can't be turned into a valid URI relative to it's source '" + getSourceUnit().getName() + "' @" + node.getClassNode().getNameWithoutPackage() + " annotations", node);
}
}

Grape.addResolver(grabResolverMap);
addGrabResolverAsStaticInitIfNeeded(grapeClassNode, node, grabResolverInitializers, grabResolverMap);
}
Expand Down Expand Up @@ -296,6 +325,8 @@ public void visit(ASTNode[] nodes, SourceUnit source) {
checkForConvenienceForm(node, false);
for (String s : GRAB_ALL) {
Expression member = node.getMember(s);
String mval = getMemberStringValue(node, s);
if (mval != null && mval.isEmpty()) member = null;
if (member == null && !GRAB_OPTIONAL.contains(s)) {
addError("The missing attribute \"" + s + "\" is required in @" + node.getClassNode().getNameWithoutPackage() + " annotations", node);
continue grabAnnotationLoop;
Expand All @@ -308,8 +339,7 @@ public void visit(ASTNode[] nodes, SourceUnit source) {
}
}
grabMaps.add(grabMap);
if ((node.getMember("initClass") == null)
|| (node.getMember("initClass") == ConstantExpression.TRUE)) {
if ((node.getMember("initClass") == null) || (node.getMember("initClass") == ConstantExpression.TRUE)) {
grabMapsInit.add(grabMap);
}
}
Expand Down Expand Up @@ -393,6 +423,7 @@ private void callGrabAsStaticInitIfNeeded(ClassNode classNode, ClassNode grapeCl

List<Expression> argList = new ArrayList<Expression>();
argList.add(basicArgs);
if (grabMapsInit.size() == 0) return;
for (Map<String, Object> grabMap : grabMapsInit) {
// add Grape.grab(excludeArgs, [group:group, module:module, version:version, classifier:classifier])
// or Grape.grab([group:group, module:module, version:version, classifier:classifier])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class GroovyActivator extends Plugin {

public static final String PLUGIN_ID = "org.codehaus.groovy"; //$NON-NLS-1$

public static final String GROOVY_ALL_JAR = "lib/groovy-all-2.3.6.jar"; //$NON-NLS-1$
public static final String GROOVY_ALL_JAR = "lib/groovy-all-2.3.7.jar"; //$NON-NLS-1$

public static URL GROOVY_ALL_JAR_URL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,21 @@
import groovy.lang.MetaClass;

import org.codehaus.groovy.ast.*;
import org.codehaus.groovy.ast.expr.*;
import org.codehaus.groovy.ast.stmt.*;
import org.codehaus.groovy.ast.expr.ArgumentListExpression;
import org.codehaus.groovy.ast.expr.BinaryExpression;
import org.codehaus.groovy.ast.expr.CastExpression;
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.VariableExpression;
import org.codehaus.groovy.ast.stmt.BlockStatement;
import org.codehaus.groovy.ast.stmt.ExpressionStatement;
import org.codehaus.groovy.ast.stmt.ReturnStatement;
import org.codehaus.groovy.ast.stmt.Statement;
import org.codehaus.groovy.classgen.asm.BytecodeHelper;
import org.codehaus.groovy.classgen.asm.MopWriter;
import org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.ClassNodeSkip;
Expand All @@ -31,6 +44,7 @@
import org.codehaus.groovy.syntax.Token;
import org.codehaus.groovy.syntax.Types;
import org.codehaus.groovy.reflection.ClassInfo;
import org.codehaus.groovy.transform.trait.Traits;
import groovyjarjarasm.asm.Label;
import groovyjarjarasm.asm.MethodVisitor;
import groovyjarjarasm.asm.Opcodes;
Expand Down Expand Up @@ -153,7 +167,8 @@ private FieldNode getMetaClassField(ClassNode node) {
public void visitClass(final ClassNode node) {
this.classNode = node;

if ((classNode.getModifiers() & Opcodes.ACC_INTERFACE) >0) {
if (Traits.isTrait(node) // maybe possible to have this true in joint compilation mode
|| ((classNode.getModifiers() & Opcodes.ACC_INTERFACE) > 0)) {
//interfaces have no constructors, but this code expects one,
//so create a dummy and don't add it to the class node
ConstructorNode dummy = new ConstructorNode(0,null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public static String getGenericsBounds(ClassNode type) {

private static void writeGenericsBoundType(StringBuilder ret, ClassNode printType, boolean writeInterfaceMarker) {
if (writeInterfaceMarker && printType.isInterface()) ret.append(":");
if (printType.equals(ClassHelper.OBJECT_TYPE) && printType.getGenericsTypes() != null) {
if (printType.isGenericsPlaceHolder() && printType.getGenericsTypes()!=null) {
ret.append("T");
ret.append(printType.getGenericsTypes()[0].getName());
ret.append(";");
Expand Down Expand Up @@ -610,6 +610,7 @@ public static void unbox(MethodVisitor mv, ClassNode type) {
/**
* box top level operand
*/
@Deprecated
public static boolean box(MethodVisitor mv, ClassNode type) {
if (type.isPrimaryClassNode()) return false;
// GRECLIPSE: start
Expand All @@ -622,6 +623,7 @@ public static boolean box(MethodVisitor mv, ClassNode type) {
/**
* Generates the bytecode to autobox the current value on the stack
*/
@Deprecated
public static boolean box(MethodVisitor mv, Class type) {
if (ReflectionCache.getCachedClass(type).isPrimitive && type != void.class) {
String returnString = "(" + BytecodeHelper.getTypeDescription(type) + ")Ljava/lang/Object;";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public void makeGetPropertySite(Expression receiver, final String methodName, fi
call.setMethodTarget(getterMethod);
call.setImplicitThis(false);
call.setSourcePosition(receiver);
call.setSafe(safe);
call.visit(controller.getAcg());
return;
}
Expand All @@ -197,6 +198,7 @@ public void makeGetPropertySite(Expression receiver, final String methodName, fi
);
call.setMethodTarget(getter);
call.setImplicitThis(false);
call.setSafe(safe);
call.setSourcePosition(receiver);
call.visit(controller.getAcg());
return;
Expand Down
2 changes: 1 addition & 1 deletion ide/Feature-org.codehaus.groovy23.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
id="org.codehaus.groovy"
download-size="0"
install-size="0"
version="2.3.6.qualifier"/>
version="2.3.7.qualifier"/>

<plugin
id="org.codehaus.groovy.eclipse"
Expand Down

0 comments on commit 54dbbff

Please sign in to comment.