Skip to content

GROOVY-12134: @Delegate regression: fails to skip a final method inhe…#2670

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12134
Jul 9, 2026
Merged

GROOVY-12134: @Delegate regression: fails to skip a final method inhe…#2670
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12134

Conversation

@paulk-asert

Copy link
Copy Markdown
Contributor

…rited from a precompiled superclass

@paulk-asert paulk-asert requested a review from Copilot July 6, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Fixes a regression in @Delegate method generation where final methods inherited from precompiled (binary) superclasses were not being properly skipped.

Changes:

  • Adjust delegate-method generation to avoid overwriting inherited implementations from precompiled classes when the AST has no method body.
  • Add regression tests covering final methods inherited from JDK classes and Groovy-compiled classes loaded from the classpath.
  • Update an existing test case to assert successful compilation where the owner’s generic signature should take precedence.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/test/groovy/org/codehaus/groovy/transform/DelegateTransformTest.groovy Adds regression coverage for inherited final methods from precompiled and classpath-loaded superclasses.
src/main/java/org/codehaus/groovy/transform/DelegateASTTransformation.java Refines overwrite condition to distinguish “bodiless placeholder” methods from real inherited implementations.

Comment thread src/test/groovy/org/codehaus/groovy/transform/DelegateTransformTest.groovy Outdated
Comment thread src/test/groovy/org/codehaus/groovy/transform/DelegateTransformTest.groovy Outdated
@codecov-commenter

codecov-commenter commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.6972%. Comparing base (77ca2fa) to head (19d37db).
⚠️ Report is 21 commits behind head on master.

Files with missing lines Patch % Lines
...us/groovy/transform/DelegateASTTransformation.java 0.0000% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2670        +/-   ##
==================================================
+ Coverage     68.5684%   68.6972%   +0.1288%     
- Complexity      33800      34121       +321     
==================================================
  Files            1524       1536        +12     
  Lines          128091     128912       +821     
  Branches        23283      23368        +85     
==================================================
+ Hits            87830      88559       +729     
- Misses          32467      32522        +55     
- Partials         7794       7831        +37     
Files with missing lines Coverage Δ
...us/groovy/transform/DelegateASTTransformation.java 87.2951% <0.0000%> (-0.4098%) ⬇️

... and 50 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jdaugherty

Copy link
Copy Markdown
Contributor

I assume the test failure is due to test flakiness?

  0
  Execution failed for task ':groovy-reactor:test' (registered by plugin 'org.gradle.jvm-test-suite').
  > Could not copy file 'C:\Users\runneradmin\.groovy\grapes\resolved-caller-all-caller-working29.properties' to 'D:\a\groovy\groovy\subprojects\groovy-reactor\build\tmp\test\.groovy\grapes\resolved-caller-all-caller-working29.properties'.
     > Problems opening file input stream for file: C:\Users\runneradmin\.groovy\grapes\resolved-caller-all-caller-working29.properties

@paulk-asert paulk-asert merged commit 07adcb3 into apache:master Jul 9, 2026
28 of 29 checks passed
@paulk-asert paulk-asert deleted the groovy12134 branch July 9, 2026 02:46
@testlens-app

testlens-app Bot commented Jul 9, 2026

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

Build and test / lts (17, ubuntu-latest) > :groovy-json:test

Test Runs
Groovy9802 > test()

🏷️ Commit: 19d37db
▶️ Tests: 23425 executed
🟡 Checks: 5/29 completed

Test Failures

Groovy9802 > test() (:groovy-json:test in Build and test / lts (17, ubuntu-latest))
java.util.concurrent.CompletionException: org.apache.groovy.json.internal.Exceptions$JsonInternalException: unexpected character :
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:649)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:844)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1193)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1666)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1633)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: org.apache.groovy.json.internal.Exceptions$JsonInternalException: unexpected character :
	at org.apache.groovy.json.internal.Exceptions.die(Exceptions.java:52)
	at org.apache.groovy.json.internal.CharScanner.parseJsonNumber(CharScanner.java:492)
	at org.apache.groovy.json.internal.JsonParserCharArray.decodeNumber(JsonParserCharArray.java:253)
	at org.apache.groovy.json.internal.JsonParserCharArray.decodeValueInternal(JsonParserCharArray.java:238)
	at org.apache.groovy.json.internal.JsonParserCharArray.decodeValue(JsonParserCharArray.java:225)
	at org.apache.groovy.json.internal.JsonParserCharArray.decodeFromChars(JsonParserCharArray.java:61)
	at org.apache.groovy.json.internal.JsonParserCharArray.parse(JsonParserCharArray.java:465)
	at org.apache.groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:277)
	at groovy.json.JsonSlurper.parseText(JsonSlurper.java:261)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:503)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:298)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1333)
	at groovy.lang.MetaClassImpl.invokeMethodClosure(MetaClassImpl.java:1118)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1209)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1108)
	at groovy.lang.Closure.call(Closure.java:563)
	at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:55)
	at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:115)
	at jdk.proxy2/jdk.proxy2.$Proxy43.apply(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	... 9 more

Muted Tests

Note

Checks are currently running using the configuration below.

Select tests to mute in this pull request:

🔲 Groovy9802 > test()

Reuse successful test results:

🔲 ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

🔲 Rerun jobs


Learn more about TestLens at testlens.app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants