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

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

paulk-asert commented on PR #2199:
URL: https://github.com/apache/groovy/pull/2199#issuecomment-2812980365

   > Can you explain the design of this one? I don't quite follow. I think this 
plays into the reason we limited the previous fix to STC.
   
   This just applies the previous fix (so only STC) to Switch Expressions as 
well as Switch Statements. The ClassCodeExpressionTransformer for the previous 
fix doesn't normally traverse deeply. We "create" a Switch Expression by 
wrapping a Switch Statement into a Closure. The change here just causes it to 
traverse deeper into the wrapped code. I did try adding some additional marker 
metadata to make traversal even more selective, but it was transformed away 
before it gets to where we'd look it up. We could try to track down where that 
happens and make it preserve the metadata, but looking inside for the Closure 
expression should eliminate many traversal paths.




> Enums in switch/case statements that are not fully qualified will cause a 
> groovy compile error but Java requires enums to "not" be fully qualified
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11614
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11614
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.0.24
>            Reporter: Saravanan
>            Priority: Minor
>
> This is a difference in Java vs Groovy behaviour. Enums must be fully 
> qualified in Groovy while Java requires them to not be fully qualified.
> -This was supposedly fixed, but does not seem to work in 4.0.24. Not sure 
> where it broke.-
> Example:
> {code:groovy}
> void test(Thread.State ts) {
>   switch (ts) {
>     case Thread.State.NEW: // cannot remove "Thread.State." without 
> @CompileStatic
>       break
>   }
> }
> {code}



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

Reply via email to