You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by "Kerridge, Jon" <J....@napier.ac.uk> on 2018/04/12 15:29:19 UTC
Compiler bug
Hi,
I got his error from Groovy 2.3.0 beta3
from the following code snippet at the highlighted line
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)
}
Error:Groovyc: While compiling gppDemos: BUG! exception in phase 'class generation' in source unit 'D:\IJgroovy\gpp\gppDemos\src\gppDemos\nQueensProblem\QueensClient.groovy' At line 70 column 13
On receiver: leftDiagonal with message: getAt and arguments: <not implemented yet for class: org.codehaus.groovy.classgen.asm.VariableSlotLoader>
This method should not have been called. Please try to create a simple example reproducing
this error and file a bug report at https://issues.apache.org/jira/browse/GROOVY
at org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:682)
at org.codehaus.groovy.classgen.asm.InvocationWriter.makeSingleArgumentCall(InvocationWriter.java:654)
at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpression(BinaryExpressionHelper.java:574)
at org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:204)
at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:290)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:698)
at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.loadWithSubscript(BinaryExpressionHelper.java:730)
at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluatePostfixMethod(BinaryExpressionHelper.java:658)
at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluatePostfixMethod(BinaryExpressionHelper.java:681)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitPostfixExpression(AsmClassGenerator.java:703)
at org.codehaus.groovy.ast.expr.PostfixExpression.visit(PostfixExpression.java:45)
at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:621)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:680)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:93)
at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:83)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:626)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeIteratorBasedForEachLoop(StaticTypesStatementWriter.java:254)
at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeForInLoop(StaticTypesStatementWriter.java:109)
at org.codehaus.groovy.classgen.asm.StatementWriter.writeForStatement(StatementWriter.java:105)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitForLoop(AsmClassGenerator.java:630)
at org.codehaus.groovy.ast.stmt.ForStatement.visit(ForStatement.java:49)
at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:93)
at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:83)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:626)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:486)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:422)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:132)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:567)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1087)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:260)
at org.codehaus.groovy.control.CompilationUnit$18.call(CompilationUnit.java:853)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1090)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)
at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:158)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda$runGroovyc$0(InProcessGroovyc.java:88)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
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
Re: Compiler bug
Posted by Paul King <pa...@asert.com.au>.
Okay, I can reproduce by adding @CompileStatic to the example I tried
previously and can confirm that 2.4.13 is where the regression started.
Workaround would be to remove @CompileStatic until we can get a fix in
place. If you can raise a bug issue in Jira, that would be great.
Cheers, Paul.
On Fri, Apr 13, 2018 at 8:20 PM, Paul King <pa...@asert.com.au> wrote:
>
> 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 <pa...@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)
>> }
>> }
>>
>> println new 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....@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
>>> http://www.soc.napier.ac.uk/~cs10/
>>>
>>> ------------------------------
>>> *From:* Daniel.Sun <su...@apache.org>
>>> *Sent:* 12 April 2018 18:22:39
>>> *To:* 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
>>>
>>> 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
>>>
>>
>>
>
Re: Compiler bug
Posted by "Kerridge, Jon" <J....@napier.ac.uk>.
Thanks for the advice, needless to say I was trying rebuild!!
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 17:52:11
To: dev@groovy.apache.org; Kerridge, Jon
Subject: Re: Compiler bug
To be clear: You have to repeatedly execute "build" - not "rebuild". While it might seem logical that, if anything, "rebuild" fixes the problem, for my that was never the case: "rebuild" just took a long time, then failed with the same error.
In my case, the problem always stays away for some time once the build works again.
I would try my suggestion first, since it will take no more than the time it takes for you to try to build your project several times. On the ther hand, if you have run into the same indeterministic problem, you will not be able to "find the point at which the code worked" - or, to be more precise, you will only think that you have found it, but it might just have worked by accident. In the beginning I did also not believe that the problem was indeterministic, since I kept changing thing until the build "worked again" - until I finally realized, that just clicking "build" several times in a row actually could make the build work (Note: My build does not have any steps outside of Groovy compilation over multiple modules).
mg
On 13.04.2018 17:32, Kerridge, Jon wrote:
Hi,
Thanks for the advice, will still try to see if I can find the point at which the code worked and is no longer working but will bear in mind your comment.
It looks as though moving to Intellij mught not have been the shangrilar it was made out to be!!
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 13:51:13
To: dev@groovy.apache.org<ma...@groovy.apache.org>; Kerridge, Jon
Subject: Re: Compiler bug
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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Paul King <pa...@asert.com.au>
Sent: 13 April 2018 11:20:16
To: dev@groovy.apache.org<ma...@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 <pa...@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)
}
}
println new 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....@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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Daniel.Sun <su...@apache.org>>
Sent: 12 April 2018 18:22:39
To: dev@groovy.incubator.apache.org<ma...@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
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
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
Re: Compiler bug
Posted by "Kerridge, Jon" <J....@napier.ac.uk>.
Hi,
I have now gone through the other 'patch' releases of 2.4 and discovered that The error appeared in 2.4.13. In other words up to 2.4.12 the code I provided yesterday worked and from then on it has failed to compile always producing the error I first reported on the same line of code.
Hope the helps in locating the problem.
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: Kerridge, Jon
Sent: 15 April 2018 16:55:13
To: dev@groovy.apache.org
Subject: Re: Compiler bug
Hi,
I have run the tests again several times (at least 3).
I alternated between compiling with Groovy.2.4.10 and Groovy2.4.15
With 2.4.10 the module compiled without fail and the code highlighted before worked as expected.
With 2.4.15 the module produced the same error as first reported and that included following mg's advice and doing several 'build's of the module but it failed every time in the same way.
I guess the thing to do is download the intermediate version to find out where there was a change 2.4.n and 2.4.n+1 to see where the change of version causes a problem.
I will now start that exercise.
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: Kerridge, Jon <J....@napier.ac.uk>
Sent: 13 April 2018 20:21:58
To: dev@groovy.apache.org
Subject: Re: Compiler bug
Hi,
Following mg's advice have compleltly built the code again from scratch.
I had installed 2.4.10 and the code that was failing before is now working and I was able to run it. However I did not have to do build more than once for each component. The build in total requires the compilation of 6 modules.
So I do not know now whether it is a bug or just a problem with Intellij. I will reinstall 2.4.15 and see if I can build it again and get it to work.
Thanks for your time and trouble
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 17:52
To: dev@groovy.apache.org; Kerridge, Jon
Subject: Re: Compiler bug
To be clear: You have to repeatedly execute "build" - not "rebuild". While it might seem logical that, if anything, "rebuild" fixes the problem, for my that was never the case: "rebuild" just took a long time, then failed with the same error.
In my case, the problem always stays away for some time once the build works again.
I would try my suggestion first, since it will take no more than the time it takes for you to try to build your project several times. On the ther hand, if you have run into the same indeterministic problem, you will not be able to "find the point at which the code worked" - or, to be more precise, you will only think that you have found it, but it might just have worked by accident. In the beginning I did also not believe that the problem was indeterministic, since I kept changing thing until the build "worked again" - until I finally realized, that just clicking "build" several times in a row actually could make the build work (Note: My build does not have any steps outside of Groovy compilation over multiple modules).
mg
On 13.04.2018 17:32, Kerridge, Jon wrote:
Hi,
Thanks for the advice, will still try to see if I can find the point at which the code worked and is no longer working but will bear in mind your comment.
It looks as though moving to Intellij mught not have been the shangrilar it was made out to be!!
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 13:51:13
To: dev@groovy.apache.org<ma...@groovy.apache.org>; Kerridge, Jon
Subject: Re: Compiler bug
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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Paul King <pa...@asert.com.au>
Sent: 13 April 2018 11:20:16
To: dev@groovy.apache.org<ma...@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 <pa...@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)
}
}
println new 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....@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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Daniel.Sun <su...@apache.org>>
Sent: 12 April 2018 18:22:39
To: dev@groovy.incubator.apache.org<ma...@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
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
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
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
Re: Compiler bug
Posted by "Kerridge, Jon" <J....@napier.ac.uk>.
Hi,
I have run the tests again several times (at least 3).
I alternated between compiling with Groovy.2.4.10 and Groovy2.4.15
With 2.4.10 the module compiled without fail and the code highlighted before worked as expected.
With 2.4.15 the module produced the same error as first reported and that included following mg's advice and doing several 'build's of the module but it failed every time in the same way.
I guess the thing to do is download the intermediate version to find out where there was a change 2.4.n and 2.4.n+1 to see where the change of version causes a problem.
I will now start that exercise.
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: Kerridge, Jon <J....@napier.ac.uk>
Sent: 13 April 2018 20:21:58
To: dev@groovy.apache.org
Subject: Re: Compiler bug
Hi,
Following mg's advice have compleltly built the code again from scratch.
I had installed 2.4.10 and the code that was failing before is now working and I was able to run it. However I did not have to do build more than once for each component. The build in total requires the compilation of 6 modules.
So I do not know now whether it is a bug or just a problem with Intellij. I will reinstall 2.4.15 and see if I can build it again and get it to work.
Thanks for your time and trouble
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 17:52
To: dev@groovy.apache.org; Kerridge, Jon
Subject: Re: Compiler bug
To be clear: You have to repeatedly execute "build" - not "rebuild". While it might seem logical that, if anything, "rebuild" fixes the problem, for my that was never the case: "rebuild" just took a long time, then failed with the same error.
In my case, the problem always stays away for some time once the build works again.
I would try my suggestion first, since it will take no more than the time it takes for you to try to build your project several times. On the ther hand, if you have run into the same indeterministic problem, you will not be able to "find the point at which the code worked" - or, to be more precise, you will only think that you have found it, but it might just have worked by accident. In the beginning I did also not believe that the problem was indeterministic, since I kept changing thing until the build "worked again" - until I finally realized, that just clicking "build" several times in a row actually could make the build work (Note: My build does not have any steps outside of Groovy compilation over multiple modules).
mg
On 13.04.2018 17:32, Kerridge, Jon wrote:
Hi,
Thanks for the advice, will still try to see if I can find the point at which the code worked and is no longer working but will bear in mind your comment.
It looks as though moving to Intellij mught not have been the shangrilar it was made out to be!!
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 13:51:13
To: dev@groovy.apache.org<ma...@groovy.apache.org>; Kerridge, Jon
Subject: Re: Compiler bug
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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Paul King <pa...@asert.com.au>
Sent: 13 April 2018 11:20:16
To: dev@groovy.apache.org<ma...@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 <pa...@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)
}
}
println new 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....@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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Daniel.Sun <su...@apache.org>>
Sent: 12 April 2018 18:22:39
To: dev@groovy.incubator.apache.org<ma...@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
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
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
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
Re: Compiler bug
Posted by "Kerridge, Jon" <J....@napier.ac.uk>.
Hi,
Following mg's advice have compleltly built the code again from scratch.
I had installed 2.4.10 and the code that was failing before is now working and I was able to run it. However I did not have to do build more than once for each component. The build in total requires the compilation of 6 modules.
So I do not know now whether it is a bug or just a problem with Intellij. I will reinstall 2.4.15 and see if I can build it again and get it to work.
Thanks for your time and trouble
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 17:52
To: dev@groovy.apache.org; Kerridge, Jon
Subject: Re: Compiler bug
To be clear: You have to repeatedly execute "build" - not "rebuild". While it might seem logical that, if anything, "rebuild" fixes the problem, for my that was never the case: "rebuild" just took a long time, then failed with the same error.
In my case, the problem always stays away for some time once the build works again.
I would try my suggestion first, since it will take no more than the time it takes for you to try to build your project several times. On the ther hand, if you have run into the same indeterministic problem, you will not be able to "find the point at which the code worked" - or, to be more precise, you will only think that you have found it, but it might just have worked by accident. In the beginning I did also not believe that the problem was indeterministic, since I kept changing thing until the build "worked again" - until I finally realized, that just clicking "build" several times in a row actually could make the build work (Note: My build does not have any steps outside of Groovy compilation over multiple modules).
mg
On 13.04.2018 17:32, Kerridge, Jon wrote:
Hi,
Thanks for the advice, will still try to see if I can find the point at which the code worked and is no longer working but will bear in mind your comment.
It looks as though moving to Intellij mught not have been the shangrilar it was made out to be!!
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 13:51:13
To: dev@groovy.apache.org<ma...@groovy.apache.org>; Kerridge, Jon
Subject: Re: Compiler bug
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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Paul King <pa...@asert.com.au>
Sent: 13 April 2018 11:20:16
To: dev@groovy.apache.org<ma...@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 <pa...@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)
}
}
println new 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....@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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Daniel.Sun <su...@apache.org>>
Sent: 12 April 2018 18:22:39
To: dev@groovy.incubator.apache.org<ma...@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
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
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
Re: Compiler bug
Posted by MG <mg...@arscreat.com>.
To be clear: You have to repeatedly execute "build" - not "rebuild".
While it might seem logical that, if anything, "rebuild" fixes the
problem, for my that was never the case: "rebuild" just took a long
time, then failed with the same error.
In my case, the problem always stays away for some time once the build
works again.
I would try my suggestion first, since it will take no more than the
time it takes for you to try to build your project several times. On the
ther hand, if you have run into the same indeterministic problem, you
will not be able to "find the point at which the code worked" - or, to
be more precise, you will only think that you have found it, but it
might just have worked by accident. In the beginning I did also not
believe that the problem was indeterministic, since I kept changing
thing until the build "worked again" - until I finally realized, that
just clicking "build" several times in a row actually could make the
build work (Note: My build does not have any steps outside of Groovy
compilation over multiple modules).
mg
On 13.04.2018 17:32, Kerridge, Jon wrote:
>
> Hi,
>
> Thanks for the advice, will still try to see if I can find the point
> at which the code worked and is no longer working but will bear in
> mind your comment.
>
>
> It looks as though moving to Intellij mught not have been the
> shangrilar it was made out to be!!
>
>
> Jon
>
>
>
>
> Professor Jon Kerridge
> School of Computing
> Edinburgh Napier University
> Merchiston Campus
> Edinburgh EH10 5DT
> 0131 455 2777
> j.kerridge@napier.ac.uk <ma...@napier.ac.uk>
> http://www.soc.napier.ac.uk/~cs10/ <http://www.soc.napier.ac.uk/%7Ecs10/>
> ------------------------------------------------------------------------
> *From:* MG <mg...@arscreat.com>
> *Sent:* 13 April 2018 13:51:13
> *To:* dev@groovy.apache.org; Kerridge, Jon
> *Subject:* Re: Compiler bug
> 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 <ma...@napier.ac.uk>
>> http://www.soc.napier.ac.uk/~cs10/ <http://www.soc.napier.ac.uk/%7Ecs10/>
>> ------------------------------------------------------------------------
>> *From:* Paul King <pa...@asert.com.au> <ma...@asert.com.au>
>> *Sent:* 13 April 2018 11:20:16
>> *To:* dev@groovy.apache.org <ma...@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
>> <ma...@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 <ma...@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 <ma...@napier.ac.uk>
>> http://www.soc.napier.ac.uk/~cs10/
>> <http://www.soc.napier.ac.uk/%7Ecs10/>
>> ------------------------------------------------------------------------
>> *From:* Daniel.Sun <sunlan@apache.org <ma...@apache.org>>
>> *Sent:* 12 April 2018 18:22:39
>> *To:* dev@groovy.incubator.apache.org
>> <ma...@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
>>
>
> 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
>
Re: Compiler bug
Posted by "Kerridge, Jon" <J....@napier.ac.uk>.
Hi,
Thanks for the advice, will still try to see if I can find the point at which the code worked and is no longer working but will bear in mind your comment.
It looks as though moving to Intellij mught not have been the shangrilar it was made out to be!!
Jon
Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT
0131 455 2777
j.kerridge@napier.ac.uk<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: MG <mg...@arscreat.com>
Sent: 13 April 2018 13:51:13
To: dev@groovy.apache.org; Kerridge, Jon
Subject: Re: Compiler bug
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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Paul King <pa...@asert.com.au>
Sent: 13 April 2018 11:20:16
To: dev@groovy.apache.org<ma...@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 <pa...@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)
}
}
println new 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....@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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/<http://www.soc.napier.ac.uk/%7Ecs10/>
________________________________
From: Daniel.Sun <su...@apache.org>>
Sent: 12 April 2018 18:22:39
To: dev@groovy.incubator.apache.org<ma...@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
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
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
Re: Compiler bug
Posted by MG <mg...@arscreat.com>.
PS: You can also try to invalidate IntelliJ's caches (File \ Inavlidate
Caches) to see if that helps. That's what I did when I first encountered
my problem, but that takes quite some time (and looking back I cannot be
sure if it did not just work by accident, by basically waiting some time
between builds) so it is only a last resort.
On 13.04.2018 14:51, MG wrote:
> 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 <ma...@napier.ac.uk>
>> http://www.soc.napier.ac.uk/~cs10/ <http://www.soc.napier.ac.uk/%7Ecs10/>
>> ------------------------------------------------------------------------
>> *From:* Paul King <pa...@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
>> <ma...@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 <ma...@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 <ma...@napier.ac.uk>
>> http://www.soc.napier.ac.uk/~cs10/
>> <http://www.soc.napier.ac.uk/%7Ecs10/>
>> ------------------------------------------------------------------------
>> *From:* Daniel.Sun <sunlan@apache.org <ma...@apache.org>>
>> *Sent:* 12 April 2018 18:22:39
>> *To:* dev@groovy.incubator.apache.org
>> <ma...@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
>>
>
Re: Compiler bug
Posted by MG <mg...@arscreat.com>.
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 <ma...@napier.ac.uk>
> http://www.soc.napier.ac.uk/~cs10/ <http://www.soc.napier.ac.uk/%7Ecs10/>
> ------------------------------------------------------------------------
> *From:* Paul King <pa...@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
> <ma...@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 <ma...@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 <ma...@napier.ac.uk>
> http://www.soc.napier.ac.uk/~cs10/
> <http://www.soc.napier.ac.uk/%7Ecs10/>
> ------------------------------------------------------------------------
> *From:* Daniel.Sun <sunlan@apache.org <ma...@apache.org>>
> *Sent:* 12 April 2018 18:22:39
> *To:* dev@groovy.incubator.apache.org
> <ma...@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
>
Re: Compiler bug
Posted by "Kerridge, Jon" <J....@napier.ac.uk>.
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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: Paul King <pa...@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 <pa...@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)
}
}
println new 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....@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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: Daniel.Sun <su...@apache.org>>
Sent: 12 April 2018 18:22:39
To: dev@groovy.incubator.apache.org<ma...@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
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
Re: Compiler bug
Posted by Paul King <pa...@asert.com.au>.
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 <pa...@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)
> }
> }
>
> println new 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....@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
>> http://www.soc.napier.ac.uk/~cs10/
>>
>> ------------------------------
>> *From:* Daniel.Sun <su...@apache.org>
>> *Sent:* 12 April 2018 18:22:39
>> *To:* 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
>>
>> 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
>>
>
>
Re: Compiler bug
Posted by Paul King <pa...@asert.com.au>.
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)
}
}
println new 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....@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
> http://www.soc.napier.ac.uk/~cs10/
>
> ------------------------------
> *From:* Daniel.Sun <su...@apache.org>
> *Sent:* 12 April 2018 18:22:39
> *To:* 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
>
> 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
>
Re: Compiler bug
Posted by "Kerridge, Jon" <J....@napier.ac.uk>.
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<ma...@napier.ac.uk>
http://www.soc.napier.ac.uk/~cs10/
________________________________
From: Daniel.Sun <su...@apache.org>
Sent: 12 April 2018 18:22:39
To: 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
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
Re: Compiler bug
Posted by "Daniel.Sun" <su...@apache.org>.
Please try Groovy 2.4.15.
Cheers,
Daniel.Sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html