[GitHub] groovy pull request #580: Fix a few checkstyle issues
Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/580 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Closed] (GROOVY-8285) Static compilation does not accept subclasses for generic arguments
[ https://issues.apache.org/jira/browse/GROOVY-8285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Harsh Gupta closed GROOVY-8285. --- Resolution: Invalid > Static compilation does not accept subclasses for generic arguments > --- > > Key: GROOVY-8285 > URL: https://issues.apache.org/jira/browse/GROOVY-8285 > Project: Groovy > Issue Type: Bug > Environment: Groovy Version: 2.4.12 JVM: 1.8.0_121 Vendor: Oracle > Corporation OS: Mac OS X >Reporter: Harsh Gupta >Priority: Critical > > This snippet does not compile. > {code:Java}import groovy.transform.CompileStatic > @CompileStatic > class Scratch { > public static void main(String[] args) { > List listA > List listB = new ArrayList<>() > listB.add(new foo()) > listA = listB > } > } > class bar { > public int blah() { return 12; } > } > class foo extends bar { > public int boo() { return 42; } > } > {code} > Compilation errors: > {quote} > repro.groovy: 10: \[Static type checking\] - Incompatible generic argument > types. Cannot assign java.util.ArrayList to: java.util.List > @ line 10, column 21. >listA = listB > {quote} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8285) Static compilation does not accept subclasses for generic arguments
[ https://issues.apache.org/jira/browse/GROOVY-8285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124118#comment-16124118 ] Harsh Gupta commented on GROOVY-8285: - This used to compile on 2.3.10, which led me to think this will work on current version of groovy. I can see why this should not compile in java, so closing issue. > Static compilation does not accept subclasses for generic arguments > --- > > Key: GROOVY-8285 > URL: https://issues.apache.org/jira/browse/GROOVY-8285 > Project: Groovy > Issue Type: Bug > Environment: Groovy Version: 2.4.12 JVM: 1.8.0_121 Vendor: Oracle > Corporation OS: Mac OS X >Reporter: Harsh Gupta >Priority: Critical > > This snippet does not compile. > {code:Java}import groovy.transform.CompileStatic > @CompileStatic > class Scratch { > public static void main(String[] args) { > List listA > List listB = new ArrayList<>() > listB.add(new foo()) > listA = listB > } > } > class bar { > public int blah() { return 12; } > } > class foo extends bar { > public int boo() { return 42; } > } > {code} > Compilation errors: > {quote} > repro.groovy: 10: \[Static type checking\] - Incompatible generic argument > types. Cannot assign java.util.ArrayList to: java.util.List > @ line 10, column 21. >listA = listB > {quote} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8286) Groovy does not respect package-private modifier of Java class
[ https://issues.apache.org/jira/browse/GROOVY-8286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16123756#comment-16123756 ] Jochen Theodorou commented on GROOVY-8286: -- this is standard for the past years yes. I am considering changing this because of JDK9 though > Groovy does not respect package-private modifier of Java class > -- > > Key: GROOVY-8286 > URL: https://issues.apache.org/jira/browse/GROOVY-8286 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.4.8 >Reporter: Angela Vibar Guardian > > Hi. I'm using Java (1.8) with Groovy (2.4.8) via GMavenPlus (although with > the project I'm working on, we actually also programmatically compile Groovy > code and add it to the class loader to mix them up). It seems however, in > Groovy scripts/classes, package-private methods defined in a Java class can > be called. > For example, I have a Java class {{Person}} in package > {{org.example.people}}, defined like so: > {code:java} > package org.example.people; > public class Person { > private String name; > void setName(String name) { > this.name = name; > } > public String getName() { > return this.name; > } > } > {code} > And I have a Groovy class {{Main}} in package {{org.example}}: > {code:java} > package org.example > import groovy.transform.CompileStatic > import org.example.people.Person > class Main { > static void main(String[] args) { > Person person = new Person() > person.setName('Bob') // Shouldn't be call-able since they belong to > different packages. > println person.getName() // Prints 'Bob' to the console. > } > } > {code} > Is this standard? Using {{\@CompileStatic}}, though, throws an > {{IllegalAccessException}}. > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (GROOVY-8286) Groovy does not respect package-private modifier of Java class
Angela Vibar Guardian created GROOVY-8286: - Summary: Groovy does not respect package-private modifier of Java class Key: GROOVY-8286 URL: https://issues.apache.org/jira/browse/GROOVY-8286 Project: Groovy Issue Type: Bug Affects Versions: 2.4.8 Reporter: Angela Vibar Guardian Hi. I'm using Java (1.8) with Groovy (2.4.8) via GMavenPlus (although with the project I'm working on, we actually also programmatically compile Groovy code and add it to the class loader to mix them up). It seems however, in Groovy scripts/classes, package-private methods defined in a Java class can be called. For example, I have a Java class {{Person}} in package {{org.example.people}}, defined like so: {code:java} package org.example.people; public class Person { private String name; void setName(String name) { this.name = name; } public String getName() { return this.name; } } {code} And I have a Groovy class {{Main}} in package {{org.example}}: {code:java} package org.example import groovy.transform.CompileStatic import org.example.people.Person class Main { static void main(String[] args) { Person person = new Person() person.setName('Bob') // Shouldn't be call-able since they belong to different packages. println person.getName() // Prints 'Bob' to the console. } } {code} Is this standard? Using {{\@CompileStatic}}, though, throws an {{IllegalAccessException}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)