[jira] [Updated] (GROOVY-9524) VerifyError when referencing a private enum method
[ https://issues.apache.org/jira/browse/GROOVY-9524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9524: Fix Version/s: 2.5.16 > VerifyError when referencing a private enum method > -- > > Key: GROOVY-9524 > URL: https://issues.apache.org/jira/browse/GROOVY-9524 > Project: Groovy > Issue Type: Bug > Components: Static compilation >Affects Versions: 2.5.11 >Reporter: Mauro Molinari >Assignee: Eric Milles >Priority: Major > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Time Spent: 0.5h > Remaining Estimate: 0h > > Very similar to GROOVY-9523, but here full static compilation is used. > Consider this Groovy class: > {code:groovy} > package test64 > import groovy.transform.CompileStatic > @CompileStatic > class Test64 { > static enum ShippingAddressSynchType { > ACCOUNTING { > @Override > void synch(Test64 customer) { > truncate('foo', 2) > } > }; > void synch(Test64 customer) { } > private String truncate(String input, int maxLength) { > if(!input) > return input > if(input.length() > maxLength) > input = input[0..maxLength - 1] > return input > } > } > } > {code} > and a Java class to run it: > {code:java} > package test64; > import test64.Test64.ShippingAddressSynchType; > public class Test64Main { > public static void main(String[] args) { > Test64 t = new Test64(); > ShippingAddressSynchType.ACCOUNTING.synch(t); > } > } > {code} > If you run this code, you'll get: > {noformat} > Exception in thread "main" java.lang.VerifyError: Bad type on operand stack > Exception Details: > Location: > test64/Test64$ShippingAddressSynchType$1.synch(Ltest64/Test64;)V @1: > invokevirtual > Reason: > Type 'test64/Test64$ShippingAddressSynchType$1' (current frame, stack[0]) > is not assignable to 'groovy/lang/Closure' > Current Frame: > bci: @1 > flags: { } > locals: { 'test64/Test64$ShippingAddressSynchType$1', 'test64/Test64' } > stack: { 'test64/Test64$ShippingAddressSynchType$1' } > Bytecode: > 0x000: 2ab6 0036 c000 0412 3805 b800 3c57 b1 > at test64.Test64$ShippingAddressSynchType.(Test64.groovy) > at test64.Test64Main.main(Test64Main.java:9) > {noformat} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-7686) Can not see local variable from overriden method called from the constructor of an anonymous class instance
[ https://issues.apache.org/jira/browse/GROOVY-7686?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-7686: Fix Version/s: 2.5.16 > Can not see local variable from overriden method called from the constructor > of an anonymous class instance > --- > > Key: GROOVY-7686 > URL: https://issues.apache.org/jira/browse/GROOVY-7686 > Project: Groovy > Issue Type: Bug > Components: Compiler, groovy-runtime >Affects Versions: 2.4.5 > Environment: Linux >Reporter: Roman Saveljev >Assignee: Eric Milles >Priority: Major > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Time Spent: 0.5h > Remaining Estimate: 0h > > Reduced code showing the problem: > https://gist.github.com/RomanSaveljev/71ed29b0df3eb306485c > In the runtime it fails with: > {noformat} > Caught: java.lang.NullPointerException > java.lang.NullPointerException > at bug$1.func(bug.groovy:14) > at A.(bug.groovy:3) > at bug$1.(bug.groovy) > at bug.func(bug.groovy:11) > at bug.run(bug.groovy:22) > {noformat} > It happens, because inside the overriden method it tries to access locally > defined {{t}}. I have translated the same code to Java (see the gist) and it > works as expected. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-8104) Could not call constructor of inner class from anonimous class inside closure
[ https://issues.apache.org/jira/browse/GROOVY-8104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-8104: Fix Version/s: 2.5.16 > Could not call constructor of inner class from anonimous class inside closure > - > > Key: GROOVY-8104 > URL: https://issues.apache.org/jira/browse/GROOVY-8104 > Project: Groovy > Issue Type: Bug >Reporter: ks.zealot >Assignee: Eric Milles >Priority: Minor > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Time Spent: 0.5h > Remaining Estimate: 0h > > When I was trying to call constructor from anonymous class, I catch strange > exception > {code} > Could not find matching constructor for: A$B(A$_foo_closure1) > {code} > Here is a reproduction > {code} > interface I { > void bar(Object o) > } > class A { > void foo(){ > C c = new C() > ['1','2','3'].each { > obj -> > c.baz(obj, new I() { > @Override > void bar(Object o) { > B b = new B( ) > } > }) > } > } > class B { > } > } > class C { > void baz(Object o, I i) { > i.bar(o) > } > } > A a = new A() > a.foo() > {code} > When my inner class have fields, exception is slightly different > {code} > GroovyRuntimeException: Could not find matching constructor for: > A$B(A$_foo_closure1, java.util.LinkedHashMap) > {code} > Enviroment : groovy 2.3.9 -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (GROOVY-10466) Compilation error on Spock expectation
[ https://issues.apache.org/jira/browse/GROOVY-10466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17484805#comment-17484805 ] Lóránt Pintér commented on GROOVY-10466: It similarly fails with 4.0.0-rc-1, rc-2 and 4.0.0 GA as well. > Compilation error on Spock expectation > -- > > Key: GROOVY-10466 > URL: https://issues.apache.org/jira/browse/GROOVY-10466 > Project: Groovy > Issue Type: Bug > Components: Compiler >Affects Versions: 4.0.0-beta-2, 4.0.0-rc-1, 4.0.0-rc-2, 4.0.0 >Reporter: Lóránt Pintér >Priority: Major > > *Reproduction steps* > * Check out [https://github.com/gradle/gradle/tree/lptr/groovy-4-bugs] > * Run {{./gradlew :execution:compileAll}}, it works using 4.0.0-beta-1! > * Change the Groovy version here to `4.0.0-beta-2`: > [https://github.com/gradle/gradle/blob/860e74522dcbf2df635a27f38fef1daa0b093322/build-logic/dependency-modules/src/main/kotlin/gradlebuild/modules/extension/ExternalModulesExtension.kt#L23] > * Run {{./gradlew :execution:compileAll}} > It fails with: > {code:java} > :execution:compileTestGroovy FAILED > Executing Spock 2.0.0-groovy-3.0 with NOT compatible Groovy version > 4.0.0-beta-2 due to set spock.iKnowWhatImDoing.disableGroovyVersionCheck > system property. This is unsupported and may result in weird runtime errors! > > startup failed: > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BroadcastChangingOutputsStepTest.groovy: > 60: Interaction is missing a target @ line 60, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: > 94: Interaction is missing a target @ line 94, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: > 117: Interaction is missing a target @ line 117, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: > 146: Interaction is missing a target @ line 146, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: > 170: Interaction is missing a target @ line 170, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: > 193: Interaction is missing a target @ line 193, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: > 214: Interaction is missing a target @ line 214, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: > 239: Interaction is missing a target @ line 239, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: > 251: Interaction is missing a target @ line 251, column 13. >0 * _ >^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CancelExecutionStepTest.groovy: > 37: Interaction is missing a target @ line 37, column 12. >0 *_ > ^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CancelExecutionStepTest.groovy: > 53: Interaction is missing a target @ line 53, column 12. >0 *_ > ^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CancelExecutionStepTest.groovy: > 70: Interaction is missing a target @ line 70, column 12. >0 *_ > ^ > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CaptureStateAfterExecutionStepTest.groovy: > 66: Interaction is missing a target @ line 66, column 13. >0 * _ >^ >
[jira] [Created] (GROOVY-10466) Compilation error on Spock expectation
Lóránt Pintér created GROOVY-10466: -- Summary: Compilation error on Spock expectation Key: GROOVY-10466 URL: https://issues.apache.org/jira/browse/GROOVY-10466 Project: Groovy Issue Type: Bug Components: Compiler Affects Versions: 4.0.0, 4.0.0-rc-2, 4.0.0-rc-1, 4.0.0-beta-2 Reporter: Lóránt Pintér *Reproduction steps* * Check out [https://github.com/gradle/gradle/tree/lptr/groovy-4-bugs] * Run {{./gradlew :execution:compileAll}}, it works using 4.0.0-beta-1! * Change the Groovy version here to `4.0.0-beta-2`: [https://github.com/gradle/gradle/blob/860e74522dcbf2df635a27f38fef1daa0b093322/build-logic/dependency-modules/src/main/kotlin/gradlebuild/modules/extension/ExternalModulesExtension.kt#L23] * Run {{./gradlew :execution:compileAll}} It fails with: {code:java} :execution:compileTestGroovy FAILED Executing Spock 2.0.0-groovy-3.0 with NOT compatible Groovy version 4.0.0-beta-2 due to set spock.iKnowWhatImDoing.disableGroovyVersionCheck system property. This is unsupported and may result in weird runtime errors! startup failed: /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BroadcastChangingOutputsStepTest.groovy: 60: Interaction is missing a target @ line 60, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: 94: Interaction is missing a target @ line 94, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: 117: Interaction is missing a target @ line 117, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: 146: Interaction is missing a target @ line 146, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: 170: Interaction is missing a target @ line 170, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: 193: Interaction is missing a target @ line 193, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: 214: Interaction is missing a target @ line 214, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: 239: Interaction is missing a target @ line 239, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/BuildCacheStepTest.groovy: 251: Interaction is missing a target @ line 251, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CancelExecutionStepTest.groovy: 37: Interaction is missing a target @ line 37, column 12. 0 *_ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CancelExecutionStepTest.groovy: 53: Interaction is missing a target @ line 53, column 12. 0 *_ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CancelExecutionStepTest.groovy: 70: Interaction is missing a target @ line 70, column 12. 0 *_ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CaptureStateAfterExecutionStepTest.groovy: 66: Interaction is missing a target @ line 66, column 13. 0 * _ ^ /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/execution/src/test/groovy/org/gradle/internal/execution/steps/CaptureStateAfterExecutionStepTest.groovy: 86: Interaction is missing a target @ line 86, column 13. 0 * _ ^
[jira] [Updated] (GROOVY-5728) Accessing private constructor from a static factory
[ https://issues.apache.org/jira/browse/GROOVY-5728?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-5728: Fix Version/s: 2.5.16 > Accessing private constructor from a static factory > --- > > Key: GROOVY-5728 > URL: https://issues.apache.org/jira/browse/GROOVY-5728 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime >Affects Versions: 2.0.4, 2.4.0-beta-3 >Reporter: Paul King >Assignee: Eric Milles >Priority: Minor > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Time Spent: 0.5h > Remaining Estimate: 0h > > The following code works fine from Java but fails in Groovy: > {code} > public abstract class FooMain { > private FooMain() {} > public abstract String bar(); > public static FooMain factory() { > return new FooMain() { > public String bar() { return "xxx"; } > }; > } > public static void main(String[] args) { > System.out.println(factory().bar()); > } > } > // => java.lang.IllegalAccessError: tried to access method FooMain.()V > from class FooMain$1 > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-6747) Problem With Anonymous Inner Enum
[ https://issues.apache.org/jira/browse/GROOVY-6747?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-6747: Fix Version/s: 2.5.16 > Problem With Anonymous Inner Enum > - > > Key: GROOVY-6747 > URL: https://issues.apache.org/jira/browse/GROOVY-6747 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.1.8, 2.4.0-rc-1 >Reporter: Jeff Brown >Assignee: Eric Milles >Priority: Major > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Attachments: enumquestion.zip > > Time Spent: 0.5h > Remaining Estimate: 0h > > Related to http://jira.grails.org/browse/GRAILS-11348. > See the attached enumquestion.zip which demonstrates the behavior without > involving Grails. Run "./gradlew test" to see a relevant test failure. > {code:title=src/main/groovy/com/demo/SampleAppIndicatorCodes.groovy|borderStyle=solid} > package com.demo > public enum SampleAppIndicatorCodes { > YES("Y") { > @Override > public String getCode() { > return booleanCode; > } > }, > NO("N") { > @Override > public String getCode() { > return booleanCode; > } > }; > private String booleanCode = null > private SampleAppIndicatorCodes(String booleanCode) { > this.booleanCode = booleanCode > } > public abstract String getCode(); > public static SampleAppIndicatorCodes getSourceIndicator(String > booleanCode) { > if ("Y".equalsIgnoreCase(booleanCode)) { > return YES > } else if ("L".equalsIgnoreCase(booleanCode)) { > return NO > } else { > throw new IllegalArgumentException("No Indicator for the code > $booleanCode") > } >} > } > {code} > {code:title=src/test/groovy/com/demo/SampleAppIndicatorCodesSpec.groovy|borderStyle=solid} > package com.demo > import spock.lang.Specification > class SampleAppIndicatorCodesSpec extends Specification { > def 'test accessing YES code'() { > expect: > 'Y' == SampleAppIndicatorCodes.YES.code > } > } > {code} > For this particular case the anonymous inner classes seems like a peculiar > way to do this but in general apparently this syntax is supposed to be valid. > I ran this example by Jochen this morning and he felt like this is probably > a bug. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Created] (GROOVY-10467) Compilation fails with method detected as transient
Lóránt Pintér created GROOVY-10467: -- Summary: Compilation fails with method detected as transient Key: GROOVY-10467 URL: https://issues.apache.org/jira/browse/GROOVY-10467 Project: Groovy Issue Type: Bug Components: Compiler Affects Versions: 4.0.0, 4.0.0-rc-2, 4.0.0-rc-1, 4.0.0-beta-2 Reporter: Lóránt Pintér *Reproduction steps* * Check out [https://github.com/gradle/gradle/tree/lptr/groovy-4-bugs] * Run {{./gradlew :ivy:compileAll}}, it works using 4.0.0-beta-1! * Change the Groovy version here to `4.0.0-beta-2`: [https://github.com/gradle/gradle/blob/860e74522dcbf2df635a27f38fef1daa0b093322/build-logic/dependency-modules/src/main/kotlin/gradlebuild/modules/extension/ExternalModulesExtension.kt#L23] * Run {{./gradlew :ivy:compileAll}} It fails with: {code:java} :ivy:compileTestFixturesGroovy FAILED Groovy compilation avoidance is an incubating feature. Executing Spock 2.0.0-groovy-3.0 with NOT compatible Groovy version 4.0.0-beta-2 due to set spock.iKnowWhatImDoing.disableGroovyVersionCheck system property. This is unsupported and may result in weird runtime errors! startup failed: /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/ivy/src/testFixtures/groovy/org/gradle/api/publish/ivy/AbstractIvyPublishIntegTest.groovy: -1: The method 'void expectFiles(java.lang.String[])' has an incorrect modifier transient. @ line -1, column -1. 1 error {code} Build scan: [https://ge.gradle.org/s/phu26h5udswba/console-log?task=:ivy:compileTestFixturesGroovy] -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (GROOVY-10467) Compilation fails with method detected as transient
[ https://issues.apache.org/jira/browse/GROOVY-10467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17484808#comment-17484808 ] Lóránt Pintér commented on GROOVY-10467: Fails similarly with 4.0.0-rc-1, rc-2 and 4.0.0 GA. > Compilation fails with method detected as transient > --- > > Key: GROOVY-10467 > URL: https://issues.apache.org/jira/browse/GROOVY-10467 > Project: Groovy > Issue Type: Bug > Components: Compiler >Affects Versions: 4.0.0-beta-2, 4.0.0-rc-1, 4.0.0-rc-2, 4.0.0 >Reporter: Lóránt Pintér >Priority: Major > > *Reproduction steps* > * Check out [https://github.com/gradle/gradle/tree/lptr/groovy-4-bugs] > * Run {{./gradlew :ivy:compileAll}}, it works using 4.0.0-beta-1! > * Change the Groovy version here to `4.0.0-beta-2`: > [https://github.com/gradle/gradle/blob/860e74522dcbf2df635a27f38fef1daa0b093322/build-logic/dependency-modules/src/main/kotlin/gradlebuild/modules/extension/ExternalModulesExtension.kt#L23] > * Run {{./gradlew :ivy:compileAll}} > It fails with: > {code:java} > :ivy:compileTestFixturesGroovy FAILED > Groovy compilation avoidance is an incubating feature. > Executing Spock 2.0.0-groovy-3.0 with NOT compatible Groovy version > 4.0.0-beta-2 due to set spock.iKnowWhatImDoing.disableGroovyVersionCheck > system property. This is unsupported and may result in weird runtime errors! > > startup failed: > /Users/lptr/Workspace/gradle/gradle-groovy-4/subprojects/ivy/src/testFixtures/groovy/org/gradle/api/publish/ivy/AbstractIvyPublishIntegTest.groovy: > -1: The method 'void expectFiles(java.lang.String[])' has an incorrect > modifier transient. > @ line -1, column -1. > 1 error > {code} > Build scan: > [https://ge.gradle.org/s/phu26h5udswba/console-log?task=:ivy:compileTestFixturesGroovy] -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9455) STC: no error for if (!(x instanceof T)) x.methodFromT()
[ https://issues.apache.org/jira/browse/GROOVY-9455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9455: Fix Version/s: 2.5.16 > STC: no error for if (!(x instanceof T)) x.methodFromT() > > > Key: GROOVY-9455 > URL: https://issues.apache.org/jira/browse/GROOVY-9455 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.4.19, 2.5.10, 3.0.2 >Reporter: Eric Milles >Assignee: Eric Milles >Priority: Minor > Fix For: 4.0.0-alpha-1, 3.0.3, 2.5.16 > > Time Spent: 0.5h > Remaining Estimate: 0h > > Variant of GROOVY-6429, GROOVY-8321, GROOVY-8412, GROOVY-8523 and GROOVY-8645. > Consider the following: > {code:groovy} > @groovy.transform.TypeChecked > void test(x) { > if (!(x instanceof Number)) { > x.byteValue() // accidentally had this and got no compiler error; STC has > Number for typeof(x) > } else { > // ... > } > } > {code} > Since the inferred type of "x" inside then block is Number, the IDE shows > code assist for Number, which is misleading. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9526) Failed to reload classes with generic parameters
[ https://issues.apache.org/jira/browse/GROOVY-9526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9526: Fix Version/s: 2.5.16 > Failed to reload classes with generic parameters > > > Key: GROOVY-9526 > URL: https://issues.apache.org/jira/browse/GROOVY-9526 > Project: Groovy > Issue Type: Bug > Components: GroovyScriptEngine >Reporter: Daniel Sun >Assignee: Daniel Sun >Priority: Major > Fix For: 4.0.0-alpha-1, 3.0.4, 2.5.16 > > Time Spent: 10m > Remaining Estimate: 0h > > See [https://github.com/apache/groovy/pull/1168] -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9336) Shift operator used in field initial value expression causing incorrect type conversion
[ https://issues.apache.org/jira/browse/GROOVY-9336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9336: Fix Version/s: 2.5.16 > Shift operator used in field initial value expression causing incorrect type > conversion > --- > > Key: GROOVY-9336 > URL: https://issues.apache.org/jira/browse/GROOVY-9336 > Project: Groovy > Issue Type: Bug >Reporter: Eric Milles >Assignee: Eric Milles >Priority: Major > Fix For: 3.0.0-rc-3, 2.5.16 > > Time Spent: 0.5h > Remaining Estimate: 0h > > Consider the following: > {code:groovy} > class C { > public static final double D = 2 << 16 - 1 > } > {code} > User has omitted parentheses around "2 << 16" and so this is evaluated as {{2 > << (16 - 1)}}. During inline constant conversion > ({{ExpressionUtils.transformInlineConstants}}), the right side of the shift > operator is converted to a double and this results in: > {code} > java.lang.UnsupportedOperationException: Shift distance must be an integral > type, but 15.0 (java.lang.Double) was supplied > at > org.codehaus.groovy.runtime.typehandling.NumberMath.leftShift(NumberMath.java:99) > at > org.apache.groovy.ast.tools.ExpressionUtils.transformBinaryConstantExpression(ExpressionUtils.java:113) > {code} > I think that the right side of any shift operation should be converted to int > (not double in this case). -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9460) Groovy 3 Compilation Failure with method with argument Class called with Class
[ https://issues.apache.org/jira/browse/GROOVY-9460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9460: Fix Version/s: 2.5.16 > Groovy 3 Compilation Failure with method with argument Class called with > Class > > > Key: GROOVY-9460 > URL: https://issues.apache.org/jira/browse/GROOVY-9460 > Project: Groovy > Issue Type: Bug > Components: Compiler >Affects Versions: 3.0.2 >Reporter: Puneet Behl >Assignee: Eric Milles >Priority: Major > Fix For: 4.0.0-alpha-1, 3.0.6, 2.5.16 > > Attachments: screenshot-1.png > > Time Spent: 20m > Remaining Estimate: 0h > > While upgrading GORM to Groovy 3 we are seeing compilation error as: > {code:java} > > Task :grails-datastore-gorm:compileGroovy > startup failed: > /Users/pbehl/Projects/grails-data-mapping/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy: > 593: [Static type checking] - Cannot call > org.grails.datastore.gorm.finders.DynamicFinder#populateArgumentsForCriteria(java.lang.Class > , org.grails.datastore.mapping.query.Query, java.util.Map java.lang.Object, V extends java.lang.Object>) with arguments > [java.lang.Class , org.grails.datastore.mapping.query.Query, > java.util.Map] > @ line 593, column 13. >DynamicFinder.populateArgumentsForCriteria(persistentClass, q, > params) >^ > /Users/pbehl/Projects/grails-data-mapping/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy: > 758: [Static type checking] - Cannot call > org.grails.datastore.gorm.finders.DynamicFinder#populateArgumentsForCriteria(java.lang.Class > , org.grails.datastore.mapping.query.Query, java.util.Map java.lang.Object, V extends java.lang.Object>) with arguments > [java.lang.Class , org.grails.datastore.mapping.query.Query, > java.util.Map] > @ line 758, column 13. >DynamicFinder.populateArgumentsForCriteria persistentClass, q, > args >^ > /Users/pbehl/Projects/grails-data-mapping/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/GormStaticApi.groovy: > 815: [Static type checking] - Cannot call > org.grails.datastore.gorm.finders.DynamicFinder#populateArgumentsForCriteria(java.lang.Class > , org.grails.datastore.mapping.query.Query, java.util.Map java.lang.Object, V extends java.lang.Object>) with arguments > [java.lang.Class , org.grails.datastore.mapping.query.Query, > java.util.Map] > @ line 815, column 13. >DynamicFinder.populateArgumentsForCriteria persistentClass, q, > args >^ > 3 errors > > Task :grails-datastore-gorm:compileGroovy FAILED > {code} > Please check out and execute "\{{./gradlew cTG}}" in the following: > > [https://github.com/grails/grails-data-mapping/tree/groovyStaticTypeCheckingError] -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9890) Static type checking can't find default method overload on interface
[ https://issues.apache.org/jira/browse/GROOVY-9890?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9890: Fix Version/s: 2.5.16 > Static type checking can't find default method overload on interface > > > Key: GROOVY-9890 > URL: https://issues.apache.org/jira/browse/GROOVY-9890 > Project: Groovy > Issue Type: Bug > Components: Static compilation, Static Type Checker >Affects Versions: 3.0.7 > Environment: jdk 11.0.6 > dependency groovy-all 3.0.7 >Reporter: Robin Friedli >Assignee: Eric Milles >Priority: Critical > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Time Spent: 0.5h > Remaining Estimate: 0h > > The static type checker cannot find default methods on an interface if the > method overloads an abstract method. For example, consider the following Java > classes: > {code:java} > package net.robinfriedli.botify.scripting; > public interface TestInt { > void foo(String s); > default void foo(long l) {} > } > public class TestImpl implements TestInt { > @Override > public void foo(String s) { > } > }{code} > When compiling the script > {code:java} > new net.robinfriedli.botify.scripting.TestImpl().foo(1l){code} > the following exception is thrown: > > {code:java} > MultipleCompilationErrorsException: > startup failed: > Script1.groovy: 1: [Static type checking] - Cannot find matching method > net.robinfriedli.botify.scripting.TestImpl#foo(long). Please check if the > declared type is correct and if the method exists. > @ line 1, column 1. >new net.robinfriedli.botify.scripting.TestImpl().foo(1l) >^ > 1 error > {code} > The script runs fine without static compilation. > > Calling the implemented abstract method compiles sucessfully: > {code:java} > new net.robinfriedli.botify.scripting.TestImpl().foo('str') > {code} > However, when changing the interface to > > {code:java} > package net.robinfriedli.botify.scripting; > public interface TestInt { > void foo(String s); > default void bar(long l) {} > } > {code} > The following script compiles: > > > {code:java} > new net.robinfriedli.botify.scripting.TestImpl().bar(1l) > {code} > > The scripts are executed in Java by GroovyShell#evaluate using the following > compiler configuration: > {code:java} > CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); > ASTTransformationCustomizer compileStaticCustomizer = new > ASTTransformationCustomizer( > singletonMap("extensions", > singletonList("net.robinfriedli.botify.scripting.TypeCheckingExtension")), > CompileStatic.class > ); > compilerConfiguration.addCompilationCustomizers(compileStaticCustomizer); > return compilerConfiguration; > {code} > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9938) VerifyError when instantiating class with @CompileStatic that implements a method with @DelegatesTo annotation.
[ https://issues.apache.org/jira/browse/GROOVY-9938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9938: Fix Version/s: 2.5.16 > VerifyError when instantiating class with @CompileStatic that implements a > method with @DelegatesTo annotation. > --- > > Key: GROOVY-9938 > URL: https://issues.apache.org/jira/browse/GROOVY-9938 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.6, 3.0.7 > Environment: Windows 10, Java 11 >Reporter: Felix ter Beek >Assignee: Eric Milles >Priority: Major > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Attachments: script.groovy > > Time Spent: 0.5h > Remaining Estimate: 0h > > Please see the script in the attachment for a minimal code sample to > reproduce this issue. > This issue occurs both when implementing a trait, or when implementing an > interface and using @Delegate to provide the implementation of the interface. > Writing the implementation directly in the class works fine. > When I take out either @CompileStatic or @DelegatesTo the issue disappears. > > stacktrace (groovy 3.0.7, using a trait (first example in script)): > ERROR java.lang.VerifyError: > Bad type on operand stack > Exception Details: > Location: > P$C.P$Ttrait$super$stuff(Lgroovy/lang/Closure;)V @8: invokevirtual > Reason: > Type 'P$C' (current frame, stack[0]) is not assignable to > 'groovy/lang/Closure' > Current Frame: > bci: @8 > flags: \{ } > locals: \{ 'P$C', 'groovy/lang/Closure' } > stack: \{ 'P$C' } > Bytecode: > 000: 2ac1 003c 9900 232a b600 42c0 000d b900 > 010: 4501 0012 4604 bd00 0459 032b 53b8 004c > 020: c000 4e57 a700 1712 042a 1246 c000 5004 > 030: bd00 0459 032b 53b8 0056 57b1 > Stackmap Table: > same_frame(@39) > same_frame(@59) > at P.run (groovysh_evaluate:13) > at P$run.call (Unknown Source) > > > stacktrace (groovy 3.0.7, using @Delegate (second example in script)): > ERROR java.lang.VerifyError: > Bad type on operand stack > Exception Details: > Location: > P2$C.stuff(Lgroovy/lang/Closure;)V @1: invokevirtual > Reason: > Type 'P2$C' (current frame, stack[0]) is not assignable to > 'groovy/lang/Closure' > Current Frame: > bci: @1 > flags: \{ } > locals: \{ 'P2$C', 'groovy/lang/Closure' } > stack: \{ 'P2$C' } > Bytecode: > 000: 2ab6 002f c000 0b2b b600 3101 57b1 > at P2.run (groovysh_evaluate:19) > at P2$run.call (Unknown Source) -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9935) int reference seems to not use its wrapper class
[ https://issues.apache.org/jira/browse/GROOVY-9935?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9935: Fix Version/s: 2.5.16 > int reference seems to not use its wrapper class > > > Key: GROOVY-9935 > URL: https://issues.apache.org/jira/browse/GROOVY-9935 > Project: Groovy > Issue Type: Bug > Components: Static compilation, Static Type Checker >Affects Versions: 3.0.7 >Reporter: Stefanos Chaliasos >Assignee: Eric Milles >Priority: Major > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Time Spent: 0.5h > Remaining Estimate: 0h > > I have the following Groovy program > > {code:groovy} > @groovy.transform.TypeChecked > class Foo { > static Number foo() { > def i = 10 // If I use: `Integer i = 10` it works > return i > } > } > {code} > h2. Actual Behavior > The program does not compile, and I get the following error. > {code:java} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Test.groovy: 5: [Static type checking] - Cannot return value of type int on > method returning type java.lang.Number > @ line 5, column 12. >return i > ^ > 1 error > {code} > h2. Expected Behavior > Compile successfully. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9903) STC: @DelegatesTo error for incomplete arguments linked to first line of source
[ https://issues.apache.org/jira/browse/GROOVY-9903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9903: Fix Version/s: 2.5.16 > STC: @DelegatesTo error for incomplete arguments linked to first line of > source > --- > > Key: GROOVY-9903 > URL: https://issues.apache.org/jira/browse/GROOVY-9903 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker >Reporter: Eric Milles >Assignee: Eric Milles >Priority: Minor > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Attachments: image-2021-01-20-15-06-14-055.png > > > Consider the following: > {code:groovy} > package bugs > void m(@DelegatesTo() Closure c) { > } > @groovy.transform.TypeChecked > void demo() { > m { > } > } > {code} > Error for incomplete {{@DelegatesTo}} metadata has source position for start > of file. > !image-2021-01-20-15-06-14-055.png! -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-10113) StackOverflowError in STC
[ https://issues.apache.org/jira/browse/GROOVY-10113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-10113: - Labels: StackOverflowError (was: ) > StackOverflowError in STC > - > > Key: GROOVY-10113 > URL: https://issues.apache.org/jira/browse/GROOVY-10113 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker >Affects Versions: 4.0.0-alpha-2, 3.0.8 >Reporter: Stefanos Chaliasos >Assignee: Eric Milles >Priority: Major > Labels: StackOverflowError > Fix For: 4.0.0-beta-1, 3.0.9 > > Time Spent: 0.5h > Remaining Estimate: 0h > > I have the following Groovy program. > {code:groovy} > @groovy.transform.TypeChecked > class Test {} > {code} > h2. Actual Behavior > The compiler crashes with the following stacktrace. > {code:java} > >>> a serious error occurred: null > >>> stacktrace: > java.lang.StackOverflowError > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > at org.codehaus.groovy.ast.ClassNode.redirect(ClassNode.java:195) > {code} > h2. Expected Behavior > Compile-time error. I would expect to report a cyclic inheritance error. > h2. Affected Version > This programs have been tested with the compiler from the master (commit: > c36c8bf3d24ce41e972e3f3e7a5763acf96f46b1), 4.0.0-alpha-2, and 3.0.8. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9711) @Sortable annotation always sorts by the parent properties
[ https://issues.apache.org/jira/browse/GROOVY-9711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9711: Fix Version/s: 2.5.16 > @Sortable annotation always sorts by the parent properties > -- > > Key: GROOVY-9711 > URL: https://issues.apache.org/jira/browse/GROOVY-9711 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime >Affects Versions: 3.0.5 > Environment: Windows 10 version 1809 > AdoptOpenJDK version 8.0.242.08 > Groovy 3.0.5 >Reporter: Ted Lundqvist >Assignee: Paul King >Priority: Major > Fix For: 4.0.0-alpha-1, 3.0.6, 2.5.16 > > Time Spent: 10m > Remaining Estimate: 0h > > Adding includeSuperProperties = false doesn't help either. > If the @Sortable annotation is removed from the super-class the test passes. > Example: > {code:groovy} > import groovy.transform.Sortable > import org.junit.Test > class SortableTest { > @Sortable(includes = ["num"]) > class SortableClass{ > Integer num > } > @Sortable(includeSuperProperties = false, includes = ["str"]) > class SortableChild extends SortableClass { > String str > } > @Test > void test(){ > List unsortedList = [new SortableChild([str: "B", num: 1]), > new SortableChild([str: "A", num: 2])] > List sortedList = unsortedList.toSorted() > assert sortedList[0].str == "A" //Fails here > } > }{code} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9862) General error during instruction selection: ClassCastException
[ https://issues.apache.org/jira/browse/GROOVY-9862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9862: Fix Version/s: 2.5.16 > General error during instruction selection: ClassCastException > -- > > Key: GROOVY-9862 > URL: https://issues.apache.org/jira/browse/GROOVY-9862 > Project: Groovy > Issue Type: Bug > Components: Compiler >Affects Versions: 3.0.5, 3.0.6, 3.0.7 >Reporter: Jason Garrett >Assignee: Daniel Sun >Priority: Major > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > > I am attempting to upgrade a large application from Groovy 2.4.15 to 3. > Compilation fails with a ClassCastException: > {code:java} > General error during instruction selection: class > org.codehaus.groovy.ast.Parameter cannot be cast to class > org.codehaus.groovy.ast.expr.VariableExpression > (org.codehaus.groovy.ast.Parameter and > org.codehaus.groovy.ast.expr.VariableExpression are in unnamed module of > loader org.gradle.internal.classloader.VisitableURLClassLoader > @2bf427fc)General error during instruction selection: class > org.codehaus.groovy.ast.Parameter cannot be cast to class > org.codehaus.groovy.ast.expr.VariableExpression > (org.codehaus.groovy.ast.Parameter and > org.codehaus.groovy.ast.expr.VariableExpression are in unnamed module of > loader org.gradle.internal.classloader.VisitableURLClassLoader @2bf427fc) > java.lang.ClassCastException: class org.codehaus.groovy.ast.Parameter cannot > be cast to class org.codehaus.groovy.ast.expr.VariableExpression > (org.codehaus.groovy.ast.Parameter and > org.codehaus.groovy.ast.expr.VariableExpression are in unnamed module of > loader org.gradle.internal.classloader.VisitableURLClassLoader @2bf427fc) at > org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:598) > at > org.codehaus.groovy.classgen.asm.InvocationWriter.makeSingleArgumentCall(InvocationWriter.java:616) > at > org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpression(BinaryExpressionHelper.java:590) > at > org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:242) > at > org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:230) > at > org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:707) > at > org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:58) > at > org.codehaus.groovy.classgen.asm.CallSiteWriter.visitBoxedArgument(CallSiteWriter.java:261) > at > org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.writeNumberNumberCall(StaticTypesCallSiteWriter.java:782) > at > org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.trySubscript(StaticTypesCallSiteWriter.java:616) > at > org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:601) > at > org.codehaus.groovy.classgen.asm.InvocationWriter.makeSingleArgumentCall(InvocationWriter.java:616) > at > org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpression(BinaryExpressionHelper.java:590) > at > org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:242) > at > org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:214) > at > org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:707) > at > org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:58) > at > org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:236) > at > org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:222) > at > org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:707) > at > org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:58) > at > org.codehaus.groovy.classgen.asm.ExpressionAsVariableSlot.visit(ExpressionAsVariableSlot.java:54) > at > org.codehaus.groovy.classgen.AsmClassGenerator.visitBytecodeExpression(AsmClassGenerator.java:1813) > at > org.codehaus.groovy.classgen.BytecodeExpression.visit(BytecodeExpression.java:48) > at > org.codehaus.groovy.transform.sc.TemporaryVariableExpression.visit(TemporaryVariableExpression.java:61) > at > org.codehaus.groovy.transform.sc.ListOfExpressionsExpression.visit(ListOfExpressionsExpression.java:52) > at >
[jira] [Updated] (GROOVY-9575) ASTNode.hashCode violates Object.hashCode contract: does not return consistent value
[ https://issues.apache.org/jira/browse/GROOVY-9575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9575: Fix Version/s: 2.5.16 > ASTNode.hashCode violates Object.hashCode contract: does not return > consistent value > > > Key: GROOVY-9575 > URL: https://issues.apache.org/jira/browse/GROOVY-9575 > Project: Groovy > Issue Type: Bug >Affects Versions: 3.0.4 >Reporter: Anders Wallgren >Assignee: Daniel Sun >Priority: Major > Fix For: 4.0.0-alpha-1, 3.0.5, 2.5.16 > > Time Spent: 1h > Remaining Estimate: 0h > > While upgrading groovy from 2.4.18 to 3.0.4 in a project we ran into a > problem: ASTNode.hashCode uses mutable properties of the object to calculate > the hash. > Those object properties are not, however, used when equals() is invoked on an > ASTNode instance (as of 3.0.4 ASTNode does not implement equals). > This means ASTNode violates an important part of the Object.hashCode contract > and you cannot safely put ASTNode instances into collections where the > hashcode is relied upon to be consistent. > Quoting the Object.hashCode javadoc: > * Whenever it is invoked on the same object more than once during an > execution of a Java application, the {{hashCode}} method must consistently > return the same integer, provided no information used in {{equals}} > comparisons on the object is modified. This integer need not remain > consistent from one execution of an application to another execution of the > same application. > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9570) Class-Level Closure Definition With Generics Fails TypeChecked
[ https://issues.apache.org/jira/browse/GROOVY-9570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9570: Fix Version/s: 2.5.16 > Class-Level Closure Definition With Generics Fails TypeChecked > -- > > Key: GROOVY-9570 > URL: https://issues.apache.org/jira/browse/GROOVY-9570 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.5, 3.0.0, 3.0.3 >Reporter: Ian >Assignee: Eric Milles >Priority: Major > Fix For: 4.0.0-alpha-1, 3.0.6, 2.5.16 > > Time Spent: 20m > Remaining Estimate: 0h > > > > {code:java} > import groovy.transform.TypeChecked > @TypeChecked > abstract class A{ > Collection testQueue > Closure c = { > testQueue.each{T item-> > println item > } > } > //def foo() { > //testQueue.each{T item-> > //println item > //} > //} > } > new A(){} > {code} > Put this in filename.groovy and call "groovy filename.groovy" and I get > > {noformat} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > /home/ianl/closureGeneric.groovy: 9: Expected parameter of type > java.lang.Object but got T > @ line 7, column 24. >testQueue.each{T item-> > ^ > 1 error{noformat} > Yet, uncomment the method foo() and there's no error there. or put the > closure definition into the method and there's no error. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9855) Compiler does not resolve compile-time constants in string concatenation
[ https://issues.apache.org/jira/browse/GROOVY-9855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9855: Fix Version/s: 2.5.16 > Compiler does not resolve compile-time constants in string concatenation > > > Key: GROOVY-9855 > URL: https://issues.apache.org/jira/browse/GROOVY-9855 > Project: Groovy > Issue Type: Bug > Components: Compiler, Static compilation >Affects Versions: 3.0.7 >Reporter: Christopher Smith >Assignee: Eric Milles >Priority: Minor > Fix For: 3.0.8, 4.0.0-alpha-3, 2.5.16 > > Time Spent: 1h > Remaining Estimate: 0h > > {code:groovy} > @Qualifier(ConfigProps.PREFIX + '.suffix') > @CompileStatic > class ConfigProps { > public static final String PREFIX = 'prefix' > } > {code} > In this case, the value ({{prefix.suffix}}) is a compile-time constant and > should be available as an annotation parameter, but the compiler does not > recognize this. Both plain and static compilation produce errors, though > different errors: > dynamic: > {code} > The value for annotation attribute Qualifier.value must be a constant > expression > {code} > static: > {code} > Attribute 'value' should have type 'java.lang.String'; but found type > 'java.lang.Object' > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9751) STC: error for addAll with collect argument
[ https://issues.apache.org/jira/browse/GROOVY-9751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9751: Fix Version/s: 2.5.16 > STC: error for addAll with collect argument > --- > > Key: GROOVY-9751 > URL: https://issues.apache.org/jira/browse/GROOVY-9751 > Project: Groovy > Issue Type: Bug >Affects Versions: 3.0.5 >Reporter: Eric Milles >Assignee: Eric Milles >Priority: Major > Fix For: 4.0.0-alpha-1, 3.0.6, 2.5.16 > > Time Spent: 1h > Remaining Estimate: 0h > > Follow up from GROOVY-9734 and GROOVY-8961. New STC error for generics > mismatch when pairing {{collect}} with a method pointer: > {code:groovy} > interface Service { > Number transform(String s) > } > @groovy.transform.TypeChecked > void test(Service service) { > Set numbers = [] > List strings = ['x','y','z'] > numbers.addAll(strings.collect(service.)) // Cannot call > java.util.Set #addAll(java.util.Collection java.lang.Number>) with arguments [java.util.List ] > } > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9763) Regression in groovyc 3.0 and 4.0 and Compile static with generic static method in trait
[ https://issues.apache.org/jira/browse/GROOVY-9763?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9763: Fix Version/s: 2.5.16 > Regression in groovyc 3.0 and 4.0 and Compile static with generic static > method in trait > > > Key: GROOVY-9763 > URL: https://issues.apache.org/jira/browse/GROOVY-9763 > Project: Groovy > Issue Type: Bug > Components: Compiler, Static compilation, Static Type Checker >Affects Versions: 4.0.0-alpha-1, 3.0.6 >Reporter: Arthur Sengileyev >Assignee: Eric Milles >Priority: Major > Fix For: 3.0.7, 4.0.0-alpha-2, 2.5.16 > > Time Spent: 50m > Remaining Estimate: 0h > > After upgrading to groovy 3.0 this code fails to compile (can't pass type > checker). > {code:java} > import groovy.transform.CompileStatic > @CompileStatic > trait StaticTrait { > static T wrapClosure(Closure callable) { > callable() > } > } > class ClassWithTrait implements StaticTrait {} > @CompileStatic > class ClassCaller { > void call() { > ClassWithTrait.wrapClosure { > println("fails to compile") > 0 > } > } > } > new ClassCaller().call() > {code} > Error output: > {code:java} > % groovyc test1.groovy > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > test1.groovy: 15: [Static type checking] - Cannot find matching method > ClassWithTrait#wrapClosure(groovy.lang.Closure ). Please > check if the declared type is correct and if the method exists. > @ line 15, column 9. > ClassWithTrait.wrapClosure { > ^ > 1 error {code} > It compiles fine with 2.5.13. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-9726) Compile error needed for illegal field modifier combination
[ https://issues.apache.org/jira/browse/GROOVY-9726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-9726: Fix Version/s: 2.5.16 > Compile error needed for illegal field modifier combination > --- > > Key: GROOVY-9726 > URL: https://issues.apache.org/jira/browse/GROOVY-9726 > Project: Groovy > Issue Type: Improvement >Affects Versions: 3.0.5, 2.5.13 >Reporter: Paul King >Assignee: Paul King >Priority: Major > Fix For: 4.0.0-alpha-1, 3.0.6, 2.5.16 > > > The JLS (recent versions at least) states: > {quote} > It is a compile-time error if a final variable is also declared volatile. > {quote} > Compiling this class: > {code} > public class Foo { > final volatile String foo = "bar"; > } > {code} > in Java gives the following compilation error: > {noformat} > error: illegal combination of modifiers: final and volatile > {noformat} > Groovy currently passes compilation but then gives the following error at > runtime when trying to create an instance of such a class: > {noformat} > java.lang.ClassFormatError: Illegal field modifiers in class Foo: 0x52 > {noformat} > Groovy should also have a compilation error for this case. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-8652) Putting key on generic Map fails when using CompileStatic
[ https://issues.apache.org/jira/browse/GROOVY-8652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-8652: Fix Version/s: 2.5.16 > Putting key on generic Map fails when using CompileStatic > - > > Key: GROOVY-8652 > URL: https://issues.apache.org/jira/browse/GROOVY-8652 > Project: Groovy > Issue Type: Bug > Components: Static compilation >Affects Versions: 3.0.0-alpha-2, 2.4.15, 2.5.0 > Environment: Elementary OS Freya 0.3.2 > java version "1.8.0_121" > Java(TM) SE Runtime Environment (build 1.8.0_121-b13) > Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode) >Reporter: Cleydson José de Figueiredo Júnior >Assignee: Eric Milles >Priority: Minor > Labels: compilestatic > Fix For: 4.0.0-beta-1, 3.0.9, 2.5.16 > > > I'm trying to use Groovy's short hand way to put a new key value to an > encapsulated Map. But the compilation fails with: > > {code:java} > [Static type checking] - Cannot assign value of type java.lang.String to > variable of type ? > {code} > > Scenario to reproduce: > {code:java} > import groovy.transform.CompileStatic > @CompileStatic > class MapHolder { >private Map map = [:] >Map getMap() { > return map >} > } > @CompileStatic > static setMapValue() { >MapHolder mapHolder = new MapHolder() >mapHolder.map.key = 'value' > } > setMapValue() > {code} > Using the *put* method works just fine: > {code:java} > import groovy.transform.CompileStatic > @CompileStatic > class MapHolder { >private Map map = [:] >Map getMap() { > return map >} > } > @CompileStatic > static setMapValue() { >MapHolder mapHolder = new MapHolder() >mapHolder.put('key', 'value') > } > setMapValue() > {code} > -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (GROOVY-8638) CompileStatic fails with Guava Multimap#asMap
[ https://issues.apache.org/jira/browse/GROOVY-8638?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Milles updated GROOVY-8638: Fix Version/s: 2.5.16 > CompileStatic fails with Guava Multimap#asMap > - > > Key: GROOVY-8638 > URL: https://issues.apache.org/jira/browse/GROOVY-8638 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.0, 3.0.5 >Reporter: Dan Ziemba >Assignee: Eric Milles >Priority: Major > Fix For: 4.0.0-beta-1, 3.0.9, 2.5.16 > > > When using CompileStatic and groovy 2.5.0, type checking appears wrong with > [Guava's Multimap.asMap > |https://google.github.io/guava/releases/25.1-jre/api/docs/com/google/common/collect/ListMultimap.html#asMap--] > method. Return type from that method is Map>, but > attempting to assign to a variable of that type results in the error message: > {noformat} > Incompatible generic argument types. Cannot assign java.util.Map to: > java.util.Map > {noformat} > This previously worked fine with Groovy 2.4.15. Adding an explicit cast to > the asMap() call appears to work around the error. > Here is a small script demonstrating the problem: > {code:java} > @Grab('com.google.guava:guava:25.1-jre') > import com.google.common.collect.ArrayListMultimap > import com.google.common.collect.ListMultimap > import groovy.transform.CompileStatic > @CompileStatic > class Test { > void test() { > ListMultimap mmap = ArrayListMultimap.create() > // This extra cast fixes all the errors... > //ListMultimap mmap = ArrayListMultimap.create() as > ListMultimap > Map> map = mmap.asMap() > > Set>> entrySet = map.entrySet() > Iterator>> iter = > entrySet.iterator() > > while (iter.hasNext()) { > Map.Entry> group = iter.next() > Collection values = group.value > } > } > > static void main(String... args) { > Test test = new Test() > test.test() > } > > } > {code} > And the full error output: > {noformat} > 5 compilation errors: > [Static type checking] - Incompatible generic argument types. Cannot assign > java.util.Map to: java.util.Map > > at line: 14, column: 48 > [Static type checking] - Incompatible generic argument types. Cannot assign > java.util.Set to: java.util.Set > at line: 16, column: 64 > [Static type checking] - Incompatible generic argument types. Cannot assign > java.util.Iterator to: java.util.Iterator > at line: 17, column: 65 > [Static type checking] - Incompatible generic argument types. Cannot assign > java.util.Map$Entry to: > java.util.Map$Entry > at line: 20, column: 60 > [Static type checking] - Cannot assign value of type java.lang.Integer to > variable of type java.util.Collection > at line: 21, column: 42 > {noformat} -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Created] (GROOVY-10468) Ability to define system properties for groovyc using CompilerConfiguration
Marcin Zajaczkowski created GROOVY-10468: Summary: Ability to define system properties for groovyc using CompilerConfiguration Key: GROOVY-10468 URL: https://issues.apache.org/jira/browse/GROOVY-10468 Project: Groovy Issue Type: New Feature Components: Compiler Affects Versions: 4.0.0, 3.0.9 Reporter: Marcin Zajaczkowski In some cases, it would be useful to be able to define system properties for groovyc using CompilerConfiguration. The real life example is a limitation of Idea which doesn't allow to provide system properties for groovyc (just for javac) - [https://youtrack.jetbrains.com/issue/IDEA-287642] . As a result, Spock 2.0-groovy-3.0 cannot be easily compiled in Idea if Maven project is imported. There are probably also some other situations where CompilerConfiguration might be more handy than playing with Gradle/Maven/Ant/Netbeans configurations. -- This message was sent by Atlassian Jira (v8.20.1#820001)