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 38660af887 GROOVY-11875: remove extra cast
38660af887 is described below
commit 38660af8873ee93b88430e1c521639771f06e037
Author: Eric Milles <[email protected]>
AuthorDate: Wed Mar 18 16:46:28 2026 -0500
GROOVY-11875: remove extra cast
---
.../groovy/classgen/AsmClassGenerator.java | 5 -----
.../groovy/gls/innerClass/InnerClassTest.groovy | 26 +++++++++++++++++++++-
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
index fdfff84e8c..377698c915 100644
--- a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -1457,13 +1457,8 @@ public class AsmClassGenerator extends ClassGenerator {
} else {
PropertyExpression pexp = thisPropX(/*implicit-this*/true,
expression.getName());
pexp.getProperty().setSourcePosition(expression);
- pexp.setType(expression.getType());
pexp.copyNodeMetaData(expression);
pexp.visit(this);
-
- if (!compileStack.isLHS() && !expression.isDynamicTyped()) {
- controller.getOperandStack().doGroovyCast(typeOf(expression));
- }
}
if (!compileStack.isLHS()) {
diff --git a/src/test/groovy/gls/innerClass/InnerClassTest.groovy
b/src/test/groovy/gls/innerClass/InnerClassTest.groovy
index 148ac23cf7..af830965d0 100644
--- a/src/test/groovy/gls/innerClass/InnerClassTest.groovy
+++ b/src/test/groovy/gls/innerClass/InnerClassTest.groovy
@@ -2439,9 +2439,33 @@ final class InnerClassTest {
'''
}
- // GROOVY-9618
+ // GROOVY-11875
@Test
void testNestedPropertyHandling6() {
+ assertScript '''import java.util.concurrent.atomic.AtomicBoolean
+ class Outer {
+ private AtomicBoolean foo = [true]
+ boolean isFoo() {
+ foo.get()
+ }
+ Boolean bar() {
+ def i = new Inner()
+ i.baz()
+ }
+ class Inner {
+ def baz() {
+ foo
+ }
+ }
+ }
+
+ assert new Outer().bar()
+ '''
+ }
+
+ // GROOVY-9618
+ @Test
+ void testNestedPropertyHandling7() {
assertScript '''
class Super {
public static X = 1