You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by jespersm <gi...@git.apache.org> on 2017/01/30 15:09:11 UTC
[GitHub] groovy pull request #485: Parrot for java7
GitHub user jespersm opened a pull request:
https://github.com/apache/groovy/pull/485
Parrot for java7
I'm sorry for vandalising the source - but here's how it could work with Java 7, so we could get it into Groovy 2.5.x
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jespersm/groovy parrot_java7
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/485.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 #485
----
commit 8efb78421c560d3b53f5c7620fcc6152fc7bd466
Author: Jesper Steen M�ller <je...@selskabet.org>
Date: 2017-01-30T12:40:12Z
Make 'parrot' (ANTLR4-based parser) work in Java 7.
----
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] groovy pull request #485: Parrot for java7
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/groovy/pull/485
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] groovy pull request #485: Parrot for java7
Posted by jespersm <gi...@git.apache.org>.
Github user jespersm commented on a diff in the pull request:
https://github.com/apache/groovy/pull/485#discussion_r98621018
--- Diff: subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/TryWithResourcesASTTransformation.java ---
@@ -342,7 +348,7 @@ private ExpressionStatement createAddSuppressedStatement(String primaryExcName,
new MethodCallExpression(
new VariableExpression(primaryExcName),
"addSuppressed",
- new ArgumentListExpression(Collections.singletonList(new VariableExpression(suppressedExcName))));
+ new ArgumentListExpression(Collections.singletonList((Expression) new VariableExpression(suppressedExcName))));
--- End diff --
True! But the type inference on Java 7 needs this, or you'll get a type mismatch, since a List<VariableExpression> is not the same as List<Expression>. On Java 8, the type inference can solve this by itself, by checking the supertypes of the generic argument to singletonList.
I found 5-6 of these kind of required change.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] groovy pull request #485: Parrot for java7
Posted by danielsun1106 <gi...@git.apache.org>.
Github user danielsun1106 commented on a diff in the pull request:
https://github.com/apache/groovy/pull/485#discussion_r98620597
--- Diff: subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/TryWithResourcesASTTransformation.java ---
@@ -342,7 +348,7 @@ private ExpressionStatement createAddSuppressedStatement(String primaryExcName,
new MethodCallExpression(
new VariableExpression(primaryExcName),
"addSuppressed",
- new ArgumentListExpression(Collections.singletonList(new VariableExpression(suppressedExcName))));
+ new ArgumentListExpression(Collections.singletonList((Expression) new VariableExpression(suppressedExcName))));
--- End diff --
Casting the type to "Expression" seems unnecessary ;)
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] groovy pull request #485: Parrot for java7
Posted by danielsun1106 <gi...@git.apache.org>.
Github user danielsun1106 commented on a diff in the pull request:
https://github.com/apache/groovy/pull/485#discussion_r98625173
--- Diff: subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/TryWithResourcesASTTransformation.java ---
@@ -342,7 +348,7 @@ private ExpressionStatement createAddSuppressedStatement(String primaryExcName,
new MethodCallExpression(
new VariableExpression(primaryExcName),
"addSuppressed",
- new ArgumentListExpression(Collections.singletonList(new VariableExpression(suppressedExcName))));
+ new ArgumentListExpression(Collections.singletonList((Expression) new VariableExpression(suppressedExcName))));
--- End diff --
Gotcha.
P.S. I deleted the comment "unnecessary casting type" by accident... it's hard to edit comments on my cell phone.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---