GROOVY-12387: Indy: exception-handler combinator bypassed on ART - #2909
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2909 +/- ##
==================================================
- Coverage 71.1943% 71.1867% -0.0076%
- Complexity 37632 37681 +49
==================================================
Files 1581 1584 +3
Lines 136251 136385 +134
Branches 25311 25340 +29
==================================================
+ Hits 97003 97088 +85
- Misses 30511 30538 +27
- Partials 8737 8759 +22
🚀 New features to boost your workflow:
|
afe6359 to
90e84a3
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Adds an Android (ART) compatibility path for MethodHandles.catchException behavior so Indy call-site exception handling matches HotSpot/JDK semantics (GROOVY-12387), including for subclass exceptions (e.g., Groovy “no-stack” exceptions).
Changes:
- Introduce
IndyCatchCompatwrappers for GroovyObject fallback and GroovyRuntimeException unwrapping on Android. - Switch
Selectorto use the wrappers whenAndroidSupport.isRunningAndroid()is true. - Add a dedicated test suite validating fallback + unwrapping semantics and call-site type preservation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/test/groovy/org/codehaus/groovy/vmplugin/v8/IndyCatchCompatTest.groovy | Adds tests covering ART compatibility wrappers (fallback + unwrapping) and method-handle type behavior. |
| src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java | Routes exception handling to IndyCatchCompat only on Android to avoid ART’s exact-class catch behavior. |
| src/main/java/org/codehaus/groovy/vmplugin/v8/IndyCatchCompat.java | Implements plain-Java exception handling wrappers that are resilient to subclass exceptions on ART. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| * on Android; on a JVM the | ||
| * combinator stays, so this class is not loaded there. |
| return INVOKE_UNWRAPPING.bindTo(spread).asCollector(Object[].class, arity).asType(type); | ||
| } | ||
|
|
||
| static Object invokeWithFallback(final MethodHandle target, final Object receiver, final String name, final Object[] args) throws Throwable { |
| } | ||
| } | ||
|
|
||
| static Object invokeUnwrapping(final MethodHandle target, final Object[] args) throws Throwable { |
| handle = AndroidSupport.isRunningAndroid() | ||
| ? IndyCatchCompat.withGroovyObjectFallback(handle) // GROOVY-12387 | ||
| : MethodHandles.catchException(handle, MissingMethodException.class, GROOVY_OBJECT_INVOKER); |
This comment has been minimized.
This comment has been minimized.
90e84a3 to
9802a1a
Compare
No description provided.