[jira] [Closed] (GROOVY-8005) [parrot] NPE when using try-with-resources with a missing semi-colon
[ https://issues.apache.org/jira/browse/GROOVY-8005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel.Sun closed GROOVY-8005. -- Resolution: Fixed > [parrot] NPE when using try-with-resources with a missing semi-colon > > > Key: GROOVY-8005 > URL: https://issues.apache.org/jira/browse/GROOVY-8005 > Project: Groovy > Issue Type: Bug >Reporter: Guillaume Laforge >Assignee: Daniel.Sun > > When testing the try-with-resouces construct in the Groovy console, I did a > mistake, and forgot the semi-colon in between resources: > {code} > def input = new File('./NOTICE') > try ( > FileInputStream fin = new FileInputStream(input) > GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(output)) > ) { > byte[] buffer = new byte[4096] > int nread = 0 > while ((nread = fin.read(buffer)) != -1) { > out.write(buffer, 0, nread) > } > } > {code} > And I got the following NPE: > {code} > java.lang.NullPointerException > at > org.apache.groovy.parser.antlr4.AstBuilder.configureAST(AstBuilder.java:3775) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExpression(AstBuilder.java:1484) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExprAlt(AstBuilder.java:1449) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExprAlt(AstBuilder.java:67) > at > org.apache.groovy.parser.antlr4.GroovyParser$CommandExprAltContext.accept(GroovyParser.java:7491) > at > org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44) > at > org.apache.groovy.parser.antlr4.AstBuilder.visit(AstBuilder.java:3408) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableInitializer(AstBuilder.java:1408) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclarator(AstBuilder.java:1392) > at > org.apache.groovy.parser.antlr4.AstBuilder.lambda$visitVariableDeclarators$17(AstBuilder.java:1365) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclarators(AstBuilder.java:1368) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclaration(AstBuilder.java:1257) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitLocalVariableDeclaration(AstBuilder.java:1210) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResource(AstBuilder.java:447) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResourceList(AstBuilder.java:442) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResources(AstBuilder.java:437) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStatement(AstBuilder.java:417) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStmtAlt(AstBuilder.java:407) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStmtAlt(AstBuilder.java:67) > at > org.apache.groovy.parser.antlr4.GroovyParser$TryCatchStmtAltContext.accept(GroovyParser.java:6039) > at > org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44) > at > org.apache.groovy.parser.antlr4.AstBuilder.visit(AstBuilder.java:3408) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at >
[jira] [Commented] (GROOVY-8005) [parrot] NPE when using try-with-resources with a missing semi-colon
[ https://issues.apache.org/jira/browse/GROOVY-8005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15697484#comment-15697484 ] Daniel.Sun commented on GROOVY-8005: Fixed. > [parrot] NPE when using try-with-resources with a missing semi-colon > > > Key: GROOVY-8005 > URL: https://issues.apache.org/jira/browse/GROOVY-8005 > Project: Groovy > Issue Type: Bug >Reporter: Guillaume Laforge >Assignee: Daniel.Sun > > When testing the try-with-resouces construct in the Groovy console, I did a > mistake, and forgot the semi-colon in between resources: > {code} > def input = new File('./NOTICE') > try ( > FileInputStream fin = new FileInputStream(input) > GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(output)) > ) { > byte[] buffer = new byte[4096] > int nread = 0 > while ((nread = fin.read(buffer)) != -1) { > out.write(buffer, 0, nread) > } > } > {code} > And I got the following NPE: > {code} > java.lang.NullPointerException > at > org.apache.groovy.parser.antlr4.AstBuilder.configureAST(AstBuilder.java:3775) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExpression(AstBuilder.java:1484) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExprAlt(AstBuilder.java:1449) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExprAlt(AstBuilder.java:67) > at > org.apache.groovy.parser.antlr4.GroovyParser$CommandExprAltContext.accept(GroovyParser.java:7491) > at > org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44) > at > org.apache.groovy.parser.antlr4.AstBuilder.visit(AstBuilder.java:3408) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableInitializer(AstBuilder.java:1408) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclarator(AstBuilder.java:1392) > at > org.apache.groovy.parser.antlr4.AstBuilder.lambda$visitVariableDeclarators$17(AstBuilder.java:1365) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclarators(AstBuilder.java:1368) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclaration(AstBuilder.java:1257) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitLocalVariableDeclaration(AstBuilder.java:1210) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResource(AstBuilder.java:447) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResourceList(AstBuilder.java:442) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResources(AstBuilder.java:437) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStatement(AstBuilder.java:417) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStmtAlt(AstBuilder.java:407) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStmtAlt(AstBuilder.java:67) > at > org.apache.groovy.parser.antlr4.GroovyParser$TryCatchStmtAltContext.accept(GroovyParser.java:6039) > at > org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44) > at > org.apache.groovy.parser.antlr4.AstBuilder.visit(AstBuilder.java:3408) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at >
[jira] [Created] (GROOVY-8008) @CompileStatic causes failure to compile Groovy class that calls overloaded Java method
Renato Athaydes created GROOVY-8008: --- Summary: @CompileStatic causes failure to compile Groovy class that calls overloaded Java method Key: GROOVY-8008 URL: https://issues.apache.org/jira/browse/GROOVY-8008 Project: Groovy Issue Type: Bug Affects Versions: 2.4.7, 2.4.5 Environment: Mac OS / Java 8_u112 Reporter: Renato Athaydes This bug is not making sense to me, but I want to report it because it's incredibly frustrating to get an error message that won't even tell me which file the compiler was trying to compile before throwing an Exception. Here's the stacktrace: Error:Groovyc: While compiling osgiaas-cli-groovy_main: java.lang.ArrayIndexOutOfBoundsException: 2 at org.codehaus.groovy.vmplugin.v5.Java5.makeParameters(Java5.java:443) at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:376) at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:265) at org.codehaus.groovy.ast.ClassNode.getAnnotations(ClassNode.java:1431) at org.codehaus.groovy.ast.ClassNode.getAnnotations(ClassNode.java:1430) at org.codehaus.groovy.transform.trait.Traits.isAnnotatedWithTrait(Traits.java:170) at org.codehaus.groovy.transform.trait.Traits.isTrait(Traits.java:149) at org.codehaus.groovy.transform.trait.Traits.collectSelfTypes(Traits.java:309) at org.codehaus.groovy.transform.trait.Traits.collectSelfTypes(Traits.java:291) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.addSelfTypes(StaticTypeCheckingVisitor.java:3102) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.makeOwnerList(StaticTypeCheckingVisitor.java:3083) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2852) at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:297) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2735) at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:297) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2735) at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:297) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2735) at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:297) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitProperty(ClassCodeVisitorSupport.java:144) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitProperty(StaticTypeCheckingVisitor.java:1518) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1074) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53) at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249) at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:122) at org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:63) at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134) at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1055) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62) at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
[jira] [Closed] (GROOVY-8007) [parrot] Getting the groovydoc comment should work in scripts as well
[ https://issues.apache.org/jira/browse/GROOVY-8007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel.Sun closed GROOVY-8007. -- Resolution: Fixed > [parrot] Getting the groovydoc comment should work in scripts as well > - > > Key: GROOVY-8007 > URL: https://issues.apache.org/jira/browse/GROOVY-8007 > Project: Groovy > Issue Type: Bug >Reporter: Guillaume Laforge >Assignee: Daniel.Sun > > In a script I can't get access to the content of the groovydoc / javadoc > comments for methods, although it works if I wrap my script in a class: > {code} > import org.codehaus.groovy.control.* > import static org.apache.groovy.parser.antlr4.AstBuilder.DOC_COMMENT > def code = ''' > /** > * a method > * @author glaforge > */ > void m(int i) {} > } > ''' > def ast = new CompilationUnit().tap { > addSource 'methodM.groovy', code > compile Phases.SEMANTIC_ANALYSIS > }.ast > assert ast.classes[0].methods[0].nodeMetaData[DOC_COMMENT] > {code} > Ideally, it should work as well for scripts as it works for classes. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (GROOVY-8007) [parrot] Getting the groovydoc comment should work in scripts as well
[ https://issues.apache.org/jira/browse/GROOVY-8007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15696199#comment-15696199 ] Daniel.Sun commented on GROOVY-8007: Fixed > [parrot] Getting the groovydoc comment should work in scripts as well > - > > Key: GROOVY-8007 > URL: https://issues.apache.org/jira/browse/GROOVY-8007 > Project: Groovy > Issue Type: Bug >Reporter: Guillaume Laforge >Assignee: Daniel.Sun > > In a script I can't get access to the content of the groovydoc / javadoc > comments for methods, although it works if I wrap my script in a class: > {code} > import org.codehaus.groovy.control.* > import static org.apache.groovy.parser.antlr4.AstBuilder.DOC_COMMENT > def code = ''' > /** > * a method > * @author glaforge > */ > void m(int i) {} > } > ''' > def ast = new CompilationUnit().tap { > addSource 'methodM.groovy', code > compile Phases.SEMANTIC_ANALYSIS > }.ast > assert ast.classes[0].methods[0].nodeMetaData[DOC_COMMENT] > {code} > Ideally, it should work as well for scripts as it works for classes. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Assigned] (GROOVY-8007) [parrot] Getting the groovydoc comment should work in scripts as well
[ https://issues.apache.org/jira/browse/GROOVY-8007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Guillaume Laforge reassigned GROOVY-8007: - Assignee: Daniel.Sun > [parrot] Getting the groovydoc comment should work in scripts as well > - > > Key: GROOVY-8007 > URL: https://issues.apache.org/jira/browse/GROOVY-8007 > Project: Groovy > Issue Type: Bug >Reporter: Guillaume Laforge >Assignee: Daniel.Sun > > In a script I can't get access to the content of the groovydoc / javadoc > comments for methods, although it works if I wrap my script in a class: > {code} > import org.codehaus.groovy.control.* > import static org.apache.groovy.parser.antlr4.AstBuilder.DOC_COMMENT > def code = ''' > /** > * a method > * @author glaforge > */ > void m(int i) {} > } > ''' > def ast = new CompilationUnit().tap { > addSource 'methodM.groovy', code > compile Phases.SEMANTIC_ANALYSIS > }.ast > assert ast.classes[0].methods[0].nodeMetaData[DOC_COMMENT] > {code} > Ideally, it should work as well for scripts as it works for classes. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] groovy pull request #465: null-safe and empty-safe number parsing of xml
GitHub user mortensoby opened a pull request: https://github.com/apache/groovy/pull/465 null-safe and empty-safe number parsing of xml The following results in af NumberFormatException: xml.'**'.find{it.name()` == 'someBigDecimal'}.toBigDecimal() if the element content is empty which means the following construct is necessary: ``` xml.'**'.find{it.name() == 'someEmptyBigDecimal' && it.text()}?.toBigDecimal() ``` This pull request ensures that null is returned if the element is empty for the following methods: ``` toBigInteger() toBigDecimal() toDouble() toBigLong() toBigFloat() ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/mortensoby/groovy master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/465.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 #465 commit 9cafd9d44fbcdb71b574664dadf87be1aa4ec06b Author: Morten Holm SøbyDate: 2016-11-25T14:39:46Z null-safe and empty-safe number parsing of xml --- 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] [Updated] (GROOVY-8006) [parrot] Allow dropping 'def' or type in try with resources
[ https://issues.apache.org/jira/browse/GROOVY-8006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Guillaume Laforge updated GROOVY-8006: -- Assignee: Daniel.Sun > [parrot] Allow dropping 'def' or type in try with resources > --- > > Key: GROOVY-8006 > URL: https://issues.apache.org/jira/browse/GROOVY-8006 > Project: Groovy > Issue Type: Improvement > Environment: Parrot parser >Reporter: Guillaume Laforge >Assignee: Daniel.Sun > > With try with resources, it would be nice to be able the type or def, just > like in the classical for loop: > {code} > import java.util.zip.GZIPOutputStream > def input = new File('./NOTICE') > def output = new File('/tmp/zipped.zip') > try ( > fin = new FileInputStream(input); >out = new GZIPOutputStream(new FileOutputStream(output)) > ) { > byte[] buffer = new byte[4096] > int nread = 0 > while ((nread = fin.read(buffer)) != -1) { > out.write(buffer, 0, nread) > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (GROOVY-8005) [parrot] NPE when using try-with-resources with a missing semi-colon
[ https://issues.apache.org/jira/browse/GROOVY-8005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Guillaume Laforge updated GROOVY-8005: -- Assignee: Daniel.Sun > [parrot] NPE when using try-with-resources with a missing semi-colon > > > Key: GROOVY-8005 > URL: https://issues.apache.org/jira/browse/GROOVY-8005 > Project: Groovy > Issue Type: Bug >Reporter: Guillaume Laforge >Assignee: Daniel.Sun > > When testing the try-with-resouces construct in the Groovy console, I did a > mistake, and forgot the semi-colon in between resources: > {code} > def input = new File('./NOTICE') > try ( > FileInputStream fin = new FileInputStream(input) > GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(output)) > ) { > byte[] buffer = new byte[4096] > int nread = 0 > while ((nread = fin.read(buffer)) != -1) { > out.write(buffer, 0, nread) > } > } > {code} > And I got the following NPE: > {code} > java.lang.NullPointerException > at > org.apache.groovy.parser.antlr4.AstBuilder.configureAST(AstBuilder.java:3775) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExpression(AstBuilder.java:1484) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExprAlt(AstBuilder.java:1449) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExprAlt(AstBuilder.java:67) > at > org.apache.groovy.parser.antlr4.GroovyParser$CommandExprAltContext.accept(GroovyParser.java:7491) > at > org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44) > at > org.apache.groovy.parser.antlr4.AstBuilder.visit(AstBuilder.java:3408) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableInitializer(AstBuilder.java:1408) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclarator(AstBuilder.java:1392) > at > org.apache.groovy.parser.antlr4.AstBuilder.lambda$visitVariableDeclarators$17(AstBuilder.java:1365) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclarators(AstBuilder.java:1368) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclaration(AstBuilder.java:1257) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitLocalVariableDeclaration(AstBuilder.java:1210) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResource(AstBuilder.java:447) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResourceList(AstBuilder.java:442) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResources(AstBuilder.java:437) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStatement(AstBuilder.java:417) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStmtAlt(AstBuilder.java:407) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStmtAlt(AstBuilder.java:67) > at > org.apache.groovy.parser.antlr4.GroovyParser$TryCatchStmtAltContext.accept(GroovyParser.java:6039) > at > org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44) > at > org.apache.groovy.parser.antlr4.AstBuilder.visit(AstBuilder.java:3408) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at >
[jira] [Updated] (GROOVY-8006) [parrot] Allow dropping 'def' or type in try with resources
[ https://issues.apache.org/jira/browse/GROOVY-8006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Guillaume Laforge updated GROOVY-8006: -- Summary: [parrot] Allow dropping 'def' or type in try with resources (was: Allow dropping 'def' or type in try with resources) > [parrot] Allow dropping 'def' or type in try with resources > --- > > Key: GROOVY-8006 > URL: https://issues.apache.org/jira/browse/GROOVY-8006 > Project: Groovy > Issue Type: Improvement > Environment: Parrot parser >Reporter: Guillaume Laforge > > With try with resources, it would be nice to be able the type or def, just > like in the classical for loop: > {code} > import java.util.zip.GZIPOutputStream > def input = new File('./NOTICE') > def output = new File('/tmp/zipped.zip') > try ( > fin = new FileInputStream(input); >out = new GZIPOutputStream(new FileOutputStream(output)) > ) { > byte[] buffer = new byte[4096] > int nread = 0 > while ((nread = fin.read(buffer)) != -1) { > out.write(buffer, 0, nread) > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (GROOVY-8005) [parrot] NPE when using try-with-resources with a missing semi-colon
[ https://issues.apache.org/jira/browse/GROOVY-8005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Guillaume Laforge updated GROOVY-8005: -- Summary: [parrot] NPE when using try-with-resources with a missing semi-colon (was: NPE when using try-with-resources with a missing semi-colon) > [parrot] NPE when using try-with-resources with a missing semi-colon > > > Key: GROOVY-8005 > URL: https://issues.apache.org/jira/browse/GROOVY-8005 > Project: Groovy > Issue Type: Bug >Reporter: Guillaume Laforge > > When testing the try-with-resouces construct in the Groovy console, I did a > mistake, and forgot the semi-colon in between resources: > {code} > def input = new File('./NOTICE') > try ( > FileInputStream fin = new FileInputStream(input) > GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(output)) > ) { > byte[] buffer = new byte[4096] > int nread = 0 > while ((nread = fin.read(buffer)) != -1) { > out.write(buffer, 0, nread) > } > } > {code} > And I got the following NPE: > {code} > java.lang.NullPointerException > at > org.apache.groovy.parser.antlr4.AstBuilder.configureAST(AstBuilder.java:3775) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExpression(AstBuilder.java:1484) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExprAlt(AstBuilder.java:1449) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExprAlt(AstBuilder.java:67) > at > org.apache.groovy.parser.antlr4.GroovyParser$CommandExprAltContext.accept(GroovyParser.java:7491) > at > org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44) > at > org.apache.groovy.parser.antlr4.AstBuilder.visit(AstBuilder.java:3408) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableInitializer(AstBuilder.java:1408) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclarator(AstBuilder.java:1392) > at > org.apache.groovy.parser.antlr4.AstBuilder.lambda$visitVariableDeclarators$17(AstBuilder.java:1365) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclarators(AstBuilder.java:1368) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitVariableDeclaration(AstBuilder.java:1257) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitLocalVariableDeclaration(AstBuilder.java:1210) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResource(AstBuilder.java:447) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResourceList(AstBuilder.java:442) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitResources(AstBuilder.java:437) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStatement(AstBuilder.java:417) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStmtAlt(AstBuilder.java:407) > at > org.apache.groovy.parser.antlr4.AstBuilder.visitTryCatchStmtAlt(AstBuilder.java:67) > at > org.apache.groovy.parser.antlr4.GroovyParser$TryCatchStmtAltContext.accept(GroovyParser.java:6039) > at > org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44) > at > org.apache.groovy.parser.antlr4.AstBuilder.visit(AstBuilder.java:3408) > at > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > at > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at >
[jira] [Commented] (GROOVY-6862) Traits dont allow $ in identifiers where normal classes do
[ https://issues.apache.org/jira/browse/GROOVY-6862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15695715#comment-15695715 ] ASF GitHub Bot commented on GROOVY-6862: Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/464 > Traits dont allow $ in identifiers where normal classes do > -- > > Key: GROOVY-6862 > URL: https://issues.apache.org/jira/browse/GROOVY-6862 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.3.0, 2.4.3 >Reporter: OC > Labels: traits > > looks like traits are stricter than the "normal" groovy when an identifier > happens to contain the dollar sign: > {code} > 252 /tmp> trait Test { > static foo_ok() { println 'trait non-$ OK' } > static foo$oops() { println 'trait $ OK' } > } > class Foo implements Test { > static foo$ok() { println 'class $ OK' } > } > Foo.foo$ok() > Foo.foo_ok() > Foo.foo$oops() > 253 /tmp> groovy q > class $ OK > trait non-$ OK > Caught: groovy.lang.MissingMethodException: No signature of method: static > Foo.foo$oops() is applicable for argument types: () values: [] > Possible solutions: foo$ok(), foo_ok() > ... > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] groovy pull request #464: GROOVY-6862: Traits dont allow $ in identifiers wh...
Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/464 --- 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. ---