This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push:
     new 577036607b GROOVY-11352: non-indy: `this` in special ctor call
577036607b is described below

commit 577036607bdc4583e8f65d5611228fca645ba1bb
Author: Eric Milles <eric.mil...@thomsonreuters.com>
AuthorDate: Tue Apr 23 17:18:25 2024 -0500

    GROOVY-11352: non-indy: `this` in special ctor call
---
 .../codehaus/groovy/classgen/asm/InvocationWriter.java    | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java 
b/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java
index ce76868b28..3302140463 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java
@@ -511,9 +511,18 @@ public class InvocationWriter {
     }
 
     private boolean isStaticInvocation(final MethodCallExpression call) {
-        if (!isThisExpression(call.getObjectExpression())) return false;
-        if (controller.isStaticMethod()) return true;
-        return controller.isStaticContext() && !call.isImplicitThis();
+        if (isThisExpression(call.getObjectExpression())) {
+            if (controller.getCompileStack().isInSpecialConstructorCall()) {
+                return true;
+            }
+            if (controller.isStaticContext() && !call.isImplicitThis()) {
+                return true;
+            }
+            if (controller.isStaticMethod()) {
+                return true;
+            }
+        }
+        return false;
     }
 
     public void writeInvokeStaticMethod(final StaticMethodCallExpression call) 
{

Reply via email to