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

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

testlens-app[bot] commented on PR #2605:
URL: https://github.com/apache/groovy/pull/2605#issuecomment-4686959680

   ## ✅ All tests passed ✅
   
   🏷️ Commit: 30496c5ea385ef6590d755d44d71eada120a227b
   ▶️ Tests:  100936 executed
   ⚪️ Checks: 30/30 completed
   
   ---
   _Learn more about TestLens at [testlens.app](https://testlens.app)._
   




> groovy-contracts: @Synchronized method with @Ensures/@Invariant but no 
> @Requires throws ClassCastException (SynchronizedStatement → BlockStatement)
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12084
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12084
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-contracts
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> This code:
> {code:groovy}
> import groovy.contracts.*
> class A {
>     @groovy.transform.Synchronized
>     //@Requires({ a >= 0 })
>     @Ensures({ a >= 0 })
>     def m(int a) { return a}
> }
> def a = new A()
> a.m(12)
> {code}
> Gives this error:
> {noformat}
> Exception thrown
> BUG! exception in phase 'instruction selection' in source unit 
> 'ConsoleScript6' class org.codehaus.groovy.ast.stmt.SynchronizedStatement 
> cannot be cast to class org.codehaus.groovy.ast.stmt.BlockStatement 
> (org.codehaus.groovy.ast.stmt.SynchronizedStatement and 
> org.codehaus.groovy.ast.stmt.BlockStatement are in unnamed module of loader 
> org.codehaus.groovy.tools.RootLoader @6e0be858)
>       at 
> org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:980)
>         ...
> {noformat}
> It runs fine if the @Requires is present.



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

Reply via email to