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

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

sonarqubecloud[bot] commented on PR #2834:
URL: https://github.com/apache/groovy/pull/2834#issuecomment-5442831123

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_groovy&pullRequest=2834) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [3 New 
issues](https://sonarcloud.io/project/issues?id=apache_groovy&pullRequest=2834&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/project/issues?id=apache_groovy&pullRequest=2834&issueStatuses=ACCEPTED)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_groovy&pullRequest=2834&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [97.1% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_groovy&pullRequest=2834&metric=new_coverage&view=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_groovy&pullRequest=2834&metric=new_duplicated_lines_density&view=list)
  
     
   <!

> ClassNodeResolver: NoClassDefFoundError during class-loader lookup aborts 
> resolution
> ------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12303
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12303
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Daniel Sun
>            Priority: Major
>
> When class-loader lookup is used ({{{}asmResolving{}}} off, or the type 
> exists only in memory), {{ClassNodeResolver}} calls 
> {{{}GroovyClassLoader.loadClass{}}}. If the requested class *exists* but 
> cannot be linked (missing superclass or interface), the JVM throws 
> {{{}NoClassDefFoundError{}}}.
> That error used to escape resolution. Compilation aborted with an {{Error}} 
> that named the {*}missing dependency{*}, not the type being resolved. 
> {{resolveName}} could also cache the name as a miss ({{{}NO_CLASS{}}}), so a 
> later successful compile of the dependency would not be retried.
> A TODO in {{findByClassLoading}} has noted this since the 2012 split out of 
> {{{}ResolveVisitor{}}}.
> h3. Expected
>  * If bytecode for the requested name is still on the class path, decompile 
> it (ASM does not link) and continue.
>  * Else if a groovy source of the same name is available, add it to the 
> compilation queue.
>  * Else if a {{.class}} resource exists for that path but declares a 
> different binary name (JVM {{defineClass}} name check; also case-insensitive 
> filesystems), treat the lookup as a miss. Detect this from the bytecode name, 
> not from {{NoClassDefFoundError}} text (HotSpot's {{wrong name}} phrase is 
> English-only; OpenJ9 does not use it).
>  * Otherwise rethrow {{NoClassDefFoundError}} with the looked-up name in the 
> message, and do not cache {{{}NO_CLASS{}}}.
> h3. Actual
> {{NoClassDefFoundError}} propagated out of 
> {{{}ClassNodeResolver.findByClassLoading{}}}.
> h3. Reproducer
> Put {{HasDep.class}} (extends a type that is not loadable) on the class path, 
> disable ASM resolving, and compile:
> {code:groovy}
> HasDep x = null
> {code}
> This fails with {{NoClassDefFoundError}} for the missing super-type instead 
> of resolving {{{}HasDep{}}}.
>  



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

Reply via email to