You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "paulk-asert (via GitHub)" <gi...@apache.org> on 2026/04/06 10:21:09 UTC

[PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

paulk-asert opened a new pull request, #2443:
URL: https://github.com/apache/groovy/pull/2443

   …e when method-level DYNAMIC_RESOLUTION is present (GROOVY-11817 regression)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202075969

   The config script simulates what happens when Spock is on the classpath. This part buried in the comment son James' issue:
   
   `grails-plugin Gradle plugin + Spock + the trait pattern`
   
   I had AI really analyse what both Spock and Groovy were doing and it couldn't see anything being incorrectly set up on the Spock side but it found the "problem" on the Groovy side. I copied its main summary of findings back into the issue but "...  AI makes mistakes ...". It seems logical to me but another set of human eyes would be good.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4205713188

   Also, I didn't know about instanceof either, I'll try to look at that too at some point if I get time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202312662

   AI updated the test. Now fails without the fix but still needs a sanity check.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4207350981

   When I checkout the groovy11907 branch and run this test:
   
   `gradlew :test --tests=org.codehaus.groovy.transform.traitx.TraitASTTransformationTest.testTraitStaticFieldHelperGetClassMarkedDynamic`
   
   It passes. If I then comment out the second param below to remove the fix:
   
   `            receiver = asClass(receiver/*, fn*/); // GROOVY-11907
   `
   The test fails.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202458531

   I'm going to try with spock; I'm in the middle of a long test run, so I cannot drop it in just yet.  I'm not sure why the helper needs dynamic resolution; I must be missing something.  But maybe the `getClass()` call could just be primed with the target method from `Object`.  Otherwise "$static$self instanceof Class ? $staticSelf : $static$self.getClass()" could be "$static$self instanceof Class self ? self : $static$self.getClass()" -- maybe that does not help...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202535018

   I have this, which may be related:
   <img width="861" height="503" alt="image" src="https://github.com/user-attachments/assets/257c97d3-b4e7-4f57-9f43-6fd58558aaa6" />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202094766

   I set up your test case, including the config script and it runs fine for me with 5.0.5.  So I can't say that the fix is a good one or if there's a better place to make a change.  I don't know why "$static$self.getClass()" would be such a problem for classgen.
   
   Side note: Did you know about the instanceof vs checkcast?  That's news to me; we have 100s of instanceof tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202031129

   Most of the details are in comments on James Fredley's links about Grails and Groovy 5/6:
   
   https://github.com/apache/grails-core/pull/15557
   https://github.com/apache/grails-core/pull/15558
   
   I can't see it there now, but there is lots there, I wonder if he has updated the content. In any case, I check out `grails-core`, switched to the `grails8-groovy5-sb4` branch, changed `groovy.version` in `dependencies.gradle` from `5.0.3` to `5.0.4`, and ran:
   
   ./gradlew :grails-geb:compileTestFixturesGroovy -S
   
   I don't know whether that branch has been changed too. The last commit for me was:
   
   `7896ef8743 fix(grails-gradle): skip missing input dirs in mergeTestReports`
   
   That reproduces the error. To verify the fix, I had to tweak the build slightly to point to mavenLocal() and use my own local version (different to what is in the Apache snapshot repo) - being careful to clear the gradle cache. I can send you the diff I have to the build files if you want to replicate the fix part. The bug doesn't need build changes apart from changing `5.0.3` to `5.0.4`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202193319

   Hmm, test passes for me too with the fix backed out. But the fix does work on the grails branch. I'll try to tweak the test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4207060351

   I've been meaning to simplify the receiver handling for this sort of case.  If I produce a restructured version, could you try it against the failing grails build?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4208653005

   Is this the error you are seeing?
   ```
   java.lang.AssertionError
           at groovyjarjarasm.asm.Frame.putAbstractType(Frame.java:1482)
           at groovyjarjarasm.asm.MethodWriter.putAbstractTypes(MethodWriter.java:1961)
           at groovyjarjarasm.asm.MethodWriter.putFrame(MethodWriter.java:1920)
           at groovyjarjarasm.asm.MethodWriter.visitFrameEnd(MethodWriter.java:1852)
           at groovyjarjarasm.asm.Frame.accept(Frame.java:1405)
           at groovyjarjarasm.asm.MethodWriter.computeAllFrames(MethodWriter.java:1630)
           at groovyjarjarasm.asm.MethodWriter.visitMaxs(MethodWriter.java:1548)
           at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:626)
           at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:110)
           at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:771)
           at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1335)
           at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1328)
           at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
           at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:379)
           at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:780)
           at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:922)
           at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:668)
           at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:642)
           at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:623)
           at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:285)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4199037136

   I'll see if I can get to this today.  Is there a description of the invalid bytecode?  There is a lot in the linked issue, but I never saw the build or runtime output of a failure.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202126428

   Does the checkcast refer to the instanceof-or case (7971)?  There is a fix for that in the 5 branch now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles closed pull request #2443: GROOVY-11907: SC: trait static field helper generates invalid bytecod…
URL: https://github.com/apache/groovy/pull/2443


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4206801322

   Do you have a small, self-contained project that demonstrates the error?  The unit test still does not get me to a runtime error of some kind.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4200646701

   I don't get any failure for the test given.  What is the config script supposed to change about the compilation?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4207356080

   I am travelling for 2 days. When I return I can try it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4191766155

   ## [Codecov](https://app.codecov.io/gh/apache/groovy/pull/2443?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `66.66667%` with `2 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 67.1304%. Comparing base ([`9941325`](https://app.codecov.io/gh/apache/groovy/commit/9941325631af01c28e62b48475fc72d2f7b06fea?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0179f9b`](https://app.codecov.io/gh/apache/groovy/commit/0179f9be766ea6c22728f48dcec012e666256592?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2443?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...oovy/transform/trait/TraitReceiverTransformer.java](https://app.codecov.io/gh/apache/groovy/pull/2443?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Ftrait%2FTraitReceiverTransformer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS90cmFpdC9UcmFpdFJlY2VpdmVyVHJhbnNmb3JtZXIuamF2YQ==) | 66.6667% | [1 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/groovy/pull/2443?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/groovy/pull/2443/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2443?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                  Coverage Diff                   @@
   ##             GROOVY_5_0_X      #2443        +/-   ##
   ======================================================
   - Coverage         67.1318%   67.1304%   -0.0014%     
   + Complexity          29431      29430         -1     
   ======================================================
     Files                1382       1382                
     Lines              116800     116804         +4     
     Branches            20473      20474         +1     
   ======================================================
   + Hits                78410      78411         +1     
   + Misses              31905      31904         -1     
   - Partials             6485       6489         +4     
   ```
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2443?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...oovy/transform/trait/TraitReceiverTransformer.java](https://app.codecov.io/gh/apache/groovy/pull/2443?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Ftrait%2FTraitReceiverTransformer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS90cmFpdC9UcmFpdFJlY2VpdmVyVHJhbnNmb3JtZXIuamF2YQ==) | `88.8889% <66.6667%> (-0.8408%)` | :arrow_down: |
   
   ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/apache/groovy/pull/2443/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4209880178

   It was an AssertionError with, from memory, a very similar stacktrace to that. I don't have everything set up on my travel laptop to confirm. I can try when I return home.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-11907: SC: trait static field helper generates invalid bytecod… [groovy]

Posted by "eric-milles (via GitHub)" <gi...@apache.org>.
eric-milles commented on PR #2443:
URL: https://github.com/apache/groovy/pull/2443#issuecomment-4202510239

   Do I need Spock to process the code that accesses the field?  Or does the Spock test need to implement the trait?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org