[ 
https://issues.apache.org/jira/browse/GROOVY-12365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112461#comment-18112461
 ] 

ASF GitHub Bot commented on GROOVY-12365:
-----------------------------------------

codecov-commenter commented on PR #2900:
URL: https://github.com/apache/groovy/pull/2900#issuecomment-5576746632

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2900?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 `91.74312%` with `9 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 71.1807%. Comparing base 
([`81b4152`](https://app.codecov.io/gh/apache/groovy/commit/81b415227d3d5cd381349624bb7712e04b23add5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`fde22ca`](https://app.codecov.io/gh/apache/groovy/commit/fde22cab3658ee69fa2e0469437bd804e65492da?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 2 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2900?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...odehaus/groovy/reflection/GeneratedMetaMethod.java](https://app.codecov.io/gh/apache/groovy/pull/2900?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Freflection%2FGeneratedMetaMethod.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3JlZmxlY3Rpb24vR2VuZXJhdGVkTWV0YU1ldGhvZC5qYXZh)
 | 72.7273% | [3 Missing and 3 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2900?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...ehaus/groovy/reflection/DgmProxyFactoryConfig.java](https://app.codecov.io/gh/apache/groovy/pull/2900?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Freflection%2FDgmProxyFactoryConfig.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3JlZmxlY3Rpb24vRGdtUHJveHlGYWN0b3J5Q29uZmlnLmphdmE=)
 | 50.0000% | [2 Missing :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2900?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...n/java/org/codehaus/groovy/tools/DgmConverter.java](https://app.codecov.io/gh/apache/groovy/pull/2900?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftools%2FDgmConverter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3Rvb2xzL0RnbUNvbnZlcnRlci5qYXZh)
 | 98.7952% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2900?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/2900/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/2900?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2900        +/-   ##
   ==================================================
   + Coverage     71.1600%   71.1807%   +0.0206%     
   - Complexity      37533      37550        +17     
   ==================================================
     Files            1579       1580         +1     
     Lines          135822     135954       +132     
     Branches        25231      25250        +19     
   ==================================================
   + Hits            96651      96773       +122     
   - Misses          30449      30455         +6     
   - Partials         8722       8726         +4     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2900?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...n/java/org/codehaus/groovy/tools/DgmConverter.java](https://app.codecov.io/gh/apache/groovy/pull/2900?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftools%2FDgmConverter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3Rvb2xzL0RnbUNvbnZlcnRlci5qYXZh)
 | `96.2500% <98.7952%> (+1.2189%)` | :arrow_up: |
   | 
[...ehaus/groovy/reflection/DgmProxyFactoryConfig.java](https://app.codecov.io/gh/apache/groovy/pull/2900?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Freflection%2FDgmProxyFactoryConfig.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3JlZmxlY3Rpb24vRGdtUHJveHlGYWN0b3J5Q29uZmlnLmphdmE=)
 | `50.0000% <50.0000%> (ø)` | |
   | 
[...odehaus/groovy/reflection/GeneratedMetaMethod.java](https://app.codecov.io/gh/apache/groovy/pull/2900?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Freflection%2FGeneratedMetaMethod.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3JlZmxlY3Rpb24vR2VuZXJhdGVkTWV0YU1ldGhvZC5qYXZh)
 | `88.4615% <72.7273%> (-2.2792%)` | :arrow_down: |
   
   ... and [17 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2900/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>




> native: Ship Groovy's own reachability metadata in the groovy jar
> -----------------------------------------------------------------
>
>                 Key: GROOVY-12365
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12365
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>
> Groovy 6 dynamic code runs in a GraalVM native image thanks to the AOT link 
> mode (GROOVY-12234), but building the image still requires every user to run 
> the {{native-image-agent}} first, purely to capture the reflection and 
> resource access Groovy's *own* runtime performs. The Iris example README says 
> it plainly: without the recorded metadata the image builds and then fails 
> initialising {{GroovySystem}}. Logging frameworks and most libraries solved 
> this years ago by shipping their reachability metadata inside the jar 
> (log4j-core carries 
> {{META-INF/native-image/org.apache.logging.log4j/log4j-core/reflect-config.json}}
>  and {{resource-config.json}}); {{native-image}} picks such files up 
> automatically from the class path, and the GraalVM Gradle/Maven plugins do 
> too. Groovy ships nothing, and the central [GraalVM reachability-metadata 
> repository|https://github.com/oracle/graalvm-reachability-metadata] has no 
> entry for {{org.apache.groovy:groovy}} either (its {{groovy-all}} entry is 
> marked not-for-native-image and points at a {{groovy}} entry that does not 
> exist), so plugin users get nothing there as well.
> h3. What the agent records for Groovy itself
> Two unrelated dynamic applications (the Iris deep-learning example and a 
> small logging probe, both on GraalVM CE 25.2.4) produce almost the same 
> Groovy-owned set: about 180 reflection entries and a handful of resources.
> * Runtime bootstrap types under {{groovy.lang}}, 
> {{org.codehaus.groovy.runtime}}, {{org.codehaus.groovy.reflection}}, 
> {{org.codehaus.groovy.vmplugin}}: {{GroovySystem}}, 
> {{MetaClassRegistryImpl}}, {{Closure}}, {{GString}}, {{GroovyObjectSupport}}, 
> {{ExpandoMetaClass}}, ranges, {{NullObject}}, the VM plugin, etc.
> * The {{Introspector}} probes the metaclass performs for every class it 
> introspects: {{<Type>BeanInfo}} and {{<Type>Customizer}} lookups for each 
> Groovy runtime type above (these are lookups of classes that do not exist; 
> they still need to be registered so the lookup fails quietly rather than with 
> {{MissingReflectionRegistrationError}}).
> * {{org.codehaus.groovy.runtime.dgm$N}} proxy classes (30 to 32 per 
> application), loaded by name from {{GeneratedMetaMethod$Proxy.createProxy}} 
> when a DGM method is first selected. This set is application dependent: a DGM 
> method not exercised during the agent run fails at run time with 
> {{ClassNotFoundException: org.codehaus.groovy.runtime.dgm$1175}} (seen when a 
> code path was added after the agent run).
> * Resources: {{META-INF/dgminfo}}, 
> {{META-INF/groovy/org.codehaus.groovy.runtime.ExtensionModule}}, 
> {{META-INF/services/org.codehaus.groovy.runtime.ExtensionModule}}, plus a 
> {{.class}} resource lookup ({{groovy/concurrent/AsyncScope.class}}).
> h3. Proposal
> Ship the Groovy-owned part of that metadata in the {{groovy}} jar under 
> {{META-INF/native-image/org.apache.groovy/groovy/}} (and the equivalent for 
> modules that need it, e.g. {{groovy-json}}, {{groovy-xml}}), following the 
> log4j-core layout, so that a dynamic Groovy application builds with plain 
> {{native-image -cp ...}} and no agent step:
> * {{reflect-config.json}} / {{reachability-metadata.json}} with the bootstrap 
> types, the {{BeanInfo}} / {{Customizer}} probe names, and the DGM proxies. 
> For the proxies the safe choice is to register all of them (about 2,000 small 
> classes, all of which are in the jar anyway) rather than a sample, since the 
> used set cannot be known ahead of time; alternatively 
> {{GeneratedMetaMethod$Proxy}} could stop resolving them by name (e.g. a 
> generated switch or a {{MethodHandle}} table), which would remove the entries 
> entirely.
> * {{resource-config.json}} for {{META-INF/dgminfo}}, the extension-module 
> descriptors and the service files.
> * A {{native-image.properties}} with {{Args}} carrying what the README 
> currently asks users to type by hand and what the AOT link mode assumes: 
> {{--initialize-at-run-time=org.codehaus.groovy.vmplugin.v8.IndyInterface}} 
> (and the other runtime classes that must not be initialised at build time). 
> This file is also the one place that can set a build-time system property for 
> everybody, which matters for the JUL caller-location workaround documented 
> under GROOVY-12354 ({{-Djdk.logger.packages=...}} is captured by a build-time 
> static initialiser and ignored at run time).
> The metadata should be generated by the build rather than hand-maintained: 
> run the agent over the existing native-image parity corpus (or a small 
> dedicated script) as part of the performance/native tests, diff against the 
> checked-in files, and fail on drift. Once the jar ships it, an entry in the 
> reachability-metadata repository becomes unnecessary (the repository prefers 
> jar-embedded metadata), but its dangling {{groovy-all}} replacement should be 
> corrected or an {{org.apache.groovy:groovy}} entry added pointing at the 
> shipped files.
> h3. Out of scope
> Caller-location accuracy in native images (GraalVM's visible 
> MethodHandle-interpreter frames) is tracked under GROOVY-12354's 
> documentation and the GraalVM issue; the fatal dynamic call to a 
> {{@CallerSensitive}} method and the failing MOP {{super}} call in native 
> images have their own issues.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to