This is an automated email from the ASF dual-hosted git repository.
emilles 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 b8ff81276b GROOVY-11854: add test case
b8ff81276b is described below
commit b8ff81276b96cd157c93c24c78a76271418b8cef
Author: Eric Milles <[email protected]>
AuthorDate: Thu Feb 5 09:35:46 2026 -0600
GROOVY-11854: add test case
---
src/test/groovy/gls/innerClass/InnerClassTest.groovy | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/test/groovy/gls/innerClass/InnerClassTest.groovy
b/src/test/groovy/gls/innerClass/InnerClassTest.groovy
index f8b44e9c89..6cff66b454 100644
--- a/src/test/groovy/gls/innerClass/InnerClassTest.groovy
+++ b/src/test/groovy/gls/innerClass/InnerClassTest.groovy
@@ -89,6 +89,18 @@ final class InnerClassTest {
'''
}
+ // GROOVY-11854
+ @Test
+ void testScriptAIC() {
+ assertScript '''
+ def obj = new Object(){}
+ def aic = obj.getClass()
+ assert aic.getName().endsWith('$1')
+ assert aic.getEnclosingClass().getName().startsWith('TestScript')
+ assert aic.getEnclosingMethod()?.getName() == 'run'
+ '''
+ }
+
// GROOVY-7370, GROOVY-10722
@Test
void testVargsAIC() {
@@ -506,11 +518,15 @@ final class InnerClassTest {
class A {
class B {
String p
+ String getQ() { WHY }
}
B m() {
return [p:'x'] // calls
ScriptBytecodeAdapter.castToType([p:'x'], A$B.class)
+ // Cannot cast object '{p=x}' with class
'java.util.LinkedHashMap' to class 'A$B' due to:
+ // GroovyRuntimeException: Could not find named-arg
compatible constructor. Expecting one of: A$B(Map), A$B()
}
final String q = 'y'
+ private static final String WHY = 'y'
}
o = new A().m()
@@ -1562,6 +1578,7 @@ final class InnerClassTest {
}
class C extends B {
}
+
def c = new C()
assert c.foo() instanceof C
'''