You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/04/21 10:09:57 UTC
[1/6] groovy git commit: GROOVY-7879 Groovy calls wrong method if
there is a static method on an interface
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_5_X cddbe169e -> 5805cdb5b
GROOVY-7879 Groovy calls wrong method if there is a static method on an interface
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e8a0e3a0
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e8a0e3a0
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e8a0e3a0
Branch: refs/heads/GROOVY_2_5_X
Commit: e8a0e3a0f982f3ea9acd511fb9d067b465cd4331
Parents: cddbe16
Author: Dmitrii Kahmitov <kh...@gmail.com>
Authored: Wed Apr 5 09:49:54 2017 +0300
Committer: paulk <pa...@asert.com.au>
Committed: Fri Apr 21 15:38:33 2017 +1000
----------------------------------------------------------------------
.../runtime/metaclass/MetaMethodIndex.java | 14 +++++--
.../runtime/methoddispatching/BarOne.java | 25 ++++++++++++
.../runtime/methoddispatching/BarThree.java | 25 ++++++++++++
.../runtime/methoddispatching/BarTwo.java | 25 ++++++++++++
.../runtime/methoddispatching/FooOne.java | 25 ++++++++++++
.../runtime/methoddispatching/FooThree.java | 33 +++++++++++++++
.../runtime/methoddispatching/FooTwo.java | 29 ++++++++++++++
.../StaticMethodOverloadTest.groovy | 42 ++++++++++++++++++++
8 files changed, 214 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/e8a0e3a0/src/main/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java b/src/main/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java
index 0598f9a..c442e48 100644
--- a/src/main/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java
+++ b/src/main/org/codehaus/groovy/runtime/metaclass/MetaMethodIndex.java
@@ -315,7 +315,7 @@ public class MetaMethodIndex {
Object oldListOrMethod = e.methodsForSuper;
if (oldListOrMethod == null)
return;
-
+
if (oldListOrMethod instanceof FastArray) {
FastArray oldList = (FastArray) oldListOrMethod;
int len1 = oldList.size();
@@ -346,7 +346,7 @@ public class MetaMethodIndex {
Object oldListOrMethod = from.methods;
if (oldListOrMethod == null)
return;
-
+
if (oldListOrMethod instanceof FastArray) {
FastArray oldList = (FastArray) oldListOrMethod;
Entry e = null;
@@ -381,7 +381,10 @@ public class MetaMethodIndex {
return list;
} else {
if (match.isPrivate()
- || (!isNonRealMethod(match) && match.getDeclaringClass().isInterface() && !method.getDeclaringClass().isInterface())) {
+ || (!isNonRealMethod(match)
+ && match.getDeclaringClass().isInterface()
+ && !method.getDeclaringClass().isInterface()
+ && !method.isStatic())) {
// do not overwrite interface methods with instance methods
// do not overwrite private methods
// Note: private methods from parent classes are not shown here,
@@ -413,7 +416,10 @@ public class MetaMethodIndex {
MetaMethod match = (MetaMethod) list.get(found);
if (match==method) return o;
if (match.isPrivate()
- || (!isNonRealMethod(match) && match.getDeclaringClass().isInterface() && !method.getDeclaringClass().isInterface())) {
+ || (!isNonRealMethod(match)
+ && match.getDeclaringClass().isInterface()
+ && !method.getDeclaringClass().isInterface()
+ && !method.isStatic())) {
// do not overwrite interface methods with instance methods
// do not overwrite private methods
// Note: private methods from parent classes are not shown here,
http://git-wip-us.apache.org/repos/asf/groovy/blob/e8a0e3a0/src/test/org/codehaus/groovy/runtime/methoddispatching/BarOne.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarOne.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarOne.java
new file mode 100644
index 0000000..56daeeb
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarOne.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching;
+
+class BarOne implements FooOne {
+ static String foo() {
+ return "I'm Bar";
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/e8a0e3a0/src/test/org/codehaus/groovy/runtime/methoddispatching/BarThree.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarThree.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarThree.java
new file mode 100644
index 0000000..63686b3
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarThree.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching;
+
+class BarThree implements FooThree {
+ static String foo() {
+ return "I'm Bar";
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/e8a0e3a0/src/test/org/codehaus/groovy/runtime/methoddispatching/BarTwo.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarTwo.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarTwo.java
new file mode 100644
index 0000000..84a8f02
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarTwo.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching;
+
+class BarTwo implements FooTwo {
+ static String foo() {
+ return "I'm Bar";
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/e8a0e3a0/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
new file mode 100644
index 0000000..f1bac0f
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching;
+
+interface FooOne {
+ static String foo() {
+ return "I'm Foo";
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/groovy/blob/e8a0e3a0/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
new file mode 100644
index 0000000..9f897ea
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching;
+
+interface FooThree {
+ static String foo() {
+ return "I'm Foo";
+ }
+
+ static String foo(int num) {
+ return String.valueOf(num);
+ }
+
+ static String foo(boolean bool) {
+ return String.valueOf(bool);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/groovy/blob/e8a0e3a0/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
new file mode 100644
index 0000000..b7b315b
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching;
+
+interface FooTwo {
+ static String foo() {
+ return "I'm Foo";
+ }
+
+ static String foo(int num) {
+ return String.valueOf(num);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/groovy/blob/e8a0e3a0/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
new file mode 100644
index 0000000..2df115f
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching
+
+class StaticMethodOverloadTest extends GroovyTestCase {
+ void testOneStaticMethod() throws Exception {
+ assert FooOne.foo() == "I'm Foo"
+ assert BarOne.foo() == "I'm Bar"
+ }
+
+ void testTwoStaticMethods() {
+ assert FooTwo.foo(42) == '42'
+ assert FooTwo.foo() == "I'm Foo"
+ assert BarTwo.foo(42) == '42'
+ assert BarTwo.foo() == "I'm Bar"
+ }
+
+ void testMoreThanTwoStaticMethods() {
+ assert FooThree.foo(42) == '42'
+ assert FooThree.foo() == "I'm Foo"
+ assert FooThree.foo(true) == 'true'
+ assert BarThree.foo(42) == '42'
+ assert BarThree.foo() == "I'm Bar"
+ assert BarThree.foo(true) == 'true'
+ }
+}
[6/6] groovy git commit: GROOVY-8143: Performance subproject included
in release artifacts
Posted by pa...@apache.org.
GROOVY-8143: Performance subproject included in release artifacts
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5805cdb5
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5805cdb5
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5805cdb5
Branch: refs/heads/GROOVY_2_5_X
Commit: 5805cdb5bfcdb8d65ee0d2c414236327fde5e27b
Parents: 981bb5b
Author: paulk <pa...@asert.com.au>
Authored: Fri Apr 21 19:47:17 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Fri Apr 21 19:47:17 2017 +1000
----------------------------------------------------------------------
build.gradle | 8 +--
gradle/publish.gradle | 45 ++++++++------
gradle/upload.gradle | 152 +++++++++++++++++++++++----------------------
3 files changed, 108 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/5805cdb5/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 1152d94..fc60290 100644
--- a/build.gradle
+++ b/build.gradle
@@ -59,6 +59,10 @@ buildScan {
recipes 'git-status', 'gc-stats', 'teamcity', 'travis-ci'
}
+ext.modules = {
+ subprojects.findAll{ !['performance', 'groovy-tests-vm8'].contains(it.name) }
+}
+
apply from: 'gradle/filter.gradle'
apply from: 'gradle/indy.gradle'
apply from: 'gradle/publish.gradle'
@@ -361,10 +365,6 @@ task ensureGrammars {
apply from: 'gradle/utils.gradle'
apply from: 'gradle/wrapper.gradle'
-ext.modules = {
- subprojects
-}
-
task dgmConverter(dependsOn:compileJava) {
description = 'Generates DGM info file required for faster startup.'
def classesDir = sourceSets.main.output.classesDir
http://git-wip-us.apache.org/repos/asf/groovy/blob/5805cdb5/gradle/publish.gradle
----------------------------------------------------------------------
diff --git a/gradle/publish.gradle b/gradle/publish.gradle
index a5647d1..e825e64 100644
--- a/gradle/publish.gradle
+++ b/gradle/publish.gradle
@@ -35,23 +35,26 @@ if (!artifactoryUser) {
logger.lifecycle "ArtifactoryUser user: $artifactoryUser"
allprojects {
- apply plugin: 'com.jfrog.artifactory-upload'
+ if (project == rootProject || rootProject.ext.modules().contains(project)) {
+ apply plugin: 'com.jfrog.artifactory-upload'
- artifactory {
- contextUrl = project.hasProperty('artifactoryContext') ? project.artifactoryContext : 'https://oss.jfrog.org'
- resolve {
- repository {
- repoKey = 'libs-release'
+ artifactory {
+ contextUrl = project.hasProperty('artifactoryContext') ? project.artifactoryContext : 'https://oss.jfrog.org'
+ resolve {
+ repository {
+ repoKey = 'libs-release'
+ }
}
- }
- publish {
- excludePatterns = "org/codehaus/groovy/groovy/*/groovy-all-*,org/codehaus/groovy/groovy/*/groovy-backports-*,org/codehaus/groovy/groovy/*/groovy-binary-*"
- repository {
- repoKey = project.hasProperty('artifactoryRepoKey') ? project.artifactoryRepoKey : 'oss-snapshot-local' //The Artifactory repository key to publish to
- //when using oss.jfrog.org the credentials are from Bintray. For local build we expect them to be found in
- //~/.gradle/gradle.properties, otherwise to be set in the build server
- username = rootProject.artifactoryUser
- password = rootProject.artifactoryPassword
+ publish {
+ excludePatterns = "org/codehaus/groovy/groovy/*/groovy-all-*,org/codehaus/groovy/groovy/*/groovy-backports-*,org/codehaus/groovy/groovy/*/groovy-binary-*"
+ repository {
+ repoKey = project.hasProperty('artifactoryRepoKey') ? project.artifactoryRepoKey : 'oss-snapshot-local'
+ //The Artifactory repository key to publish to
+ //when using oss.jfrog.org the credentials are from Bintray. For local build we expect them to be found in
+ //~/.gradle/gradle.properties, otherwise to be set in the build server
+ username = rootProject.artifactoryUser
+ password = rootProject.artifactoryPassword
+ }
}
}
}
@@ -84,10 +87,14 @@ artifactoryPublish {
if (isReleaseVersion) {
allprojects {
- configurations.archives.artifacts.findAll{ it.name == project.name && it.type == 'jar' && it.extension == 'jar' && !it.classifier }.each {
- // add pom signatures
- def pomSigLocation = "$project.projectDir/target/poms/pom-${project == rootProject ? 'groovy' : 'default'}.xml.asc"
- deployDetails.add(newDetails(it, file(pomSigLocation), 'pom.asc', 'pom'))
+ if (project == rootProject || rootProject.ext.modules().contains(project)) {
+ configurations.archives.artifacts.findAll {
+ it.name == project.name && it.type == 'jar' && it.extension == 'jar' && !it.classifier
+ }.each {
+ // add pom signatures
+ def pomSigLocation = "$project.projectDir/target/poms/pom-${project == rootProject ? 'groovy' : 'default'}.xml.asc"
+ deployDetails.add(newDetails(it, file(pomSigLocation), 'pom.asc', 'pom'))
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/5805cdb5/gradle/upload.gradle
----------------------------------------------------------------------
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index c6c1c01..be65fba 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -32,9 +32,11 @@ def removeJarjaredDependencies = { p ->
}
allprojects {
- apply plugin: 'maven'
- apply from: "${rootProject.projectDir}/gradle/pomconfigurer.gradle"
- install.dependsOn checkCompatibility
+ if (project == rootProject || modules().contains(project)) {
+ apply plugin: 'maven'
+ apply from: "${rootProject.projectDir}/gradle/pomconfigurer.gradle"
+ install.dependsOn checkCompatibility
+ }
}
apply from: 'gradle/backports.gradle'
@@ -43,95 +45,97 @@ ext.basename = { String s -> s.take(s.lastIndexOf('.')) }
ext.deriveFile = { File archive, String suffix -> new File(archive.parent, basename(archive.name) + "-${suffix}.jar") }
allprojects {
- ext.signWithClassifier = { String c, File f ->
- if (rootProject.isReleaseVersion) {
- signing.sign(c, f)
- def ascFile = new File(f.parent, f.name + '.asc')
- if (ascFile.exists()) {
- project.artifacts.add('archives', ascFile) {
- classifier = c
- type = 'asc'
- extension = 'jar.asc'
+ if (project == rootProject || modules().contains(project)) {
+ ext.signWithClassifier = { String c, File f ->
+ if (rootProject.isReleaseVersion) {
+ signing.sign(c, f)
+ def ascFile = new File(f.parent, f.name + '.asc')
+ if (ascFile.exists()) {
+ project.artifacts.add('archives', ascFile) {
+ classifier = c
+ type = 'asc'
+ extension = 'jar.asc'
+ }
}
}
}
- }
- ext.signArchiveTask = { archiveTask ->
- if (rootProject.isReleaseVersion) {
- signing.sign(archiveTask.classifier, archiveTask.archivePath)
- def ascFile = new File(archiveTask.destinationDir, archiveTask.archiveName + '.asc')
- if (ascFile.exists()) {
- project.artifacts.add('archives', ascFile) {
- name = archiveTask.baseName
- classifier = archiveTask.classifier
- type = 'asc'
- extension = archiveTask.extension + '.asc'
+ ext.signArchiveTask = { archiveTask ->
+ if (rootProject.isReleaseVersion) {
+ signing.sign(archiveTask.classifier, archiveTask.archivePath)
+ def ascFile = new File(archiveTask.destinationDir, archiveTask.archiveName + '.asc')
+ if (ascFile.exists()) {
+ project.artifacts.add('archives', ascFile) {
+ name = archiveTask.baseName
+ classifier = archiveTask.classifier
+ type = 'asc'
+ extension = archiveTask.extension + '.asc'
+ }
}
}
}
- }
- uploadArchives {
- repositories {
- mavenDeployer {
- pom pomConfigureClosure
- beforeDeployment { MavenDeployment deployment -> if (rootProject.isReleaseVersion) signing.signPom(deployment) }
+ uploadArchives {
+ repositories {
+ mavenDeployer {
+ pom pomConfigureClosure
+ beforeDeployment { MavenDeployment deployment -> if (rootProject.isReleaseVersion) signing.signPom(deployment) }
+ }
}
}
- }
- install {
- repositories {
- mavenInstaller {
- pom pomConfigureClosure
- beforeDeployment { MavenDeployment deployment -> if (rootProject.isReleaseVersion) signing.signPom(deployment) }
+ install {
+ repositories {
+ mavenInstaller {
+ pom pomConfigureClosure
+ beforeDeployment { MavenDeployment deployment -> if (rootProject.isReleaseVersion) signing.signPom(deployment) }
+ }
}
}
- }
- artifacts {
- archives jar
- archives sourceJar
- archives javadocJar
- archives groovydocJar
- }
+ artifacts {
+ archives jar
+ archives sourceJar
+ archives javadocJar
+ archives groovydocJar
+ }
- [uploadArchives, install]*.with {
- // dependency on jarAllAll should in theory be replaced with jar, jarWithIndy but
- // in practice, it is faster
- dependsOn([jarAllAll, sourceJar, javadocJar, groovydocJar])
- doFirst {
- if (rootProject.useIndy()) {
- new GradleException('You cannot use uploadArchives or install task with the flag [indy] turned'
- +' on because the build handles indy artifacts by itself in that case.')
- }
- def indyJar = rootProject.ext.deriveFile(jar.archivePath, 'indy')
- if (indyJar.exists()) {
- project.artifacts.add('archives', indyJar)
- }
- def grooidJar = rootProject.ext.deriveFile(jar.archivePath, 'grooid')
- if (grooidJar.exists()) {
- project.artifacts.add('archives', grooidJar)
+ [uploadArchives, install]*.with {
+ // dependency on jarAllAll should in theory be replaced with jar, jarWithIndy but
+ // in practice, it is faster
+ dependsOn([jarAllAll, sourceJar, javadocJar, groovydocJar])
+ doFirst {
+ if (rootProject.useIndy()) {
+ new GradleException('You cannot use uploadArchives or install task with the flag [indy] turned'
+ + ' on because the build handles indy artifacts by itself in that case.')
+ }
+ def indyJar = rootProject.ext.deriveFile(jar.archivePath, 'indy')
+ if (indyJar.exists()) {
+ project.artifacts.add('archives', indyJar)
+ }
+ def grooidJar = rootProject.ext.deriveFile(jar.archivePath, 'grooid')
+ if (grooidJar.exists()) {
+ project.artifacts.add('archives', grooidJar)
+ }
}
}
- }
- install {
- doFirst {
- // gradle doesn't expect us to mutate configurations like we do here
- // so signing the configuration won't work and we do it manually here
- signArchiveTask(jar)
- signArchiveTask(sourceJar)
- signArchiveTask(javadocJar)
- signArchiveTask(groovydocJar)
- def indyJar = rootProject.ext.deriveFile(jar.archivePath, 'indy')
- if (indyJar.exists()) {
- signWithClassifier('indy', indyJar)
- }
- def grooidJar = rootProject.ext.deriveFile(jar.archivePath, 'grooid')
- if (grooidJar.exists()) {
- signWithClassifier('grooid', grooidJar)
+ install {
+ doFirst {
+ // gradle doesn't expect us to mutate configurations like we do here
+ // so signing the configuration won't work and we do it manually here
+ signArchiveTask(jar)
+ signArchiveTask(sourceJar)
+ signArchiveTask(javadocJar)
+ signArchiveTask(groovydocJar)
+ def indyJar = rootProject.ext.deriveFile(jar.archivePath, 'indy')
+ if (indyJar.exists()) {
+ signWithClassifier('indy', indyJar)
+ }
+ def grooidJar = rootProject.ext.deriveFile(jar.archivePath, 'grooid')
+ if (grooidJar.exists()) {
+ signWithClassifier('grooid', grooidJar)
+ }
}
}
}
[5/6] groovy git commit: GROOVY-7879: Groovy calls wrong method if
there is a static method on an interface (tests only for JDK8+)
Posted by pa...@apache.org.
GROOVY-7879: Groovy calls wrong method if there is a static method on an interface (tests only for JDK8+)
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/981bb5b5
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/981bb5b5
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/981bb5b5
Branch: refs/heads/GROOVY_2_5_X
Commit: 981bb5b57d578c9a6e34809c61818200d7c1ea00
Parents: 0efdb1e
Author: paulk <pa...@asert.com.au>
Authored: Fri Apr 21 19:46:44 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Fri Apr 21 19:46:44 2017 +1000
----------------------------------------------------------------------
settings.gradle | 1 +
.../runtime/methoddispatching/vm8/FooOne.java | 31 ------------
.../runtime/methoddispatching/vm8/FooThree.java | 53 --------------------
.../runtime/methoddispatching/vm8/FooTwo.java | 45 -----------------
...StaticMethodOverloadCompileStaticTest.groovy | 45 -----------------
.../vm8/StaticMethodOverloadTest.groovy | 42 ----------------
subprojects/groovy-tests-vm8/build.gradle | 42 ++++++++++++++++
7 files changed, 43 insertions(+), 216 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/981bb5b5/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 5df4d51..32af155 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -31,6 +31,7 @@ def subprojects = ['groovy-ant',
'groovy-swing',
'groovy-templates',
'groovy-test',
+ 'groovy-tests-vm8',
'groovy-testng',
'groovy-xml',
'groovy-macro'
http://git-wip-us.apache.org/repos/asf/groovy/blob/981bb5b5/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooOne.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooOne.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooOne.java
deleted file mode 100644
index 7e50432..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooOne.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching.vm8;
-
-interface FooOne {
- static String foo() {
- return "FooOne.foo()";
- }
-}
-
-class BarOne implements FooOne {
- static String foo() {
- return "BarOne.foo()";
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/981bb5b5/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooThree.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooThree.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooThree.java
deleted file mode 100644
index d74871b..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooThree.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching.vm8;
-
-import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
-
-/**
- * To test the case when we call a static method on a class and while we load all the methods from its interface,
- * {@link MetaMethodIndex.Entry} contains more than one method from interface already
- */
-interface FooThree {
- static String foo() {
- return "FooThree.foo()";
- }
-
- static String foo(int a) {
- return String.format("FooThree.foo(%1$d)", a);
- }
-
- static String foo(int a, int b) {
- return String.format("FooThree.foo(%1$d, %2$d)", a, b);
- }
-}
-
-class BarThree implements FooThree {
- static String foo() {
- return "BarThree.foo()";
- }
-
- static String foo(int a) {
- return String.format("BarThree.foo(%1$d)", a);
- }
-
- static String foo(int a, int b) {
- return String.format("BarThree.foo(%1$d, %2$d)", a, b);
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/981bb5b5/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooTwo.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooTwo.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooTwo.java
deleted file mode 100644
index f91e9d8..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooTwo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching.vm8;
-
-import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
-
-/**
- * To test the case when we call a static method on a class and {@link MetaMethodIndex.Entry}
- * contains more than one method from interface already
- */
-interface FooTwo {
- static String foo() {
- return "FooTwo.foo()";
- }
-
- static String foo(int a) {
- return String.format("FooTwo.foo(%1$d)", a);
- }
-}
-
-class BarTwo implements FooTwo {
- static String foo() {
- return "BarTwo.foo()";
- }
-
- static String foo(int a) {
- return String.format("BarTwo.foo(%1$d)", a);
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/981bb5b5/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadCompileStaticTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadCompileStaticTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadCompileStaticTest.groovy
deleted file mode 100644
index b62b978..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadCompileStaticTest.groovy
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching.vm8
-
-import groovy.transform.CompileStatic
-
-@CompileStatic
-class StaticMethodOverloadCompileStaticTest extends GroovyTestCase {
- void testOneStaticMethod() {
- assert FooOne.foo() == "FooOne.foo()"
- assert BarOne.foo() == "BarOne.foo()"
- }
-
- void testTwoStaticMethods() {
- assert FooTwo.foo() == "FooTwo.foo()"
- assert FooTwo.foo(0) == "FooTwo.foo(0)"
- assert BarTwo.foo() == "BarTwo.foo()"
- assert BarTwo.foo(0) == "BarTwo.foo(0)"
- }
-
- void testMoreThanTwoStaticMethods() {
- assert FooThree.foo() == "FooThree.foo()"
- assert FooThree.foo(0) == "FooThree.foo(0)"
- assert FooThree.foo(0, 1) == "FooThree.foo(0, 1)"
- assert BarThree.foo() == "BarThree.foo()"
- assert BarThree.foo(0) == "BarThree.foo(0)"
- assert BarThree.foo(0, 1) == "BarThree.foo(0, 1)"
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/981bb5b5/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadTest.groovy
deleted file mode 100644
index 1442421..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadTest.groovy
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching.vm8
-
-class StaticMethodOverloadTest extends GroovyTestCase {
- void testOneStaticMethod() {
- assert FooOne.foo() == "FooOne.foo()"
- assert BarOne.foo() == "BarOne.foo()"
- }
-
- void testTwoStaticMethods() {
- assert FooTwo.foo() == "FooTwo.foo()"
- assert FooTwo.foo(0) == "FooTwo.foo(0)"
- assert BarTwo.foo() == "BarTwo.foo()"
- assert BarTwo.foo(0) == "BarTwo.foo(0)"
- }
-
- void testMoreThanTwoStaticMethods() {
- assert FooThree.foo() == "FooThree.foo()"
- assert FooThree.foo(0) == "FooThree.foo(0)"
- assert FooThree.foo(0, 1) == "FooThree.foo(0, 1)"
- assert BarThree.foo() == "BarThree.foo()"
- assert BarThree.foo(0) == "BarThree.foo(0)"
- assert BarThree.foo(0, 1) == "BarThree.foo(0, 1)"
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/981bb5b5/subprojects/groovy-tests-vm8/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-tests-vm8/build.gradle b/subprojects/groovy-tests-vm8/build.gradle
new file mode 100644
index 0000000..82c9330
--- /dev/null
+++ b/subprojects/groovy-tests-vm8/build.gradle
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+dependencies {
+ compile rootProject
+ testCompile project(':groovy-test')
+}
+
+tasks.withType(JavaCompile) {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+}
+
+sourceSets {
+ test {
+ java {
+ if (!JavaVersion.current().isJava8Compatible()) {
+ exclude '**/vm8/*'
+ }
+ }
+ groovy {
+ if (!JavaVersion.current().isJava8Compatible()) {
+ exclude '**/vm8/*'
+ }
+ }
+ }
+}
[4/6] groovy git commit: minor refactor: no longer needed
Posted by pa...@apache.org.
minor refactor: no longer needed
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/0efdb1e4
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/0efdb1e4
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/0efdb1e4
Branch: refs/heads/GROOVY_2_5_X
Commit: 0efdb1e4d8db6f8a16de0adb5c30cb80a152e67a
Parents: b100c6f
Author: paulk <pa...@asert.com.au>
Authored: Fri Apr 21 13:12:40 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Fri Apr 21 16:06:17 2017 +1000
----------------------------------------------------------------------
build.gradle | 5 -----
1 file changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/0efdb1e4/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index b2a5047..1152d94 100644
--- a/build.gradle
+++ b/build.gradle
@@ -258,11 +258,6 @@ sourceSets {
'src/main',
"$generatedDirectory/src/main"
]
- fileTree('src/main/groovy/ui').matching {
- exclude 'GroovyMain.java', 'GroovySocketServer.java'
- }.visit { details ->
- exclude "groovy/ui/$details.path"
- }
}
groovy {
srcDirs = [
[3/6] groovy git commit: GROOVY-7879: Groovy calls wrong method if
there is a static method on an interface (minor refactor - closes #521)
Posted by pa...@apache.org.
GROOVY-7879: Groovy calls wrong method if there is a static method on an interface (minor refactor - closes #521)
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/b100c6f9
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b100c6f9
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b100c6f9
Branch: refs/heads/GROOVY_2_5_X
Commit: b100c6f9b52b7615a85f12cfaac48e510c346789
Parents: 4ce1299
Author: paulk <pa...@asert.com.au>
Authored: Fri Apr 21 13:49:29 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Fri Apr 21 15:38:53 2017 +1000
----------------------------------------------------------------------
.../runtime/methoddispatching/FooOne.java | 31 ------------
.../runtime/methoddispatching/FooThree.java | 53 --------------------
.../runtime/methoddispatching/FooTwo.java | 45 -----------------
...StaticMethodOverloadCompileStaticTest.groovy | 45 -----------------
.../StaticMethodOverloadTest.groovy | 42 ----------------
.../runtime/methoddispatching/vm8/FooOne.java | 31 ++++++++++++
.../runtime/methoddispatching/vm8/FooThree.java | 53 ++++++++++++++++++++
.../runtime/methoddispatching/vm8/FooTwo.java | 45 +++++++++++++++++
...StaticMethodOverloadCompileStaticTest.groovy | 45 +++++++++++++++++
.../vm8/StaticMethodOverloadTest.groovy | 42 ++++++++++++++++
10 files changed, 216 insertions(+), 216 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
deleted file mode 100644
index 25e11c1..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching;
-
-interface FooOne {
- static String foo() {
- return "FooOne.foo()";
- }
-}
-
-class BarOne implements FooOne {
- static String foo() {
- return "BarOne.foo()";
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
deleted file mode 100644
index 5c0c7cb..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching;
-
-import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
-
-/**
- * To test the case when we call a static method on a class and while we load all the methods from its interface,
- * {@link MetaMethodIndex.Entry} contains more than one method from interface already
- */
-interface FooThree {
- static String foo() {
- return "FooThree.foo()";
- }
-
- static String foo(int a) {
- return String.format("FooThree.foo(%1$d)", a);
- }
-
- static String foo(int a, int b) {
- return String.format("FooThree.foo(%1$d, %2$d)", a, b);
- }
-}
-
-class BarThree implements FooThree {
- static String foo() {
- return "BarThree.foo()";
- }
-
- static String foo(int a) {
- return String.format("BarThree.foo(%1$d)", a);
- }
-
- static String foo(int a, int b) {
- return String.format("BarThree.foo(%1$d, %2$d)", a, b);
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
deleted file mode 100644
index ec54c49..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching;
-
-import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
-
-/**
- * To test the case when we call a static method on a class and {@link MetaMethodIndex.Entry}
- * contains more than one method from interface already
- */
-interface FooTwo {
- static String foo() {
- return "FooTwo.foo()";
- }
-
- static String foo(int a) {
- return String.format("FooTwo.foo(%1$d)", a);
- }
-}
-
-class BarTwo implements FooTwo {
- static String foo() {
- return "BarTwo.foo()";
- }
-
- static String foo(int a) {
- return String.format("BarTwo.foo(%1$d)", a);
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadCompileStaticTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadCompileStaticTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadCompileStaticTest.groovy
deleted file mode 100644
index ba4e1d1..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadCompileStaticTest.groovy
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching
-
-import groovy.transform.CompileStatic
-
-@CompileStatic
-class StaticMethodOverloadCompileStaticTest extends GroovyTestCase {
- void testOneStaticMethod() {
- assert FooOne.foo() == "FooOne.foo()"
- assert BarOne.foo() == "BarOne.foo()"
- }
-
- void testTwoStaticMethods() {
- assert FooTwo.foo() == "FooTwo.foo()"
- assert FooTwo.foo(0) == "FooTwo.foo(0)"
- assert BarTwo.foo() == "BarTwo.foo()"
- assert BarTwo.foo(0) == "BarTwo.foo(0)"
- }
-
- void testMoreThanTwoStaticMethods() {
- assert FooThree.foo() == "FooThree.foo()"
- assert FooThree.foo(0) == "FooThree.foo(0)"
- assert FooThree.foo(0, 1) == "FooThree.foo(0, 1)"
- assert BarThree.foo() == "BarThree.foo()"
- assert BarThree.foo(0) == "BarThree.foo(0)"
- assert BarThree.foo(0, 1) == "BarThree.foo(0, 1)"
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
deleted file mode 100644
index e12af7a..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching
-
-class StaticMethodOverloadTest extends GroovyTestCase {
- void testOneStaticMethod() {
- assert FooOne.foo() == "FooOne.foo()"
- assert BarOne.foo() == "BarOne.foo()"
- }
-
- void testTwoStaticMethods() {
- assert FooTwo.foo() == "FooTwo.foo()"
- assert FooTwo.foo(0) == "FooTwo.foo(0)"
- assert BarTwo.foo() == "BarTwo.foo()"
- assert BarTwo.foo(0) == "BarTwo.foo(0)"
- }
-
- void testMoreThanTwoStaticMethods() {
- assert FooThree.foo() == "FooThree.foo()"
- assert FooThree.foo(0) == "FooThree.foo(0)"
- assert FooThree.foo(0, 1) == "FooThree.foo(0, 1)"
- assert BarThree.foo() == "BarThree.foo()"
- assert BarThree.foo(0) == "BarThree.foo(0)"
- assert BarThree.foo(0, 1) == "BarThree.foo(0, 1)"
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooOne.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooOne.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooOne.java
new file mode 100644
index 0000000..7e50432
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooOne.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching.vm8;
+
+interface FooOne {
+ static String foo() {
+ return "FooOne.foo()";
+ }
+}
+
+class BarOne implements FooOne {
+ static String foo() {
+ return "BarOne.foo()";
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooThree.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooThree.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooThree.java
new file mode 100644
index 0000000..d74871b
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooThree.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching.vm8;
+
+import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
+
+/**
+ * To test the case when we call a static method on a class and while we load all the methods from its interface,
+ * {@link MetaMethodIndex.Entry} contains more than one method from interface already
+ */
+interface FooThree {
+ static String foo() {
+ return "FooThree.foo()";
+ }
+
+ static String foo(int a) {
+ return String.format("FooThree.foo(%1$d)", a);
+ }
+
+ static String foo(int a, int b) {
+ return String.format("FooThree.foo(%1$d, %2$d)", a, b);
+ }
+}
+
+class BarThree implements FooThree {
+ static String foo() {
+ return "BarThree.foo()";
+ }
+
+ static String foo(int a) {
+ return String.format("BarThree.foo(%1$d)", a);
+ }
+
+ static String foo(int a, int b) {
+ return String.format("BarThree.foo(%1$d, %2$d)", a, b);
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooTwo.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooTwo.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooTwo.java
new file mode 100644
index 0000000..f91e9d8
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/FooTwo.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching.vm8;
+
+import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
+
+/**
+ * To test the case when we call a static method on a class and {@link MetaMethodIndex.Entry}
+ * contains more than one method from interface already
+ */
+interface FooTwo {
+ static String foo() {
+ return "FooTwo.foo()";
+ }
+
+ static String foo(int a) {
+ return String.format("FooTwo.foo(%1$d)", a);
+ }
+}
+
+class BarTwo implements FooTwo {
+ static String foo() {
+ return "BarTwo.foo()";
+ }
+
+ static String foo(int a) {
+ return String.format("BarTwo.foo(%1$d)", a);
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadCompileStaticTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadCompileStaticTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadCompileStaticTest.groovy
new file mode 100644
index 0000000..b62b978
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadCompileStaticTest.groovy
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching.vm8
+
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class StaticMethodOverloadCompileStaticTest extends GroovyTestCase {
+ void testOneStaticMethod() {
+ assert FooOne.foo() == "FooOne.foo()"
+ assert BarOne.foo() == "BarOne.foo()"
+ }
+
+ void testTwoStaticMethods() {
+ assert FooTwo.foo() == "FooTwo.foo()"
+ assert FooTwo.foo(0) == "FooTwo.foo(0)"
+ assert BarTwo.foo() == "BarTwo.foo()"
+ assert BarTwo.foo(0) == "BarTwo.foo(0)"
+ }
+
+ void testMoreThanTwoStaticMethods() {
+ assert FooThree.foo() == "FooThree.foo()"
+ assert FooThree.foo(0) == "FooThree.foo(0)"
+ assert FooThree.foo(0, 1) == "FooThree.foo(0, 1)"
+ assert BarThree.foo() == "BarThree.foo()"
+ assert BarThree.foo(0) == "BarThree.foo(0)"
+ assert BarThree.foo(0, 1) == "BarThree.foo(0, 1)"
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/b100c6f9/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadTest.groovy
new file mode 100644
index 0000000..1442421
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/vm8/StaticMethodOverloadTest.groovy
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching.vm8
+
+class StaticMethodOverloadTest extends GroovyTestCase {
+ void testOneStaticMethod() {
+ assert FooOne.foo() == "FooOne.foo()"
+ assert BarOne.foo() == "BarOne.foo()"
+ }
+
+ void testTwoStaticMethods() {
+ assert FooTwo.foo() == "FooTwo.foo()"
+ assert FooTwo.foo(0) == "FooTwo.foo(0)"
+ assert BarTwo.foo() == "BarTwo.foo()"
+ assert BarTwo.foo(0) == "BarTwo.foo(0)"
+ }
+
+ void testMoreThanTwoStaticMethods() {
+ assert FooThree.foo() == "FooThree.foo()"
+ assert FooThree.foo(0) == "FooThree.foo(0)"
+ assert FooThree.foo(0, 1) == "FooThree.foo(0, 1)"
+ assert BarThree.foo() == "BarThree.foo()"
+ assert BarThree.foo(0) == "BarThree.foo(0)"
+ assert BarThree.foo(0, 1) == "BarThree.foo(0, 1)"
+ }
+}
[2/6] groovy git commit: GROOVY-7879 Groovy calls wrong method if
there is a static method on an interface * @CompileStatic test cases added *
Test with more than two methods changed so it's valid Java code (JLS8,
8.4.8 Inheritance, Overriding, and Hidin
Posted by pa...@apache.org.
GROOVY-7879 Groovy calls wrong method if there is a static method on an interface * @CompileStatic test cases added * Test with more than two methods changed so it's valid Java code (JLS8, 8.4.8 Inheritance, Overriding, and Hiding)
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/4ce12990
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/4ce12990
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/4ce12990
Branch: refs/heads/GROOVY_2_5_X
Commit: 4ce129902c769311c7e10aec271f379a4a8dfe9f
Parents: e8a0e3a
Author: Dmitrii Kahmitov <kh...@gmail.com>
Authored: Sun Apr 9 00:18:47 2017 +0300
Committer: paulk <pa...@asert.com.au>
Committed: Fri Apr 21 15:38:42 2017 +1000
----------------------------------------------------------------------
.../runtime/methoddispatching/BarOne.java | 25 -----------
.../runtime/methoddispatching/BarThree.java | 25 -----------
.../runtime/methoddispatching/BarTwo.java | 25 -----------
.../runtime/methoddispatching/FooOne.java | 10 ++++-
.../runtime/methoddispatching/FooThree.java | 32 +++++++++++---
.../runtime/methoddispatching/FooTwo.java | 24 +++++++++--
...StaticMethodOverloadCompileStaticTest.groovy | 45 ++++++++++++++++++++
.../StaticMethodOverloadTest.groovy | 26 +++++------
8 files changed, 112 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/4ce12990/src/test/org/codehaus/groovy/runtime/methoddispatching/BarOne.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarOne.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarOne.java
deleted file mode 100644
index 56daeeb..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarOne.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching;
-
-class BarOne implements FooOne {
- static String foo() {
- return "I'm Bar";
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/4ce12990/src/test/org/codehaus/groovy/runtime/methoddispatching/BarThree.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarThree.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarThree.java
deleted file mode 100644
index 63686b3..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarThree.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching;
-
-class BarThree implements FooThree {
- static String foo() {
- return "I'm Bar";
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/4ce12990/src/test/org/codehaus/groovy/runtime/methoddispatching/BarTwo.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarTwo.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/BarTwo.java
deleted file mode 100644
index 84a8f02..0000000
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/BarTwo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.groovy.runtime.methoddispatching;
-
-class BarTwo implements FooTwo {
- static String foo() {
- return "I'm Bar";
- }
-}
http://git-wip-us.apache.org/repos/asf/groovy/blob/4ce12990/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
index f1bac0f..25e11c1 100644
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooOne.java
@@ -20,6 +20,12 @@ package org.codehaus.groovy.runtime.methoddispatching;
interface FooOne {
static String foo() {
- return "I'm Foo";
+ return "FooOne.foo()";
}
-}
\ No newline at end of file
+}
+
+class BarOne implements FooOne {
+ static String foo() {
+ return "BarOne.foo()";
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/4ce12990/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
index 9f897ea..5c0c7cb 100644
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooThree.java
@@ -18,16 +18,36 @@
*/
package org.codehaus.groovy.runtime.methoddispatching;
+import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
+
+/**
+ * To test the case when we call a static method on a class and while we load all the methods from its interface,
+ * {@link MetaMethodIndex.Entry} contains more than one method from interface already
+ */
interface FooThree {
static String foo() {
- return "I'm Foo";
+ return "FooThree.foo()";
+ }
+
+ static String foo(int a) {
+ return String.format("FooThree.foo(%1$d)", a);
+ }
+
+ static String foo(int a, int b) {
+ return String.format("FooThree.foo(%1$d, %2$d)", a, b);
+ }
+}
+
+class BarThree implements FooThree {
+ static String foo() {
+ return "BarThree.foo()";
}
- static String foo(int num) {
- return String.valueOf(num);
+ static String foo(int a) {
+ return String.format("BarThree.foo(%1$d)", a);
}
- static String foo(boolean bool) {
- return String.valueOf(bool);
+ static String foo(int a, int b) {
+ return String.format("BarThree.foo(%1$d, %2$d)", a, b);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/4ce12990/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
index b7b315b..ec54c49 100644
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/FooTwo.java
@@ -18,12 +18,28 @@
*/
package org.codehaus.groovy.runtime.methoddispatching;
+import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
+
+/**
+ * To test the case when we call a static method on a class and {@link MetaMethodIndex.Entry}
+ * contains more than one method from interface already
+ */
interface FooTwo {
static String foo() {
- return "I'm Foo";
+ return "FooTwo.foo()";
+ }
+
+ static String foo(int a) {
+ return String.format("FooTwo.foo(%1$d)", a);
+ }
+}
+
+class BarTwo implements FooTwo {
+ static String foo() {
+ return "BarTwo.foo()";
}
- static String foo(int num) {
- return String.valueOf(num);
+ static String foo(int a) {
+ return String.format("BarTwo.foo(%1$d)", a);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/4ce12990/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadCompileStaticTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadCompileStaticTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadCompileStaticTest.groovy
new file mode 100644
index 0000000..ba4e1d1
--- /dev/null
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadCompileStaticTest.groovy
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.codehaus.groovy.runtime.methoddispatching
+
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class StaticMethodOverloadCompileStaticTest extends GroovyTestCase {
+ void testOneStaticMethod() {
+ assert FooOne.foo() == "FooOne.foo()"
+ assert BarOne.foo() == "BarOne.foo()"
+ }
+
+ void testTwoStaticMethods() {
+ assert FooTwo.foo() == "FooTwo.foo()"
+ assert FooTwo.foo(0) == "FooTwo.foo(0)"
+ assert BarTwo.foo() == "BarTwo.foo()"
+ assert BarTwo.foo(0) == "BarTwo.foo(0)"
+ }
+
+ void testMoreThanTwoStaticMethods() {
+ assert FooThree.foo() == "FooThree.foo()"
+ assert FooThree.foo(0) == "FooThree.foo(0)"
+ assert FooThree.foo(0, 1) == "FooThree.foo(0, 1)"
+ assert BarThree.foo() == "BarThree.foo()"
+ assert BarThree.foo(0) == "BarThree.foo(0)"
+ assert BarThree.foo(0, 1) == "BarThree.foo(0, 1)"
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/4ce12990/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy b/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
index 2df115f..e12af7a 100644
--- a/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
+++ b/src/test/org/codehaus/groovy/runtime/methoddispatching/StaticMethodOverloadTest.groovy
@@ -19,24 +19,24 @@
package org.codehaus.groovy.runtime.methoddispatching
class StaticMethodOverloadTest extends GroovyTestCase {
- void testOneStaticMethod() throws Exception {
- assert FooOne.foo() == "I'm Foo"
- assert BarOne.foo() == "I'm Bar"
+ void testOneStaticMethod() {
+ assert FooOne.foo() == "FooOne.foo()"
+ assert BarOne.foo() == "BarOne.foo()"
}
void testTwoStaticMethods() {
- assert FooTwo.foo(42) == '42'
- assert FooTwo.foo() == "I'm Foo"
- assert BarTwo.foo(42) == '42'
- assert BarTwo.foo() == "I'm Bar"
+ assert FooTwo.foo() == "FooTwo.foo()"
+ assert FooTwo.foo(0) == "FooTwo.foo(0)"
+ assert BarTwo.foo() == "BarTwo.foo()"
+ assert BarTwo.foo(0) == "BarTwo.foo(0)"
}
void testMoreThanTwoStaticMethods() {
- assert FooThree.foo(42) == '42'
- assert FooThree.foo() == "I'm Foo"
- assert FooThree.foo(true) == 'true'
- assert BarThree.foo(42) == '42'
- assert BarThree.foo() == "I'm Bar"
- assert BarThree.foo(true) == 'true'
+ assert FooThree.foo() == "FooThree.foo()"
+ assert FooThree.foo(0) == "FooThree.foo(0)"
+ assert FooThree.foo(0, 1) == "FooThree.foo(0, 1)"
+ assert BarThree.foo() == "BarThree.foo()"
+ assert BarThree.foo(0) == "BarThree.foo(0)"
+ assert BarThree.foo(0, 1) == "BarThree.foo(0, 1)"
}
}