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 2019/10/04 00:32:00 UTC
[jira] [Comment Edited] (GROOVY-9237) GContracts and Groovy3
[ https://issues.apache.org/jira/browse/GROOVY-9237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16944133#comment-16944133 ]
Paul King edited comment on GROOVY-9237 at 10/4/19 12:31 AM:
-------------------------------------------------------------
Can you elaborate on the reason? Are you actually using node metadata? I am wondering whether we should disable setting that for the singleton? Also, just for my own understanding, what's an example of where source range is needed for a statement that is conceptually kind of not supposed to be there?
was (Author: paulk):
Any reason?
> GContracts and Groovy3
> ----------------------
>
> Key: GROOVY-9237
> URL: https://issues.apache.org/jira/browse/GROOVY-9237
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Assignee: Eric Milles
> Priority: Minor
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The following runs fine in 2.5.8 (needs gcontracts and asm jars on classpath):
> {code}
> import org.gcontracts.annotations.Invariant
> import groovy.transform.*
> @Invariant({ month >= 1 && month <= 12 && day >= 1 && day <= lastDay[month-1] })
> @MapConstructor
> @ToString(includeNames=true)
> class Calendar {
> private static final int[] lastDay = [31,29,31,30,31,30,31,31,30,31,30,31]
> int month
> int day
>
> def mutateByOneMonth() {
> month++
> }
> }
> new Calendar(month: 2, day: 2).mutateByOneMonth() // Okay
> new Calendar(month: 12, day: 2).mutateByOneMonth() // ClassInvariantViolation
> new Calendar(month: 1, day: 31).mutateByOneMonth() // ClassInvariantViolation
> {code}
> but with 3.0.0-beta-3 I get:
> {noformat}
> java.lang.IllegalAccessError: tried to access method org.codehaus.groovy.ast.stmt.EmptyStatement.<init>()V from class org.gcontracts.generation.TryCatchBlockGenerator
> {noformat}
> We should check whether we have made an unneeded breaking change or whether a gcontracts upgrade might be needed.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)