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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3227?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 `60.60606%` with `13 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.1711%. Comparing base 
([`ee802a1`](https://app.codecov.io/gh/apache/groovy/commit/ee802a1814eae7a50016cf6ad2896ff9e80f6665?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`81895bc`](https://app.codecov.io/gh/apache/groovy/commit/81895bc2955799ecbaf8903df2efeb34557d4db3?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/3227?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...va/org/codehaus/groovy/control/ResolveVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3227?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FResolveVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvUmVzb2x2ZVZpc2l0b3IuamF2YQ==)
 | 60.6061% | [3 Missing and 10 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3227?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/3227/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/3227?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3227        +/-   ##
   ==================================================
   - Coverage     74.1723%   74.1711%   -0.0012%     
   - Complexity      43760      43772        +12     
   ==================================================
     Files            1692       1692                
     Lines          149599     149627        +28     
     Branches        28386      28399        +13     
   ==================================================
   + Hits           110961     110980        +19     
   - Misses          28430      28433         +3     
   - Partials        10208      10214         +6     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3227?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...va/org/codehaus/groovy/control/ResolveVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3227?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FResolveVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvUmVzb2x2ZVZpc2l0b3IuamF2YQ==)
 | `90.1676% <60.6061%> (-0.8359%)` | :arrow_down: |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3227/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>




> Star imports should not resolve package-private types
> -----------------------------------------------------
>
>                 Key: GROOVY-11916
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11916
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Priority: Major
>
> Groovy's star import resolution (e.g., import java.util.*) currently includes 
> package-private classes in name resolution. On modern JDKs (9+) with the 
> module system, these classes cannot actually be used — attempts result in 
> IllegalAccessError at runtime. This can lead to confusing errors and 
> inconsistency with Java's behaviour where star imports only resolve public 
> types.
> For example, import java.util.* allows def cls = TimSort to compile 
> (resolving the package-private java.util.TimSort), but any actual usage 
> (instanceof, construction, method calls) fails at runtime with 
> IllegalAccessError.
> {code:groovy}
> import java.util.*
> assert String.modifiers == 17
> def cls = TimSort     // fine
> assert cls.modifiers == 0
> println cls           // => class java.util.TimSort
> println Class.forName('java.util.TimSort') // => class java.util.TimSort
> println new Object() instanceof TimSort // IllegalAccessError
> {code}
> Having said that, as a counter example, is it really any different than being 
> able to get the class via Class.forName?
> If the Java behavior is deemed correct, the fix would be to filter non-public 
> classes during star import resolution in ResolveVisitor, producing a clean 
> compile-time error instead of a runtime error. This is technically a breaking 
> change but only affects code that was already failing at runtime on modular 
> JDKs.
> This also benefits the import module feature (GROOVY-11896), which expands to 
> star imports — filtering at the resolution level means module imports 
> correctly include only public types, matching Java's import module semantics.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to