Groovy3 compiler bug?

Schalk Cronje <[email protected]> Tue, 4 Nov 2025 12:56:22 +0100
Newsgroups gmane.comp.lang.groovy.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------QlrJhgeRX0IwTrPGBs0127pL
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

*Preamble*: /In Grolifant we compile the core code against Groovy 3.0.22 
so that is compatible with any Gradle 7.3+. There was a bug in Grolifant 
where the OperatingSystem instance did not report the correct operating 
system./

In this file 
https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/RELEASE_5_8_0/grolifant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLinux.groovy?ref_type=tags, 
there is the line

     public static final OperatingSystem INSTANCE = new DefaultLinux()

The DefaultLinux class extends DefaultGenericUnix. Now when INSTANCE is 
accessed, it shows up as DefaultGenericUnix instead of DefaultLinux. 
(There are a couple of classes that has the same default behaviour).

To get this to work I had to change it to 
https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/e1614b58e0956580831916c35f41b76476dcfcc0/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 called INSTANCE and that DefaultLinux 
no longer extended DefaultGenericUnix.

I guess this is a compiler bug? I don't want it fixedh, but it would 
great if someone can explain this behaviour.

-- 
Schalk W. Cronjé
Fediverse: @[email protected] (general), @[email protected] (outdoor), @[email protected] (photoblog), @[email protected] (videoblog), @[email protected] (open-source work).
Ello: @ysb33r

--------------QlrJhgeRX0IwTrPGBs0127pL
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><b>Preamble</b>: <i>In Grolifant we compile the core code
        against Groovy 3.0.22 so that is compatible with any Gradle
        7.3+. There was a bug in Grolifant where the OperatingSystem
        instance did not report the correct operating system.</i></p>
    <p>In this file
<a class="moz-txt-link-freetext" href="https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/RELEASE_5_8_0/grolifant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLinux.groovy?ref_type=tags">https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/RELEASE_5_8_0/grolifant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLinux.groovy?ref_type=tags</a>,
      there is the line<br>
      <br>
          public static final OperatingSystem INSTANCE = new
      DefaultLinux()</p>
    <p>The DefaultLinux class extends DefaultGenericUnix. Now when
      INSTANCE is accessed, it shows up as DefaultGenericUnix instead of
      DefaultLinux. (There are a couple of classes that has the same
      default behaviour).</p>
    <p>To get this to work I had to change it to
<a class="moz-txt-link-freetext" href="https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/e1614b58e0956580831916c35f41b76476dcfcc0/grolifant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLinux.groovy">https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/e1614b58e0956580831916c35f41b76476dcfcc0/grolifant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLinux.groovy</a>
      so that both DefaultGenericUnix and DefaultLinux has a common
      ancestor which does not have a static field called INSTANCE and
      that DefaultLinux no longer extended DefaultGenericUnix.<br>
      <br>
      I guess this is a compiler bug? I don't want it fixedh, but it
      would great if someone can explain this behaviour.</p>
    <pre class="moz-signature" cols="72">-- 
Schalk W. Cronjé
Fediverse: @[email protected] (general), @[email protected] (outdoor), @[email protected] (photoblog), @[email protected] (videoblog), @[email protected] (open-source work).
Ello: @ysb33r</pre>
  </body>
</html>

--------------QlrJhgeRX0IwTrPGBs0127pL--