daniellansun commented on PR #2755:
URL: https://github.com/apache/groovy/pull/2755#issuecomment-5182105563

   @paulk-asert  Thanks for capturing this — both points are real and we’ve 
addressed them in the current code.
   
   ### 1. Soft-fail under native image
   
   Agreed that `UnsupportedFeatureError` extends `Error` directly and was not 
covered by `LinkageError`.
   
   `tryDefineNestmate` now soft-fails that case by **class name** 
(`com.oracle.svm.core.jdk.UnsupportedFeatureError`) with no GraalVM compile 
dependency, and rethrows other `Error`s. The shared path is 
`softFailOrRethrow(Error)`.
   
   ### 2. Kill switch baked in at build time
   
   Agreed. The old `static final HIDDEN_CLASSES_DISABLED` snapshot was unsafe 
if the class is initialized at native-image build time.
   
   We removed that field. **`isEnabled()` is evaluated on each call** (class 
definition is not a hot path):
   
   - returns `false` when `org.graalvm.nativeimage.imagecode=runtime` (skip 
define entirely);
   - otherwise honours `-Dgroovy.hidden.classes.disable=true` at **run** time.
   
   So native users get a working escape hatch, and the soft-fail on 
`UnsupportedFeatureError` is belt-and-braces if something still attempts define.
   
   Happy to adjust further if you hit a concrete native path that still reaches 
`HiddenClassDefiner` unexpectedly.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to