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 15:10:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17627771#comment-17627771 ]
Eric Milles commented on GROOVY-6925:
-------------------------------------
[~paulk] Is there a play here where instead of "@CompileStatic(TypeCheckingMode.SKIP) @TypeChecked(TypeCheckingMode.PASS)" we can say something via "@CompileDynamic"? Or should the annotation "@TypeChecked" enough to disable static compilation while retaining type checking for a member?
> 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
> 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)