Re: Groovy3 compiler bug?

Jochen Theodorou <[email protected]> Wed, 5 Nov 2025 19:10:27 +0100
Newsgroups gmane.comp.lang.groovy.user
Message-ID <[email protected]>
How did you access INSTANCE?

On 04.11.25 12:56, Schalk Cronje wrote:
> *Preamble*: /In Grolifant we compile the core code against Groovy 3.0.22=
=20
> so that is compatible with any Gradle 7.3+. There was a bug in Grolifant=
=20
> where the OperatingSystem instance did not report the correct operating=
=20
> system./
>=20
> In this file=20
> https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/RELEASE_5_8_0/groli=
fant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLi=
nux.groovy?ref_type=3Dtags, there is the line
>=20
>  =C2=A0 =C2=A0 public static final OperatingSystem INSTANCE =3D new Defa=
ultLinux()
>=20
> The DefaultLinux class extends DefaultGenericUnix. Now when INSTANCE is=
=20
> accessed, it shows up as DefaultGenericUnix instead of DefaultLinux.=20
> (There are a couple of classes that has the same default behaviour).
>=20
> To get this to work I had to change it to=20
> https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/e1614b58e0956580831=
916c35f41b76476dcfcc0/grolifant-core/src/main/groovy/org/ysb33r/grolifant5=
/internal/core/os/DefaultLinux.groovy so that both DefaultGenericUnix and =
DefaultLinux has a common ancestor which does not have a static field call=
ed INSTANCE and that DefaultLinux no longer extended DefaultGenericUnix.
>=20
> I guess this is a compiler bug? I don't want it fixedh, but it would=20
> great if someone can explain this behaviour.
>=20
> --=20
> Schalk W. Cronj=C3=A9
> Fediverse: @[email protected] (general), @[email protected] (=
outdoor), @[email protected] (photoblog), @[email protected] (videobl=
og), @[email protected] (open-source work).
> Ello: @ysb33r
>=20