[jira] [Commented] (GROOVY-8629) Groovy STC fails on return of nested class using generics
[ https://issues.apache.org/jira/browse/GROOVY-8629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16499802#comment-16499802 ] Daniel Sun commented on GROOVY-8629: Here is a workaround: {code:java} import groovy.transform.CompileStatic /** * A utility class for comparing two maps */ @CompileStatic class MapComparison implements Iterable { Map m1 Map m2 Set unionKeys = null MapComparison(Map map1, Map map2) { this.m1 = map1 this.m2 = map2 } @Override Iterator iterator() { if (unionKeys == null) { unionKeys = m1.keySet() + m2.keySet() } def iterator = unionKeys.iterator() // workaround return new IntegerPairIterator(iterator) } class IntegerPairIterator implements Iterator { private Iterator keyIterator IntegerPairIterator(Iterator keyIterator) { this.keyIterator = keyIterator } @Override boolean hasNext() { return keyIterator.hasNext() } @Override IntegerPair next() { String key = keyIterator.next() IntegerPair comp = new IntegerPair(m1[key], m2[key]) return comp } @Override void remove() { throw new UnsupportedOperationException() } } static class IntegerPair { Integer i1; Integer i2; IntegerPair(Integer int1, Integer int2) { i1 = int1; i2 = int2; } } } def mc = new MapComparison([:],[:]) {code} > Groovy STC fails on return of nested class using generics > - > > Key: GROOVY-8629 > URL: https://issues.apache.org/jira/browse/GROOVY-8629 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.0-rc-3, 2.5.0 > Environment: I can reproduce from the command line with: > groovy mapComparisonTest.groovy > With Groovy 2.5.0 and Java 1.8.0_172 on macOS High Sierra. >Reporter: Sean Gilligan >Priority: Major > Attachments: mapComparisonTest.groovy > > > The error returns on line 22 of the attached file: > return new IntegerPairIterator(unionKeys.iterator()) > Assigning to a temporary variable and returning on a second line OR removing > @StaticCompile will fix the problem. > I thought this was related to GROOVY-8590 because it first occurred in Groovy > 2.5.0-rc-3, but it was not fixed in Groovy 2.5.0. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8590) STC incorrectly infers type of nested method call used in a return stmt
[ https://issues.apache.org/jira/browse/GROOVY-8590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16499790#comment-16499790 ] Sean Gilligan commented on GROOVY-8590: --- I saw a problem on Groovy 2.5.0-rc-3 that I thought was caused by this bug. When it was NOT fixed by Groovy 2.5.0, I created a new issue: GROOVY-8629 > STC incorrectly infers type of nested method call used in a return stmt > --- > > Key: GROOVY-8590 > URL: https://issues.apache.org/jira/browse/GROOVY-8590 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker >Affects Versions: 2.5.0-rc-3 >Reporter: John Wagenleitner >Assignee: John Wagenleitner >Priority: Major > Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.0 > > > {code:groovy} > class Source { > Object getValue() { '32' } > } > @groovy.transform.CompileStatic > int m(Source src) { > return Integer.parseInt((String) src.getValue()) > } > null > {code} > Fails with > {code} > [Static type checking] - Inconvertible types: cannot cast int to > java.lang.String > {code} > Git bisect shows it is related to change for GROOVY-7753 ([commit > 9d7c1bf1b07d43c1efd16c9252b|https://github.com/apache/groovy/commit/9d7c1bf1b07d43c1efd16c9252b209d29d739ced#diff-8f6109b9267c3330807df2c0ce2fab92R3237]). -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (GROOVY-8629) Groovy STC fails on return of nested class using generics
Sean Gilligan created GROOVY-8629: - Summary: Groovy STC fails on return of nested class using generics Key: GROOVY-8629 URL: https://issues.apache.org/jira/browse/GROOVY-8629 Project: Groovy Issue Type: Bug Affects Versions: 2.5.0, 2.5.0-rc-3 Environment: I can reproduce from the command line with: groovy mapComparisonTest.groovy With Groovy 2.5.0 and Java 1.8.0_172 on macOS High Sierra. Reporter: Sean Gilligan Attachments: mapComparisonTest.groovy The error returns on line 22 of the attached file: return new IntegerPairIterator(unionKeys.iterator()) Assigning to a temporary variable and returning on a second line OR removing @StaticCompile will fix the problem. I thought this was related to GROOVY-8590 because it first occurred in Groovy 2.5.0-rc-3, but it was not fixed in Groovy 2.5.0. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8628) Groovydoc fails to parse Java static nested classes with diamond operator
[ https://issues.apache.org/jira/browse/GROOVY-8628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16499616#comment-16499616 ] ASF GitHub Bot commented on GROOVY-8628: Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/748#discussion_r192608515 --- Diff: subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/JavaStaticNestedClassWithDiamond.java --- @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.groovy.tools.groovydoc.testfiles; + +public abstract class JavaStaticNestedClassWithDiamond { + +JavaStaticNestedClassWithDiamond() { +} + +static class Nested extends JavaStaticNestedClassWithDiamond { --- End diff -- Would you mind add some javadoc to this inner class and test whether its javadoc can be extracted properly? > Groovydoc fails to parse Java static nested classes with diamond operator > - > > Key: GROOVY-8628 > URL: https://issues.apache.org/jira/browse/GROOVY-8628 > Project: Groovy > Issue Type: Bug > Components: GroovyDoc >Reporter: Marco-Antonio Avallone >Priority: Major > > Failing source file example: > {code:java} > public class JavaClass { > JavaClass() { } > public static class Nested extends JavaClass { > Nested() { } > } > } > JavaClass expectedObject = new JavaClass.Nested<>(); > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] groovy pull request #748: GROOVY-8628: Groovydoc fails to parse Java static ...
Github user danielsun1106 commented on a diff in the pull request: https://github.com/apache/groovy/pull/748#discussion_r192608515 --- Diff: subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/JavaStaticNestedClassWithDiamond.java --- @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.codehaus.groovy.tools.groovydoc.testfiles; + +public abstract class JavaStaticNestedClassWithDiamond { + +JavaStaticNestedClassWithDiamond() { +} + +static class Nested extends JavaStaticNestedClassWithDiamond { --- End diff -- Would you mind add some javadoc to this inner class and test whether its javadoc can be extracted properly? ---
[jira] [Updated] (GROOVY-8628) Groovydoc fails to parse Java static nested classes with diamond operator
[ https://issues.apache.org/jira/browse/GROOVY-8628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Marco-Antonio Avallone updated GROOVY-8628: --- Description: Failing source file example: {code:java} public class JavaClass { JavaClass() { } public static class Nested extends JavaClass { Nested() { } } } JavaClass expectedObject = new JavaClass.Nested<>(); {code} was: Failing source file example: {code:java} class JavaClass { JavaClass() { } static class Nested extends JavaClass { Nested() { } } } JavaClass expectedObject = new JavaClass.Nested<>(); {code} > Groovydoc fails to parse Java static nested classes with diamond operator > - > > Key: GROOVY-8628 > URL: https://issues.apache.org/jira/browse/GROOVY-8628 > Project: Groovy > Issue Type: Bug > Components: GroovyDoc >Reporter: Marco-Antonio Avallone >Priority: Major > > Failing source file example: > {code:java} > public class JavaClass { > JavaClass() { } > public static class Nested extends JavaClass { > Nested() { } > } > } > JavaClass expectedObject = new JavaClass.Nested<>(); > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8628) Groovydoc fails to parse Java static nested classes with diamond operator
[ https://issues.apache.org/jira/browse/GROOVY-8628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16499557#comment-16499557 ] ASF GitHub Bot commented on GROOVY-8628: GitHub user av-m opened a pull request: https://github.com/apache/groovy/pull/748 GROOVY-8628: Groovydoc fails to parse Java static nested classes with… … diamond operator java.g grammar file: * Added support for Java static nested class with diamond operator, e.g. new Class.Nested<>() * Simplified classOrInterfaceType with typeArgumentsOrDiamond groovydoc test: * Added groovydoc tool test for Java static nested class with diamond operator You can merge this pull request into a Git repository by running: $ git pull https://github.com/av-m/groovy GROOVY-8628 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/748.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #748 commit 02c7d8e0d911ca4fb4a7c51f348183dd5a061fd8 Author: Marco-Antonio Avallone Date: 2018-06-03T20:36:17Z GROOVY-8628: Groovydoc fails to parse Java static nested classes with diamond operator java.g grammar file: * Added support for Java static nested class with diamond operator, e.g. new Class.Nested<>() * Simplified classOrInterfaceType with typeArgumentsOrDiamond groovydoc test: * Added groovydoc tool test for Java static nested class with diamond operator > Groovydoc fails to parse Java static nested classes with diamond operator > - > > Key: GROOVY-8628 > URL: https://issues.apache.org/jira/browse/GROOVY-8628 > Project: Groovy > Issue Type: Bug > Components: GroovyDoc >Reporter: Marco-Antonio Avallone >Priority: Major > > Failing source file example: > {code:java} > class JavaClass { > JavaClass() { } > static class Nested extends JavaClass { > Nested() { } > } > } > JavaClass expectedObject = new JavaClass.Nested<>(); > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] groovy pull request #748: GROOVY-8628: Groovydoc fails to parse Java static ...
GitHub user av-m opened a pull request: https://github.com/apache/groovy/pull/748 GROOVY-8628: Groovydoc fails to parse Java static nested classes with⦠⦠diamond operator java.g grammar file: * Added support for Java static nested class with diamond operator,  e.g. new Class.Nested<>() * Simplified classOrInterfaceType with typeArgumentsOrDiamond groovydoc test: * Added groovydoc tool test for Java static nested class with diamond  operator You can merge this pull request into a Git repository by running: $ git pull https://github.com/av-m/groovy GROOVY-8628 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/748.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #748 commit 02c7d8e0d911ca4fb4a7c51f348183dd5a061fd8 Author: Marco-Antonio Avallone Date: 2018-06-03T20:36:17Z GROOVY-8628: Groovydoc fails to parse Java static nested classes with diamond operator java.g grammar file: * Added support for Java static nested class with diamond operator,  e.g. new Class.Nested<>() * Simplified classOrInterfaceType with typeArgumentsOrDiamond groovydoc test: * Added groovydoc tool test for Java static nested class with diamond  operator ---
[jira] [Created] (GROOVY-8628) Groovydoc fails to parse Java static nested classes with diamond operator
Marco-Antonio Avallone created GROOVY-8628: -- Summary: Groovydoc fails to parse Java static nested classes with diamond operator Key: GROOVY-8628 URL: https://issues.apache.org/jira/browse/GROOVY-8628 Project: Groovy Issue Type: Bug Components: GroovyDoc Reporter: Marco-Antonio Avallone Failing source file example: {code:java} class JavaClass { JavaClass() { } static class Nested extends JavaClass { Nested() { } } } JavaClass expectedObject = new JavaClass.Nested<>(); {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)