[jira] [Commented] (GROOVY-8471) Contents of META-INF/services/org.codehaus.groovy.source.Extensions conflict with Maven/Jisaw
[ https://issues.apache.org/jira/browse/GROOVY-8471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16364818#comment-16364818 ] ASF GitHub Bot commented on GROOVY-8471: Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/663 > Contents of META-INF/services/org.codehaus.groovy.source.Extensions conflict > with Maven/Jisaw > - > > Key: GROOVY-8471 > URL: https://issues.apache.org/jira/browse/GROOVY-8471 > Project: Groovy > Issue Type: Bug >Affects Versions: 3.0.0-alpha-1, 2.4.13 >Reporter: Ceki Gülcü >Priority: Critical > > From what [I can > gather|http://markmail.org/thread/nekeppbvwrfl7hbb#query:+page:1+mid:qtqqcfrw6us6aupz+state:results], > Jigsaw module resolution analyzes the contents of module-info.class, > MANIFEST.MF and META-INF/services/* files. > As such, it turns out that the contents of > {{src/resources/META-INF/services/org.codehaus.groovy.source.Extensions}} > prevents groovy-*.jar from being loaded as an automatic module, at least > within a Maven build. > [~rfscholte] has pointed out that this is not a Maven specific problem as can > be verified in JShell by invoking: > {code} > java.lang.module.ModuleFinder.of(java.nio.file.Paths.get(artifact)).findAll().stream().findFirst().get().descriptor().name() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8477) @Immutable-related transformations should be more configurable
[ https://issues.apache.org/jira/browse/GROOVY-8477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16364817#comment-16364817 ] ASF GitHub Bot commented on GROOVY-8477: Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/662 > @Immutable-related transformations should be more configurable > -- > > Key: GROOVY-8477 > URL: https://issues.apache.org/jira/browse/GROOVY-8477 > Project: Groovy > Issue Type: Improvement >Reporter: Paul King >Priority: Major > > This would allow other immutability libraries to be leveraged, e.g. Guava's > immutable collections. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] groovy pull request #662: GROOVY-8477: @Immutable-related transformations sh...
Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/662 ---
[GitHub] groovy pull request #663: GROOVY-8471: Contents of META-INF/services/org.cod...
Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/663 ---
[jira] [Commented] (GROOVY-8241) SAM parameter type inference for explicit parameter
[ https://issues.apache.org/jira/browse/GROOVY-8241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16364596#comment-16364596 ] ASF GitHub Bot commented on GROOVY-8241: Github user daniel-huss commented on a diff in the pull request: https://github.com/apache/groovy/pull/643#discussion_r168272512 --- Diff: src/test/groovy/transform/stc/MethodCallsSTCTest.groovy --- @@ -383,6 +406,94 @@ class MethodCallsSTCTest extends StaticTypeCheckingTestCase { ''', 'Reference to method is ambiguous' } +void testShouldFailWithMultiplePossibleMethods2() { +shouldFailWithMessages ''' +static String foo(String s) { +'String' +} +static String foo(Integer s) { +'Integer' +} +static String foo(Boolean s) { +'Boolean' +} +['foo',123,true].each { argument -> +if (argument instanceof String || argument instanceof Boolean || argument instanceof Integer) { +foo(argument) +} +} +''', 'Reference to method is ambiguous' +} + +void testInstanceOfOnExplicitParameter() { +assertScript ''' +1.with { obj -> +if (obj instanceof String) { +obj.toUpperCase() +} +} +''' +} + +void testSAMWithExplicitParameter() { +assertScript ''' +public interface SAM { +boolean run(String var1, Thread th); +} + +static boolean foo(SAM sam) { + sam.run("foo", new Thread()) +} + +static def callSAM() { +foo { str, th -> +str.toUpperCase().equals(th.getName()) +} +} +''' +} + +void testGroovy8241() { +assertScript ''' +import java.util.function.Predicate + +static boolean foo(Predicate p) { +p.test("foo") +} + +static def testPredicate() { +foo { it -> +it.toUpperCase() --- End diff -- Oh, you're right. I forgot Groovy's interpretation of is simply :) > SAM parameter type inference for explicit parameter > --- > > Key: GROOVY-8241 > URL: https://issues.apache.org/jira/browse/GROOVY-8241 > Project: Groovy > Issue Type: Bug > Components: Static compilation, Static Type Checker >Affects Versions: 2.4.10 >Reporter: Daniil Ovchinnikov >Assignee: Daniel Sun >Priority: Major > Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 2.4.14, 3.0.0-alpha-2 > > > {code} > import groovy.transform.CompileStatic > import java.util.function.Predicate > @CompileStatic > static boolean foo(Predicate p) { > p.test("foo") > } > @CompileStatic > static def testPredicate() { > foo { // it -> > it.toUpperCase() > true > } > } > {code} > Uncomment {{it}}, compiler will say: > {noformat} > Cannot find matching method java.lang.Object#toUpperCase() > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] groovy pull request #643: GROOVY-8241 SAM parameter type inference for expli...
Github user daniel-huss commented on a diff in the pull request: https://github.com/apache/groovy/pull/643#discussion_r168272512 --- Diff: src/test/groovy/transform/stc/MethodCallsSTCTest.groovy --- @@ -383,6 +406,94 @@ class MethodCallsSTCTest extends StaticTypeCheckingTestCase { ''', 'Reference to method is ambiguous' } +void testShouldFailWithMultiplePossibleMethods2() { +shouldFailWithMessages ''' +static String foo(String s) { +'String' +} +static String foo(Integer s) { +'Integer' +} +static String foo(Boolean s) { +'Boolean' +} +['foo',123,true].each { argument -> +if (argument instanceof String || argument instanceof Boolean || argument instanceof Integer) { +foo(argument) +} +} +''', 'Reference to method is ambiguous' +} + +void testInstanceOfOnExplicitParameter() { +assertScript ''' +1.with { obj -> +if (obj instanceof String) { +obj.toUpperCase() +} +} +''' +} + +void testSAMWithExplicitParameter() { +assertScript ''' +public interface SAM { +boolean run(String var1, Thread th); +} + +static boolean foo(SAM sam) { + sam.run("foo", new Thread()) +} + +static def callSAM() { +foo { str, th -> +str.toUpperCase().equals(th.getName()) +} +} +''' +} + +void testGroovy8241() { +assertScript ''' +import java.util.function.Predicate + +static boolean foo(Predicate p) { +p.test("foo") +} + +static def testPredicate() { +foo { it -> +it.toUpperCase() --- End diff -- Oh, you're right. I forgot Groovy's interpretation of is simply :) ---
[jira] [Commented] (GROOVY-8338) Calling Stream.of from groovy class in JDK 9 fails
[ https://issues.apache.org/jira/browse/GROOVY-8338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16364207#comment-16364207 ] Slawomir Nowak commented on GROOVY-8338: [~paulk] this kind of blocks the usage of groovy (for example for testing) in any jdk9 based project. Are there any plans to fix this issue? > Calling Stream.of from groovy class in JDK 9 fails > -- > > Key: GROOVY-8338 > URL: https://issues.apache.org/jira/browse/GROOVY-8338 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime >Affects Versions: 2.4.12 >Reporter: Marcus Nylander >Priority: Major > > Trying to call Stream.of from groovy class (groovy version 2.4.12) using JDK > 9 (jdk 9 181) fails. > Example: > {code} > package test > import java.util.stream.Stream > class B { > static void main(String[] args) { > Stream.of("1").forEach({ println(it) }) > } > } > {code} > The code above fails with: > Exception in thread "main" java.lang.IncompatibleClassChangeError: Method > java.util.stream.Stream.of(Ljava/lang/Object;)Ljava/util/stream/Stream; must > be InterfaceMethodref constant > at java_util_stream_Stream$of.call(Unknown Source) > at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) > at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) > at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) > at test.B.main(B.groovy:7) > The same occurs for other interface static methods also: > {code} > public interface D { > static D of(String s) { > return new D() { > }; > } > } > class C { > static void main(String[] args) { > D.of("1") > } > } > {code} > Also fails with: > Exception in thread "main" java.lang.IncompatibleClassChangeError: Method > test.D.of(Ljava/lang/String;)Ltest/D; must be InterfaceMethodref constant > at test.D$of.call(Unknown Source) > at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) > at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) > at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) > at test.C.main(C.groovy:7) > Running with JDK 8 works fine. -- This message was sent by Atlassian JIRA (v7.6.3#76005)