You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/09/18 15:49:54 UTC
[groovy] branch master updated: Fix the failing test
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 5a77687 Fix the failing test
5a77687 is described below
commit 5a77687f24dacf316de1af35c14bdaa8d05bc532
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Sep 18 23:49:09 2021 +0800
Fix the failing test
---
.../groovy/bugs/groovy9236/Groovy9236Bug.groovy | 12 ++------
.../bugs/groovy9236/Groovy9236ClassLoader.java | 33 ++++++++++++++++++++++
2 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/src/test/groovy/bugs/groovy9236/Groovy9236Bug.groovy b/src/test/groovy/bugs/groovy9236/Groovy9236Bug.groovy
index 3ecf084..093eed4 100644
--- a/src/test/groovy/bugs/groovy9236/Groovy9236Bug.groovy
+++ b/src/test/groovy/bugs/groovy9236/Groovy9236Bug.groovy
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package groovy.bugs.groovy9236
+package bugs.groovy9236
import groovy.test.GroovyTestCase
import org.apache.groovy.util.ScriptRunner
@@ -105,19 +105,11 @@ java.util.stream$Stream
'groovy.lang.GroovyObject$groovy$transform$CompileStatic',
'groovy.lang.GroovyObject$java$util$stream$Stream']
+ assert !cl.guessedClassNameList.isEmpty()
assert cl.guessedClassNameList.every(n -> !classNamesShouldAvoidToGuess.contains(n))
}
void testResolvingPrecedence() {
ScriptRunner.runScript('/groovy/bugs/groovy9236/Main.groovy')
}
-
- private static class Groovy9236ClassLoader extends GroovyClassLoader {
- def guessedClassNameList = []
-
- protected Class<?> findClass(final String name) throws ClassNotFoundException {
- guessedClassNameList << name
- super.findClass(name)
- }
- }
}
diff --git a/src/test/groovy/bugs/groovy9236/Groovy9236ClassLoader.java b/src/test/groovy/bugs/groovy9236/Groovy9236ClassLoader.java
new file mode 100644
index 0000000..8a430b1
--- /dev/null
+++ b/src/test/groovy/bugs/groovy9236/Groovy9236ClassLoader.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 bugs.groovy9236;
+
+import groovy.lang.GroovyClassLoader;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Groovy9236ClassLoader extends GroovyClassLoader {
+ final List<String> guessedClassNameList = new ArrayList<>();
+
+ protected Class<?> findClass(final String name) throws ClassNotFoundException {
+ guessedClassNameList.add(name);
+ return super.findClass(name);
+ }
+}