You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/01/22 01:52:25 UTC
groovy git commit: Minor refactoring
Repository: groovy
Updated Branches:
refs/heads/parrot ad91e0e4a -> 75d920b0a
Minor refactoring
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/75d920b0
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/75d920b0
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/75d920b0
Branch: refs/heads/parrot
Commit: 75d920b0ac37c9398a9211768dcdd87d4293719e
Parents: ad91e0e
Author: sunlan <su...@apache.org>
Authored: Sun Jan 22 09:52:10 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Sun Jan 22 09:52:10 2017 +0800
----------------------------------------------------------------------
.../apache/groovy/parser/antlr4/GroovyLexer.g4 | 2 +-
.../apache/groovy/parser/antlr4/AstBuilder.java | 22 ++++++++++----------
2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/75d920b0/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyLexer.g4
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyLexer.g4 b/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyLexer.g4
index 69e58e8..1f990ad 100644
--- a/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyLexer.g4
+++ b/subprojects/groovy-parser-antlr4/src/main/antlr4/org/apache/groovy/parser/antlr4/GroovyLexer.g4
@@ -120,7 +120,7 @@ options {
@Override
public int hashCode() {
- return text.hashCode() * line + column;
+ return (int) (text.hashCode() * line + column);
}
@Override
http://git-wip-us.apache.org/repos/asf/groovy/blob/75d920b0/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 8ab5578..fa75abf 100644
--- a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -4168,7 +4168,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> implements Groov
int result = 0;
for (ModifierNode modifierNode : modifierNodeList) {
- result |= modifierNode.getOpCode();
+ result |= modifierNode.getOpcode();
}
if (!this.containsVisibilityModifier()) {
@@ -4215,7 +4215,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> implements Groov
public Parameter processParameter(Parameter parameter) {
modifierNodeList.forEach(e -> {
- parameter.setModifiers(parameter.getModifiers() | e.getOpCode());
+ parameter.setModifiers(parameter.getModifiers() | e.getOpcode());
if (e.isAnnotation()) {
parameter.addAnnotation(e.getAnnotationNode());
@@ -4227,7 +4227,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> implements Groov
public MethodNode processMethodNode(MethodNode mn) {
modifierNodeList.forEach(e -> {
- mn.setModifiers(mn.getModifiers() | e.getOpCode());
+ mn.setModifiers(mn.getModifiers() | e.getOpcode());
if (e.isAnnotation()) {
mn.addAnnotation(e.getAnnotationNode());
@@ -4239,7 +4239,7 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> implements Groov
public VariableExpression processVariableExpression(VariableExpression ve) {
modifierNodeList.forEach(e -> {
- ve.setModifiers(ve.getModifiers() | e.getOpCode());
+ ve.setModifiers(ve.getModifiers() | e.getOpcode());
// local variable does not attach annotations
});
@@ -4261,13 +4261,13 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> implements Groov
*/
public static class ModifierNode extends ASTNode {
private Integer type;
- private Integer opCode; // ASM opcode
+ private Integer opcode; // ASM opcode
private String text;
private AnnotationNode annotationNode;
private boolean repeatable;
public static final int ANNOTATION_TYPE = -999;
- public static final Map<Integer, Integer> MODIFIER_OPCODE_MAP = new HashMap<Integer, Integer>() {
+ public static final Map<Integer, Integer> MODIFIER_OPCODE_MAP = Collections.unmodifiableMap(new HashMap<Integer, Integer>() {
{
put(ANNOTATION_TYPE, 0);
put(DEF, 0);
@@ -4286,14 +4286,14 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> implements Groov
put(STRICTFP, Opcodes.ACC_STRICT);
put(DEFAULT, 0); // no flag for specifying a default method in the JVM spec, hence no ACC_DEFAULT flag in ASM
}
- };
+ });
public ModifierNode(Integer type) {
this.type = type;
- this.opCode = MODIFIER_OPCODE_MAP.get(type);
+ this.opcode = MODIFIER_OPCODE_MAP.get(type);
this.repeatable = ANNOTATION_TYPE == type; // Only annotations are repeatable
- if (!asBoolean((Object) this.opCode)) {
+ if (!asBoolean((Object) this.opcode)) {
throw new IllegalArgumentException("Unsupported modifier type: " + type);
}
}
@@ -4349,8 +4349,8 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> implements Groov
return type;
}
- public Integer getOpCode() {
- return opCode;
+ public Integer getOpcode() {
+ return opcode;
}
public boolean isRepeatable() {