[jira] [Commented] (GROOVY-7888) Type checker infers wrong type on compound assignment (e.g. += for collection) for property
[ https://issues.apache.org/jira/browse/GROOVY-7888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15430205#comment-15430205 ] ASF GitHub Bot commented on GROOVY-7888: GitHub user paulk-asert opened a pull request: https://github.com/apache/groovy/pull/390 GROOVY-7888: Type checker infers wrong type on compound assignment (e… ….g. += for collection) for property You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/groovy groovy7888 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/390.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 #390 commit c6aacaf01a347504422abc5d3567b758aab5ef84 Author: paulk Date: 2016-08-22T06:53:25Z GROOVY-7888: Type checker infers wrong type on compound assignment (e.g. += for collection) for property > Type checker infers wrong type on compound assignment (e.g. += for > collection) for property > --- > > Key: GROOVY-7888 > URL: https://issues.apache.org/jira/browse/GROOVY-7888 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker >Affects Versions: 2.4.7 >Reporter: Stefan Wolf > > Given the Java class > {code} > public class ContainsSet extends GroovyObjectSupport { > private Set files = new HashSet(); > public Set getFiles() { > return files; > } > public void setFiles(Set files) { > this.files = files; > } > } > {code} > the following Groovy code will not type check: > {code} > @TypeChecked > private Set modifyIdeaModel() { > set.files += new File('foo') > } > {code} > The failure is: > {code} > Error: Groovyc: [Static type checking] - Cannot assign value of type > java.io.File to variable of type java.util.Set > {code} > Without the {{@TypeChecked}} the code runs with dynamic Groovy. > Using the following Groovy class type checking the code above works. > {code} > class ContainsSet { > Set files = new HashSet<>() > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] groovy pull request #390: GROOVY-7888: Type checker infers wrong type on com...
GitHub user paulk-asert opened a pull request: https://github.com/apache/groovy/pull/390 GROOVY-7888: Type checker infers wrong type on compound assignment (e⦠â¦.g. += for collection) for property You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/groovy groovy7888 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/390.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 #390 commit c6aacaf01a347504422abc5d3567b758aab5ef84 Author: paulk Date: 2016-08-22T06:53:25Z GROOVY-7888: Type checker infers wrong type on compound assignment (e.g. += for collection) for property --- 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] [Commented] (GROOVY-7888) Type checker infers wrong type on compound assignment (e.g. += for collection) for property
[ https://issues.apache.org/jira/browse/GROOVY-7888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15430199#comment-15430199 ] Paul King commented on GROOVY-7888: --- Updated the summary since it's not related to accessing a Java class > Type checker infers wrong type on compound assignment (e.g. += for > collection) for property > --- > > Key: GROOVY-7888 > URL: https://issues.apache.org/jira/browse/GROOVY-7888 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker >Affects Versions: 2.4.7 >Reporter: Stefan Wolf > > Given the Java class > {code} > public class ContainsSet extends GroovyObjectSupport { > private Set files = new HashSet(); > public Set getFiles() { > return files; > } > public void setFiles(Set files) { > this.files = files; > } > } > {code} > the following Groovy code will not type check: > {code} > @TypeChecked > private Set modifyIdeaModel() { > set.files += new File('foo') > } > {code} > The failure is: > {code} > Error: Groovyc: [Static type checking] - Cannot assign value of type > java.io.File to variable of type java.util.Set > {code} > Without the {{@TypeChecked}} the code runs with dynamic Groovy. > Using the following Groovy class type checking the code above works. > {code} > class ContainsSet { > Set files = new HashSet<>() > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (GROOVY-7888) Type checker infers wrong type on compound assignment (e.g. += for collection) for property
[ https://issues.apache.org/jira/browse/GROOVY-7888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King updated GROOVY-7888: -- Summary: Type checker infers wrong type on compound assignment (e.g. += for collection) for property (was: Type checker infers wrong type collection plus assignment (+=) for property on Java class) > Type checker infers wrong type on compound assignment (e.g. += for > collection) for property > --- > > Key: GROOVY-7888 > URL: https://issues.apache.org/jira/browse/GROOVY-7888 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker >Affects Versions: 2.4.7 >Reporter: Stefan Wolf > > Given the Java class > {code} > public class ContainsSet extends GroovyObjectSupport { > private Set files = new HashSet(); > public Set getFiles() { > return files; > } > public void setFiles(Set files) { > this.files = files; > } > } > {code} > the following Groovy code will not type check: > {code} > @TypeChecked > private Set modifyIdeaModel() { > set.files += new File('foo') > } > {code} > The failure is: > {code} > Error: Groovyc: [Static type checking] - Cannot assign value of type > java.io.File to variable of type java.util.Set > {code} > Without the {{@TypeChecked}} the code runs with dynamic Groovy. > Using the following Groovy class type checking the code above works. > {code} > class ContainsSet { > Set files = new HashSet<>() > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (GROOVY-7913) ClassInfo.globalClassValue lead to GroovyClassLoader can't unload classes
[ https://issues.apache.org/jira/browse/GROOVY-7913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chenxiaojie updated GROOVY-7913: Summary: ClassInfo.globalClassValue lead to GroovyClassLoader can't unload classes (was: ClassInfo.globalClassValue lead to GroovyClassLoader unload classes) > ClassInfo.globalClassValue lead to GroovyClassLoader can't unload classes > -- > > Key: GROOVY-7913 > URL: https://issues.apache.org/jira/browse/GROOVY-7913 > Project: Groovy > Issue Type: Bug > Components: class generator >Affects Versions: 2.4.6 >Reporter: chenxiaojie > Original Estimate: 26m > Remaining Estimate: 26m > > org.codehaus.groovy.reflection.ClassInfo: > private static final GroovyClassValue globalClassValue = > GroovyClassValueFactory.createGroovyClassValue(new ComputeValue(){ > @Override > public ClassInfo computeValue(Class type) { > ClassInfo ret = new ClassInfo(type); > globalClassSet.add(ret); > return ret; > } > }); > dynamic load groovy classes will be cached in globalClassValue > can't unload classes > cause java.lang.OutOfMemoryError: PermGen space -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (GROOVY-7913) ClassInfo.globalClassValue lead to GroovyClassLoader unload classes
chenxiaojie created GROOVY-7913: --- Summary: ClassInfo.globalClassValue lead to GroovyClassLoader unload classes Key: GROOVY-7913 URL: https://issues.apache.org/jira/browse/GROOVY-7913 Project: Groovy Issue Type: Bug Components: class generator Affects Versions: 2.4.6 Reporter: chenxiaojie org.codehaus.groovy.reflection.ClassInfo: private static final GroovyClassValue globalClassValue = GroovyClassValueFactory.createGroovyClassValue(new ComputeValue(){ @Override public ClassInfo computeValue(Class type) { ClassInfo ret = new ClassInfo(type); globalClassSet.add(ret); return ret; } }); dynamic load groovy classes will be cached in globalClassValue can't unload classes cause java.lang.OutOfMemoryError: PermGen space -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] groovy pull request #389: findbugs fixes
GitHub user jwagenleitner opened a pull request: https://github.com/apache/groovy/pull/389 findbugs fixes You can merge this pull request into a Git repository by running: $ git pull https://github.com/jwagenleitner/groovy findbugs Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/389.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 #389 commit a1d6669c2eade9a32bdc4a1dd19ae093b5469c92 Author: John Wagenleitner Date: 2016-08-21T21:46:58Z findbugs: impossible instanceof loop.getBooleanExpression() can't return a ConstantExpression and the if branch never executed. commit 663f6409030ca94a478302703f45bac1f25d2804 Author: John Wagenleitner Date: 2016-08-21T22:25:41Z findbugs: impossible cast removed cast that would always fail and added some basic tests. commit 1f61f67e409783547c49662894404d12bb56f6a7 Author: John Wagenleitner Date: 2016-08-21T23:14:55Z findbugs: un-callable method in anonymous class --- 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] [Comment Edited] (GROOVY-5396) Extending Abstract Java class with a Groovy class, can't see super properties.
[ https://issues.apache.org/jira/browse/GROOVY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429669#comment-15429669 ] Paul King edited comment on GROOVY-5396 at 8/21/16 10:50 AM: - Not gradle related. Creating the java class file by hand leads to the same problem as does creating an equivalent groovy class file using @PackageScope for the field. And even in the same source unit as per below: {code} class GroovyBase extends AbstractBase { GroovyBase(int n) { super(n) } int mult(int n) { n * base } static main(args) { println new GroovyBase(10).mult(3) } } abstract class AbstractBase { @groovy.transform.PackageScope int base AbstractBase(int base) { this.base = base } abstract int mult(int n) } {code} was (Author: paulk): Not gradle related. Creating the java class file by hand leads to the same problem as does creating an equivalent groovy class file using @PackageScope for the field. > Extending Abstract Java class with a Groovy class, can't see super properties. > -- > > Key: GROOVY-5396 > URL: https://issues.apache.org/jira/browse/GROOVY-5396 > Project: Groovy > Issue Type: Bug > Components: Compiler >Affects Versions: 2.0-beta-1, 1.8.6 >Reporter: Tim Yates > Attachments: FailingAbstractSuper.tgz > > > If I have a standard gradle project setup (attached): > {code} > build.gradle > src/ > main/ > java/ > test/ > AbstractBase.java > SamePackageJavaBase.java > groovy/ > test/ > GroovyBase.groovy > GroovyBaseWithSuper.groovy > {code} > I have a single Abstract base class: > {code:title=AbstractBase.java} > package test ; > public abstract class AbstractBase { > int base ; > public AbstractBase( int base ) { > this.base = base ; > } > public abstract int mult( int n ) ; > } > {code} > And a class {{GroovyBase}} that extends this class: > {code:title=GroovyBase.groovy} > package test > public class GroovyBase extends AbstractBase { > public GroovyBase( int n ) { > super( n ) > } > public int mult( int n ) { > n * base > } > static main( args ) { > println new GroovyBase( 10 ).mult( 3 ) > } > } > {code} > When running this (using the Gradle script in the attachment), I get the > exception: > {code} > Exception in thread "main" groovy.lang.MissingPropertyException: No such > property: base for class: test.GroovyBase > Possible solutions: class > {code} > Changing the line > {code} > n * base > {code} > to > {code} > n * super.base > {code} > Or making the {{base}} field public in the {{AbstractBase}} class makes it > work. > It's as if the classes are considered to be in different packages for some > things, but not for others. > Thinking about it, not sure if this is a Gradle bug or a Groovy cross > compiler one. > To run the tests, unpack the attachment, and run: > {code} > # Test the above failing example > gradle -Pmain=test.GroovyBase > # Test the addition of super.base > gradle -Pmain=test.GroovyBaseWithSuper > # Test the Java extension of the Abstract class > gradle -Pmain=test.SamePackageJavaBase > {code} > You can change the groovy version from 1.8.6 by passing (for example) > {{-Pgroovy=groovy=2.0.0-beta-2}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (GROOVY-7888) Type checker infers wrong type collection plus assignment (+=) for property on Java class
[ https://issues.apache.org/jira/browse/GROOVY-7888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429675#comment-15429675 ] Paul King commented on GROOVY-7888: --- A smaller self-contained example illustrating the problem: {code} class ContainsSet { void setFiles(Set files) { } } @groovy.transform.TypeChecked modifyIdeaModel(ContainsSet set) { set.files += new File('foo') } modifyIdeaModel(new ContainsSet()) {code} > Type checker infers wrong type collection plus assignment (+=) for property > on Java class > - > > Key: GROOVY-7888 > URL: https://issues.apache.org/jira/browse/GROOVY-7888 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker >Affects Versions: 2.4.7 >Reporter: Stefan Wolf > > Given the Java class > {code} > public class ContainsSet extends GroovyObjectSupport { > private Set files = new HashSet(); > public Set getFiles() { > return files; > } > public void setFiles(Set files) { > this.files = files; > } > } > {code} > the following Groovy code will not type check: > {code} > @TypeChecked > private Set modifyIdeaModel() { > set.files += new File('foo') > } > {code} > The failure is: > {code} > Error: Groovyc: [Static type checking] - Cannot assign value of type > java.io.File to variable of type java.util.Set > {code} > Without the {{@TypeChecked}} the code runs with dynamic Groovy. > Using the following Groovy class type checking the code above works. > {code} > class ContainsSet { > Set files = new HashSet<>() > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (GROOVY-5396) Extending Abstract Java class with a Groovy class, can't see super properties.
[ https://issues.apache.org/jira/browse/GROOVY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429669#comment-15429669 ] Paul King commented on GROOVY-5396: --- Not gradle related. Creating the java class file by hand leads to the same problem as dies creating an equivalent groovy class file using @PackageScope for the field. > Extending Abstract Java class with a Groovy class, can't see super properties. > -- > > Key: GROOVY-5396 > URL: https://issues.apache.org/jira/browse/GROOVY-5396 > Project: Groovy > Issue Type: Bug > Components: Compiler >Affects Versions: 2.0-beta-1, 1.8.6 >Reporter: Tim Yates > Attachments: FailingAbstractSuper.tgz > > > If I have a standard gradle project setup (attached): > {code} > build.gradle > src/ > main/ > java/ > test/ > AbstractBase.java > SamePackageJavaBase.java > groovy/ > test/ > GroovyBase.groovy > GroovyBaseWithSuper.groovy > {code} > I have a single Abstract base class: > {code:title=AbstractBase.java} > package test ; > public abstract class AbstractBase { > int base ; > public AbstractBase( int base ) { > this.base = base ; > } > public abstract int mult( int n ) ; > } > {code} > And a class {{GroovyBase}} that extends this class: > {code:title=GroovyBase.groovy} > package test > public class GroovyBase extends AbstractBase { > public GroovyBase( int n ) { > super( n ) > } > public int mult( int n ) { > n * base > } > static main( args ) { > println new GroovyBase( 10 ).mult( 3 ) > } > } > {code} > When running this (using the Gradle script in the attachment), I get the > exception: > {code} > Exception in thread "main" groovy.lang.MissingPropertyException: No such > property: base for class: test.GroovyBase > Possible solutions: class > {code} > Changing the line > {code} > n * base > {code} > to > {code} > n * super.base > {code} > Or making the {{base}} field public in the {{AbstractBase}} class makes it > work. > It's as if the classes are considered to be in different packages for some > things, but not for others. > Thinking about it, not sure if this is a Gradle bug or a Groovy cross > compiler one. > To run the tests, unpack the attachment, and run: > {code} > # Test the above failing example > gradle -Pmain=test.GroovyBase > # Test the addition of super.base > gradle -Pmain=test.GroovyBaseWithSuper > # Test the Java extension of the Abstract class > gradle -Pmain=test.SamePackageJavaBase > {code} > You can change the groovy version from 1.8.6 by passing (for example) > {{-Pgroovy=groovy=2.0.0-beta-2}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Comment Edited] (GROOVY-5396) Extending Abstract Java class with a Groovy class, can't see super properties.
[ https://issues.apache.org/jira/browse/GROOVY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429669#comment-15429669 ] Paul King edited comment on GROOVY-5396 at 8/21/16 10:30 AM: - Not gradle related. Creating the java class file by hand leads to the same problem as does creating an equivalent groovy class file using @PackageScope for the field. was (Author: paulk): Not gradle related. Creating the java class file by hand leads to the same problem as dies creating an equivalent groovy class file using @PackageScope for the field. > Extending Abstract Java class with a Groovy class, can't see super properties. > -- > > Key: GROOVY-5396 > URL: https://issues.apache.org/jira/browse/GROOVY-5396 > Project: Groovy > Issue Type: Bug > Components: Compiler >Affects Versions: 2.0-beta-1, 1.8.6 >Reporter: Tim Yates > Attachments: FailingAbstractSuper.tgz > > > If I have a standard gradle project setup (attached): > {code} > build.gradle > src/ > main/ > java/ > test/ > AbstractBase.java > SamePackageJavaBase.java > groovy/ > test/ > GroovyBase.groovy > GroovyBaseWithSuper.groovy > {code} > I have a single Abstract base class: > {code:title=AbstractBase.java} > package test ; > public abstract class AbstractBase { > int base ; > public AbstractBase( int base ) { > this.base = base ; > } > public abstract int mult( int n ) ; > } > {code} > And a class {{GroovyBase}} that extends this class: > {code:title=GroovyBase.groovy} > package test > public class GroovyBase extends AbstractBase { > public GroovyBase( int n ) { > super( n ) > } > public int mult( int n ) { > n * base > } > static main( args ) { > println new GroovyBase( 10 ).mult( 3 ) > } > } > {code} > When running this (using the Gradle script in the attachment), I get the > exception: > {code} > Exception in thread "main" groovy.lang.MissingPropertyException: No such > property: base for class: test.GroovyBase > Possible solutions: class > {code} > Changing the line > {code} > n * base > {code} > to > {code} > n * super.base > {code} > Or making the {{base}} field public in the {{AbstractBase}} class makes it > work. > It's as if the classes are considered to be in different packages for some > things, but not for others. > Thinking about it, not sure if this is a Gradle bug or a Groovy cross > compiler one. > To run the tests, unpack the attachment, and run: > {code} > # Test the above failing example > gradle -Pmain=test.GroovyBase > # Test the addition of super.base > gradle -Pmain=test.GroovyBaseWithSuper > # Test the Java extension of the Abstract class > gradle -Pmain=test.SamePackageJavaBase > {code} > You can change the groovy version from 1.8.6 by passing (for example) > {{-Pgroovy=groovy=2.0.0-beta-2}} -- This message was sent by Atlassian JIRA (v6.3.4#6332)