You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/11/02 16:22:00 UTC

[jira] [Assigned] (GROOVY-6925) Cannot enable static type checking on a method where static compilation has been disabled

     [ https://issues.apache.org/jira/browse/GROOVY-6925?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles reassigned GROOVY-6925:
-----------------------------------

    Assignee: Eric Milles

> Cannot enable static type checking on a method where static compilation has been disabled
> -----------------------------------------------------------------------------------------
>
>                 Key: GROOVY-6925
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6925
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.3.3
>            Reporter: Mauro Molinari
>            Assignee: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code}
> package j
> import groovy.transform.CompileStatic;
> import groovy.transform.TypeChecked;
> import groovy.transform.TypeCheckingMode;
> @CompileStatic
> class J {
> 	
>   @CompileStatic(TypeCheckingMode.SKIP)
>   @TypeChecked(TypeCheckingMode.PASS)
>   void doSomething() {
> 	  Integer myString = myObject()
>   }
>   
>   Object myObject() {
>     return 1
>   }
> }
> {code}
> What I'm trying to say here is this: the class must be statically compiled, except for the {{doSomething()}} method. However, I'd like to have at least static type checking on that method. Unfortunately, this does not work: Groovy does not complain that {{myString}} assignment is not valid.



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