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/06 17:41:00 UTC
[jira] [Comment Edited] (GROOVY-9857) Immutable generates invalid super constructor call
[ https://issues.apache.org/jira/browse/GROOVY-9857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17629520#comment-17629520 ]
Eric Milles edited comment on GROOVY-9857 at 11/6/22 5:40 PM:
--------------------------------------------------------------
https://github.com/apache/groovy/commit/873e1952cf93373ad1eb348ef944fd628a3e9610
{{Immutable}} will not try and choose constructor. You will however get an error now that there is no no-arg constructor to call and you must take some action, which would likely be adding {{includeSuperProperties=true}} attribute.
was (Author: emilles):
https://github.com/apache/groovy/commit/873e1952cf93373ad1eb348ef944fd628a3e9610
{{Immutable}} will not try and choose constructor. You will however get an error now that there is no no-arg constructor to call and you must take some action.
> Immutable generates invalid super constructor call
> --------------------------------------------------
>
> Key: GROOVY-9857
> URL: https://issues.apache.org/jira/browse/GROOVY-9857
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 3.0.7
> Reporter: Christopher Smith
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 4.0.7
>
>
> The transforms invoked by {{@Immutable}} generate constructor code that unconditionally makes a call to {{super()}} even when the superclass has no default constructor.
> {code:groovy}
> @TupleConstructor(defaults = false)
> abstract class AbstractClass {
> String a
> }
> @Immutable
> class ImmutableSubclass extends AbstractClass {
> String i
> }
> {code}
> Compiling this pair produces {{invokespecial AbstractClass.<init>()}}, which does not exist. This should at a minimum produce a compile-time error.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)