Re: Groovy3 compiler bug?

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

Correction, the 2nd URL is 
https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/f8227cb0e18dc6b21fdad6b8077ea176f9b64e81/grolifant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLinux.groovy

On 04/11/2025 12:56, Schalk Cronje wrote:
>
> *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

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

--------------0VzjKpDfn97X6eHFCH0lKf9D
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>Correction, the 2nd URL is
<a class="moz-txt-link-freetext" href="https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/f8227cb0e18dc6b21fdad6b8077ea176f9b64e81/grolifant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLinux.groovy">https://gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/f8227cb0e18dc6b21fdad6b8077ea176f9b64e81/grolifant-core/src/main/groovy/org/ysb33r/grolifant5/internal/core/os/DefaultLinux.groovy</a></p>
    <div class="moz-cite-prefix">On 04/11/2025 12:56, Schalk Cronje
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:f3a04578-a54c-4925-ae36-c3ad05d1646b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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"
          moz-do-not-send="true">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"
          moz-do-not-send="true">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>
    </blockquote>
    <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>

--------------0VzjKpDfn97X6eHFCH0lKf9D--