Make a first attempt at better naming
diff --git a/javaparser-core/bnd.bnd b/javaparser-core/bnd.bnd
index 3691171..bf50c24 100644
--- a/javaparser-core/bnd.bnd
+++ b/javaparser-core/bnd.bnd
@@ -11,7 +11,8 @@
com.github.javaparser.ast.expr, \
com.github.javaparser.ast.stmt, \
com.github.javaparser.ast.type, \
- com.github.javaparser.ast.visitor
+ com.github.javaparser.ast.visitor, \
+ com.github.javaparser.ast.observing
# Don't use the project's version for the packages
# We prefer not setting a version as we don't follow OSGi version semantics
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/Modifier.java b/javaparser-core/src/main/java/com/github/javaparser/ast/Modifier.java
index 14ecfe8..5af4f36 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/Modifier.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/Modifier.java
@@ -3,29 +3,29 @@
import java.util.EnumSet;
public enum Modifier {
- PUBLIC("public"),
+ PUBLIC("public"),
PROTECTED("protected"),
- PRIVATE("private"),
+ PRIVATE("private"),
ABSTRACT("abstract"),
- STATIC("static"),
- FINAL("final"),
- TRANSIENT("transient"),
+ STATIC("static"),
+ FINAL("final"),
+ TRANSIENT("transient"),
VOLATILE("volatile"),
- SYNCHRONIZED("synchronized"),
- NATIVE("native"),
- STRICTFP("strictfp");
+ SYNCHRONIZED("synchronized"),
+ NATIVE("native"),
+ STRICTFP("strictfp");
- String lib;
+ String asString;
- private Modifier(String lib) {
- this.lib = lib;
+ Modifier(String asString) {
+ this.asString = asString;
}
/**
- * @return the lib
+ * @return the keyword represented by this modifier.
*/
- public String getLib() {
- return lib;
+ public String asString() {
+ return asString;
}
public EnumSet<Modifier> toEnumSet() {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java
index 22da810..8065a41 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java
@@ -49,14 +49,14 @@
NodeWithExtends<ClassOrInterfaceDeclaration>,
NodeWithTypeParameters<ClassOrInterfaceDeclaration> {
- private boolean interface_;
+ private boolean isInterface;
private NodeList<TypeParameter> typeParameters;
// Can contain more than one item if this is an interface
- private NodeList<ClassOrInterfaceType> extendsList;
+ private NodeList<ClassOrInterfaceType> extendedTypes;
- private NodeList<ClassOrInterfaceType> implementsList;
+ private NodeList<ClassOrInterfaceType> implementedTypes;
public ClassOrInterfaceDeclaration() {
this(null,
@@ -87,24 +87,24 @@
final NodeList<AnnotationExpr> annotations, final boolean isInterface,
final SimpleName name,
final NodeList<TypeParameter> typeParameters,
- final NodeList<ClassOrInterfaceType> extendsList,
- final NodeList<ClassOrInterfaceType> implementsList,
+ final NodeList<ClassOrInterfaceType> extendedTypes,
+ final NodeList<ClassOrInterfaceType> implementedTypes,
final NodeList<BodyDeclaration<?>> members) {
- this(null, modifiers, annotations, isInterface, name, typeParameters, extendsList, implementsList, members);
+ this(null, modifiers, annotations, isInterface, name, typeParameters, extendedTypes, implementedTypes, members);
}
public ClassOrInterfaceDeclaration(Range range, final EnumSet<Modifier> modifiers,
final NodeList<AnnotationExpr> annotations, final boolean isInterface,
final SimpleName name,
final NodeList<TypeParameter> typeParameters,
- final NodeList<ClassOrInterfaceType> extendsList,
- final NodeList<ClassOrInterfaceType> implementsList,
+ final NodeList<ClassOrInterfaceType> extendedTypes,
+ final NodeList<ClassOrInterfaceType> implementedTypes,
final NodeList<BodyDeclaration<?>> members) {
super(range, annotations, modifiers, name, members);
setInterface(isInterface);
setTypeParameters(typeParameters);
- setExtends(extendsList);
- setImplements(implementsList);
+ setExtends(extendedTypes);
+ setImplements(implementedTypes);
}
@Override
@@ -119,12 +119,12 @@
@Override
public NodeList<ClassOrInterfaceType> getExtends() {
- return extendsList;
+ return extendedTypes;
}
@Override
public NodeList<ClassOrInterfaceType> getImplements() {
- return implementsList;
+ return implementedTypes;
}
public NodeList<TypeParameter> getTypeParameters() {
@@ -132,28 +132,28 @@
}
public boolean isInterface() {
- return interface_;
+ return isInterface;
}
@Override
public ClassOrInterfaceDeclaration setExtends(final NodeList<ClassOrInterfaceType> extendsList) {
- notifyPropertyChange(ObservableProperty.EXTENDS, this.extendsList, extendsList);
- this.extendsList = assertNotNull(extendsList);
- setAsParentNodeOf(this.extendsList);
+ notifyPropertyChange(ObservableProperty.EXTENDED_TYPES, this.extendedTypes, extendsList);
+ this.extendedTypes = assertNotNull(extendsList);
+ setAsParentNodeOf(this.extendedTypes);
return this;
}
@Override
public ClassOrInterfaceDeclaration setImplements(final NodeList<ClassOrInterfaceType> implementsList) {
- notifyPropertyChange(ObservableProperty.IMPLEMENTS_LIST, this.implementsList, implementsList);
- this.implementsList = assertNotNull(implementsList);
- setAsParentNodeOf(this.implementsList);
+ notifyPropertyChange(ObservableProperty.IMPLEMENTED_TYPES, this.implementedTypes, implementsList);
+ this.implementedTypes = assertNotNull(implementsList);
+ setAsParentNodeOf(this.implementedTypes);
return this;
}
public ClassOrInterfaceDeclaration setInterface(final boolean interface_) {
- notifyPropertyChange(ObservableProperty.INTERFACE, this.interface_, interface_);
- this.interface_ = interface_;
+ notifyPropertyChange(ObservableProperty.IS_INTERFACE, this.isInterface, interface_);
+ this.isInterface = interface_;
return this;
}
@@ -169,8 +169,8 @@
public List<NodeList<?>> getNodeLists() {
List<NodeList<?>> res = new LinkedList<>(super.getNodeLists());
res.add(typeParameters);
- res.add(extendsList);
- res.add(implementsList);
+ res.add(extendedTypes);
+ res.add(implementedTypes);
return res;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java
index 20bfdf9..2a1f577 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java
@@ -63,7 +63,7 @@
private NodeList<Parameter> parameters;
- private NodeList<ReferenceType<?>> throws_;
+ private NodeList<ReferenceType<?>> thrownTypes;
private BlockStmt body;
@@ -91,7 +91,7 @@
public ConstructorDeclaration(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations,
NodeList<TypeParameter> typeParameters,
- SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType<?>> throws_,
+ SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType<?>> thrownTypes,
BlockStmt block) {
this(null,
modifiers,
@@ -99,19 +99,19 @@
typeParameters,
name,
parameters,
- throws_,
+ thrownTypes,
block);
}
public ConstructorDeclaration(Range range, EnumSet<Modifier> modifiers,
NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name,
- NodeList<Parameter> parameters, NodeList<ReferenceType<?>> throws_, BlockStmt block) {
+ NodeList<Parameter> parameters, NodeList<ReferenceType<?>> thrownTypes, BlockStmt block) {
super(range, annotations);
setModifiers(modifiers);
setTypeParameters(typeParameters);
setName(name);
setParameters(parameters);
- setThrows(throws_);
+ setThrownTypes(thrownTypes);
setBody(block);
}
@@ -147,8 +147,8 @@
}
@Override
- public NodeList<ReferenceType<?>> getThrows() {
- return throws_;
+ public NodeList<ReferenceType<?>> getThrownTypes() {
+ return thrownTypes;
}
public NodeList<TypeParameter> getTypeParameters() {
@@ -178,10 +178,10 @@
}
@Override
- public ConstructorDeclaration setThrows(NodeList<ReferenceType<?>> throws_) {
- notifyPropertyChange(ObservableProperty.THROWS, this.throws_, throws_);
- this.throws_ = assertNotNull(throws_);
- setAsParentNodeOf(this.throws_);
+ public ConstructorDeclaration setThrownTypes(NodeList<ReferenceType<?>> thrownTypes) {
+ notifyPropertyChange(ObservableProperty.THROWN_TYPES, this.thrownTypes, thrownTypes);
+ this.thrownTypes = assertNotNull(thrownTypes);
+ setAsParentNodeOf(this.thrownTypes);
return this;
}
@@ -225,7 +225,7 @@
sb.append(")");
if (includingThrows) {
boolean firstThrow = true;
- for (ReferenceType thr : getThrows()) {
+ for (ReferenceType thr : getThrownTypes()) {
if (firstThrow) {
firstThrow = false;
sb.append(" throws ");
@@ -273,7 +273,7 @@
List<NodeList<?>> res = new LinkedList<>(super.getNodeLists());
res.add(typeParameters);
res.add(parameters);
- res.add(throws_);
+ res.add(thrownTypes);
return res;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java
index 63f5e14..aa74b49 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
@@ -42,43 +42,43 @@
/**
* @author Julio Vilmar Gesser
*/
-public final class EnumConstantDeclaration extends BodyDeclaration<EnumConstantDeclaration> implements
+public final class EnumConstantDeclaration extends BodyDeclaration<EnumConstantDeclaration> implements
NodeWithJavaDoc<EnumConstantDeclaration>,
NodeWithSimpleName<EnumConstantDeclaration>,
NodeWithArguments<EnumConstantDeclaration> {
private SimpleName name;
- private NodeList<Expression> args;
+ private NodeList<Expression> arguments;
private NodeList<BodyDeclaration<?>> classBody;
public EnumConstantDeclaration() {
- this(null,
- new NodeList<>(),
+ this(null,
+ new NodeList<>(),
new SimpleName(),
new NodeList<>(),
new NodeList<>());
}
public EnumConstantDeclaration(String name) {
- this(null,
+ this(null,
new NodeList<>(),
new SimpleName(name),
new NodeList<>(),
new NodeList<>());
}
- public EnumConstantDeclaration(NodeList<AnnotationExpr> annotations, SimpleName name, NodeList<Expression> args,
+ public EnumConstantDeclaration(NodeList<AnnotationExpr> annotations, SimpleName name, NodeList<Expression> arguments,
NodeList<BodyDeclaration<?>> classBody) {
- this(null, annotations, name, args, classBody);
+ this(null, annotations, name, arguments, classBody);
}
- public EnumConstantDeclaration(Range range, NodeList<AnnotationExpr> annotations, SimpleName name, NodeList<Expression> args,
+ public EnumConstantDeclaration(Range range, NodeList<AnnotationExpr> annotations, SimpleName name, NodeList<Expression> arguments,
NodeList<BodyDeclaration<?>> classBody) {
super(range, annotations);
setName(name);
- setArgs(args);
+ setArguments(arguments);
setClassBody(classBody);
}
@@ -92,8 +92,8 @@
v.visit(this, arg);
}
- public NodeList<Expression> getArgs() {
- return args;
+ public NodeList<Expression> getArguments() {
+ return arguments;
}
public NodeList<BodyDeclaration<?>> getClassBody() {
@@ -105,17 +105,17 @@
return name;
}
- public EnumConstantDeclaration setArgs(NodeList<Expression> args) {
- notifyPropertyChange(ObservableProperty.ARGS, this.args, args);
- this.args = assertNotNull(args);
- setAsParentNodeOf(this.args);
+ public EnumConstantDeclaration setArguments(NodeList<Expression> arguments) {
+ notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments);
+ this.arguments = assertNotNull(arguments);
+ setAsParentNodeOf(this.arguments);
return this;
}
public EnumConstantDeclaration setClassBody(NodeList<BodyDeclaration<?>> classBody) {
notifyPropertyChange(ObservableProperty.CLASS_BODY, this.classBody, classBody);
this.classBody = assertNotNull(classBody);
- setAsParentNodeOf(this.classBody);
+ setAsParentNodeOf(this.classBody);
return this;
}
@@ -129,7 +129,7 @@
@Override
public JavadocComment getJavaDoc() {
- if(getComment() instanceof JavadocComment){
+ if (getComment() instanceof JavadocComment) {
return (JavadocComment) getComment();
}
return null;
@@ -138,7 +138,7 @@
@Override
public List<NodeList<?>> getNodeLists() {
List<NodeList<?>> res = new LinkedList<>(super.getNodeLists());
- res.add(args);
+ res.add(arguments);
res.add(classBody);
return res;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java
index 5d2a941..cc2d7a9 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java
@@ -44,7 +44,7 @@
public final class EnumDeclaration extends TypeDeclaration<EnumDeclaration> implements
NodeWithImplements<EnumDeclaration> {
- private NodeList<ClassOrInterfaceType> implementsList;
+ private NodeList<ClassOrInterfaceType> implementedTypes;
private NodeList<EnumConstantDeclaration> entries;
@@ -69,22 +69,22 @@
}
public EnumDeclaration(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, SimpleName name,
- NodeList<ClassOrInterfaceType> implementsList, NodeList<EnumConstantDeclaration> entries,
+ NodeList<ClassOrInterfaceType> implementedTypes, NodeList<EnumConstantDeclaration> entries,
NodeList<BodyDeclaration<?>> members) {
this(null,
modifiers,
annotations,
name,
- implementsList,
+ implementedTypes,
entries,
members);
}
public EnumDeclaration(Range range, EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, SimpleName name,
- NodeList<ClassOrInterfaceType> implementsList, NodeList<EnumConstantDeclaration> entries,
+ NodeList<ClassOrInterfaceType> implementedTypes, NodeList<EnumConstantDeclaration> entries,
NodeList<BodyDeclaration<?>> members) {
super(range, annotations, modifiers, name, members);
- setImplements(implementsList);
+ setImplements(implementedTypes);
setEntries(entries);
}
@@ -109,7 +109,7 @@
@Override
public NodeList<ClassOrInterfaceType> getImplements() {
- return implementsList;
+ return implementedTypes;
}
public EnumDeclaration setEntries(NodeList<EnumConstantDeclaration> entries) {
@@ -121,9 +121,9 @@
@Override
public EnumDeclaration setImplements(NodeList<ClassOrInterfaceType> implementsList) {
- notifyPropertyChange(ObservableProperty.IMPLEMENTS_LIST, this.implementsList, implementsList);
- this.implementsList = assertNotNull(implementsList);
- setAsParentNodeOf(this.implementsList);
+ notifyPropertyChange(ObservableProperty.IMPLEMENTED_TYPES, this.implementedTypes, implementsList);
+ this.implementedTypes = assertNotNull(implementsList);
+ setAsParentNodeOf(this.implementedTypes);
return this;
}
@@ -137,7 +137,7 @@
@Override
public List<NodeList<?>> getNodeLists() {
List<NodeList<?>> res = new LinkedList<>(super.getNodeLists());
- res.add(implementsList);
+ res.add(implementedTypes);
res.add(entries);
return res;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java
index de8acfb..07ddb38 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java
@@ -195,7 +195,7 @@
"You can use this only when the field is attached to a class or an enum");
VariableDeclarator variable = getVariable(0);
- String fieldName = variable.getId().getNameAsString();
+ String fieldName = variable.getIdentifier().getNameAsString();
String fieldNameUpper = fieldName.toUpperCase().substring(0, 1) + fieldName.substring(1, fieldName.length());
final MethodDeclaration getter;
if (parentClass != null)
@@ -227,7 +227,7 @@
"You can use this only when the field is attached to a class or an enum");
VariableDeclarator variable = getVariable(0);
- String fieldName = variable.getId().getNameAsString();
+ String fieldName = variable.getIdentifier().getNameAsString();
String fieldNameUpper = fieldName.toUpperCase().substring(0, 1) + fieldName.substring(1, fieldName.length());
final MethodDeclaration setter;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java
index 7c0731a..3766b27 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java
@@ -74,7 +74,7 @@
private NodeList<Parameter> parameters;
- private NodeList<ReferenceType<?>> throws_;
+ private NodeList<ReferenceType<?>> thrownTypes;
private BlockStmt body;
@@ -139,7 +139,7 @@
final boolean isDefault,
final NodeList<Parameter> parameters,
final NodeList<ArrayBracketPair> arrayBracketPairsAfterParameterList,
- final NodeList<ReferenceType<?>> throws_,
+ final NodeList<ReferenceType<?>> thrownTypes,
final BlockStmt body) {
this(null,
modifiers,
@@ -151,7 +151,7 @@
isDefault,
parameters,
arrayBracketPairsAfterParameterList,
- throws_,
+ thrownTypes,
body);
}
@@ -165,7 +165,7 @@
final boolean isDefault,
final NodeList<Parameter> parameters,
final NodeList<ArrayBracketPair> arrayBracketPairsAfterParameterList,
- final NodeList<ReferenceType<?>> throws_,
+ final NodeList<ReferenceType<?>> thrownTypes,
final BlockStmt body) {
super(range, annotations);
setModifiers(modifiers);
@@ -175,7 +175,7 @@
setParameters(parameters);
setArrayBracketPairsAfterElementType(arrayBracketPairsAfterElementType);
setArrayBracketPairsAfterParameterList(arrayBracketPairsAfterParameterList);
- setThrows(throws_);
+ setThrownTypes(thrownTypes);
setBody(body);
setDefault(isDefault);
}
@@ -217,8 +217,8 @@
}
@Override
- public NodeList<ReferenceType<?>> getThrows() {
- return throws_;
+ public NodeList<ReferenceType<?>> getThrownTypes() {
+ return thrownTypes;
}
@Override
@@ -276,10 +276,10 @@
}
@Override
- public MethodDeclaration setThrows(final NodeList<ReferenceType<?>> throws_) {
- notifyPropertyChange(ObservableProperty.THROWS, this.throws_, throws_);
- this.throws_ = assertNotNull(throws_);
- setAsParentNodeOf(this.throws_);
+ public MethodDeclaration setThrownTypes(final NodeList<ReferenceType<?>> thrownTypes) {
+ notifyPropertyChange(ObservableProperty.THROWN_TYPES, this.thrownTypes, thrownTypes);
+ this.thrownTypes = assertNotNull(thrownTypes);
+ setAsParentNodeOf(this.thrownTypes);
return this;
}
@@ -384,7 +384,7 @@
sb.append(")");
if (includingThrows) {
boolean firstThrow = true;
- for (ReferenceType<?> thr : getThrows()) {
+ for (ReferenceType<?> thr : getThrownTypes()) {
if (firstThrow) {
firstThrow = false;
sb.append(" throws ");
@@ -438,7 +438,7 @@
List<NodeList<?>> res = new LinkedList<>(super.getNodeLists());
res.add(typeParameters);
res.add(parameters);
- res.add(throws_);
+ res.add(thrownTypes);
res.add(arrayBracketPairsAfterType);
res.add(arrayBracketPairsAfterParameterList);
return res;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/Parameter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/Parameter.java
index 9bb80bc..c9dd2c2 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/Parameter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/Parameter.java
@@ -52,7 +52,8 @@
NodeWithElementType<Parameter>,
NodeWithAnnotations<Parameter>,
NodeWithSimpleName<Parameter>,
- NodeWithModifiers<Parameter> {
+ NodeWithModifiers<Parameter>,
+ NodeWithVariableDeclaratorId<Parameter> {
private Type<?> elementType;
@@ -62,7 +63,7 @@
private NodeList<AnnotationExpr> annotations;
- private VariableDeclaratorId id;
+ private VariableDeclaratorId identifier;
private NodeList<ArrayBracketPair> arrayBracketPairsAfterType;
@@ -76,14 +77,14 @@
new VariableDeclaratorId());
}
- public Parameter(Type<?> elementType, VariableDeclaratorId id) {
+ public Parameter(Type<?> elementType, VariableDeclaratorId identifier) {
this(null,
EnumSet.noneOf(Modifier.class),
new NodeList<>(),
elementType,
new NodeList<>(),
false,
- id);
+ identifier);
}
/**
@@ -102,14 +103,14 @@
new VariableDeclaratorId(name));
}
- public Parameter(EnumSet<Modifier> modifiers, Type<?> elementType, VariableDeclaratorId id) {
+ public Parameter(EnumSet<Modifier> modifiers, Type<?> elementType, VariableDeclaratorId identifier) {
this(null,
modifiers,
new NodeList<>(),
elementType,
new NodeList<>(),
false,
- id);
+ identifier);
}
public Parameter(final Range range,
@@ -118,11 +119,11 @@
Type<?> elementType,
NodeList<ArrayBracketPair> arrayBracketPairsAfterElementType,
boolean isVarArgs,
- VariableDeclaratorId id) {
+ VariableDeclaratorId identifier) {
super(range);
setModifiers(modifiers);
setAnnotations(annotations);
- setId(id);
+ setIdentifier(identifier);
setElementType(elementType);
setVarArgs(isVarArgs);
setArrayBracketPairsAfterElementType(assertNotNull(arrayBracketPairsAfterElementType));
@@ -142,7 +143,7 @@
public Type<?> getType() {
return wrapInArrayTypes((Type<?>) elementType.clone(),
getArrayBracketPairsAfterElementType(),
- getId().getArrayBracketPairsAfterId());
+ getIdentifier().getArrayBracketPairsAfterId());
}
public boolean isVarArgs() {
@@ -154,7 +155,7 @@
Pair<Type<?>, NodeList<ArrayBracketPair>> unwrapped = ArrayType.unwrapArrayTypes(type);
setElementType(unwrapped.a);
setArrayBracketPairsAfterElementType(unwrapped.b);
- getId().setArrayBracketPairsAfterId(new NodeList<>());
+ getIdentifier().setArrayBracketPairsAfterId(new NodeList<>());
return this;
}
@@ -172,24 +173,25 @@
return annotations;
}
- public VariableDeclaratorId getId() {
- return id;
+ @Override
+ public VariableDeclaratorId getIdentifier() {
+ return identifier;
}
-
+
@Override
public SimpleName getName() {
- return getId().getName();
+ return getIdentifier().getName();
}
@Override
public Parameter setName(SimpleName name) {
assertNotNull(name);
- if (id != null) {
- id.setName(name);
+ if (identifier != null) {
+ identifier.setName(name);
} else {
VariableDeclaratorId newId = new VariableDeclaratorId(name);
- notifyPropertyChange(ObservableProperty.ID, this.id, newId);
- id = newId;
+ notifyPropertyChange(ObservableProperty.ID, this.identifier, newId);
+ identifier = newId;
}
return this;
}
@@ -217,9 +219,11 @@
return this;
}
- public void setId(VariableDeclaratorId id) {
- this.id = id;
- setAsParentNodeOf(this.id);
+ @Override
+ public Parameter setIdentifier(VariableDeclaratorId identifier) {
+ this.identifier = identifier;
+ setAsParentNodeOf(this.identifier);
+ return this;
}
@Override
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java
index affc043..3e5577f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java
@@ -29,6 +29,7 @@
import com.github.javaparser.ast.expr.NameExpr;
import com.github.javaparser.ast.nodeTypes.NodeWithElementType;
import com.github.javaparser.ast.nodeTypes.NodeWithType;
+import com.github.javaparser.ast.nodeTypes.NodeWithVariableDeclaratorId;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.type.ArrayType;
import com.github.javaparser.ast.type.Type;
@@ -45,18 +46,19 @@
* @author Julio Vilmar Gesser
*/
public final class VariableDeclarator extends Node implements
- NodeWithType<VariableDeclarator, Type<?>> {
+ NodeWithType<VariableDeclarator, Type<?>>,
+ NodeWithVariableDeclaratorId<VariableDeclarator> {
- private VariableDeclaratorId id;
+ private VariableDeclaratorId identifier;
- private Expression init;
+ private Expression initializer;
public VariableDeclarator() {
this(null, new VariableDeclaratorId(), null);
}
- public VariableDeclarator(VariableDeclaratorId id) {
- this(null, id, null);
+ public VariableDeclarator(VariableDeclaratorId identifier) {
+ this(null, identifier, null);
}
public VariableDeclarator(String variableName) {
@@ -66,22 +68,22 @@
/**
* Defines the declaration of a variable.
*
- * @param id The identifier for this variable. IE. The variables name.
- * @param init What this variable should be initialized to. An {@link com.github.javaparser.ast.expr.AssignExpr} is
+ * @param identifier The identifier for this variable. IE. The variables name.
+ * @param initializer What this variable should be initialized to. An {@link com.github.javaparser.ast.expr.AssignExpr} is
* unnecessary as the <code>=</code> operator is already added.
*/
- public VariableDeclarator(VariableDeclaratorId id, Expression init) {
- this(null, id, init);
+ public VariableDeclarator(VariableDeclaratorId identifier, Expression initializer) {
+ this(null, identifier, initializer);
}
- public VariableDeclarator(String variableName, Expression init) {
- this(null, new VariableDeclaratorId(variableName), init);
+ public VariableDeclarator(String variableName, Expression initializer) {
+ this(null, new VariableDeclaratorId(variableName), initializer);
}
- public VariableDeclarator(Range range, VariableDeclaratorId id, Expression init) {
+ public VariableDeclarator(Range range, VariableDeclaratorId identifier, Expression initializer) {
super(range);
- setId(id);
- setInit(init);
+ setIdentifier(identifier);
+ setInitializer(initializer);
}
@Override
@@ -94,45 +96,45 @@
v.visit(this, arg);
}
- public VariableDeclaratorId getId() {
- return id;
+ public VariableDeclaratorId getIdentifier() {
+ return identifier;
}
- public Optional<Expression> getInit() {
- return Optional.ofNullable(init);
+ public Optional<Expression> getInitializer() {
+ return Optional.ofNullable(initializer);
}
- public VariableDeclarator setId(VariableDeclaratorId id) {
- notifyPropertyChange(ObservableProperty.ID, this.id, id);
- this.id = assertNotNull(id);
- setAsParentNodeOf(this.id);
+ public VariableDeclarator setIdentifier(VariableDeclaratorId identifier) {
+ notifyPropertyChange(ObservableProperty.ID, this.identifier, identifier);
+ this.identifier = assertNotNull(identifier);
+ setAsParentNodeOf(this.identifier);
return this;
}
/**
- * Sets the init expression
+ * Sets the initializer expression
*
- * @param init the init expression, can be null
+ * @param initializer the initializer expression, can be null
* @return this, the VariableDeclarator
*/
- public VariableDeclarator setInit(Expression init) {
- notifyPropertyChange(ObservableProperty.INIT, this.init, init);
- this.init = init;
- setAsParentNodeOf(this.init);
+ public VariableDeclarator setInitializer(Expression initializer) {
+ notifyPropertyChange(ObservableProperty.INIT, this.initializer, initializer);
+ this.initializer = initializer;
+ setAsParentNodeOf(this.initializer);
return this;
}
/**
- * Will create a {@link NameExpr} with the init param
+ * Will create a {@link NameExpr} with the initializer param
*
- * @param init the init expression, can be null
+ * @param init the initializer expression, can be null
* @return this, the VariableDeclarator
*/
public VariableDeclarator setInit(String init) {
NameExpr newInit = new NameExpr(assertNotNull(init));
- notifyPropertyChange(ObservableProperty.INIT, this.init, newInit);
- this.init = newInit;
- setAsParentNodeOf(this.init);
+ notifyPropertyChange(ObservableProperty.INIT, this.initializer, newInit);
+ this.initializer = newInit;
+ setAsParentNodeOf(this.initializer);
return this;
}
@@ -143,7 +145,7 @@
return wrapInArrayTypes((Type<?>) elementType.getElementType().clone(),
elementType.getArrayBracketPairsAfterElementType(),
- getId().getArrayBracketPairsAfterId());
+ getIdentifier().getArrayBracketPairsAfterId());
}
@Override
@@ -155,7 +157,7 @@
}
nodeWithElementType.setElementType(unwrapped.a);
nodeWithElementType.setArrayBracketPairsAfterElementType(new NodeList<>());
- getId().setArrayBracketPairsAfterId(unwrapped.b);
+ getIdentifier().setArrayBracketPairsAfterId(unwrapped.b);
return this;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java
index a8d8030..70c9ca9 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java
@@ -18,10 +18,11 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
+import com.github.javaparser.ast.nodeTypes.NodeWithExpression;
import com.github.javaparser.ast.nodeTypes.NodeWithType;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
@@ -34,7 +35,9 @@
/**
* @author Julio Vilmar Gesser
*/
-public final class CastExpr extends Expression implements NodeWithType<CastExpr, Type<?>> {
+public final class CastExpr extends Expression implements
+ NodeWithType<CastExpr, Type<?>>,
+ NodeWithExpression<CastExpr> {
private Type<?> type;
@@ -51,7 +54,7 @@
public CastExpr(Range range, Type<?> type, Expression expr) {
super(range);
setType(type);
- setExpr(expr);
+ setExpression(expr);
}
@Override
@@ -64,7 +67,8 @@
v.visit(this, arg);
}
- public Expression getExpr() {
+ @Override
+ public Expression getExpression() {
return expr;
}
@@ -73,10 +77,11 @@
return type;
}
- public CastExpr setExpr(Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPR, this.expr, expr);
+ @Override
+ public CastExpr setExpression(Expression expr) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expr, expr);
this.expr = assertNotNull(expr);
- setAsParentNodeOf(this.expr);
+ setAsParentNodeOf(this.expr);
return this;
}
@@ -84,7 +89,7 @@
public CastExpr setType(Type<?> type) {
notifyPropertyChange(ObservableProperty.TYPE, this.type, type);
this.type = assertNotNull(type);
- setAsParentNodeOf(this.type);
+ setAsParentNodeOf(this.type);
return this;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java
index 7f35e1e..ddb2ea3 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java
@@ -18,10 +18,11 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
+import com.github.javaparser.ast.nodeTypes.NodeWithExpression;
import com.github.javaparser.ast.nodeTypes.NodeWithType;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
@@ -34,55 +35,61 @@
/**
* @author Julio Vilmar Gesser
*/
-public final class InstanceOfExpr extends Expression implements NodeWithType<InstanceOfExpr, ReferenceType<?>> {
+public final class InstanceOfExpr extends Expression implements
+ NodeWithType<InstanceOfExpr, ReferenceType<?>>,
+ NodeWithExpression<InstanceOfExpr> {
- private Expression expr;
+ private Expression expression;
- private ReferenceType<?> type;
+ private ReferenceType<?> type;
- public InstanceOfExpr() {
+ public InstanceOfExpr() {
this(null, new NameExpr(), new ClassOrInterfaceType());
- }
+ }
- public InstanceOfExpr(final Expression expr, final ReferenceType<?> type) {
- this(null, expr, type);
- }
+ public InstanceOfExpr(final Expression expression, final ReferenceType<?> type) {
+ this(null, expression, type);
+ }
- public InstanceOfExpr(final Range range, final Expression expr, final ReferenceType<?> type) {
- super(range);
- setExpr(expr);
- setType(type);
- }
+ public InstanceOfExpr(final Range range, final Expression expression, final ReferenceType<?> type) {
+ super(range);
+ setExpression(expression);
+ setType(type);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- public Expression getExpr() {
- return expr;
- }
+ @Override
+ public Expression getExpression() {
+ return expression;
+ }
- @Override
- public ReferenceType<?> getType() {
- return type;
- }
+ @Override
+ public ReferenceType<?> getType() {
+ return type;
+ }
- public InstanceOfExpr setExpr(final Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPR, this.expr, expr);
- this.expr = assertNotNull(expr);
- setAsParentNodeOf(this.expr);
- return this;
- }
-
- @Override
- public InstanceOfExpr setType(final ReferenceType<?> type) {
- notifyPropertyChange(ObservableProperty.TYPE, this.type, type);
- this.type = assertNotNull(type);
- setAsParentNodeOf(this.type);
+ @Override
+ public InstanceOfExpr setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = assertNotNull(expression);
+ setAsParentNodeOf(this.expression);
return this;
- }
+ }
+
+ @Override
+ public InstanceOfExpr setType(final ReferenceType<?> type) {
+ notifyPropertyChange(ObservableProperty.TYPE, this.type, type);
+ this.type = assertNotNull(type);
+ setAsParentNodeOf(this.type);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java
index 473c06c..faffe1e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java
@@ -49,7 +49,7 @@
private SimpleName name;
- private NodeList<Expression> args;
+ private NodeList<Expression> arguments;
public MethodCallExpr() {
this(null,
@@ -67,20 +67,20 @@
new NodeList<>());
}
- public MethodCallExpr(final Expression scope, final SimpleName name, final NodeList<Expression> args) {
+ public MethodCallExpr(final Expression scope, final SimpleName name, final NodeList<Expression> arguments) {
this(null,
scope,
new NodeList<>(),
name,
- args);
+ arguments);
}
- public MethodCallExpr(final Range range, final Expression scope, final NodeList<Type<?>> typeArguments, final SimpleName name, final NodeList<Expression> args) {
+ public MethodCallExpr(final Range range, final Expression scope, final NodeList<Type<?>> typeArguments, final SimpleName name, final NodeList<Expression> arguments) {
super(range);
setScope(scope);
setTypeArguments(typeArguments);
setName(name);
- setArgs(args);
+ setArguments(arguments);
}
@Override
@@ -93,9 +93,8 @@
v.visit(this, arg);
}
- @Override
- public NodeList<Expression> getArgs() {
- return args;
+ public NodeList<Expression> getArguments() {
+ return arguments;
}
@Override
@@ -107,11 +106,10 @@
return scope;
}
- @Override
- public MethodCallExpr setArgs(final NodeList<Expression> args) {
- notifyPropertyChange(ObservableProperty.ARGS, this.args, args);
- this.args = assertNotNull(args);
- setAsParentNodeOf(this.args);
+ public MethodCallExpr setArguments(final NodeList<Expression> arguments) {
+ notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments);
+ this.arguments = assertNotNull(arguments);
+ setAsParentNodeOf(this.arguments);
return this;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java
index 3cd458b..ec5fddf 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java
@@ -57,7 +57,7 @@
private NodeList<Type<?>> typeArguments;
- private NodeList<Expression> args;
+ private NodeList<Expression> arguments;
private NodeList<BodyDeclaration<?>> anonymousClassBody;
@@ -75,27 +75,27 @@
*
* @param scope may be null
* @param type this is the class that the constructor is being called for.
- * @param args Any arguments to pass to the constructor
+ * @param arguments Any arguments to pass to the constructor
*/
public ObjectCreationExpr(final Expression scope, final ClassOrInterfaceType type,
- final NodeList<Expression> args) {
+ final NodeList<Expression> arguments) {
this(null,
scope,
type,
new NodeList<>(),
- args,
+ arguments,
null);
}
public ObjectCreationExpr(final Range range,
final Expression scope, final ClassOrInterfaceType type,
final NodeList<Type<?>> typeArguments,
- final NodeList<Expression> args, final NodeList<BodyDeclaration<?>> anonymousBody) {
+ final NodeList<Expression> arguments, final NodeList<BodyDeclaration<?>> anonymousBody) {
super(range);
setScope(scope);
setType(type);
setTypeArguments(typeArguments);
- setArgs(args);
+ setArguments(arguments);
setAnonymousClassBody(anonymousBody);
}
@@ -120,8 +120,8 @@
}
@Override
- public NodeList<Expression> getArgs() {
- return args;
+ public NodeList<Expression> getArguments() {
+ return arguments;
}
public Optional<Expression> getScope() {
@@ -149,10 +149,10 @@
}
@Override
- public ObjectCreationExpr setArgs(final NodeList<Expression> args) {
- notifyPropertyChange(ObservableProperty.ARGS, this.args, args);
- this.args = assertNotNull(args);
- setAsParentNodeOf(this.args);
+ public ObjectCreationExpr setArguments(final NodeList<Expression> arguments) {
+ notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments);
+ this.arguments = assertNotNull(arguments);
+ setAsParentNodeOf(this.arguments);
return this;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java
index c0b3511..829f2c5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java
@@ -22,6 +22,7 @@
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
+import com.github.javaparser.ast.nodeTypes.NodeWithExpression;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
@@ -29,7 +30,8 @@
/**
* @author Julio Vilmar Gesser
*/
-public final class UnaryExpr extends Expression {
+public final class UnaryExpr extends Expression implements
+ NodeWithExpression<UnaryExpr> {
public enum Operator {
positive, // +
@@ -42,7 +44,7 @@
postDecrement, // --
}
- private Expression expr;
+ private Expression expression;
private Operator op;
@@ -50,13 +52,13 @@
this(null, new IntegerLiteralExpr(), Operator.postIncrement);
}
- public UnaryExpr(final Expression expr, final Operator op) {
- this(null, expr, op);
+ public UnaryExpr(final Expression expression, final Operator op) {
+ this(null, expression, op);
}
- public UnaryExpr(final Range range, final Expression expr, final Operator op) {
+ public UnaryExpr(final Range range, final Expression expression, final Operator op) {
super(range);
- setExpr(expr);
+ setExpression(expression);
setOperator(op);
}
@@ -68,18 +70,20 @@
v.visit(this, arg);
}
- public Expression getExpr() {
- return expr;
+ @Override
+ public Expression getExpression() {
+ return expression;
}
public Operator getOperator() {
return op;
}
- public UnaryExpr setExpr(final Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPR, this.expr, expr);
- this.expr = expr;
- setAsParentNodeOf(this.expr);
+ @Override
+ public UnaryExpr setExpression(final Expression expr) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expr);
+ this.expression = expr;
+ setAsParentNodeOf(this.expression);
return this;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithArguments.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithArguments.java
index 1c7467f..9ec380a 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithArguments.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithArguments.java
@@ -6,12 +6,12 @@
import com.github.javaparser.ast.expr.NameExpr;
public interface NodeWithArguments<N extends Node> {
- N setArgs(NodeList<Expression> args);
+ N setArguments(NodeList<Expression> arguments);
- NodeList<Expression> getArgs();
+ NodeList<Expression> getArguments();
- default Expression getArg(int i) {
- return getArgs().get(i);
+ default Expression getArgument(int i) {
+ return getArguments().get(i);
}
default N addArgument(String arg) {
@@ -20,7 +20,7 @@
}
default N addArgument(Expression arg) {
- getArgs().add(arg);
+ getArguments().add(arg);
return (N) this;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithExpression.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithExpression.java
new file mode 100644
index 0000000..d17d311
--- /dev/null
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithExpression.java
@@ -0,0 +1,10 @@
+package com.github.javaparser.ast.nodeTypes;
+
+import com.github.javaparser.ast.Node;
+import com.github.javaparser.ast.expr.Expression;
+
+public interface NodeWithExpression<N extends Node> {
+ Expression getExpression();
+
+ N setExpression(Expression expression);
+}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java
index 3a0505f..517facb 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java
@@ -260,7 +260,7 @@
default FieldDeclaration getFieldByName(String name) {
return (FieldDeclaration) getMembers().stream()
.filter(m -> m instanceof FieldDeclaration && ((FieldDeclaration) m).getVariables().stream()
- .anyMatch(var -> var.getId().getNameAsString().equals(name)))
+ .anyMatch(var -> var.getIdentifier().getNameAsString().equals(name)))
.findFirst().orElse(null);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java
index da9f39a..be1ac96 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.nodeTypes;
+import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.expr.SimpleName;
/**
@@ -28,15 +29,15 @@
*
* The main reason for this interface is to permit users to manipulate homogeneously all nodes with a getName method.
*/
-public interface NodeWithSimpleName<T> {
+public interface NodeWithSimpleName<N extends Node> {
SimpleName getName();
- T setName(SimpleName name);
+ N setName(SimpleName name);
@SuppressWarnings("unchecked")
- default T setName(String name){
+ default N setName(String name){
setName(new SimpleName(name));
- return (T) this;
+ return (N) this;
}
default String getNameAsString(){
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrowable.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrowable.java
index a285ab5..96cad0f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrowable.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrowable.java
@@ -6,12 +6,12 @@
import com.github.javaparser.ast.type.ReferenceType;
public interface NodeWithThrowable<N extends Node> {
- N setThrows(NodeList<ReferenceType<?>> throws_);
+ N setThrownTypes(NodeList<ReferenceType<?>> thrownTypes);
- NodeList<ReferenceType<?>> getThrows();
+ NodeList<ReferenceType<?>> getThrownTypes();
- default ReferenceType getThrow(int i) {
- return getThrows().get(i);
+ default ReferenceType getThrownType(int i) {
+ return getThrownTypes().get(i);
}
/**
@@ -21,8 +21,8 @@
* @return this
*/
@SuppressWarnings("unchecked")
- default N addThrows(ReferenceType<?> throwType) {
- getThrows().add(throwType);
+ default N addThrownType(ReferenceType<?> throwType) {
+ getThrownTypes().add(throwType);
throwType.setParentNode((Node) this);
return (N) this;
}
@@ -33,28 +33,32 @@
* @param clazz the exception class
* @return this
*/
- default N addThrows(Class<? extends Throwable> clazz) {
+ default N addThrownType(Class<? extends Throwable> clazz) {
((Node) this).tryAddImportToParentCompilationUnit(clazz);
- return addThrows(new ClassOrInterfaceType(clazz.getSimpleName()));
+ return addThrownType(new ClassOrInterfaceType(clazz.getSimpleName()));
}
/**
- * Check whether this elements throws this exception class
+ * Check whether this elements throws this exception class.
+ * Note that this is simply a text compare of the simple name of the class,
+ * no actual type resolution takes place.
*
* @param clazz the class of the exception
* @return true if found in throws clause, false if not
*/
- default boolean isThrows(Class<? extends Throwable> clazz) {
- return isThrows(clazz.getSimpleName());
+ default boolean isThrown(Class<? extends Throwable> clazz) {
+ return isThrown(clazz.getSimpleName());
}
/**
* Check whether this elements throws this exception class
+ * Note that this is simply a text compare,
+ * no actual type resolution takes place.
*
* @param throwableName the class of the exception
* @return true if found in throws clause, false if not
*/
- default boolean isThrows(String throwableName) {
- return getThrows().stream().anyMatch(t -> t.toString().equals(throwableName));
+ default boolean isThrown(String throwableName) {
+ return getThrownTypes().stream().anyMatch(t -> t.toString().equals(throwableName));
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithVariableDeclaratorId.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithVariableDeclaratorId.java
new file mode 100644
index 0000000..d2e6055
--- /dev/null
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithVariableDeclaratorId.java
@@ -0,0 +1,19 @@
+package com.github.javaparser.ast.nodeTypes;
+
+import com.github.javaparser.ast.Node;
+import com.github.javaparser.ast.body.VariableDeclaratorId;
+
+public interface NodeWithVariableDeclaratorId<N extends Node> {
+ VariableDeclaratorId getIdentifier();
+
+ N setIdentifier(VariableDeclaratorId identifier);
+
+ default String getIdentifierAsString() {
+ return getIdentifier().getNameAsString();
+ }
+
+ default N setIdentifier(String identifier) {
+ getIdentifier().setName(identifier);
+ return (N) this;
+ }
+}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/observing/ObservableProperty.java b/javaparser-core/src/main/java/com/github/javaparser/ast/observing/ObservableProperty.java
index 148e266..063a4dc 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/observing/ObservableProperty.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/observing/ObservableProperty.java
@@ -8,7 +8,7 @@
ANONYMOUS_CLASS_BODY,
ARRAY_BRACKET_PAIRS_AFTER_ID,
ARRAY_BRACKET_PAIRS_AFTER_TYPE,
- ARGS,
+ ARGUMENTS,
BLOCK,
BODY,
CATCHS,
@@ -29,19 +29,19 @@
ELSE_EXPR,
ELSE_STMT,
ENTRIES,
- EXPR,
- EXTENDS,
+ EXPRESSION,
+ EXTENDED_TYPES,
FIELD,
FINALLY_BLOCK,
ID,
IDENTIFIER,
- IMPLEMENTS_LIST,
+ IMPLEMENTED_TYPES,
IMPORTS,
INDEX,
INIT,
INITIALIZER,
INNER,
- INTERFACE,
+ IS_INTERFACE,
ITERABLE,
IS_THIS,
LABEL,
@@ -72,7 +72,7 @@
TARGET,
THEN_EXPR,
THEN_STMT,
- THROWS,
+ THROWN_TYPES,
TRY_BLOCK,
TYPE,
TYPES,
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java
index 2a92687..285d5ab 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java
@@ -43,27 +43,27 @@
private boolean isThis;
- private Expression expr;
+ private Expression expression;
- private NodeList<Expression> args;
+ private NodeList<Expression> arguments;
public ExplicitConstructorInvocationStmt() {
this(null, new NodeList<>(), true, null, new NodeList<>());
}
public ExplicitConstructorInvocationStmt(final boolean isThis,
- final Expression expr, final NodeList<Expression> args) {
- this(null, new NodeList<>(), isThis, expr, args);
+ final Expression expression, final NodeList<Expression> arguments) {
+ this(null, new NodeList<>(), isThis, expression, arguments);
}
public ExplicitConstructorInvocationStmt(Range range,
- final NodeList<Type<?>> typeArguments, final boolean isThis,
- final Expression expr, final NodeList<Expression> args) {
+ final NodeList<Type<?>> typeArguments, final boolean isThis,
+ final Expression expression, final NodeList<Expression> arguments) {
super(range);
setTypeArguments(typeArguments);
setThis(isThis);
- setExpr(expr);
- setArgs(args);
+ setExpression(expression);
+ setArguments(arguments);
}
@Override
@@ -76,39 +76,39 @@
v.visit(this, arg);
}
- public NodeList<Expression> getArgs() {
- return args;
+ public NodeList<Expression> getArguments() {
+ return arguments;
}
- public Expression getArg(int i) {
- return getArgs().get(i);
+ public Expression getArgument(int i) {
+ return getArguments().get(i);
}
- public Optional<Expression> getExpr() {
- return Optional.ofNullable(expr);
+ public Optional<Expression> getExpression() {
+ return Optional.ofNullable(expression);
}
public boolean isThis() {
return isThis;
}
- public ExplicitConstructorInvocationStmt setArgs(final NodeList<Expression> args) {
- notifyPropertyChange(ObservableProperty.ARGS, this.args, args);
- this.args = assertNotNull(args);
- setAsParentNodeOf(this.args);
+ public ExplicitConstructorInvocationStmt setArguments(final NodeList<Expression> arguments) {
+ notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments);
+ this.arguments = assertNotNull(arguments);
+ setAsParentNodeOf(this.arguments);
return this;
}
/**
- * Sets the expr
+ * Sets the expression
*
- * @param expr the expression, can be null
+ * @param expression the expression, can be null
* @return this, the ExplicitConstructorInvocationStmt
*/
- public ExplicitConstructorInvocationStmt setExpr(final Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPR, this.expr, expr);
- this.expr = expr;
- setAsParentNodeOf(this.expr);
+ public ExplicitConstructorInvocationStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = expression;
+ setAsParentNodeOf(this.expression);
return this;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java
index 0e1975a..0c13062 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java
@@ -24,6 +24,7 @@
import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.BooleanLiteralExpr;
import com.github.javaparser.ast.expr.Expression;
+import com.github.javaparser.ast.nodeTypes.NodeWithExpression;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
@@ -33,7 +34,8 @@
/**
* @author Julio Vilmar Gesser
*/
-public final class ExpressionStmt extends Statement {
+public final class ExpressionStmt extends Statement implements
+ NodeWithExpression<ExpressionStmt> {
private Expression expr;
@@ -58,13 +60,15 @@
v.visit(this, arg);
}
+ @Override
public Expression getExpression() {
return expr;
}
- public ExpressionStmt setExpression(final Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPR, this.expr, expr);
- this.expr = assertNotNull(expr);
+ @Override
+ public ExpressionStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expr, expression);
+ this.expr = assertNotNull(expression);
setAsParentNodeOf(this.expr);
return this;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java
index e5a2bfa..f45c2d5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java
@@ -24,6 +24,7 @@
import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.NameExpr;
+import com.github.javaparser.ast.nodeTypes.NodeWithExpression;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
@@ -35,26 +36,26 @@
*/
public final class ReturnStmt extends Statement {
- private Expression expr;
+ private Expression expression;
public ReturnStmt() {
this(null, null);
}
- public ReturnStmt(final Expression expr) {
- this(null, expr);
+ public ReturnStmt(final Expression expression) {
+ this(null, expression);
}
- public ReturnStmt(Range range, final Expression expr) {
+ public ReturnStmt(Range range, final Expression expression) {
super(range);
- setExpr(expr);
+ setExpression(expression);
}
/**
* Will create a NameExpr with the string param
*/
- public ReturnStmt(String expr) {
- this(null, new NameExpr(expr));
+ public ReturnStmt(String expression) {
+ this(null, new NameExpr(expression));
}
@Override
@@ -66,20 +67,20 @@
v.visit(this, arg);
}
- public Optional<Expression> getExpr() {
- return Optional.ofNullable(expr);
+ public Optional<Expression> getExpression() {
+ return Optional.ofNullable(expression);
}
/**
- * Sets the expr
+ * Sets the expression
*
- * @param expr the expr, can be null
+ * @param expression the expression, can be null
* @return this, the ReturnStmt
*/
- public ReturnStmt setExpr(final Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPR, this.expr, expr);
- this.expr = expr;
- setAsParentNodeOf(this.expr);
+ public ReturnStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = expression;
+ setAsParentNodeOf(this.expression);
return this;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java
index 3eccc4a..c87d1b5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java
@@ -25,6 +25,7 @@
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.NameExpr;
import com.github.javaparser.ast.nodeTypes.NodeWithBlockStmt;
+import com.github.javaparser.ast.nodeTypes.NodeWithExpression;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
@@ -34,9 +35,11 @@
/**
* @author Julio Vilmar Gesser
*/
-public final class SynchronizedStmt extends Statement implements NodeWithBlockStmt<SynchronizedStmt> {
+public final class SynchronizedStmt extends Statement implements
+ NodeWithBlockStmt<SynchronizedStmt>,
+ NodeWithExpression<SynchronizedStmt> {
- private Expression expr;
+ private Expression expression;
private BlockStmt block;
@@ -44,13 +47,13 @@
this(null, new NameExpr(), new BlockStmt());
}
- public SynchronizedStmt(final Expression expr, final BlockStmt block) {
- this(null, expr, block);
+ public SynchronizedStmt(final Expression expression, final BlockStmt block) {
+ this(null, expression, block);
}
- public SynchronizedStmt(Range range, final Expression expr, final BlockStmt block) {
+ public SynchronizedStmt(Range range, final Expression expression, final BlockStmt block) {
super(range);
- setExpr(expr);
+ setExpression(expression);
setBody(block);
}
@@ -72,8 +75,8 @@
return block;
}
- public Expression getExpr() {
- return expr;
+ public Expression getExpression() {
+ return expression;
}
/**
@@ -84,10 +87,10 @@
return setBody(block);
}
- public SynchronizedStmt setExpr(final Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPR, this.expr, expr);
- this.expr = assertNotNull(expr);
- setAsParentNodeOf(this.expr);
+ public SynchronizedStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = assertNotNull(expression);
+ setAsParentNodeOf(this.expression);
return this;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java
index 7323996..7fca14b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java
@@ -24,6 +24,7 @@
import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.NameExpr;
+import com.github.javaparser.ast.nodeTypes.NodeWithExpression;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
@@ -31,21 +32,22 @@
/**
* @author Julio Vilmar Gesser
*/
-public final class ThrowStmt extends Statement {
+public final class ThrowStmt extends Statement implements
+ NodeWithExpression<ThrowStmt> {
- private Expression expr;
+ private Expression expression;
public ThrowStmt() {
this(null, new NameExpr());
}
- public ThrowStmt(final Expression expr) {
- this(null, expr);
+ public ThrowStmt(final Expression expression) {
+ this(null, expression);
}
- public ThrowStmt(Range range, final Expression expr) {
+ public ThrowStmt(Range range, final Expression expression) {
super(range);
- setExpr(expr);
+ setExpression(expression);
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
@@ -56,14 +58,16 @@
v.visit(this, arg);
}
- public Expression getExpr() {
- return expr;
+ @Override
+ public Expression getExpression() {
+ return expression;
}
- public ThrowStmt setExpr(final Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPR, this.expr, expr);
- this.expr = expr;
- setAsParentNodeOf(this.expr);
+ @Override
+ public ThrowStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = expression;
+ setAsParentNodeOf(this.expression);
return this;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java
index 7273d90..010de5d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java
@@ -81,7 +81,7 @@
* @return this, the WildcardType
*/
public WildcardType setExtends(final ReferenceType<?> ext) {
- notifyPropertyChange(ObservableProperty.EXTENDS, this.ext, ext);
+ notifyPropertyChange(ObservableProperty.EXTENDED_TYPES, this.ext, ext);
this.ext = ext;
setAsParentNodeOf(this.ext);
return this;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java
index cbae500..0671b9b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java
@@ -226,7 +226,7 @@
@Override
public Visitable visit(EnumConstantDeclaration _n, Object _arg) {
NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- NodeList<Expression> args = cloneList(_n.getArgs(), _arg);
+ NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
NodeList<BodyDeclaration<?>> classBody = cloneList(_n.getClassBody(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
@@ -294,8 +294,8 @@
@Override
public Visitable visit(VariableDeclarator _n, Object _arg) {
- VariableDeclaratorId id = cloneNode(_n.getId(), _arg);
- Expression init = cloneNode(_n.getInit(), _arg);
+ VariableDeclaratorId id = cloneNode(_n.getIdentifier(), _arg);
+ Expression init = cloneNode(_n.getInitializer(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
VariableDeclarator r = new VariableDeclarator(
@@ -325,7 +325,7 @@
NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
NodeList<TypeParameter> typeParameters = cloneList(_n.getTypeParameters(), _arg);
NodeList<Parameter> parameters= cloneList(_n.getParameters(), _arg);
- NodeList<ReferenceType<?>> throws_ = cloneList(_n.getThrows(), _arg);
+ NodeList<ReferenceType<?>> throws_ = cloneList(_n.getThrownTypes(), _arg);
BlockStmt block = cloneNode(_n.getBody(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
SimpleName nameExpr_ = cloneNode(_n.getName(), _arg);
@@ -345,7 +345,7 @@
Type<?> type_ = cloneNode(_n.getElementType(), _arg);
SimpleName nameExpr_ = cloneNode(_n.getName(), _arg);
NodeList<Parameter> parameters_ = cloneList(_n.getParameters(), _arg);
- NodeList<ReferenceType<?>> throws_ = cloneList(_n.getThrows(), _arg);
+ NodeList<ReferenceType<?>> throws_ = cloneList(_n.getThrownTypes(), _arg);
BlockStmt block_ = cloneNode(_n.getBody(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
NodeList<ArrayBracketPair> arrayBracketPairsAfterElementType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
@@ -373,7 +373,7 @@
public Visitable visit(Parameter _n, Object _arg) {
NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
Type<?> type_ = cloneNode(_n.getElementType(), _arg);
- VariableDeclaratorId id = cloneNode(_n.getId(), _arg);
+ VariableDeclaratorId id = cloneNode(_n.getIdentifier(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
NodeList<ArrayBracketPair> arrayBracketPairsAfterType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
@@ -608,7 +608,7 @@
@Override
public Visitable visit(CastExpr _n, Object _arg) {
Type<?> type_ = cloneNode(_n.getType(), _arg);
- Expression expr = cloneNode(_n.getExpr(), _arg);
+ Expression expr = cloneNode(_n.getExpression(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
CastExpr r = new CastExpr(
@@ -679,7 +679,7 @@
@Override
public Visitable visit(InstanceOfExpr _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpr(), _arg);
+ Expression expr = cloneNode(_n.getExpression(), _arg);
ReferenceType<?> type_ = cloneNode(_n.getType(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
@@ -793,7 +793,7 @@
public Visitable visit(MethodCallExpr _n, Object _arg) {
Expression scope_ = cloneNode(_n.getScope(), _arg);
NodeList<Type<?>> typeArguments_ = cloneList(_n.getTypeArguments().orElse(null), _arg);
- NodeList<Expression> args = cloneList(_n.getArgs(), _arg);
+ NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
SimpleName nameExpr = cloneNode(_n.getName(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
@@ -825,7 +825,7 @@
Expression scope = cloneNode(_n.getScope(), _arg);
ClassOrInterfaceType type_ = cloneNode(_n.getType(), _arg);
NodeList<Type<?>> typeArguments = cloneList(_n.getTypeArguments().orElse(null), _arg);
- NodeList<Expression> args = cloneList(_n.getArgs(), _arg);
+ NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
NodeList<BodyDeclaration<?>> anonymousBody = cloneList(_n.getAnonymousClassBody().orElse(null), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
@@ -884,7 +884,7 @@
@Override
public Visitable visit(UnaryExpr _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpr(), _arg);
+ Expression expr = cloneNode(_n.getExpression(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
UnaryExpr r = new UnaryExpr(
@@ -972,8 +972,8 @@
@Override
public Visitable visit(ExplicitConstructorInvocationStmt _n, Object _arg) {
NodeList<Type<?>> typeArguments_ = cloneList(_n.getTypeArguments().orElse(null), _arg);
- Expression expr_ = cloneNode(_n.getExpr(), _arg);
- NodeList<Expression> args = cloneList(_n.getArgs(), _arg);
+ Expression expr_ = cloneNode(_n.getExpression(), _arg);
+ NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
ExplicitConstructorInvocationStmt r = new ExplicitConstructorInvocationStmt(
@@ -1104,7 +1104,7 @@
@Override
public Visitable visit(ReturnStmt _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpr(), _arg);
+ Expression expr = cloneNode(_n.getExpression(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
ReturnStmt r = new ReturnStmt(
@@ -1203,7 +1203,7 @@
@Override
public Visitable visit(ThrowStmt _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpr(), _arg);
+ Expression expr = cloneNode(_n.getExpression(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
ThrowStmt r = new ThrowStmt(
@@ -1216,7 +1216,7 @@
@Override
public Visitable visit(SynchronizedStmt _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpr(), _arg);
+ Expression expr = cloneNode(_n.getExpression(), _arg);
BlockStmt block = cloneNode(_n.getBody(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java
index 9655320..236c084 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java
@@ -375,7 +375,7 @@
return false;
}
- if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
+ if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
return false;
}
@@ -469,11 +469,11 @@
@Override public Boolean visit(final VariableDeclarator n1, final Visitable arg) {
final VariableDeclarator n2 = (VariableDeclarator) arg;
- if (!nodeEquals(n1.getId(), n2.getId())) {
+ if (!nodeEquals(n1.getIdentifier(), n2.getIdentifier())) {
return false;
}
- if (!nodeEquals(n1.getInit().orElse(null), n2.getInit().orElse(null))) {
+ if (!nodeEquals(n1.getInitializer().orElse(null), n2.getInitializer().orElse(null))) {
return false;
}
@@ -519,7 +519,7 @@
return false;
}
- if (!nodesEquals(n1.getThrows(), n2.getThrows())) {
+ if (!nodesEquals(n1.getThrownTypes(), n2.getThrownTypes())) {
return false;
}
@@ -567,7 +567,7 @@
return false;
}
- if (!nodesEquals(n1.getThrows(), n2.getThrows())) {
+ if (!nodesEquals(n1.getThrownTypes(), n2.getThrownTypes())) {
return false;
}
@@ -594,7 +594,7 @@
return false;
}
- if (!nodeEquals(n1.getId(), n2.getId())) {
+ if (!nodeEquals(n1.getIdentifier(), n2.getIdentifier())) {
return false;
}
@@ -865,7 +865,7 @@
return false;
}
- if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
return false;
}
@@ -931,7 +931,7 @@
@Override public Boolean visit(final InstanceOfExpr n1, final Visitable arg) {
final InstanceOfExpr n2 = (InstanceOfExpr) arg;
- if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
return false;
}
@@ -1037,7 +1037,7 @@
return false;
}
- if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
+ if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
return false;
}
@@ -1073,7 +1073,7 @@
return false;
}
- if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
+ if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
return false;
}
@@ -1132,7 +1132,7 @@
return false;
}
- if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
return false;
}
@@ -1220,11 +1220,11 @@
@Override public Boolean visit(final ExplicitConstructorInvocationStmt n1, final Visitable arg) {
final ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg;
- if (!nodeEquals(n1.getExpr().orElse(null), n2.getExpr().orElse(null))) {
+ if (!nodeEquals(n1.getExpression().orElse(null), n2.getExpression().orElse(null))) {
return false;
}
- if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
+ if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
return false;
}
@@ -1334,7 +1334,7 @@
@Override public Boolean visit(final ReturnStmt n1, final Visitable arg) {
final ReturnStmt n2 = (ReturnStmt) arg;
- if (!nodeEquals(n1.getExpr().orElse(null), n2.getExpr().orElse(null))) {
+ if (!nodeEquals(n1.getExpression().orElse(null), n2.getExpression().orElse(null))) {
return false;
}
@@ -1440,7 +1440,7 @@
@Override public Boolean visit(final ThrowStmt n1, final Visitable arg) {
final ThrowStmt n2 = (ThrowStmt) arg;
- if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
return false;
}
@@ -1450,7 +1450,7 @@
@Override public Boolean visit(final SynchronizedStmt n1, final Visitable arg) {
final SynchronizedStmt n2 = (SynchronizedStmt) arg;
- if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
return false;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java
index d2d7806..09689bf 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java
@@ -339,7 +339,7 @@
}
}
{
- R result = n.getExpr().accept(this, arg);
+ R result = n.getExpression().accept(this, arg);
if (result != null) {
return result;
}
@@ -560,8 +560,8 @@
}
}
}
- if (n.getThrows() != null) {
- for (final ReferenceType name : n.getThrows()) {
+ if (n.getThrownTypes() != null) {
+ for (final ReferenceType name : n.getThrownTypes()) {
{
R result = name.accept(this, arg);
if (result != null) {
@@ -654,8 +654,8 @@
}
}
}
- if (n.getArgs() != null) {
- for (final Expression e : n.getArgs()) {
+ if (n.getArguments() != null) {
+ for (final Expression e : n.getArguments()) {
{
R result = e.accept(this, arg);
if (result != null) {
@@ -726,9 +726,9 @@
@Override
public R visit(final ExplicitConstructorInvocationStmt n, final A arg) {
visitComment(n, arg);
- if (!n.isThis() && n.getExpr().isPresent()) {
+ if (!n.isThis() && n.getExpression().isPresent()) {
{
- R result = n.getExpr().get().accept(this, arg);
+ R result = n.getExpression().get().accept(this, arg);
if (result != null) {
return result;
}
@@ -742,8 +742,8 @@
}
}
}
- if (n.getArgs() != null) {
- for (final Expression e : n.getArgs()) {
+ if (n.getArguments() != null) {
+ for (final Expression e : n.getArguments()) {
{
R result = e.accept(this, arg);
if (result != null) {
@@ -927,7 +927,7 @@
public R visit(final InstanceOfExpr n, final A arg) {
visitComment(n, arg);
{
- R result = n.getExpr().accept(this, arg);
+ R result = n.getExpression().accept(this, arg);
if (result != null) {
return result;
}
@@ -1025,8 +1025,8 @@
}
}
}
- if (n.getArgs() != null) {
- for (final Expression e : n.getArgs()) {
+ if (n.getArguments() != null) {
+ for (final Expression e : n.getArguments()) {
{
R result = e.accept(this, arg);
if (result != null) {
@@ -1077,8 +1077,8 @@
}
}
}
- if (n.getThrows() != null) {
- for (final ReferenceType<?> name : n.getThrows()) {
+ if (n.getThrownTypes() != null) {
+ for (final ReferenceType<?> name : n.getThrownTypes()) {
{
R result = name.accept(this, arg);
if (result != null) {
@@ -1157,8 +1157,8 @@
return result;
}
}
- if (n.getArgs() != null) {
- for (final Expression e : n.getArgs()) {
+ if (n.getArguments() != null) {
+ for (final Expression e : n.getArguments()) {
{
R result = e.accept(this, arg);
if (result != null) {
@@ -1222,7 +1222,7 @@
}
}
{
- R result = n.getId().accept(this, arg);
+ R result = n.getIdentifier().accept(this, arg);
if (result != null) {
return result;
}
@@ -1341,9 +1341,9 @@
@Override
public R visit(final ReturnStmt n, final A arg) {
visitComment(n, arg);
- if (n.getExpr().isPresent()) {
+ if (n.getExpression().isPresent()) {
{
- R result = n.getExpr().get().accept(this, arg);
+ R result = n.getExpression().get().accept(this, arg);
if (result != null) {
return result;
}
@@ -1441,8 +1441,8 @@
public R visit(final SynchronizedStmt n, final A arg) {
visitComment(n, arg);
{
- if (n.getExpr() != null) {
- R result = n.getExpr().accept(this, arg);
+ if (n.getExpression() != null) {
+ R result = n.getExpression().accept(this, arg);
if (result != null) {
return result;
}
@@ -1475,7 +1475,7 @@
public R visit(final ThrowStmt n, final A arg) {
visitComment(n, arg);
{
- R result = n.getExpr().accept(this, arg);
+ R result = n.getExpression().accept(this, arg);
if (result != null) {
return result;
}
@@ -1555,7 +1555,7 @@
public R visit(final UnaryExpr n, final A arg) {
visitComment(n, arg);
{
- R result = n.getExpr().accept(this, arg);
+ R result = n.getExpression().accept(this, arg);
if (result != null) {
return result;
}
@@ -1599,14 +1599,14 @@
public R visit(final VariableDeclarator n, final A arg) {
visitComment(n, arg);
{
- R result = n.getId().accept(this, arg);
+ R result = n.getIdentifier().accept(this, arg);
if (result != null) {
return result;
}
}
- if (n.getInit().isPresent()) {
+ if (n.getInitializer().isPresent()) {
{
- R result = n.getInit().get().accept(this, arg);
+ R result = n.getInitializer().get().accept(this, arg);
if (result != null) {
return result;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java
index 136d5a3..060fc00 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java
@@ -263,7 +263,7 @@
public Visitable visit(final CastExpr n, final A arg) {
visitComment(n, arg);
final Type type = (Type) n.getType().accept(this, arg);
- final Expression expr = (Expression) n.getExpr().accept(this, arg);
+ final Expression expr = (Expression) n.getExpression().accept(this, arg);
if (type == null) {
return expr;
}
@@ -271,7 +271,7 @@
return null;
}
n.setType(type);
- n.setExpr(expr);
+ n.setExpression(expr);
return n;
}
@@ -352,7 +352,7 @@
n.setAnnotations((NodeList<AnnotationExpr>) n.getAnnotations().accept(this, arg));
n.setTypeParameters(modifyList(n.getTypeParameters(), arg));
n.setParameters((NodeList<Parameter>) n.getParameters().accept(this, arg));
- n.setThrows((NodeList<ReferenceType<?>>) n.getThrows().accept(this, arg));
+ n.setThrownTypes((NodeList<ReferenceType<?>>) n.getThrownTypes().accept(this, arg));
n.setBody((BlockStmt) n.getBody().accept(this, arg));
return n;
}
@@ -417,7 +417,7 @@
public Visitable visit(final EnumConstantDeclaration n, final A arg) {
visitComment(n, arg);
n.setAnnotations((NodeList<AnnotationExpr>) n.getAnnotations().accept(this, arg));
- n.setArgs((NodeList<Expression>) n.getArgs().accept(this, arg));
+ n.setArguments((NodeList<Expression>) n.getArguments().accept(this, arg));
n.setClassBody((NodeList<BodyDeclaration<?>>) n.getClassBody().accept(this, arg));
return n;
}
@@ -435,11 +435,11 @@
@Override
public Visitable visit(final ExplicitConstructorInvocationStmt n, final A arg) {
visitComment(n, arg);
- if (!n.isThis() && n.getExpr().isPresent()) {
- n.setExpr((Expression) n.getExpr().get().accept(this, arg));
+ if (!n.isThis() && n.getExpression().isPresent()) {
+ n.setExpression((Expression) n.getExpression().get().accept(this, arg));
}
n.setTypeArguments(modifyList(n.getTypeArguments().orElse(null), arg));
- n.setArgs((NodeList<Expression>) n.getArgs().accept(this, arg));
+ n.setArguments((NodeList<Expression>) n.getArguments().accept(this, arg));
return n;
}
@@ -527,7 +527,7 @@
@Override
public Visitable visit(final InstanceOfExpr n, final A arg) {
visitComment(n, arg);
- n.setExpr((Expression) n.getExpr().accept(this, arg));
+ n.setExpression((Expression) n.getExpression().accept(this, arg));
n.setType((ReferenceType<?>) n.getType().accept(this, arg));
return n;
}
@@ -589,7 +589,7 @@
n.setScope((Expression) n.getScope().accept(this, arg));
}
n.setTypeArguments(modifyList(n.getTypeArguments().orElse(null), arg));
- n.setArgs((NodeList<Expression>) n.getArgs().accept(this, arg));
+ n.setArguments((NodeList<Expression>) n.getArguments().accept(this, arg));
return n;
}
@@ -600,7 +600,7 @@
n.setTypeParameters(modifyList(n.getTypeParameters(), arg));
n.setElementType((Type) n.getElementType().accept(this, arg));
n.setParameters((NodeList<Parameter>) n.getParameters().accept(this, arg));
- n.setThrows((NodeList<ReferenceType<?>>) n.getThrows().accept(this, arg));
+ n.setThrownTypes((NodeList<ReferenceType<?>>) n.getThrownTypes().accept(this, arg));
if (n.getBody().isPresent()) {
n.setBody((BlockStmt) n.getBody().get().accept(this, arg));
}
@@ -635,7 +635,7 @@
}
n.setTypeArguments(modifyList(n.getTypeArguments().orElse(null), arg));
n.setType((ClassOrInterfaceType) n.getType().accept(this, arg));
- n.setArgs((NodeList<Expression>) n.getArgs().accept(this, arg));
+ n.setArguments((NodeList<Expression>) n.getArguments().accept(this, arg));
if (n.getAnonymousClassBody().isPresent())
n.setAnonymousClassBody((NodeList<BodyDeclaration<?>>) n.getAnonymousClassBody().get().accept(this, arg));
return n;
@@ -653,7 +653,7 @@
public Visitable visit(final Parameter n, final A arg) {
visitComment(n, arg);
visitAnnotations(n, arg);
- n.setId((VariableDeclaratorId) n.getId().accept(this, arg));
+ n.setIdentifier((VariableDeclaratorId) n.getIdentifier().accept(this, arg));
n.setElementType((Type) n.getElementType().accept(this, arg));
return n;
}
@@ -716,8 +716,8 @@
@Override
public Visitable visit(final ReturnStmt n, final A arg) {
visitComment(n, arg);
- if (n.getExpr().isPresent()) {
- n.setExpr((Expression) n.getExpr().get().accept(this, arg));
+ if (n.getExpression().isPresent()) {
+ n.setExpression((Expression) n.getExpression().get().accept(this, arg));
}
return n;
}
@@ -767,7 +767,7 @@
@Override
public Visitable visit(final SynchronizedStmt n, final A arg) {
visitComment(n, arg);
- n.setExpr((Expression) n.getExpr().accept(this, arg));
+ n.setExpression((Expression) n.getExpression().accept(this, arg));
n.setBody((BlockStmt) n.getBody().accept(this, arg));
return n;
}
@@ -784,7 +784,7 @@
@Override
public Visitable visit(final ThrowStmt n, final A arg) {
visitComment(n, arg);
- n.setExpr((Expression) n.getExpr().accept(this, arg));
+ n.setExpression((Expression) n.getExpression().accept(this, arg));
return n;
}
@@ -817,7 +817,7 @@
@Override
public Visitable visit(final UnaryExpr n, final A arg) {
visitComment(n, arg);
- n.setExpr((Expression) n.getExpr().accept(this, arg));
+ n.setExpression((Expression) n.getExpression().accept(this, arg));
return n;
}
@@ -846,13 +846,13 @@
@Override
public Visitable visit(final VariableDeclarator n, final A arg) {
visitComment(n, arg);
- final VariableDeclaratorId id = (VariableDeclaratorId) n.getId().accept(this, arg);
+ final VariableDeclaratorId id = (VariableDeclaratorId) n.getIdentifier().accept(this, arg);
if (id == null) {
return null;
}
- n.setId(id);
- if (n.getInit().isPresent()) {
- n.setInit((Expression) n.getInit().get().accept(this, arg));
+ n.setIdentifier(id);
+ if (n.getInitializer().isPresent()) {
+ n.setInitializer((Expression) n.getInitializer().get().accept(this, arg));
}
return n;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java
index e911f75..1c7c507 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java
@@ -233,7 +233,7 @@
public void visit(final CastExpr n, final A arg) {
visitComment(n.getComment(), arg);
n.getType().accept(this, arg);
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
}
@Override
@@ -328,8 +328,8 @@
p.accept(this, arg);
}
}
- if (n.getThrows() != null) {
- for (final ReferenceType name : n.getThrows()) {
+ if (n.getThrownTypes() != null) {
+ for (final ReferenceType name : n.getThrownTypes()) {
name.accept(this, arg);
}
}
@@ -380,8 +380,8 @@
public void visit(final EnumConstantDeclaration n, final A arg) {
visitComment(n.getComment(), arg);
visitAnnotations(n, arg);
- if (n.getArgs() != null) {
- for (final Expression e : n.getArgs()) {
+ if (n.getArguments() != null) {
+ for (final Expression e : n.getArguments()) {
e.accept(this, arg);
}
}
@@ -417,16 +417,16 @@
@Override
public void visit(final ExplicitConstructorInvocationStmt n, final A arg) {
visitComment(n.getComment(), arg);
- if (!n.isThis() && n.getExpr().isPresent()) {
- n.getExpr().get().accept(this, arg);
+ if (!n.isThis() && n.getExpression().isPresent()) {
+ n.getExpression().get().accept(this, arg);
}
if (n.getTypeArguments().isPresent()) {
for (final Type<?> t : n.getTypeArguments().get()) {
t.accept(this, arg);
}
}
- if (n.getArgs() != null) {
- for (final Expression e : n.getArgs()) {
+ if (n.getArguments() != null) {
+ for (final Expression e : n.getArguments()) {
e.accept(this, arg);
}
}
@@ -502,7 +502,7 @@
@Override
public void visit(final InstanceOfExpr n, final A arg) {
visitComment(n.getComment(), arg);
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
n.getType().accept(this, arg);
}
@@ -564,8 +564,8 @@
}
}
n.getName().accept(this, arg);
- if (n.getArgs() != null) {
- for (final Expression e : n.getArgs()) {
+ if (n.getArguments() != null) {
+ for (final Expression e : n.getArguments()) {
e.accept(this, arg);
}
}
@@ -587,8 +587,8 @@
p.accept(this, arg);
}
}
- if (n.getThrows() != null) {
- for (final ReferenceType<?> name : n.getThrows()) {
+ if (n.getThrownTypes() != null) {
+ for (final ReferenceType<?> name : n.getThrownTypes()) {
name.accept(this, arg);
}
}
@@ -630,8 +630,8 @@
}
}
n.getType().accept(this, arg);
- if (n.getArgs() != null) {
- for (final Expression e : n.getArgs()) {
+ if (n.getArguments() != null) {
+ for (final Expression e : n.getArguments()) {
e.accept(this, arg);
}
}
@@ -654,7 +654,7 @@
visitComment(n.getComment(), arg);
visitAnnotations(n, arg);
n.getElementType().accept(this, arg);
- n.getId().accept(this, arg);
+ n.getIdentifier().accept(this, arg);
}
@Override
@@ -713,8 +713,8 @@
@Override
public void visit(final ReturnStmt n, final A arg) {
visitComment(n.getComment(), arg);
- if (n.getExpr().isPresent()) {
- n.getExpr().get().accept(this, arg);
+ if (n.getExpression().isPresent()) {
+ n.getExpression().get().accept(this, arg);
}
}
@@ -765,7 +765,7 @@
@Override
public void visit(final SynchronizedStmt n, final A arg) {
visitComment(n.getComment(), arg);
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
n.getBody().accept(this, arg);
}
@@ -780,7 +780,7 @@
@Override
public void visit(final ThrowStmt n, final A arg) {
visitComment(n.getComment(), arg);
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
}
@Override
@@ -821,7 +821,7 @@
@Override
public void visit(final UnaryExpr n, final A arg) {
visitComment(n.getComment(), arg);
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
}
@Override
@@ -842,9 +842,9 @@
@Override
public void visit(final VariableDeclarator n, final A arg) {
visitComment(n.getComment(), arg);
- n.getId().accept(this, arg);
- if (n.getInit().isPresent()) {
- n.getInit().get().accept(this, arg);
+ n.getIdentifier().accept(this, arg);
+ if (n.getInitializer().isPresent()) {
+ n.getInitializer().get().accept(this, arg);
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java
index 69923b3..2929d07 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java
@@ -157,7 +157,7 @@
private void printModifiers(final EnumSet<Modifier> modifiers) {
if (modifiers.size() > 0)
- printer.print(modifiers.stream().map(Modifier::getLib).collect(Collectors.joining(" ")) + " ");
+ printer.print(modifiers.stream().map(Modifier::asString).collect(Collectors.joining(" ")) + " ");
}
private void printMembers(final NodeList<BodyDeclaration<?>> members, final Void arg) {
@@ -545,10 +545,10 @@
@Override
public void visit(final VariableDeclarator n, final Void arg) {
printJavaComment(n.getComment(), arg);
- n.getId().accept(this, arg);
- if (n.getInit().isPresent()) {
+ n.getIdentifier().accept(this, arg);
+ if (n.getInitializer().isPresent()) {
printer.print(" = ");
- n.getInit().get().accept(this, arg);
+ n.getInitializer().get().accept(this, arg);
}
}
@@ -730,7 +730,7 @@
printer.print("(");
n.getType().accept(this, arg);
printer.print(") ");
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
}
@Override
@@ -772,7 +772,7 @@
@Override
public void visit(final InstanceOfExpr n, final Void arg) {
printJavaComment(n.getComment(), arg);
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
printer.print(" instanceof ");
n.getType().accept(this, arg);
}
@@ -864,7 +864,7 @@
}
printTypeArgs(n, arg);
n.getName().accept(this, arg);
- printArguments(n.getArgs(), arg);
+ printArguments(n.getArguments(), arg);
}
@Override
@@ -884,7 +884,7 @@
n.getType().accept(this, arg);
- printArguments(n.getArgs(), arg);
+ printArguments(n.getArguments(), arg);
if (n.getAnonymousClassBody().isPresent()) {
printer.println(" {");
@@ -920,7 +920,7 @@
default:
}
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
switch (n.getOperator()) {
case postIncrement:
@@ -957,9 +957,9 @@
}
printer.print(")");
- if (!isNullOrEmpty(n.getThrows())) {
+ if (!isNullOrEmpty(n.getThrownTypes())) {
printer.print(" throws ");
- for (final Iterator<ReferenceType<?>> i = n.getThrows().iterator(); i.hasNext();) {
+ for (final Iterator<ReferenceType<?>> i = n.getThrownTypes().iterator(); i.hasNext();) {
final ReferenceType<?> name = i.next();
name.accept(this, arg);
if (i.hasNext()) {
@@ -1009,9 +1009,9 @@
pair.accept(this, arg);
}
- if (!isNullOrEmpty(n.getThrows())) {
+ if (!isNullOrEmpty(n.getThrownTypes())) {
printer.print(" throws ");
- for (final Iterator<ReferenceType<?>> i = n.getThrows().iterator(); i.hasNext();) {
+ for (final Iterator<ReferenceType<?>> i = n.getThrownTypes().iterator(); i.hasNext();) {
final ReferenceType name = i.next();
name.accept(this, arg);
if (i.hasNext()) {
@@ -1042,7 +1042,7 @@
printer.print("...");
}
printer.print(" ");
- n.getId().accept(this, arg);
+ n.getIdentifier().accept(this, arg);
}
@Override
@@ -1052,14 +1052,14 @@
printTypeArgs(n, arg);
printer.print("this");
} else {
- if (n.getExpr().isPresent()) {
- n.getExpr().get().accept(this, arg);
+ if (n.getExpression().isPresent()) {
+ n.getExpression().get().accept(this, arg);
printer.print(".");
}
printTypeArgs(n, arg);
printer.print("super");
}
- printArguments(n.getArgs(), arg);
+ printArguments(n.getArguments(), arg);
printer.print(";");
}
@@ -1195,9 +1195,9 @@
public void visit(final ReturnStmt n, final Void arg) {
printJavaComment(n.getComment(), arg);
printer.print("return");
- if (n.getExpr().isPresent()) {
+ if (n.getExpression().isPresent()) {
printer.print(" ");
- n.getExpr().get().accept(this, arg);
+ n.getExpression().get().accept(this, arg);
}
printer.print(";");
}
@@ -1252,8 +1252,8 @@
printMemberAnnotations(n.getAnnotations(), arg);
n.getName().accept(this, arg);
- if (!n.getArgs().isEmpty()) {
- printArguments(n.getArgs(), arg);
+ if (!n.getArguments().isEmpty()) {
+ printArguments(n.getArguments(), arg);
}
if (!n.getClassBody().isEmpty()) {
@@ -1391,7 +1391,7 @@
public void visit(final ThrowStmt n, final Void arg) {
printJavaComment(n.getComment(), arg);
printer.print("throw ");
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
printer.print(";");
}
@@ -1399,7 +1399,7 @@
public void visit(final SynchronizedStmt n, final Void arg) {
printJavaComment(n.getComment(), arg);
printer.print("synchronized (");
- n.getExpr().accept(this, arg);
+ n.getExpression().accept(this, arg);
printer.print(") ");
n.getBody().accept(this, arg);
}
diff --git a/javaparser-core/src/main/javacc/java_1_8.jj b/javaparser-core/src/main/javacc/java_1_8.jj
index 5b6a5aa..f66037b 100644
--- a/javaparser-core/src/main/javacc/java_1_8.jj
+++ b/javaparser-core/src/main/javacc/java_1_8.jj
@@ -162,23 +162,23 @@
if (ret instanceof EnclosedExpr) {
Optional<Expression> inner = ((EnclosedExpr) ret).getInner();
if (inner.isPresent() && inner.get() instanceof NameExpr) {
- VariableDeclaratorId id = new VariableDeclaratorId(inner.get().getRange().get(), ((NameExpr) inner.get()).getName(), emptyList());
- NodeList<Parameter> params = add(emptyList(), new Parameter(ret.getRange().get(), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, id));
+ VariableDeclaratorId identifier = new VariableDeclaratorId(inner.get().getRange().get(), ((NameExpr) inner.get()).getName(), emptyList());
+ NodeList<Parameter> params = add(emptyList(), new Parameter(ret.getRange().get(), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, identifier));
ret = new LambdaExpr(range(ret.getBegin().get(), lambdaBody.getEnd().get()), params, lambdaBody, true);
} else {
ret = new LambdaExpr(range(ret.getBegin().get(), lambdaBody.getEnd().get()), emptyList(), lambdaBody, true);
}
} else if (ret instanceof NameExpr) {
- VariableDeclaratorId id = new VariableDeclaratorId(ret.getRange().get(), ((NameExpr) ret).getName(), emptyList());
- NodeList<Parameter> params = add(emptyList(), new Parameter(ret.getRange().get(), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, id));
+ VariableDeclaratorId identifier = new VariableDeclaratorId(ret.getRange().get(), ((NameExpr) ret).getName(), emptyList());
+ NodeList<Parameter> params = add(emptyList(), new Parameter(ret.getRange().get(), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, identifier));
ret = new LambdaExpr(ret.getRange().get(), params, lambdaBody, false);
} else if (ret instanceof LambdaExpr) {
((LambdaExpr) ret).setBody(lambdaBody);
ret.setRange(range(ret.getBegin().get(), lambdaBody.getEnd().get()));
} else if (ret instanceof CastExpr) {
CastExpr castExpr = (CastExpr) ret;
- Expression inner = generateLambda(castExpr.getExpr(), lambdaBody);
- castExpr.setExpr(inner);
+ Expression inner = generateLambda(castExpr.getExpression(), lambdaBody);
+ castExpr.setExpression(inner);
} else {
addProblem("Failed to parse lambda expression! Please create an issue at https://github.com/javaparser/javaparser/issues");
}
@@ -1526,7 +1526,7 @@
NodeList<AnnotationExpr> annotations = new NodeList<AnnotationExpr>();
AnnotationExpr ann;
SimpleName name;
- NodeList<Expression> args = emptyList();
+ NodeList<Expression> arguments = emptyList();
NodeList<BodyDeclaration<?>> classBody = emptyList();
Position begin = INVALID;
}
@@ -1534,9 +1534,9 @@
{ }
( ann = Annotation() { annotations = add(annotations, ann); begin = begin.orIfInvalid(ann.getBegin().get()); } )*
name = SimpleName() { begin = begin.orIfInvalid(tokenBegin()); }
- [ args = Arguments() ] [ classBody = ClassOrInterfaceBody(false) ]
+ [ arguments = Arguments() ] [ classBody = ClassOrInterfaceBody(false) ]
{
- return new EnumConstantDeclaration(range(begin, tokenEnd()), annotations, name, args, classBody);
+ return new EnumConstantDeclaration(range(begin, tokenEnd()), annotations, name, arguments, classBody);
}
}
@@ -1683,12 +1683,12 @@
VariableDeclarator VariableDeclarator():
{
- VariableDeclaratorId id;
- Expression init = null;
+ VariableDeclaratorId identifier;
+ Expression initializer = null;
}
{
- id = VariableDeclaratorId() [ "=" init = VariableInitializer() ]
- { return new VariableDeclarator(range(id.getBegin().get(), tokenEnd()), id, init); }
+ identifier = VariableDeclaratorId() [ "=" initializer = VariableInitializer() ]
+ { return new VariableDeclarator(range(identifier.getBegin().get(), tokenEnd()), identifier, initializer); }
}
VariableDeclaratorId VariableDeclaratorId():
@@ -1735,7 +1735,7 @@
NodeList<Parameter> parameters = emptyList();
ArrayBracketPair arrayBracketPair;
NodeList<ArrayBracketPair> arrayBracketPairs = emptyList();
- NodeList<ReferenceType<?>> throws_ = emptyList();
+ NodeList<ReferenceType<?>> thrownTypes = emptyList();
BlockStmt block = null;
Position begin = modifier.begin;
ReferenceType throwType;
@@ -1745,12 +1745,12 @@
[ typeParameters = TypeParameters() { begin = begin.orIfInvalid(typeParameters.range.begin); } ]
type = ResultType() { begin = begin.orIfInvalid(type.getBegin().get()); }
name = SimpleName() parameters = FormalParameters() ( arrayBracketPair = ArrayBracketPair() { arrayBracketPairs=add(arrayBracketPairs, arrayBracketPair); } )*
- [ "throws" throwType = ReferenceTypeWithAnnotations() { throws_ = add(throws_, throwType); }
- ("," throwType = ReferenceTypeWithAnnotations() { throws_ = add(throws_, throwType); })* ]
+ [ "throws" throwType = ReferenceTypeWithAnnotations() { thrownTypes = add(thrownTypes, throwType); }
+ ("," throwType = ReferenceTypeWithAnnotations() { thrownTypes = add(thrownTypes, throwType); })* ]
( block = Block() | ";" )
{
Pair<Type<?>, NodeList<ArrayBracketPair>> typeListPair = unwrapArrayTypes(type);
- return new MethodDeclaration(range(begin, pos(token.endLine, token.endColumn)), modifier.modifiers, modifier.annotations, typeParameters.list, typeListPair.a, typeListPair.b, name, false, parameters, arrayBracketPairs, throws_, block);
+ return new MethodDeclaration(range(begin, pos(token.endLine, token.endColumn)), modifier.modifiers, modifier.annotations, typeParameters.list, typeListPair.a, typeListPair.b, name, false, parameters, arrayBracketPairs, thrownTypes, block);
}
}
@@ -1798,13 +1798,13 @@
NodeList<Parameter> InferredLambdaParameters():
{
NodeList<Parameter> ret = null;
- VariableDeclaratorId id;
+ VariableDeclaratorId identifier;
}
{
","
- id = VariableDeclaratorId() { ret = add(ret, new Parameter(range(id.getBegin().get(), id.getEnd().get()), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, id));}
+ identifier = VariableDeclaratorId() { ret = add(ret, new Parameter(range(identifier.getBegin().get(), identifier.getEnd().get()), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, identifier));}
(
- "," id = VariableDeclaratorId() { ret = add(ret, new Parameter(range(id.getBegin().get(), id.getEnd().get()), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, id)); }
+ "," identifier = VariableDeclaratorId() { ret = add(ret, new Parameter(range(identifier.getBegin().get(), identifier.getEnd().get()), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, identifier)); }
)*
{ return ret; }
}
@@ -1814,15 +1814,15 @@
ModifierHolder modifier;
Type type;
boolean isVarArg = false;
- VariableDeclaratorId id;
+ VariableDeclaratorId identifier;
}
{
- modifier = Modifiers() type = Type() [ "..." { isVarArg = true;} ] id = VariableDeclaratorId()
+ modifier = Modifiers() type = Type() [ "..." { isVarArg = true;} ] identifier = VariableDeclaratorId()
{
Position begin = modifier.begin.orIfInvalid(type.getBegin().get());
Pair<Type<?>, NodeList<ArrayBracketPair>> typeListPair = unwrapArrayTypes(type);
- return new Parameter(range(begin, tokenEnd()), modifier.modifiers, modifier.annotations, typeListPair.a, typeListPair.b, isVarArg, id);
+ return new Parameter(range(begin, tokenEnd()), modifier.modifiers, modifier.annotations, typeListPair.a, typeListPair.b, isVarArg, identifier);
}
}
@@ -1831,7 +1831,7 @@
RangedList<TypeParameter> typeParameters = new RangedList<TypeParameter>(emptyList());
SimpleName name;
NodeList<Parameter> parameters = emptyList();
- NodeList<ReferenceType<?>> throws_ = emptyList();
+ NodeList<ReferenceType<?>> thrownTypes = emptyList();
ExplicitConstructorInvocationStmt exConsInv = null;
NodeList<Statement> stmts = emptyList();
Position begin = modifier.begin;
@@ -1841,8 +1841,8 @@
{
[ typeParameters = TypeParameters() { begin = begin.orIfInvalid(typeParameters.range.begin); } ]
// Modifiers matched in the caller
- name = SimpleName() { begin = begin.orIfInvalid(typeParameters.range.begin); } parameters = FormalParameters() [ "throws" throwType = ReferenceTypeWithAnnotations() { throws_ = add(throws_, throwType); }
- ("," throwType = ReferenceTypeWithAnnotations() { throws_ = add(throws_, throwType); })* ]
+ name = SimpleName() { begin = begin.orIfInvalid(typeParameters.range.begin); } parameters = FormalParameters() [ "throws" throwType = ReferenceTypeWithAnnotations() { thrownTypes = add(thrownTypes, throwType); }
+ ("," throwType = ReferenceTypeWithAnnotations() { thrownTypes = add(thrownTypes, throwType); })* ]
"{" { blockBegin=tokenBegin(); }
[ LOOKAHEAD(ExplicitConstructorInvocation()) exConsInv = ExplicitConstructorInvocation() ]
stmts = Statements()
@@ -1852,15 +1852,15 @@
if (exConsInv != null) {
stmts = add(0, stmts, exConsInv);
}
- return new ConstructorDeclaration(range(begin, pos(token.endLine, token.endColumn)), modifier.modifiers, modifier.annotations, typeParameters.list, name, parameters, throws_, new BlockStmt(range(blockBegin, tokenEnd()), stmts));
+ return new ConstructorDeclaration(range(begin, pos(token.endLine, token.endColumn)), modifier.modifiers, modifier.annotations, typeParameters.list, name, parameters, thrownTypes, new BlockStmt(range(blockBegin, tokenEnd()), stmts));
}
}
ExplicitConstructorInvocationStmt ExplicitConstructorInvocation():
{
boolean isThis = false;
- NodeList<Expression> args;
- Expression expr = null;
+ NodeList<Expression> arguments;
+ Expression expression = null;
RangedList<Type<?>> typeArgs = new RangedList<Type<?>>(null);
Position begin = INVALID;
}
@@ -1869,18 +1869,18 @@
LOOKAHEAD([ TypeArguments() ] <THIS> "(")
[ typeArgs = TypeArguments() { begin=typeArgs.range.begin; } ]
<THIS> { begin = begin.orIfInvalid(tokenBegin()); isThis = true; }
- args = Arguments() ";"
+ arguments = Arguments() ";"
|
[
LOOKAHEAD( PrimaryExpressionWithoutSuperSuffix() "." )
- expr = PrimaryExpressionWithoutSuperSuffix() "."
- { begin=expr.getBegin().get(); }
+ expression = PrimaryExpressionWithoutSuperSuffix() "."
+ { begin=expression.getBegin().get(); }
]
[ typeArgs = TypeArguments() { begin = begin.orIfInvalid(typeArgs.range.begin); } ]
<SUPER> {begin = begin.orIfInvalid(tokenBegin());}
- args = Arguments() ";"
+ arguments = Arguments() ";"
)
- { return new ExplicitConstructorInvocationStmt(range(begin, tokenEnd()),typeArgs.list, isThis, expr, args); }
+ { return new ExplicitConstructorInvocationStmt(range(begin, tokenEnd()),typeArgs.list, isThis, expression, arguments); }
}
NodeList<Statement> Statements():
@@ -2499,14 +2499,14 @@
Expression ret = null;
SimpleName name;
RangedList<Type<?>> typeArgs = new RangedList<Type<?>>(null);
- NodeList<Expression> args = emptyList();
+ NodeList<Expression> arguments = emptyList();
NodeList<Parameter> params = emptyList();
boolean hasArgs = false;
boolean isLambda = false;
Type type;
Position begin;
Parameter p = null;
- VariableDeclaratorId id = null;
+ VariableDeclaratorId identifier = null;
}
{
(
@@ -2519,10 +2519,10 @@
"."
[ typeArgs = TypeArguments() ]
name = SimpleName()
- [ args = Arguments() {hasArgs=true;} ]
+ [ arguments = Arguments() {hasArgs=true;} ]
{
if (hasArgs) {
- ret = new MethodCallExpr(range(ret.getBegin().get(), pos(token.endLine, token.endColumn)), ret, typeArgs.list, name, args);
+ ret = new MethodCallExpr(range(ret.getBegin().get(), pos(token.endLine, token.endColumn)), ret, typeArgs.list, name, arguments);
} else {
ret = new FieldAccessExpr(range(ret.getBegin().get(), pos(token.endLine, token.endColumn)), ret, emptyList(), name);
}
@@ -2547,8 +2547,8 @@
if(ret != null){
if(ret instanceof NameExpr)
{
- id = new VariableDeclaratorId(range(ret.getBegin().get(), ret.getEnd().get()), ((NameExpr)ret).getName(), emptyList());
- p = new Parameter(range(ret.getBegin().get(), ret.getEnd().get()), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, id);
+ identifier = new VariableDeclaratorId(range(ret.getBegin().get(), ret.getEnd().get()), ((NameExpr)ret).getName(), emptyList());
+ p = new Parameter(range(ret.getBegin().get(), ret.getEnd().get()), EnumSet.noneOf(Modifier.class), emptyList(), new UnknownType(), emptyList(), false, identifier);
}
}
@@ -2573,10 +2573,10 @@
|
name = SimpleName() { begin=tokenBegin(); }
- [ args = Arguments() { hasArgs=true; } ]
+ [ arguments = Arguments() { hasArgs=true; } ]
{
if (hasArgs) {
- ret = new MethodCallExpr(range(begin, tokenEnd()), null, emptyList(), name, args);
+ ret = new MethodCallExpr(range(begin, tokenEnd()), null, emptyList(), name, arguments);
} else {
ret = new NameExpr(name);
}
@@ -2603,7 +2603,7 @@
{
Expression ret;
RangedList<Type<?>> typeArgs = new RangedList<Type<?>>(null);
- NodeList<Expression> args = emptyList();
+ NodeList<Expression> arguments = emptyList();
boolean hasArgs = false;
SimpleName name;
}
@@ -2618,10 +2618,10 @@
LOOKAHEAD( [ TypeArguments() ] <IDENTIFIER> )
[ typeArgs = TypeArguments() ]
name = SimpleName()
- [ args = Arguments() {hasArgs=true;} ]
+ [ arguments = Arguments() {hasArgs=true;} ]
{
if (hasArgs) {
- ret = new MethodCallExpr(range(scope.getBegin().get(), tokenEnd()), scope, typeArgs.list, name, args);
+ ret = new MethodCallExpr(range(scope.getBegin().get(), tokenEnd()), scope, typeArgs.list, name, arguments);
} else {
ret = new FieldAccessExpr(range(scope.getBegin().get(), tokenEnd()), scope, typeArgs.list, name);
}
@@ -2698,10 +2698,10 @@
NodeList<Expression> ArgumentList():
{
NodeList<Expression> ret = emptyList();
- Expression expr;
+ Expression expression;
}
{
- expr = Expression() { ret.add(expr); } ( "," expr = Expression() { ret.add(expr); } )*
+ expression = Expression() { ret.add(expression); } ( "," expression = Expression() { ret.add(expression); } )*
{ return ret; }
}
@@ -2711,7 +2711,7 @@
Type type;
RangedList<Type<?>> typeArgs = new RangedList<Type<?>>(null);
NodeList<BodyDeclaration<?>> anonymousBody = null;
- NodeList<Expression> args;
+ NodeList<Expression> arguments;
Position begin;
NodeList<AnnotationExpr> annotations = new NodeList<AnnotationExpr>();
}
@@ -2728,8 +2728,8 @@
(
ret = ArrayCreation(begin, type)
|
- args = Arguments() [ LOOKAHEAD(2) anonymousBody = ClassOrInterfaceBody(false) ]
- { ret = new ObjectCreationExpr(range(begin, tokenEnd()), scope, (ClassOrInterfaceType) type, typeArgs.list, args, anonymousBody); }
+ arguments = Arguments() [ LOOKAHEAD(2) anonymousBody = ClassOrInterfaceBody(false) ]
+ { ret = new ObjectCreationExpr(range(begin, tokenEnd()), scope, (ClassOrInterfaceType) type, typeArgs.list, arguments, anonymousBody); }
)
)
{ return ret; }
@@ -2741,7 +2741,7 @@
*/
ArrayCreationExpr ArrayCreation(Position begin, Type type):
{
- Expression expr = null;
+ Expression expression = null;
ArrayInitializerExpr arrayInitializerExpr = null;
NodeList<Expression> inits = emptyList();
List<NodeList<AnnotationExpr>> accum = new ArrayList<NodeList<AnnotationExpr>>();
@@ -2751,8 +2751,8 @@
(
annotations = Annotations()
"["
- (expr = Expression())?
- { accum = add(accum, annotations); inits = add(inits, expr); annotations=null; expr=null; }
+ (expression = Expression())?
+ { accum = add(accum, annotations); inits = add(inits, expression); annotations=null; expression=null; }
"]"
)+
(arrayInitializerExpr = ArrayInitializer())?
@@ -2847,7 +2847,7 @@
Statement BlockStatement():
{
Statement ret;
- Expression expr;
+ Expression expression;
ClassOrInterfaceDeclaration typeDecl;
ModifierHolder modifier;
}
@@ -2859,8 +2859,8 @@
typeDecl = ClassOrInterfaceDeclaration(modifier) { ret = new TypeDeclarationStmt(range(typeDecl.getBegin().get().line, typeDecl.getBegin().get().column, token.endLine, token.endColumn), typeDecl); }
|
LOOKAHEAD(VariableDeclarationExpression() )
- expr = VariableDeclarationExpression() ";"
- { ret = new ExpressionStmt(range(expr.getBegin().get().line, expr.getBegin().get().column, token.endLine, token.endColumn), expr); }
+ expression = VariableDeclarationExpression() ";"
+ { ret = new ExpressionStmt(range(expression.getBegin().get().line, expression.getBegin().get().column, token.endLine, token.endColumn), expression); }
|
ret = Statement()
)
@@ -2892,14 +2892,14 @@
Statement LambdaBody():
{
- Expression expr;
+ Expression expression;
Statement n = null;
}
{
(
- expr = Expression()
+ expression = Expression()
{
- n = new ExpressionStmt(range(expr.getBegin().get(), tokenEnd()), expr);
+ n = new ExpressionStmt(range(expression.getBegin().get(), tokenEnd()), expression);
}
| n = Block()
)
@@ -2916,7 +2916,7 @@
* use PostfixExpression for performance reasons.
*/
{
- Expression expr;
+ Expression expression;
AssignExpr.Operator op;
Expression value;
RangedList<Type<?>> typeArgs = new RangedList<Type<?>>(null);
@@ -2924,28 +2924,28 @@
}
{
( LOOKAHEAD(2)
- expr = PreIncrementExpression()
+ expression = PreIncrementExpression()
|
- expr = PreDecrementExpression()
+ expression = PreDecrementExpression()
|
- expr = PrimaryExpression()
+ expression = PrimaryExpression()
[
- "++" { expr = new UnaryExpr(range(expr.getBegin().get(), tokenEnd()), expr, UnaryExpr.Operator.postIncrement); }
+ "++" { expression = new UnaryExpr(range(expression.getBegin().get(), tokenEnd()), expression, UnaryExpr.Operator.postIncrement); }
|
- "--" { expr = new UnaryExpr(range(expr.getBegin().get(), tokenEnd()), expr, UnaryExpr.Operator.postDecrement); }
+ "--" { expression = new UnaryExpr(range(expression.getBegin().get(), tokenEnd()), expression, UnaryExpr.Operator.postDecrement); }
|
- op = AssignmentOperator() value = Expression() { expr = new AssignExpr(range(expr.getBegin().get(), tokenEnd()), expr, value, op); }
- | "::" [typeArgs = TypeArguments() ] (<IDENTIFIER > | "new"){expr = new MethodReferenceExpr(range(expr.getBegin().get(), tokenEnd()), expr, typeArgs.list, token.image); }
+ op = AssignmentOperator() value = Expression() { expression = new AssignExpr(range(expression.getBegin().get(), tokenEnd()), expression, value, op); }
+ | "::" [typeArgs = TypeArguments() ] (<IDENTIFIER > | "new"){expression = new MethodReferenceExpr(range(expression.getBegin().get(), tokenEnd()), expression, typeArgs.list, token.image); }
|
"->" lambdaBody = LambdaBody()
{
- expr = generateLambda(expr, lambdaBody);
+ expression = generateLambda(expression, lambdaBody);
}
]
)
";"
- { return new ExpressionStmt(range(expr.getBegin().get(), tokenEnd()), expr); }
+ { return new ExpressionStmt(range(expression.getBegin().get(), tokenEnd()), expression); }
}
SwitchStmt SwitchStatement():
@@ -3033,8 +3033,8 @@
Statement ForStatement():
{
VariableDeclarationExpr varExpr = null;
- Expression expr = null;
- NodeList<Expression> init = emptyList();
+ Expression expression = null;
+ NodeList<Expression> initializer = emptyList();
NodeList<Expression> update = emptyList();
Statement body;
Position begin;
@@ -3044,30 +3044,30 @@
(
LOOKAHEAD(VariableDeclarationExpression() ":")
- varExpr = VariableDeclarationExpression() ":" expr = Expression()
+ varExpr = VariableDeclarationExpression() ":" expression = Expression()
|
- [ init = ForInit() ] ";" [ expr = Expression() ] ";" [ update = ForUpdate() ]
+ [ initializer = ForInit() ] ";" [ expression = Expression() ] ";" [ update = ForUpdate() ]
)
")" body = Statement()
{
if (varExpr != null) {
- return new ForeachStmt(range(begin, tokenEnd()),varExpr, expr, body);
+ return new ForeachStmt(range(begin, tokenEnd()),varExpr, expression, body);
}
- return new ForStmt(range(begin, tokenEnd()),init, expr, update, body);
+ return new ForStmt(range(begin, tokenEnd()),initializer, expression, update, body);
}
}
NodeList<Expression> ForInit():
{
NodeList<Expression> ret;
- Expression expr;
+ Expression expression;
}
{
(
LOOKAHEAD( Modifiers() Type() <IDENTIFIER> )
- expr = VariableDeclarationExpression() { ret = new NodeList<Expression>(); ret.add(expr); }
+ expression = VariableDeclarationExpression() { ret = new NodeList<Expression>(); ret.add(expression); }
|
ret = ExpressionList()
)
@@ -3077,10 +3077,10 @@
NodeList<Expression> ExpressionList():
{
NodeList<Expression> ret = new NodeList<Expression>();
- Expression expr;
+ Expression expression;
}
{
- expr = Expression() { ret.add(expr); } ( "," expr = Expression() { ret.add(expr); } )*
+ expression = Expression() { ret.add(expression); } ( "," expression = Expression() { ret.add(expression); } )*
{ return ret; }
}
@@ -3097,53 +3097,53 @@
BreakStmt BreakStatement():
{
- String id = null;
+ String identifier = null;
Position begin;
}
{
- "break" {begin=tokenBegin();} [ <IDENTIFIER> { id = token.image; } ] ";"
- { return new BreakStmt(range(begin, tokenEnd()),id); }
+ "break" {begin=tokenBegin();} [ <IDENTIFIER> { identifier = token.image; } ] ";"
+ { return new BreakStmt(range(begin, tokenEnd()),identifier); }
}
ContinueStmt ContinueStatement():
{
- String id = null;
+ String identifier = null;
Position begin;
}
{
- "continue" {begin=tokenBegin();} [ <IDENTIFIER> { id = token.image; } ] ";"
- { return new ContinueStmt(range(begin, tokenEnd()),id); }
+ "continue" {begin=tokenBegin();} [ <IDENTIFIER> { identifier = token.image; } ] ";"
+ { return new ContinueStmt(range(begin, tokenEnd()),identifier); }
}
ReturnStmt ReturnStatement():
{
- Expression expr = null;
+ Expression expression = null;
Position begin;
}
{
- "return" {begin=tokenBegin();} [ expr = Expression() ] ";"
- { return new ReturnStmt(range(begin, tokenEnd()),expr); }
+ "return" {begin=tokenBegin();} [ expression = Expression() ] ";"
+ { return new ReturnStmt(range(begin, tokenEnd()),expression); }
}
ThrowStmt ThrowStatement():
{
- Expression expr;
+ Expression expression;
Position begin;
}
{
- "throw" {begin=tokenBegin();} expr = Expression() ";"
- { return new ThrowStmt(range(begin, tokenEnd()),expr); }
+ "throw" {begin=tokenBegin();} expression = Expression() ";"
+ { return new ThrowStmt(range(begin, tokenEnd()),expression); }
}
SynchronizedStmt SynchronizedStatement():
{
- Expression expr;
+ Expression expression;
BlockStmt block;
Position begin;
}
{
- "synchronized" {begin=tokenBegin();} "(" expr = Expression() ")" block = Block()
- { return new SynchronizedStmt(range(begin, tokenEnd()),expr, block); }
+ "synchronized" {begin=tokenBegin();} "(" expression = Expression() ")" block = Block()
+ { return new SynchronizedStmt(range(begin, tokenEnd()),expression, block); }
}
TryStmt TryStatement():