You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2026/04/19 05:09:00 UTC

[jira] [Updated] (GROOVY-11910) Add ModifiesChecker type checking extension to verify @Modifies frame conditions

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

Paul King updated GROOVY-11910:
-------------------------------
    Component/s: groovy-typecheckers

> Add ModifiesChecker type checking extension to verify @Modifies frame conditions
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-11910
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11910
>             Project: Groovy
>          Issue Type: New Feature
>          Components: groovy-typecheckers
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 6.0.0-alpha-1
>
>
> Add an opt-in ModifiesChecker type checking extension in groovy-typecheckers that verifies method bodies comply with their @Modifies frame condition declarations (GROOVY-11909). Enabled  
>   via @TypeChecked(extensions = 'groovy.typecheckers.ModifiesChecker').                                                                                                                                   
>                                                                                                                                                                                                           
>   The checker validates that:                                                                                                                                                                             
>   - Direct field assignments only target fields listed in @Modifies                                                                                                                                       
>   - Calls to methods on this have compatible @Modifies frames or are @Pure                                                                                                                                
>   - Calls on parameters/variables not in @Modifies use only non-mutating methods
>                                                                                                                                                                                                           
>   Non-mutating calls are determined by a layered approach: immutable receiver type detection (reusing ImmutablePropertyUtils), @Pure annotation, and a curated whitelist of safe method names (size, get, 
>   contains, toString, etc.). Unknown calls produce warnings rather than errors to support incremental adoption.                                                                                           
>                                                                                                                                                                                                           
>   No hard dependency on groovy-contracts — the checker communicates via node metadata set by ModifiesASTTransformation.                                                                                   
>                                                             



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