You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Bjørn Mølgård Vester (Jira)" <ji...@apache.org> on 2020/02/10 16:55:00 UTC
[jira] [Updated] (GROOVY-9389) STC regression using
increment/decrement operators on custom bean accessors in Groovy 3.0.0
[ https://issues.apache.org/jira/browse/GROOVY-9389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bjørn Mølgård Vester updated GROOVY-9389:
-----------------------------------------
Summary: STC regression using increment/decrement operators on custom bean accessors in Groovy 3.0.0 (was: STC regression using increment/decrement operators using custom bean accessors in Groovy 3.0.0)
> STC regression using increment/decrement operators on custom bean accessors in Groovy 3.0.0
> -------------------------------------------------------------------------------------------
>
> Key: GROOVY-9389
> URL: https://issues.apache.org/jira/browse/GROOVY-9389
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 3.0.0
> Reporter: Bjørn Mølgård Vester
> Priority: Minor
>
> The following code works in Groovy 2.5.8 but fails compilation in 3.0.0:
> {code:java}
> @groovy.transform.CompileStatic
> class MyProp {
> Integer myInt = 0
> Integer getMyInt() { return myInt } // Custom getter
> void setMyInt(Integer i) { myInt = i } // Custom setter
> }
> @groovy.transform.CompileStatic
> class BugInGroovy300 {
> static void main() {
> new MyProp().myInt++ // This line cannot compile in Groovy 3.0.0
> }
> }
> {code}
> The error is:
> {noformat}
> [Static type checking] - Cannot find matching method java.lang.Object#next(). Please check if the declared type is correct and if the method exists.
> @ line 13, column 21.
> new MyProp().myInt++ // This line cannot compile in Groovy 3.0.0{noformat}
> If using the decrement operator (--), the type checker looks for a "#previous()" method instead.
> The code works in 3.0.0 if using CompileDynamic instead. Relying on the generated accessor methods by Groovy also works.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)