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

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

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

   ## [![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=3008) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 New 
issues](https://sonarcloud.io/project/issues?id=apache_groovy&pullRequest=3008&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=3008&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=3008&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_groovy&pullRequest=3008&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=3008&metric=new_duplicated_lines_density&view=list)
  
     
   <!

> SC: static compilation in some situation prefers boolean getter over static 
> field and produces cast exception
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12473
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12473
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.23, 3.0.25, 5.0.3, 4.0.33, 5.1.3, 6.0.0
>            Reporter: Björn Kautler
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 6.0.1
>
>
> Given this snippet:
> {code:groovy}
> @groovy.transform.CompileStatic
> def foo() {
>   (Float as Class<Float>).NaN
> }
> foo().toString()
> {code}
> It fails at runtime with a class-cast exception, because static compilation 
> decides it would be a good idea to interpret the {{NaN}} not as the static 
> field, but as {{isNaN()}} call, casting the {{Class<FLoat>}} to {{Float}} 
> which fails of course.
> (This might seem like forged example, of course you would usually do 
> {{Float.NaN}} which works. Nevertheless it should work and not produce cast 
> exception, and if you use {{Float.NaN}} in a Spock assertion with a 
> SC-optimized Spock, you get exactly that cast exception)



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

Reply via email to