[groovy] branch GROOVY_2_5_X updated (a995ad2 -> b1fb94b)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a change to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git. from a995ad2 GROOVY-9135: Additional support for @Testable annotation in JUnit5Runner new 73f999e Update eclipse gradle scripts new 875db5e Fix test compile dependency new f920a8b Add test runtime dependency (closes #932) new 519cd72 GROOVY-9141: add null check for classNode when checking for abstract method with body (closes #933) new b1fb94b GROOVY-9141: add null check for classNode when checking for abstract method with body (tweaks) The 5 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .gitignore | 17 ++-- gradle/eclipse.gradle | 109 ++--- .../codehaus/groovy/antlr/AntlrParserPlugin.java | 13 ++- .../{Groovy8797Bug.groovy => Groovy9141.groovy}| 31 +++--- subprojects/groovy-docgenerator/build.gradle | 4 + subprojects/groovy-groovydoc/build.gradle | 9 ++ subprojects/groovy-groovysh/build.gradle | 4 + subprojects/groovy-json/build.gradle | 7 +- subprojects/groovy-servlet/build.gradle| 7 +- subprojects/groovy-test/build.gradle | 4 + subprojects/tests-vm8/build.gradle | 4 + 11 files changed, 141 insertions(+), 68 deletions(-) copy src/test/groovy/bugs/{Groovy8797Bug.groovy => Groovy9141.groovy} (61%)
[groovy] 02/05: Fix test compile dependency
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit 875db5ea473a5f0280d2c617bc0a8729397372d9 Author: Eric Milles AuthorDate: Thu May 23 11:29:08 2019 -0500 Fix test compile dependency --- subprojects/groovy-servlet/build.gradle | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/subprojects/groovy-servlet/build.gradle b/subprojects/groovy-servlet/build.gradle index 60faeb1..f5b16a0 100644 --- a/subprojects/groovy-servlet/build.gradle +++ b/subprojects/groovy-servlet/build.gradle @@ -24,18 +24,15 @@ dependencies { provided dep exclude(group: 'javax.servlet', module: 'servlet-api') } -compile rootProject testCompile "jmock:jmock:$jmockVersion" + +compile rootProject // needed for MarkupBuilder compile project(':groovy-xml') // needed by TemplateServlet compile project(':groovy-templates') + testCompile rootProject.sourceSets.test.runtimeClasspath +testCompile project(':groovy-json') testCompile project(':groovy-test') -// for compilation, dependency is not necessary because the classes are loaded using Class.forName -testRuntime project(':groovy-json') -} - -eclipse.classpath.file.whenMerged { -entries.removeAll { entry -> entry.path == '/groovy-json' } }
[groovy] 01/05: Update eclipse gradle scripts
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit 73f999e5979a60ff382c1303688496492a02a5d2 Author: Eric Milles AuthorDate: Wed May 22 14:40:40 2019 -0500 Update eclipse gradle scripts --- .gitignore | 17 +++-- gradle/eclipse.gradle| 109 +-- subprojects/groovy-docgenerator/build.gradle | 4 + subprojects/groovy-groovydoc/build.gradle| 9 +++ subprojects/groovy-groovysh/build.gradle | 4 + subprojects/groovy-json/build.gradle | 6 +- subprojects/groovy-servlet/build.gradle | 6 +- subprojects/groovy-test/build.gradle | 4 + subprojects/tests-vm8/build.gradle | 4 + 9 files changed, 116 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index 1ba2a13..338baa0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,21 @@ +user.gradle +.gradle/ target/ build/ out/ -/bin/ + *.DS_Store +*.class +*.swp *~ -.gradle + +.idea *.iml *.ipr *.iws -.idea -.*.swp -*.class -user.gradle +.shelf + .settings/ .classpath .project -.shelf +bin/ diff --git a/gradle/eclipse.gradle b/gradle/eclipse.gradle index 559004b..84be8cf 100644 --- a/gradle/eclipse.gradle +++ b/gradle/eclipse.gradle @@ -16,52 +16,85 @@ * specific language governing permissions and limitations * under the License. */ -//most of this is just a "hack" to break the circular dependencies between projects -//which exist because Eclipse does not distinguish between build phases (e.g. compile, test, runtime) allprojects { apply plugin: 'eclipse' - -eclipse.jdt { -sourceCompatibility = 1.7 -targetCompatibility = 1.7 -} - -eclipse.classpath.file { -whenMerged { classpath -> -classpath.entries.removeAll{ entry -> entry.path == '/groovy-groovydoc' } -classpath.entries.removeAll{ entry -> entry.path =~ /groovy-ant/ } -classpath.entries.removeAll{ entry -> entry.path =~ /target/ } -classpath.entries.unique(true){ entry -> entry.path } + +eclipse.classpath.file.whenMerged { +entries.removeAll { entry -> entry.path =~ '/target/' } // affects: cli-commons, cli-picocli, console, groovydoc, macro, servlet, swing, templates, xml +entries.unique(true) { entry -> entry.path } // affects: console, groovydoc, macro, servlet, swing, templates, xml +entries.sort(true) { entry -> "${entry.kind}:${entry.path}".toString() } + +// set "test" attribute based on gradle scopes +entries.findAll { entry -> +entry.class.name in [ +'org.gradle.plugins.ide.eclipse.model.Library', +'org.gradle.plugins.ide.eclipse.model.SourceFolder' +] +}.each { entry -> +if (entry.entryAttributes['gradle_used_by_scope'] == 'test') { +entry.entryAttributes['test'] = 'true' +} } -withXml { -def node = it.asNode() -node.appendNode('classpathentry', [kind: 'lib', path: "${rootProject.jar.archivePath}"]) +// set "test" attribute based on configuration +entries.findAll { entry -> +entry.class.name in [ +'org.gradle.plugins.ide.eclipse.model.ProjectDependency' +] +}.each { entry -> +if (entry.path.substring(1) in project.configurations.testCompile.dependencies*.name) { +entry.entryAttributes['test'] = 'true' +} } } - + project.tasks.eclipse.doLast { -File groovyPrefs = file("${project.projectDir}/.settings/org.eclipse.jdt.groovy.core.prefs") -if (!groovyPrefs.exists()) { -groovyPrefs.append('groovy.compiler.level=-1\n') + file("${project.projectDir}/.settings/org.eclipse.jdt.groovy.core.prefs").with { prefs -> +if (!prefs.exists()) { +append('''\ +eclipse.preferences.version=1 +groovy.compiler.level=30 +'''.stripIndent() +) +} } -} -} -eclipse.classpath.file { -whenMerged { classpath -> -classpath.entries.find { entry -> entry.path =~ /src\/main/ }.path = '/groovy/src/main' -classpath.entries.find { entry -> entry.path =~ /src\/main/ }.includes = [] -classpath.entries.each { entry -> if(entry.path == 'src/test'){ entry.excludes = ['groovy/PropertyTest.groovy'] as List } } -classpath.entries.removeAll{ entry -> entry.path == '/groovy-test' } -classpath.entries.removeAll{ entry -> entry.path =~ /subprojects/ } -classpath.entries.removeAll{ entry -> entry.path =~ /examples/ } -} -withXml { -def node = it.asNode() -['groovy-test', 'groovy-groovydoc', 'groovy
[groovy] 05/05: GROOVY-9141: add null check for classNode when checking for abstract method with body (tweaks)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit b1fb94bff00617a90a93ba4f4dc29a6816a9d22c Author: Paul King AuthorDate: Fri May 24 11:45:47 2019 +1000 GROOVY-9141: add null check for classNode when checking for abstract method with body (tweaks) --- .../codehaus/groovy/antlr/AntlrParserPlugin.java | 9 src/test/groovy/bugs/Groovy9141.groovy | 27 +++--- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java index 81ac6a4..dee0a95 100644 --- a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java +++ b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java @@ -921,12 +921,11 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin, Groovy modifiers &= ~Opcodes.ACC_SYNTHETIC; methodNode = new MethodNode(name, modifiers, returnType, parameters, exceptions, code); if ((modifiers & Opcodes.ACC_ABSTRACT) == 0) { -if (node != null) { -assertNodeType(SLIST, node); -code = statementList(node); -} else { -throw new ASTRuntimeException(methodDef, "You defined a method without body. Try adding a body, or declare it abstract."); +if (node == null) { +throw new ASTRuntimeException(methodDef, "You defined a method without a body. Try adding a body, or declare it abstract."); } +assertNodeType(SLIST, node); +code = statementList(node); } else if (node != null) { if (classNode != null && classNode.isAnnotationDefinition()) { code = statement(node); diff --git a/src/test/groovy/bugs/Groovy9141.groovy b/src/test/groovy/bugs/Groovy9141.groovy index 32dd3a4..97d986c 100644 --- a/src/test/groovy/bugs/Groovy9141.groovy +++ b/src/test/groovy/bugs/Groovy9141.groovy @@ -23,24 +23,23 @@ import groovy.transform.CompileStatic @CompileStatic final class Groovy9141 extends CompilableTestSupport { +private static final String METHOD_DEF = ''' +abstract meth() { +println 42 +} +''' -void testAbstractMethodWithBody1() { -def err = shouldNotCompile '''\ -abstract def meth() { - println 42 -} -'''.stripIndent() -assert err =~ / You can not define a abstract method\[meth\] in the script. Try removing the 'abstract' / +void testAbstractMethodWithBodyInScript() { +def err = shouldNotCompile METHOD_DEF +assert err =~ / Abstract methods do not define a body. / } -void testAbstractMethodWithBody2() { -def err = shouldNotCompile '''\ +void testAbstractMethodWithBodyInClass() { +def err = shouldNotCompile """ class Main { - abstract def meth() { -println 42 - } +$METHOD_DEF } -'''.stripIndent() -assert err =~ / Can't have an abstract method in a non-abstract class. / +""" +assert err =~ / Abstract methods do not define a body. / } }
[groovy] 03/05: Add test runtime dependency (closes #932)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit f920a8b67592342193e886af21dc61d935b903e7 Author: Eric Milles AuthorDate: Thu May 23 12:30:58 2019 -0500 Add test runtime dependency (closes #932) --- subprojects/groovy-json/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/groovy-json/build.gradle b/subprojects/groovy-json/build.gradle index 3ff11ac..1ab2576 100644 --- a/subprojects/groovy-json/build.gradle +++ b/subprojects/groovy-json/build.gradle @@ -20,6 +20,7 @@ dependencies { compile rootProject testCompile project(':groovy-test') testCompile project(':groovy-dateutil') +testRuntime "org.slf4j:slf4j-api:$slf4jVersion" testRuntime project(':groovy-ant') // for JavadocAssertionTests }
[groovy] 04/05: GROOVY-9141: add null check for classNode when checking for abstract method with body (closes #933)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit 519cd72e361f1c712b1c495ebe2e4348cc8f478f Author: Eric Milles AuthorDate: Thu May 23 12:19:50 2019 -0500 GROOVY-9141: add null check for classNode when checking for abstract method with body (closes #933) --- .../codehaus/groovy/antlr/AntlrParserPlugin.java | 18 - src/test/groovy/bugs/Groovy9141.groovy | 46 ++ 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java index 40362d0..81ac6a4 100644 --- a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java +++ b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java @@ -901,7 +901,6 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin, Groovy ClassNode[] exceptions = ClassNode.EMPTY_ARRAY; if (classNode == null || !classNode.isAnnotationDefinition()) { - assertNodeType(PARAMETERS, node); parameters = parameters(node); if (parameters == null) parameters = Parameter.EMPTY_ARRAY; @@ -922,16 +921,17 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin, Groovy modifiers &= ~Opcodes.ACC_SYNTHETIC; methodNode = new MethodNode(name, modifiers, returnType, parameters, exceptions, code); if ((modifiers & Opcodes.ACC_ABSTRACT) == 0) { -if (node == null) { +if (node != null) { +assertNodeType(SLIST, node); +code = statementList(node); +} else { throw new ASTRuntimeException(methodDef, "You defined a method without body. Try adding a body, or declare it abstract."); } -assertNodeType(SLIST, node); -code = statementList(node); -} else if (node != null && classNode.isAnnotationDefinition()) { -code = statement(node); -hasAnnotationDefault = true; -} else if ((modifiers & Opcodes.ACC_ABSTRACT) > 0) { -if (node != null) { +} else if (node != null) { +if (classNode != null && classNode.isAnnotationDefinition()) { +code = statement(node); +hasAnnotationDefault = true; +} else { throw new ASTRuntimeException(methodDef, "Abstract methods do not define a body."); } } diff --git a/src/test/groovy/bugs/Groovy9141.groovy b/src/test/groovy/bugs/Groovy9141.groovy new file mode 100644 index 000..32dd3a4 --- /dev/null +++ b/src/test/groovy/bugs/Groovy9141.groovy @@ -0,0 +1,46 @@ +/* + * 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 groovy.bugs + +import gls.CompilableTestSupport +import groovy.transform.CompileStatic + +@CompileStatic +final class Groovy9141 extends CompilableTestSupport { + +void testAbstractMethodWithBody1() { +def err = shouldNotCompile '''\ +abstract def meth() { + println 42 +} +'''.stripIndent() +assert err =~ / You can not define a abstract method\[meth\] in the script. Try removing the 'abstract' / +} + +void testAbstractMethodWithBody2() { +def err = shouldNotCompile '''\ +class Main { + abstract def meth() { +println 42 + } +} +'''.stripIndent() +assert err =~ / Can't have an abstract method in a non-abstract class. / +} +}
[groovy] 02/02: GROOVY-9141: add null check for classNode when checking for abstract method with body (tweaks)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git commit 4cafae822961b51775b49d3b7201b20939e967b1 Author: Paul King AuthorDate: Fri May 24 11:45:47 2019 +1000 GROOVY-9141: add null check for classNode when checking for abstract method with body (tweaks) --- .../codehaus/groovy/antlr/AntlrParserPlugin.java | 9 +++-- src/test/groovy/bugs/Groovy9141.groovy | 38 ++ .../apache/groovy/parser/antlr4/AstBuilder.java| 6 ++-- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java index 81ac6a4..dee0a95 100644 --- a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java +++ b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java @@ -921,12 +921,11 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin, Groovy modifiers &= ~Opcodes.ACC_SYNTHETIC; methodNode = new MethodNode(name, modifiers, returnType, parameters, exceptions, code); if ((modifiers & Opcodes.ACC_ABSTRACT) == 0) { -if (node != null) { -assertNodeType(SLIST, node); -code = statementList(node); -} else { -throw new ASTRuntimeException(methodDef, "You defined a method without body. Try adding a body, or declare it abstract."); +if (node == null) { +throw new ASTRuntimeException(methodDef, "You defined a method without a body. Try adding a body, or declare it abstract."); } +assertNodeType(SLIST, node); +code = statementList(node); } else if (node != null) { if (classNode != null && classNode.isAnnotationDefinition()) { code = statement(node); diff --git a/src/test/groovy/bugs/Groovy9141.groovy b/src/test/groovy/bugs/Groovy9141.groovy index 32dd3a4..0889d36 100644 --- a/src/test/groovy/bugs/Groovy9141.groovy +++ b/src/test/groovy/bugs/Groovy9141.groovy @@ -20,27 +20,39 @@ package groovy.bugs import gls.CompilableTestSupport import groovy.transform.CompileStatic +import org.codehaus.groovy.control.CompilerConfiguration + +import static org.codehaus.groovy.control.ParserVersion.V_2 @CompileStatic final class Groovy9141 extends CompilableTestSupport { +private static final String METHOD_DEF = ''' +abstract meth() { +println 42 +} +''' -void testAbstractMethodWithBody1() { -def err = shouldNotCompile '''\ -abstract def meth() { - println 42 -} -'''.stripIndent() -assert err =~ / You can not define a abstract method\[meth\] in the script. Try removing the 'abstract' / +void testAbstractMethodWithBodyInScript() { +def err = shouldNotCompile METHOD_DEF +assert err =~ / You cannot define an abstract method\[meth\] in the script. Try removing the 'abstract' / } -void testAbstractMethodWithBody2() { -def err = shouldNotCompile '''\ +void testAbstractMethodWithBodyInClass() { +def err = shouldNotCompile """ class Main { - abstract def meth() { -println 42 - } +$METHOD_DEF } -'''.stripIndent() +""" +// not a language requirement but class level check takes precedence in current implementation assert err =~ / Can't have an abstract method in a non-abstract class. / } + +void testAbstractMethodWithBodyInScript_oldParser() { +def cc = new CompilerConfiguration(parserVersion: V_2) +def err = shouldFail { +new GroovyShell(cc).evaluate METHOD_DEF +} +assert err =~ / Abstract methods do not define a body/ +} + } diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java index 0e54bb9..bd93781 100644 --- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java +++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java @@ -1637,7 +1637,7 @@ public class AstBuilder extends GroovyParserBaseVisitor implements Groov if (9 == ctx.ct) { // script if (isAbstractMethod || !hasMethodBody) { // method should not be declared abstract in the script -throw createParsingFailedException("You can not define a " + (isAbstractMethod ? "abstract" : "") + " method[" + methodNode.getName() + "] " + (!hasMethodBody ? "without method body" : "") + " in the script. Try " + (isAbstractMethod ? "removing the 'abstract'" : "") + (isAbstractMethod && !hasMethodBody ? " a
[groovy] branch master updated (5a5494a -> 4cafae8)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git. from 5a5494a Add test runtime dependency (closes #932) new 25465fc GROOVY-9141: add null check for classNode when checking for abstract method with body (closes #933) new 4cafae8 GROOVY-9141: add null check for classNode when checking for abstract method with body (tweaks) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../codehaus/groovy/antlr/AntlrParserPlugin.java | 13 +++-- src/test/groovy/bugs/Groovy9141.groovy | 58 ++ .../apache/groovy/parser/antlr4/AstBuilder.java| 6 +-- 3 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 src/test/groovy/bugs/Groovy9141.groovy
[groovy] 01/02: GROOVY-9141: add null check for classNode when checking for abstract method with body (closes #933)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git commit 25465fcad59b2fa4cd365b66a27cac15ef6f49e0 Author: Eric Milles AuthorDate: Thu May 23 12:19:50 2019 -0500 GROOVY-9141: add null check for classNode when checking for abstract method with body (closes #933) --- .../codehaus/groovy/antlr/AntlrParserPlugin.java | 18 - src/test/groovy/bugs/Groovy9141.groovy | 46 ++ 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java index 40362d0..81ac6a4 100644 --- a/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java +++ b/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java @@ -901,7 +901,6 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin, Groovy ClassNode[] exceptions = ClassNode.EMPTY_ARRAY; if (classNode == null || !classNode.isAnnotationDefinition()) { - assertNodeType(PARAMETERS, node); parameters = parameters(node); if (parameters == null) parameters = Parameter.EMPTY_ARRAY; @@ -922,16 +921,17 @@ public class AntlrParserPlugin extends ASTHelper implements ParserPlugin, Groovy modifiers &= ~Opcodes.ACC_SYNTHETIC; methodNode = new MethodNode(name, modifiers, returnType, parameters, exceptions, code); if ((modifiers & Opcodes.ACC_ABSTRACT) == 0) { -if (node == null) { +if (node != null) { +assertNodeType(SLIST, node); +code = statementList(node); +} else { throw new ASTRuntimeException(methodDef, "You defined a method without body. Try adding a body, or declare it abstract."); } -assertNodeType(SLIST, node); -code = statementList(node); -} else if (node != null && classNode.isAnnotationDefinition()) { -code = statement(node); -hasAnnotationDefault = true; -} else if ((modifiers & Opcodes.ACC_ABSTRACT) > 0) { -if (node != null) { +} else if (node != null) { +if (classNode != null && classNode.isAnnotationDefinition()) { +code = statement(node); +hasAnnotationDefault = true; +} else { throw new ASTRuntimeException(methodDef, "Abstract methods do not define a body."); } } diff --git a/src/test/groovy/bugs/Groovy9141.groovy b/src/test/groovy/bugs/Groovy9141.groovy new file mode 100644 index 000..32dd3a4 --- /dev/null +++ b/src/test/groovy/bugs/Groovy9141.groovy @@ -0,0 +1,46 @@ +/* + * 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 groovy.bugs + +import gls.CompilableTestSupport +import groovy.transform.CompileStatic + +@CompileStatic +final class Groovy9141 extends CompilableTestSupport { + +void testAbstractMethodWithBody1() { +def err = shouldNotCompile '''\ +abstract def meth() { + println 42 +} +'''.stripIndent() +assert err =~ / You can not define a abstract method\[meth\] in the script. Try removing the 'abstract' / +} + +void testAbstractMethodWithBody2() { +def err = shouldNotCompile '''\ +class Main { + abstract def meth() { +println 42 + } +} +'''.stripIndent() +assert err =~ / Can't have an abstract method in a non-abstract class. / +} +}
[groovy] 03/03: Add test runtime dependency (closes #932)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git commit 5a5494ae12be4d2b7c7dd50038f88d86c938a1f5 Author: Eric Milles AuthorDate: Thu May 23 12:30:58 2019 -0500 Add test runtime dependency (closes #932) --- subprojects/groovy-json/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/groovy-json/build.gradle b/subprojects/groovy-json/build.gradle index 3ff11ac..1ab2576 100644 --- a/subprojects/groovy-json/build.gradle +++ b/subprojects/groovy-json/build.gradle @@ -20,6 +20,7 @@ dependencies { compile rootProject testCompile project(':groovy-test') testCompile project(':groovy-dateutil') +testRuntime "org.slf4j:slf4j-api:$slf4jVersion" testRuntime project(':groovy-ant') // for JavadocAssertionTests }
[groovy] 02/03: Fix test compile dependency
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git commit fc99f70c6f146590faf1f952df480398faa5ead1 Author: Eric Milles AuthorDate: Thu May 23 11:29:08 2019 -0500 Fix test compile dependency --- subprojects/groovy-servlet/build.gradle | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/subprojects/groovy-servlet/build.gradle b/subprojects/groovy-servlet/build.gradle index 60faeb1..f5b16a0 100644 --- a/subprojects/groovy-servlet/build.gradle +++ b/subprojects/groovy-servlet/build.gradle @@ -24,18 +24,15 @@ dependencies { provided dep exclude(group: 'javax.servlet', module: 'servlet-api') } -compile rootProject testCompile "jmock:jmock:$jmockVersion" + +compile rootProject // needed for MarkupBuilder compile project(':groovy-xml') // needed by TemplateServlet compile project(':groovy-templates') + testCompile rootProject.sourceSets.test.runtimeClasspath +testCompile project(':groovy-json') testCompile project(':groovy-test') -// for compilation, dependency is not necessary because the classes are loaded using Class.forName -testRuntime project(':groovy-json') -} - -eclipse.classpath.file.whenMerged { -entries.removeAll { entry -> entry.path == '/groovy-json' } }
[groovy] 01/03: Update eclipse gradle scripts
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git commit ebd902af8bd3aa8d96cbe6739258750145a32db3 Author: Eric Milles AuthorDate: Wed May 22 14:40:40 2019 -0500 Update eclipse gradle scripts --- .gitignore | 18 +++-- gradle/eclipse.gradle| 109 +-- subprojects/groovy-docgenerator/build.gradle | 4 + subprojects/groovy-groovydoc/build.gradle| 4 + subprojects/groovy-groovysh/build.gradle | 4 + subprojects/groovy-json/build.gradle | 6 +- subprojects/groovy-servlet/build.gradle | 6 +- subprojects/groovy-test/build.gradle | 4 + subprojects/groovy-yaml/build.gradle | 4 + 9 files changed, 111 insertions(+), 48 deletions(-) diff --git a/.gitignore b/.gitignore index b7ec6f4..338baa0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,21 @@ +user.gradle +.gradle/ target/ build/ out/ -/bin/ + *.DS_Store +*.class +*.swp *~ -.gradle + +.idea *.iml *.ipr *.iws -.idea -.*.swp -*.class -user.gradle +.shelf + .settings/ .classpath .project -.shelf - +bin/ diff --git a/gradle/eclipse.gradle b/gradle/eclipse.gradle index 559004b..84be8cf 100644 --- a/gradle/eclipse.gradle +++ b/gradle/eclipse.gradle @@ -16,52 +16,85 @@ * specific language governing permissions and limitations * under the License. */ -//most of this is just a "hack" to break the circular dependencies between projects -//which exist because Eclipse does not distinguish between build phases (e.g. compile, test, runtime) allprojects { apply plugin: 'eclipse' - -eclipse.jdt { -sourceCompatibility = 1.7 -targetCompatibility = 1.7 -} - -eclipse.classpath.file { -whenMerged { classpath -> -classpath.entries.removeAll{ entry -> entry.path == '/groovy-groovydoc' } -classpath.entries.removeAll{ entry -> entry.path =~ /groovy-ant/ } -classpath.entries.removeAll{ entry -> entry.path =~ /target/ } -classpath.entries.unique(true){ entry -> entry.path } + +eclipse.classpath.file.whenMerged { +entries.removeAll { entry -> entry.path =~ '/target/' } // affects: cli-commons, cli-picocli, console, groovydoc, macro, servlet, swing, templates, xml +entries.unique(true) { entry -> entry.path } // affects: console, groovydoc, macro, servlet, swing, templates, xml +entries.sort(true) { entry -> "${entry.kind}:${entry.path}".toString() } + +// set "test" attribute based on gradle scopes +entries.findAll { entry -> +entry.class.name in [ +'org.gradle.plugins.ide.eclipse.model.Library', +'org.gradle.plugins.ide.eclipse.model.SourceFolder' +] +}.each { entry -> +if (entry.entryAttributes['gradle_used_by_scope'] == 'test') { +entry.entryAttributes['test'] = 'true' +} } -withXml { -def node = it.asNode() -node.appendNode('classpathentry', [kind: 'lib', path: "${rootProject.jar.archivePath}"]) +// set "test" attribute based on configuration +entries.findAll { entry -> +entry.class.name in [ +'org.gradle.plugins.ide.eclipse.model.ProjectDependency' +] +}.each { entry -> +if (entry.path.substring(1) in project.configurations.testCompile.dependencies*.name) { +entry.entryAttributes['test'] = 'true' +} } } - + project.tasks.eclipse.doLast { -File groovyPrefs = file("${project.projectDir}/.settings/org.eclipse.jdt.groovy.core.prefs") -if (!groovyPrefs.exists()) { -groovyPrefs.append('groovy.compiler.level=-1\n') + file("${project.projectDir}/.settings/org.eclipse.jdt.groovy.core.prefs").with { prefs -> +if (!prefs.exists()) { +append('''\ +eclipse.preferences.version=1 +groovy.compiler.level=30 +'''.stripIndent() +) +} } -} -} -eclipse.classpath.file { -whenMerged { classpath -> -classpath.entries.find { entry -> entry.path =~ /src\/main/ }.path = '/groovy/src/main' -classpath.entries.find { entry -> entry.path =~ /src\/main/ }.includes = [] -classpath.entries.each { entry -> if(entry.path == 'src/test'){ entry.excludes = ['groovy/PropertyTest.groovy'] as List } } -classpath.entries.removeAll{ entry -> entry.path == '/groovy-test' } -classpath.entries.removeAll{ entry -> entry.path =~ /subprojects/ } -classpath.entries.removeAll{ entry -> entry.path =~ /examples/ } -} -withXml { -def node = it.asNode() -['groovy-test', 'groovy-groovydoc', 'groovy-jmx',
[groovy] branch master updated (8635e34 -> 5a5494a)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git. from 8635e34 GROOVY-9139: Bump JUnit 5 to 5.5.0-M1 new ebd902a Update eclipse gradle scripts new fc99f70 Fix test compile dependency new 5a5494a Add test runtime dependency (closes #932) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .gitignore | 18 +++-- gradle/eclipse.gradle| 109 +-- subprojects/groovy-docgenerator/build.gradle | 4 + subprojects/groovy-groovydoc/build.gradle| 4 + subprojects/groovy-groovysh/build.gradle | 4 + subprojects/groovy-json/build.gradle | 7 +- subprojects/groovy-servlet/build.gradle | 7 +- subprojects/groovy-test/build.gradle | 4 + subprojects/groovy-yaml/build.gradle | 4 + 9 files changed, 111 insertions(+), 50 deletions(-)