groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MG <mg...@arscreat.com>
Subject Re: Compiler bug
Date Fri, 13 Apr 2018 12:51:13 GMT
Hi John,

I have bee using IntelliJ for years and have had a non-deterministic 
build problem for about the same time span, where the Groovy compiler 
throws on my code overriding a method in a child class with an 
incompatible return type. Only my code is correct, and the problem 
dissappears every time if I rebuild the project multiple times (without 
any changes between builds). Afair IntelliJ introduced some kind of 
caching mechanism to speed up Groovy builds some time back, and I assume 
this is the cause of the problem.

So it might sound odd, but I would suggest you try rebuilding your 
project multiple times in a row, with a little bit of delay between 
builds, if possible through different build paths (e.g. build a 
submodule other modules depend on first, etc), to see if the build 
suddenly works in your case too.

Cheers,
mg


On 13.04.2018 14:27, Kerridge, Jon wrote:
>
> Hi,
>
>
> This becomes problematic as the containing class is part of a much 
> larger system.  I am building a a Groovy Parallel Patterns Library and 
> this is just one of the demos of the library I am working on.  I have 
> had the code working in an Eclipse envrionment with an earlier release 
> of 2.4 probably around 10 or 11.
>
>
> I have now moved to Intellij and this has thrown up the problem.
>
>
> I will download a previous release of 2.4.n and see if I can get the 
> code to work and that may then help you to identify the problem.
>
>
> I have been doing a major revision of my codebase moving from 
> Eclipse/Mercurial/ Bitbucket to Intellij/Github and this has thrown up 
> this problem.
>
>
> Jon
>
>
>
>
> Professor Jon Kerridge
> School of Computing
> Edinburgh Napier University
> Merchiston Campus
> Edinburgh EH10 5DT
> 0131 455 2777
> j.kerridge@napier.ac.uk <mailto:j.kerridge@napier.ac.uk>
> http://www.soc.napier.ac.uk/~cs10/ <http://www.soc.napier.ac.uk/%7Ecs10/>
> ------------------------------------------------------------------------
> *From:* Paul King <paulk@asert.com.au>
> *Sent:* 13 April 2018 11:20:16
> *To:* dev@groovy.apache.org
> *Subject:* Re: Compiler bug
>
> Not sure what happened to the formatting - here it is again:
>
> class QueensBase {
>   int N = 2
>
>   double doFitness(List <Integer> board) {
>     List <Integer> leftDiagonal = new ArrayList(2*N)
>     List <Integer> rightDiagonal = new ArrayList(2*N)
>     double sum = 0.0D
>
>     for ( i in 1 .. 2*N) {
>         leftDiagonal[i] = 0
>         rightDiagonal[i] = 0
>     }
>     for ( i in 1 .. N) {
>         leftDiagonal[i+board[i]-1]++
>         rightDiagonal[N-i+board[i]]++
>     }
>     for ( i in 1 .. ((2*N) - 1)) {
>         int counter = 0
>         if ( leftDiagonal[i] > 1)
>             counter += leftDiagonal[i] - 1
>         if ( rightDiagonal[i] > 1)
>             counter += rightDiagonal[i] - 1
>         sum += counter / (N - Math.abs(i-N))
>     }
>     // target fitness is 0.0
>     // sum can be negative so return absolute value
>     return Math.abs(sum)
>   }
> }
>
> println new QueensBase().doFitness(1..16)
>
>
> On Fri, Apr 13, 2018 at 8:18 PM, Paul King <paulk@asert.com.au 
> <mailto:paulk@asert.com.au>> wrote:
>
>     I tried this script:
>
>     class QueensBase {
>        int N =2 double doFitness(List <Integer> board) { List <Integer>
>     leftDiagonal = new ArrayList(2*N) List <Integer> rightDiagonal =
>     new ArrayList(2*N) double sum = 0.0D for ( i in 1 .. 2*N) {
>     leftDiagonal[i] = 0 rightDiagonal[i] = 0 } for ( i in 1 .. N) {
>     leftDiagonal[i+board[i]-1]++ rightDiagonal[N-i+board[i]]++ } for (
>     i in 1 .. ((2*N) - 1)) { int counter = 0 if ( leftDiagonal[i] > 1)
>     counter += leftDiagonal[i] - 1 if ( rightDiagonal[i] > 1) counter
>     += rightDiagonal[i] - 1 sum += counter / (N - Math.abs(i-N)) } //
>     target fitness is 0.0 // sum can be negative so return absolute
>     value return Math.abs(sum) } } printlnnew QueensBase().doFitness(1..16)
>
>
>     It worked for me in the Groovy Web Console, Intellij IDEA 2017.3.5
>     pointing to 2.4.15, and the GroovyConsole for 2.4.15 and 2.3.0.
>
>     Perhaps we need a bigger sample to track down your issue.
>
>     Cheers, Paul.
>
>
>     On Fri, Apr 13, 2018 at 7:39 PM, Kerridge, Jon
>     <J.Kerridge@napier.ac.uk <mailto:J.Kerridge@napier.ac.uk>> wrote:
>
>         Daniel,
>
>
>         Thanks for getting back to me so quickly.
>
>
>         I have converted to groovy2.4.15 and the same error occurs.  I
>         am running under Intellij IDE and had downloaded the sdk bundle.
>
>
>         Jon
>
>
>
>
>         Professor Jon Kerridge
>         School of Computing
>         Edinburgh Napier University
>         Merchiston Campus
>         Edinburgh EH10 5DT
>         0131 455 2777
>         j.kerridge@napier.ac.uk <mailto:j.kerridge@napier.ac.uk>
>         http://www.soc.napier.ac.uk/~cs10/
>         <http://www.soc.napier.ac.uk/%7Ecs10/>
>         ------------------------------------------------------------------------
>         *From:* Daniel.Sun <sunlan@apache.org <mailto:sunlan@apache.org>>
>         *Sent:* 12 April 2018 18:22:39
>         *To:* dev@groovy.incubator.apache.org
>         <mailto:dev@groovy.incubator.apache.org>
>         *Subject:* Re: Compiler bug
>         Please try Groovy 2.4.15.
>
>         Cheers,
>         Daniel.Sun
>
>
>
>         --
>         Sent from:
>         http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
>         <http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html>
>
>         This message and its attachment(s) are intended for the
>         addressee(s) only and should not be read, copied, disclosed,
>         forwarded or relied upon by any person other than the intended
>         addressee(s) without the permission of the sender. If you are
>         not the intended addressee you must not take any action based
>         on this message and its attachment(s) nor must you copy or
>         show them to anyone. Please respond to the sender and ensure
>         that this message and its attachment(s) are deleted.
>
>         It is your responsibility to ensure that this message and its
>         attachment(s) are scanned for viruses or other defects.
>         Edinburgh Napier University does not accept liability for any
>         loss or damage which may result from this message or its
>         attachment(s), or for errors or omissions arising after it was
>         sent. Email is not a secure medium. Emails entering Edinburgh
>         Napier University's system are subject to routine monitoring
>         and filtering by Edinburgh Napier University.
>
>         Edinburgh Napier University is a registered Scottish charity.
>         Registration number SC018373
>
>
>
> This message and its attachment(s) are intended for the addressee(s) 
> only and should not be read, copied, disclosed, forwarded or relied 
> upon by any person other than the intended addressee(s) without the 
> permission of the sender. If you are not the intended addressee you 
> must not take any action based on this message and its attachment(s) 
> nor must you copy or show them to anyone. Please respond to the sender 
> and ensure that this message and its attachment(s) are deleted.
>
> It is your responsibility to ensure that this message and its 
> attachment(s) are scanned for viruses or other defects. Edinburgh 
> Napier University does not accept liability for any loss or damage 
> which may result from this message or its attachment(s), or for errors 
> or omissions arising after it was sent. Email is not a secure medium. 
> Emails entering Edinburgh Napier University's system are subject to 
> routine monitoring and filtering by Edinburgh Napier University.
>
> Edinburgh Napier University is a registered Scottish charity. 
> Registration number SC018373
>


Mime
View raw message