Skip to content

Commit

Permalink
Update the Groovy plug-in to 3.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Sep 29, 2020
1 parent dc41bb8 commit ae81a3d
Show file tree
Hide file tree
Showing 52 changed files with 1,220 additions and 3,041 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2009-2020 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.
* You may obtain a copy of the License at
*
* https://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.eclipse.jdt.groovy.core.tests.basic;

import static org.eclipse.jdt.groovy.core.tests.GroovyBundle.isAtLeastGroovy;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import java.util.Arrays;
import java.util.Collections;

import org.codehaus.groovy.control.CompilerConfiguration;
import org.junit.Test;

public final class ConfigurationTests {

@Test
public void testDefaults() {
CompilerConfiguration config = CompilerConfiguration.DEFAULT;

assertNull(config.getJointCompilationOptions());
assertNull(config.getDisabledGlobalASTTransformations());
assertEquals(Collections.emptyList(), config.getClasspath());
assertEquals(Collections.emptyList(), config.getCompilationCustomizers());
assertEquals(Collections.singleton("groovy"), config.getScriptExtensions());
assertEquals(isAtLeastGroovy(25) ? "1.8" : "1.5", config.getTargetBytecode());
}

@Test
public void testTargetVersion() {
CompilerConfiguration config = new CompilerConfiguration();

String x9x = isAtLeastGroovy(25) ? "9" : "1.8";
String x10x = isAtLeastGroovy(25) ? "10" : "1.8";
String x11x = isAtLeastGroovy(25) ? "11" : "1.8";
String x12x = isAtLeastGroovy(25) ? "12" : "1.8";
String x13x = isAtLeastGroovy(25) ? "13" : "1.8";
String x14x = isAtLeastGroovy(25) ? "14" : "1.8";
String x15x = isAtLeastGroovy(30) ? "15" : isAtLeastGroovy(25) ? "14" : "1.8";
String x16x = isAtLeastGroovy(30) ? "16" : isAtLeastGroovy(25) ? "14" : "1.8";

String[] inputs = {"1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "5", "6", "7", "8", "9", "9.0", "10", "11", "12", "13", "14", "15", "16"};
String[] expect = {"1.4", "1.4", "1.5", "1.6", "1.7", "1.8", x9x, "1.5", "1.6", "1.7", "1.8", x9x, x9x, x10x, x11x, x12x, x13x, x14x, x15x, x16x};
assertArrayEquals(expect, Arrays.stream(inputs).map(v -> { config.setTargetBytecode(v); return config.getTargetBytecode(); }).toArray(String[]::new));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected String[] getDefaultClassPaths() {
String[] cps = super.getDefaultClassPaths();
String[] newcps = Arrays.copyOf(cps, cps.length + 2);

String[] groovyVersions = {"3.0.5-indy", "2.5.13-indy", "2.4.20"};
String[] groovyVersions = {"3.0.6-indy", "2.5.13-indy", "2.4.20"};
String[] ivyVersions = {"2.5.0", "2.4.0"};
try {
URL groovyJar = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@
import static org.eclipse.jdt.groovy.core.tests.GroovyBundle.isAtLeastGroovy;
import static org.eclipse.jdt.groovy.core.tests.GroovyBundle.isParrotParser;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;

import java.io.File;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;

import org.codehaus.groovy.control.CompilerConfiguration;
import org.codehaus.jdt.groovy.internal.compiler.ast.EventListener;
import org.codehaus.jdt.groovy.internal.compiler.ast.GroovyClassScope;
import org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration;
Expand Down Expand Up @@ -5297,17 +5294,6 @@ public void testVisibility() {
runConformTest(sources, "success");
}

@Test
public void testConfigDefaults() {
CompilerConfiguration defaultConfig = CompilerConfiguration.DEFAULT;

assertNull(defaultConfig.getJointCompilationOptions());
assertNull(defaultConfig.getDisabledGlobalASTTransformations());
assertEquals(Collections.emptyList(), defaultConfig.getClasspath());
assertEquals(Collections.emptyList(), defaultConfig.getCompilationCustomizers());
assertEquals(Collections.singleton("groovy"), defaultConfig.getScriptExtensions());
}

@Test
public void testConfigScriptWithError() {
Map<String, String> options = getCompilerOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,9 @@ public void setTargetBytecode(String version) {
}
}
*/
int index = Arrays.binarySearch(ALLOWED_JDKS, version);
int index = Arrays.binarySearch(ALLOWED_JDKS, !version.startsWith("1") ? "1." + version : version);
if (index >= 0) {
targetBytecode = version; // exact match
targetBytecode = ALLOWED_JDKS[index];
} else {
index = Math.abs(index) - 2; // closest version
targetBytecode = ALLOWED_JDKS[Math.max(0, index)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,14 @@ private void setTargetBytecodeIfValid(String version) {
this.targetBytecode = version;
}
*/
int index = Arrays.binarySearch(ALLOWED_JDKS, version);
int index;
try { ALLOWED_JDKS[5] = "1.9"; // 9 is out of order for binary search
index = Arrays.binarySearch(ALLOWED_JDKS, !version.startsWith("1") ? "1." + version : version);
} finally {
ALLOWED_JDKS[5] = "9";
}
if (index >= 0) {
targetBytecode = version; // exact match
targetBytecode = ALLOWED_JDKS[index];
} else {
index = Math.abs(index) - 2; // closest version
targetBytecode = ALLOWED_JDKS[Math.max(0, index)];
Expand Down
3 changes: 0 additions & 3 deletions base/org.codehaus.groovy30/.checkstyle
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@
<file-match-pattern match-pattern="groovy/classgen/Verifier.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticInvocationWriter.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticPropertyAccessHelper.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticTypesBinaryExpressionMultiTypeDispatcher.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticTypesUnaryExpressionHelper.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/control/CompilationUnit.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/control/CompilerConfiguration.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/control/ErrorCollector.java" include-pattern="false" />
Expand Down
8 changes: 4 additions & 4 deletions base/org.codehaus.groovy30/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy30/lib/ivy-2.5.0-javadoc.jar!/" />
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/groovy-3.0.5-indy.jar" sourcepath="lib/groovy-3.0.5-sources.jar" exported="true">
<classpathentry kind="lib" path="lib/groovy-3.0.6-indy.jar" sourcepath="lib/groovy-3.0.6-sources.jar" exported="true">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy30/lib/groovy-3.0.5-javadoc.jar!/" />
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy30/lib/groovy-3.0.6-javadoc.jar!/" />
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/groovy-test-3.0.5-indy.jar" sourcepath="lib/groovy-test-3.0.5-sources.jar" exported="true">
<classpathentry kind="lib" path="lib/groovy-test-3.0.6-indy.jar" sourcepath="lib/groovy-test-3.0.6-sources.jar" exported="true">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy30/lib/groovy-test-3.0.5-javadoc.jar!/" />
<attribute name="javadoc_location" value="jar:platform:/resource/org.codehaus.groovy30/lib/groovy-test-3.0.6-javadoc.jar!/" />
</attributes>
</classpathentry>

Expand Down
178 changes: 89 additions & 89 deletions base/org.codehaus.groovy30/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -4,100 +4,100 @@ Bundle-SymbolicName: org.codehaus.groovy
Automatic-Module-Name: org.codehaus.groovy
Bundle-Name: Apache Groovy
Bundle-Vendor: Pivotal Software, Inc.
Bundle-Version: 3.0.5.qualifier
Bundle-Version: 3.0.6.qualifier
Bundle-ClassPath: eclipse-trace.jar,
groovy-eclipse.jar,
lib/ivy-2.5.0.jar,
lib/groovy-3.0.5-indy.jar,
lib/groovy-test-3.0.5-indy.jar
Export-Package: groovy.beans;version="3.0.5",
groovy.cli;version="3.0.5",
groovy.grape;version="3.0.5",
groovy.inspect;version="3.0.5",
groovy.io;version="3.0.5",
groovy.lang;version="3.0.5",
groovy.lang.groovydoc;version="3.0.5",
groovy.mock.interceptor;version="3.0.5",
groovy.namespace;version="3.0.5",
groovy.security;version="3.0.5",
groovy.test;version="3.0.5",
groovy.time;version="3.0.5",
groovy.transform;version="3.0.5",
groovy.transform.builder;version="3.0.5",
groovy.transform.options;version="3.0.5",
groovy.transform.stc;version="3.0.5",
groovy.ui;version="3.0.5",
groovy.util;version="3.0.5",
groovy.util.logging;version="3.0.5",
groovy.xml;version="3.0.5",
lib/groovy-3.0.6-indy.jar,
lib/groovy-test-3.0.6-indy.jar
Export-Package: groovy.beans;version="3.0.6",
groovy.cli;version="3.0.6",
groovy.grape;version="3.0.6",
groovy.inspect;version="3.0.6",
groovy.io;version="3.0.6",
groovy.lang;version="3.0.6",
groovy.lang.groovydoc;version="3.0.6",
groovy.mock.interceptor;version="3.0.6",
groovy.namespace;version="3.0.6",
groovy.security;version="3.0.6",
groovy.test;version="3.0.6",
groovy.time;version="3.0.6",
groovy.transform;version="3.0.6",
groovy.transform.builder;version="3.0.6",
groovy.transform.options;version="3.0.6",
groovy.transform.stc;version="3.0.6",
groovy.ui;version="3.0.6",
groovy.util;version="3.0.6",
groovy.util.logging;version="3.0.6",
groovy.xml;version="3.0.6",
groovyjarjarantlr;x-friends:="org.codehaus.groovy.eclipse.refactoring",
org.apache.groovy.antlr;version="3.0.5",
org.apache.groovy.ast.tools;version="3.0.5",
org.apache.groovy.io;version="3.0.5",
org.apache.groovy.lang.annotation;version="3.0.5",
org.apache.groovy.metaclass;version="3.0.5",
org.apache.groovy.plugin;version="3.0.5",
org.apache.groovy.test;version="3.0.5",
org.apache.groovy.test.transform;version="3.0.5",
org.apache.groovy.util;version="3.0.5",
org.apache.groovy.util.concurrent;version="3.0.5",
org.apache.groovy.util.concurrent.concurrentlinkedhashmap;version="3.0.5",
org.codehaus.groovy;version="3.0.5",
org.codehaus.groovy.antlr;version="3.0.5",
org.codehaus.groovy.antlr.parser;version="3.0.5",
org.codehaus.groovy.ast;version="3.0.5",
org.codehaus.groovy.ast.builder;version="3.0.5",
org.codehaus.groovy.ast.decompiled;version="3.0.5",
org.codehaus.groovy.ast.expr;version="3.0.5",
org.codehaus.groovy.ast.stmt;version="3.0.5",
org.codehaus.groovy.ast.tools;version="3.0.5",
org.codehaus.groovy.classgen;version="3.0.5",
org.codehaus.groovy.classgen.asm;version="3.0.5",
org.codehaus.groovy.classgen.asm.indy;version="3.0.5",
org.codehaus.groovy.classgen.asm.indy.sc;version="3.0.5",
org.codehaus.groovy.classgen.asm.sc;version="3.0.5",
org.codehaus.groovy.classgen.asm.util;version="3.0.5",
org.codehaus.groovy.control;version="3.0.5",
org.codehaus.groovy.control.customizers;version="3.0.5",
org.codehaus.groovy.control.customizers.builder;version="3.0.5",
org.codehaus.groovy.control.io;version="3.0.5",
org.codehaus.groovy.control.messages;version="3.0.5",
org.apache.groovy.antlr;version="3.0.6",
org.apache.groovy.ast.tools;version="3.0.6",
org.apache.groovy.io;version="3.0.6",
org.apache.groovy.lang.annotation;version="3.0.6",
org.apache.groovy.metaclass;version="3.0.6",
org.apache.groovy.plugin;version="3.0.6",
org.apache.groovy.test;version="3.0.6",
org.apache.groovy.test.transform;version="3.0.6",
org.apache.groovy.util;version="3.0.6",
org.apache.groovy.util.concurrent;version="3.0.6",
org.apache.groovy.util.concurrent.concurrentlinkedhashmap;version="3.0.6",
org.codehaus.groovy;version="3.0.6",
org.codehaus.groovy.antlr;version="3.0.6",
org.codehaus.groovy.antlr.parser;version="3.0.6",
org.codehaus.groovy.ast;version="3.0.6",
org.codehaus.groovy.ast.builder;version="3.0.6",
org.codehaus.groovy.ast.decompiled;version="3.0.6",
org.codehaus.groovy.ast.expr;version="3.0.6",
org.codehaus.groovy.ast.stmt;version="3.0.6",
org.codehaus.groovy.ast.tools;version="3.0.6",
org.codehaus.groovy.classgen;version="3.0.6",
org.codehaus.groovy.classgen.asm;version="3.0.6",
org.codehaus.groovy.classgen.asm.indy;version="3.0.6",
org.codehaus.groovy.classgen.asm.indy.sc;version="3.0.6",
org.codehaus.groovy.classgen.asm.sc;version="3.0.6",
org.codehaus.groovy.classgen.asm.util;version="3.0.6",
org.codehaus.groovy.control;version="3.0.6",
org.codehaus.groovy.control.customizers;version="3.0.6",
org.codehaus.groovy.control.customizers.builder;version="3.0.6",
org.codehaus.groovy.control.io;version="3.0.6",
org.codehaus.groovy.control.messages;version="3.0.6",
org.codehaus.groovy.eclipse,
org.codehaus.groovy.plugin;version="3.0.5",
org.codehaus.groovy.reflection;version="3.0.5",
org.codehaus.groovy.reflection.android;version="3.0.5",
org.codehaus.groovy.reflection.stdclasses;version="3.0.5",
org.codehaus.groovy.reflection.v7;version="3.0.5",
org.codehaus.groovy.runtime;version="3.0.5",
org.codehaus.groovy.runtime.callsite;version="3.0.5",
org.codehaus.groovy.runtime.dgmimpl;version="3.0.5",
org.codehaus.groovy.runtime.dgmimpl.arrays;version="3.0.5",
org.codehaus.groovy.runtime.m12n;version="3.0.5",
org.codehaus.groovy.runtime.memoize;version="3.0.5",
org.codehaus.groovy.runtime.metaclass;version="3.0.5",
org.codehaus.groovy.runtime.powerassert;version="3.0.5",
org.codehaus.groovy.runtime.typehandling;version="3.0.5",
org.codehaus.groovy.runtime.wrappers;version="3.0.5",
org.codehaus.groovy.syntax;version="3.0.5",
org.codehaus.groovy.tools;version="3.0.5",
org.codehaus.groovy.tools.ast;version="3.0.5",
org.codehaus.groovy.tools.gse;version="3.0.5",
org.codehaus.groovy.tools.javac;version="3.0.5",
org.codehaus.groovy.tools.shell;version="3.0.5",
org.codehaus.groovy.tools.shell.util;version="3.0.5",
org.codehaus.groovy.transform;version="3.0.5",
org.codehaus.groovy.transform.sc;version="3.0.5",
org.codehaus.groovy.transform.sc.transformers;version="3.0.5",
org.codehaus.groovy.transform.stc;version="3.0.5",
org.codehaus.groovy.transform.tailrec;version="3.0.5",
org.codehaus.groovy.transform.trait;version="3.0.5",
org.codehaus.groovy.util;version="3.0.5",
org.codehaus.groovy.vmplugin;version="3.0.5",
org.codehaus.groovy.vmplugin.v5;version="3.0.5",
org.codehaus.groovy.vmplugin.v6;version="3.0.5",
org.codehaus.groovy.vmplugin.v7;version="3.0.5",
org.codehaus.groovy.vmplugin.v8;version="3.0.5",
org.codehaus.groovy.vmplugin.v9;version="3.0.5"
org.codehaus.groovy.plugin;version="3.0.6",
org.codehaus.groovy.reflection;version="3.0.6",
org.codehaus.groovy.reflection.android;version="3.0.6",
org.codehaus.groovy.reflection.stdclasses;version="3.0.6",
org.codehaus.groovy.reflection.v7;version="3.0.6",
org.codehaus.groovy.runtime;version="3.0.6",
org.codehaus.groovy.runtime.callsite;version="3.0.6",
org.codehaus.groovy.runtime.dgmimpl;version="3.0.6",
org.codehaus.groovy.runtime.dgmimpl.arrays;version="3.0.6",
org.codehaus.groovy.runtime.m12n;version="3.0.6",
org.codehaus.groovy.runtime.memoize;version="3.0.6",
org.codehaus.groovy.runtime.metaclass;version="3.0.6",
org.codehaus.groovy.runtime.powerassert;version="3.0.6",
org.codehaus.groovy.runtime.typehandling;version="3.0.6",
org.codehaus.groovy.runtime.wrappers;version="3.0.6",
org.codehaus.groovy.syntax;version="3.0.6",
org.codehaus.groovy.tools;version="3.0.6",
org.codehaus.groovy.tools.ast;version="3.0.6",
org.codehaus.groovy.tools.gse;version="3.0.6",
org.codehaus.groovy.tools.javac;version="3.0.6",
org.codehaus.groovy.tools.shell;version="3.0.6",
org.codehaus.groovy.tools.shell.util;version="3.0.6",
org.codehaus.groovy.transform;version="3.0.6",
org.codehaus.groovy.transform.sc;version="3.0.6",
org.codehaus.groovy.transform.sc.transformers;version="3.0.6",
org.codehaus.groovy.transform.stc;version="3.0.6",
org.codehaus.groovy.transform.tailrec;version="3.0.6",
org.codehaus.groovy.transform.trait;version="3.0.6",
org.codehaus.groovy.util;version="3.0.6",
org.codehaus.groovy.vmplugin;version="3.0.6",
org.codehaus.groovy.vmplugin.v5;version="3.0.6",
org.codehaus.groovy.vmplugin.v6;version="3.0.6",
org.codehaus.groovy.vmplugin.v7;version="3.0.6",
org.codehaus.groovy.vmplugin.v8;version="3.0.6",
org.codehaus.groovy.vmplugin.v9;version="3.0.6"
Require-Bundle: org.eclipse.core.runtime,
org.junit;resolution:=optional
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Expand Down
1 change: 1 addition & 0 deletions base/org.codehaus.groovy30/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
2020-04-10: GROOVY_3_0_3
2020-05-21: GROOVY_3_0_4
2020-07-23: GROOVY_3_0_5
2020-09-29: GROOVY_3_0_5
Loading

0 comments on commit ae81a3d

Please sign in to comment.