aboutsummaryrefslogtreecommitdiffstats
path: root/javaparser-core
diff options
context:
space:
mode:
authorDanny van Bruggen <lol@meuk.info>2016-07-13 17:11:51 +0200
committerGitHub <noreply@github.com>2016-07-13 17:11:51 +0200
commiteab9292e07d961dea28492b0c169f4455ba399ed (patch)
treec3311a939222546c850e8f012620dcc730cb1a79 /javaparser-core
parent21dce6e3e8178f1d6c1fa2f5d9c86b930c60afad (diff)
parentd378a6763d33a1b0db2353347a0d90eef94627ab (diff)
downloadplatform_external_javaparser-eab9292e07d961dea28492b0c169f4455ba399ed.tar.gz
platform_external_javaparser-eab9292e07d961dea28492b0c169f4455ba399ed.tar.bz2
platform_external_javaparser-eab9292e07d961dea28492b0c169f4455ba399ed.zip
Merge branch 'master' into wiki_samples_test
Diffstat (limited to 'javaparser-core')
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/CommentsInserter.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/Position.java110
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/PositionUtils.java18
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/Range.java89
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/AccessSpecifier.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java21
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/ImportDeclaration.java33
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/Node.java151
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/PackageDeclaration.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/TypeArguments.java1
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/TypeParameter.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotableNode.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/BaseParameter.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyMemberDeclaration.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyTypeDeclaration.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumConstantDeclaration.java12
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java12
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java12
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/MultiTypeParameter.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/Parameter.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclaratorId.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java30
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsCollection.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsParser.java23
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java22
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java12
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/CastExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/InstanceOfExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralMinValueExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralMinValueExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/QualifiedNameExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/internal/Utils.java1
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java17
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/CatchClause.java25
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java20
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java21
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java22
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java17
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java18
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java18
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java19
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java18
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TypeDeclarationStmt.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java17
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java20
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java18
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java15
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java185
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/DumpVisitor.java7
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java613
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitor.java172
-rw-r--r--javaparser-core/src/main/javacc/java_1_8.jj355
110 files changed, 2214 insertions, 968 deletions
diff --git a/javaparser-core/src/main/java/com/github/javaparser/CommentsInserter.java b/javaparser-core/src/main/java/com/github/javaparser/CommentsInserter.java
index 41222707b..6445c56b5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/CommentsInserter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/CommentsInserter.java
@@ -145,7 +145,7 @@ class CommentsInserter {
for (Comment comment : commentsToAttribute) {
if (comment.isLineComment()) {
for (Node child : children) {
- if (child.getEndLine() == comment.getBeginLine()
+ if (child.getEnd().line == comment.getBegin().line
&& attributeLineCommentToNodeOrChild(child,
comment.asLineComment())) {
attributedComments.add(comment);
@@ -196,7 +196,7 @@ class CommentsInserter {
LineComment lineComment) {
// The node start and end at the same line as the comment,
// let's give to it the comment
- if (node.getBeginLine() == lineComment.getBeginLine()
+ if (node.getBegin().line == lineComment.getBegin().line
&& !node.hasComment()) {
node.setComment(lineComment);
return true;
@@ -222,8 +222,8 @@ class CommentsInserter {
if (!PositionUtils.areInOrder(a, b)) {
return thereAreLinesBetween(b, a);
}
- int endOfA = a.getEndLine();
- return b.getBeginLine() > (endOfA + 1);
+ int endOfA = a.getEnd().line;
+ return b.getBegin().line > (endOfA + 1);
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/Position.java b/javaparser-core/src/main/java/com/github/javaparser/Position.java
index 522411c27..1a75c4eb5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/Position.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/Position.java
@@ -18,36 +18,102 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser;
import com.github.javaparser.ast.Node;
-public class Position {
- private int line;
- private int column;
+/**
+ * A position in a source file. Lines and columns start counting at 1.
+ */
+public class Position implements Comparable<Position> {
+ public final int line;
+ public final int column;
+
+ public static final Position ABSOLUTE_START = new Position(Node.ABSOLUTE_BEGIN_LINE, -1);
+ public static final Position ABSOLUTE_END = new Position(Node.ABSOLUTE_END_LINE, -1);
+
+ /**
+ * The first position in the file
+ */
+ public static final Position HOME = new Position(1, 1);
+ public static final Position UNKNOWN = new Position(0, 0);
+
+ public Position(int line, int column) {
+ if (line < Node.ABSOLUTE_END_LINE) {
+ throw new IllegalArgumentException("Can't position at line " + line);
+ }
+ if (column < -1) {
+ throw new IllegalArgumentException("Can't position at column " + column);
+ }
+ this.line = line;
+ this.column = column;
+ }
+
+ /**
+ * Convenient factory method.
+ */
+ public static Position pos(int line, int column) {
+ return new Position(line, column);
+ }
+
+ public Position withColumn(int column) {
+ return new Position(this.line, column);
+ }
+
+ public Position withLine(int line) {
+ return new Position(line, this.column);
+ }
+
+ public boolean isAfter(Position position) {
+ if (position.line == Node.ABSOLUTE_BEGIN_LINE) return true;
+ if (line > position.line) {
+ return true;
+ } else if (line == position.line) {
+ return column > position.column;
+ }
+ return false;
+
+ }
+
+ public boolean isBefore(Position position) {
+ if (position.line == Node.ABSOLUTE_END_LINE) return true;
+ if (line < position.line) {
+ return true;
+ } else if (line == position.line) {
+ return column < position.column;
+ }
+ return false;
+ }
- public static final Position ABSOLUTE_START = new Position(Node.ABSOLUTE_BEGIN_LINE,-1);
- public static final Position ABSOLUTE_END = new Position(Node.ABSOLUTE_END_LINE,-1);
+ @Override
+ public int compareTo(Position o) {
+ if (isBefore(o)) {
+ return -1;
+ }
+ if (isAfter(o)) {
+ return 1;
+ }
+ return 0;
+ }
- public static Position beginOf(Node node){
- return new Position(node.getBeginLine(),node.getBeginColumn());
- }
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
- public static Position endOf(Node node){
- return new Position(node.getEndLine(),node.getEndColumn());
- }
+ Position position = (Position) o;
- public Position(int line, int column){
- this.line = line;
- this.column = column;
- }
+ return line == position.line && column == position.column;
+ }
- public int getLine(){
- return this.line;
- }
+ @Override
+ public int hashCode() {
+ return 31 * line + column;
+ }
- public int getColumn(){
- return this.column;
- }
+ @Override
+ public String toString() {
+ return "(line " + line + ",col " + column + ")";
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/PositionUtils.java b/javaparser-core/src/main/java/com/github/javaparser/PositionUtils.java
index 1fbb10b88..99b00e7e9 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/PositionUtils.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/PositionUtils.java
@@ -74,9 +74,9 @@ public final class PositionUtils {
}
}
- int signLine = signum( a.getBeginLine() - b.getBeginLine() );
+ int signLine = signum( a.getBegin().line - b.getBegin().line );
if (signLine == 0) {
- return signum(a.getBeginColumn() - b.getBeginColumn());
+ return signum(a.getBegin().column - b.getBegin().column);
} else {
return signLine;
}
@@ -97,12 +97,12 @@ public final class PositionUtils {
}
private static int beginLineWithoutConsideringAnnotation(Node node) {
- return beginNodeWithoutConsideringAnnotations(node).getBeginLine();
+ return beginNodeWithoutConsideringAnnotations(node).getBegin().line;
}
private static int beginColumnWithoutConsideringAnnotation(Node node) {
- return beginNodeWithoutConsideringAnnotations(node).getBeginColumn();
+ return beginNodeWithoutConsideringAnnotations(node).getBegin().column;
}
private static Node beginNodeWithoutConsideringAnnotations(Node node) {
@@ -129,11 +129,11 @@ public final class PositionUtils {
if (container instanceof AnnotableNode){
int bl = beginLineWithoutConsideringAnnotation(container);
int bc = beginColumnWithoutConsideringAnnotation(container);
- if (bl>contained.getBeginLine()) return false;
- if (bl==contained.getBeginLine() && bc>contained.getBeginColumn()) return false;
- if (container.getEndLine()<contained.getEndLine()) return false;
- if (container.getEndLine()==contained.getEndLine() && container.getEndColumn()<contained.getEndColumn()) return false;
- return true;
+ if (bl>contained.getBegin().line) return false;
+ if (bl==contained.getBegin().line && bc>contained.getBegin().column) return false;
+ if (container.getEnd().line<contained.getEnd().line) return false;
+ // TODO < or <= ?
+ return !(container.getEnd().line == contained.getEnd().line && container.getEnd().column < contained.getEnd().column);
}
return true;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/Range.java b/javaparser-core/src/main/java/com/github/javaparser/Range.java
new file mode 100644
index 000000000..68e364aed
--- /dev/null
+++ b/javaparser-core/src/main/java/com/github/javaparser/Range.java
@@ -0,0 +1,89 @@
+package com.github.javaparser;
+
+import static com.github.javaparser.Position.pos;
+
+/**
+ * A range of characters in a source file, from "begin" to "end", including the characters at "begin" and "end".
+ */
+public class Range {
+ public static final Range UNKNOWN = range(Position.UNKNOWN, Position.UNKNOWN);
+
+ public final Position begin;
+ public final Position end;
+
+ public Range(Position begin, Position end) {
+ if (begin == null) {
+ throw new IllegalArgumentException("begin can't be null");
+ }
+ if (end == null) {
+ throw new IllegalArgumentException("end can't be null");
+ }
+ this.begin = begin;
+ this.end = end;
+ }
+
+ public static Range range(Position begin, Position end) {
+ return new Range(begin, end);
+ }
+
+ public static Range range(int beginLine, int beginColumn, int endLine, int endColumn) {
+ return new Range(pos(beginLine, beginColumn), pos(endLine, endColumn));
+ }
+
+ public Range withBeginColumn(int column) {
+ return range(begin.withColumn(column), end);
+ }
+
+ public Range withBeginLine(int line) {
+ return range(begin.withLine(line), end);
+ }
+
+ public Range withEndColumn(int column) {
+ return range(begin, end.withColumn(column));
+ }
+
+ public Range withEndLine(int line) {
+ return range(begin, end.withLine(line));
+ }
+
+ public Range withBegin(Position begin) {
+ return range(begin, this.end);
+ }
+
+ public Range withEnd(Position end) {
+ return range(this.begin, end);
+ }
+
+ public boolean contains(Range other) {
+ return begin.isBefore(other.begin) && end.isAfter(other.end);
+ }
+
+ public boolean isBefore(Position position) {
+ return end.isBefore(position);
+ }
+
+ public boolean isAfter(Position position) {
+ return begin.isAfter(position);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Range range = (Range) o;
+
+ return begin.equals(range.begin) && end.equals(range.end);
+
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * begin.hashCode() + end.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return begin+"-"+end;
+ }
+}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/AccessSpecifier.java b/javaparser-core/src/main/java/com/github/javaparser/ast/AccessSpecifier.java
index 5eafdac64..121b8bfea 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/AccessSpecifier.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/AccessSpecifier.java
@@ -37,7 +37,7 @@ public enum AccessSpecifier {
private String codeRepresenation;
- private AccessSpecifier(String codeRepresentation) {
+ AccessSpecifier(String codeRepresentation) {
this.codeRepresenation = codeRepresentation;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java b/javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java
index 13636242f..5ceee3841 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java
@@ -21,19 +21,18 @@
package com.github.javaparser.ast;
-import com.github.javaparser.ast.body.AnnotationDeclaration;
-import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
-import com.github.javaparser.ast.body.EmptyTypeDeclaration;
-import com.github.javaparser.ast.body.EnumDeclaration;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
+import com.github.javaparser.ast.body.*;
import com.github.javaparser.ast.comments.Comment;
import com.github.javaparser.ast.comments.JavadocComment;
-import com.github.javaparser.ast.body.TypeDeclaration;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
-import static com.github.javaparser.ast.internal.Utils.*;
+import static com.github.javaparser.Position.pos;
+import static com.github.javaparser.ast.internal.Utils.ensureNotNull;
/**
* <p>
@@ -67,8 +66,16 @@ public final class CompilationUnit extends Node {
setTypes(types);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public CompilationUnit(int beginLine, int beginColumn, int endLine, int endColumn, PackageDeclaration pakage, List<ImportDeclaration> imports, List<TypeDeclaration> types) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), pakage, imports, types);
+ }
+
+ public CompilationUnit(Range range, PackageDeclaration pakage, List<ImportDeclaration> imports, List<TypeDeclaration> types) {
+ super(range);
setPackage(pakage);
setImports(imports);
setTypes(types);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/ImportDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/ImportDeclaration.java
index e32d38140..5b7495b5e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/ImportDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/ImportDeclaration.java
@@ -21,10 +21,14 @@
package com.github.javaparser.ast;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.NameExpr;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* <p>
* This class represents a import declaration or an empty import declaration. Imports are optional for the
@@ -52,8 +56,16 @@ public final class ImportDeclaration extends Node {
asterisk = false;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
private ImportDeclaration(int beginLine, int beginColumn, int endLine, int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ private ImportDeclaration(Range range) {
+ super(range);
this.isEmptyImportDeclaration = true;
static_ = false;
asterisk = false;
@@ -68,11 +80,20 @@ public final class ImportDeclaration extends Node {
/**
* Create an empty import declaration specifying its position.
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public static ImportDeclaration createEmptyDeclaration(int beginLine, int beginColumn, int endLine, int endColumn){
return new ImportDeclaration(beginLine, beginColumn, endLine, endColumn);
}
+ /**
+ * Create an empty import declaration specifying its position.
+ */
+ public static ImportDeclaration createEmptyDeclaration(Range range){
+ return new ImportDeclaration(range);
+ }
+
public ImportDeclaration(NameExpr name, boolean isStatic, boolean isAsterisk) {
setAsterisk(isAsterisk);
setName(name);
@@ -80,8 +101,16 @@ public final class ImportDeclaration extends Node {
this.isEmptyImportDeclaration = false;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ImportDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, NameExpr name, boolean isStatic, boolean isAsterisk) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name, isStatic, isAsterisk);
+ }
+
+ public ImportDeclaration(Range range, NameExpr name, boolean isStatic, boolean isAsterisk) {
+ super(range);
setAsterisk(isAsterisk);
setName(name);
setStatic(isStatic);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/Node.java b/javaparser-core/src/main/java/com/github/javaparser/ast/Node.java
index c25646a4c..b37a0b511 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/Node.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/Node.java
@@ -21,12 +21,16 @@
package com.github.javaparser.ast;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
+import com.github.javaparser.ast.comments.Comment;
+import com.github.javaparser.ast.visitor.*;
+
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import com.github.javaparser.ast.comments.Comment;
-import com.github.javaparser.ast.visitor.*;
+import static com.github.javaparser.Position.pos;
/**
* Abstract class for all nodes of the AST.
@@ -38,14 +42,7 @@ import com.github.javaparser.ast.visitor.*;
* @author Julio Vilmar Gesser
*/
public abstract class Node implements Cloneable {
-
- private int beginLine;
-
- private int beginColumn;
-
- private int endLine;
-
- private int endColumn;
+ private Range range;
private Node parentNode;
@@ -60,13 +57,19 @@ public abstract class Node implements Cloneable {
private Comment comment;
public Node() {
+ this(Range.UNKNOWN);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public Node(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- this.beginLine = beginLine;
- this.beginColumn = beginColumn;
- this.endLine = endLine;
- this.endColumn = endColumn;
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public Node(Range range) {
+ this.range = range;
}
/**
@@ -100,18 +103,22 @@ public abstract class Node implements Cloneable {
* Return the begin column of this node.
*
* @return the begin column of this node
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public final int getBeginColumn() {
- return beginColumn;
+ return range.begin.column;
}
/**
* Return the begin line of this node.
*
* @return the begin line of this node
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public final int getBeginLine() {
- return beginLine;
+ return range.begin.line;
}
/**
@@ -136,18 +143,22 @@ public abstract class Node implements Cloneable {
* Return the end column of this node.
*
* @return the end column of this node
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public final int getEndColumn() {
- return endColumn;
+ return range.end.column;
}
/**
* Return the end line of this node.
*
* @return the end line of this node
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public final int getEndLine() {
- return endLine;
+ return range.end.line;
}
/**
@@ -155,9 +166,11 @@ public abstract class Node implements Cloneable {
*
* @param beginColumn
* the begin column of this node
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public final void setBeginColumn(final int beginColumn) {
- this.beginColumn = beginColumn;
+ range = range.withBeginColumn(beginColumn);
}
/**
@@ -165,9 +178,53 @@ public abstract class Node implements Cloneable {
*
* @param beginLine
* the begin line of this node
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public final void setBeginLine(final int beginLine) {
- this.beginLine = beginLine;
+ range = range.withBeginLine(beginLine);
+ }
+
+ /**
+ * The begin position of this node in the source file.
+ */
+ public Position getBegin() {
+ return range.begin;
+ }
+
+ /**
+ * The end position of this node in the source file.
+ */
+ public Position getEnd() {
+ return range.end;
+ }
+
+ /**
+ * Sets the begin position of this node in the source file.
+ */
+ public void setBegin(Position begin) {
+ range=range.withBegin(begin);
+ }
+
+ /**
+ * Sets the end position of this node in the source file.
+ */
+ public void setEnd(Position end) {
+ range=range.withEnd(end);
+ }
+
+ /**
+ * @return the range of characters in the source code that this node covers.
+ */
+ public Range getRange() {
+ return range;
+ }
+
+ /**
+ * @param range the range of characters in the source code that this node covers.
+ */
+ public void setRange(Range range) {
+ this.range = range;
}
/**
@@ -203,9 +260,11 @@ public abstract class Node implements Cloneable {
*
* @param endColumn
* the end column of this node
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public final void setEndColumn(final int endColumn) {
- this.endColumn = endColumn;
+ range = range.withEndColumn(endColumn);
}
/**
@@ -213,9 +272,11 @@ public abstract class Node implements Cloneable {
*
* @param endLine
* the end line of this node
+ * @deprecated prefer using Range objects.
*/
+ @Deprecated
public final void setEndLine(final int endLine) {
- this.endLine = endLine;
+ range = range.withEndLine(endLine);
}
/**
@@ -263,11 +324,7 @@ public abstract class Node implements Cloneable {
}
public boolean contains(Node other) {
- if (getBeginLine() > other.getBeginLine()) return false;
- if (getBeginLine() == other.getBeginLine() && getBeginColumn() > other.getBeginColumn()) return false;
- if (getEndLine() < other.getEndLine()) return false;
- if (getEndLine() == other.getEndLine() && getEndColumn() < other.getEndColumn()) return false;
- return true;
+ return range.contains(other.range);
}
public void addOrphanComment(Comment comment) {
@@ -330,9 +387,7 @@ public abstract class Node implements Cloneable {
protected void setAsParentNodeOf(List<? extends Node> childNodes) {
if (childNodes != null) {
- Iterator<? extends Node> it = childNodes.iterator();
- while (it.hasNext()) {
- Node current = it.next();
+ for (Node current : childNodes) {
current.setParentNode(this);
}
}
@@ -347,30 +402,30 @@ public abstract class Node implements Cloneable {
public static final int ABSOLUTE_BEGIN_LINE = -1;
public static final int ABSOLUTE_END_LINE = -2;
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public boolean isPositionedAfter(int line, int column) {
- if (line == ABSOLUTE_BEGIN_LINE) return true;
- if (getBeginLine() > line) {
- return true;
- } else if (getBeginLine() == line) {
- return getBeginColumn() > column;
- } else {
- return false;
- }
+ return range.isAfter(pos(line, column));
}
+ public boolean isPositionedAfter(Position position) {
+ return range.isAfter(position);
+ }
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public boolean isPositionedBefore(int line, int column) {
- if (line == ABSOLUTE_END_LINE) return true;
- if (getEndLine() < line) {
- return true;
- } else if (getEndLine() == line) {
- return getEndColumn() < column;
- } else {
- return false;
- }
+ return range.isBefore(pos(line, column));
+ }
+
+ public boolean isPositionedBefore(Position position) {
+ return range.isBefore(position);
}
- public boolean hasComment()
- {
+ public boolean hasComment() {
return comment != null;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/PackageDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/PackageDeclaration.java
index 7ddbe2fd7..efa0516b5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/PackageDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/PackageDeclaration.java
@@ -21,16 +21,17 @@
package com.github.javaparser.ast;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.expr.NameExpr;
import com.github.javaparser.ast.internal.Utils;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* <p>
* This class represents the package declaration. The package declaration is
@@ -62,8 +63,16 @@ public final class PackageDeclaration extends Node {
setName(name);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public PackageDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations, NameExpr name) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), annotations, name);
+ }
+
+ public PackageDeclaration(Range range, List<AnnotationExpr> annotations, NameExpr name) {
+ super(range);
setAnnotations(annotations);
setName(name);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/TypeArguments.java b/javaparser-core/src/main/java/com/github/javaparser/ast/TypeArguments.java
index 80980b09f..ed819e8c5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/TypeArguments.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/TypeArguments.java
@@ -26,7 +26,6 @@ import java.util.Collections;
import java.util.List;
import static com.github.javaparser.ast.internal.Utils.ensureNotNull;
-import static java.util.Collections.unmodifiableList;
public class TypeArguments {
public static final TypeArguments EMPTY = withArguments(Collections.<Type>emptyList());
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/TypeParameter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/TypeParameter.java
index 57e069f04..c3378f0b6 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/TypeParameter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/TypeParameter.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.visitor.GenericVisitor;
@@ -28,6 +29,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.ensureNotNull;
/**
@@ -58,9 +60,17 @@ public final class TypeParameter extends Node implements NamedNode {
setTypeBound(typeBound);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public TypeParameter(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String name, final List<ClassOrInterfaceType> typeBound) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final String name, final List<ClassOrInterfaceType> typeBound) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name, typeBound);
+ }
+
+ public TypeParameter(Range range, final String name, final List<ClassOrInterfaceType> typeBound) {
+ super(range);
setName(name);
setTypeBound(typeBound);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotableNode.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotableNode.java
index 47c8c4fe8..d416f6abb 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotableNode.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotableNode.java
@@ -32,5 +32,5 @@ import java.util.List;
* @since July 2014
*/
public interface AnnotableNode {
- public List<AnnotationExpr> getAnnotations();
+ List<AnnotationExpr> getAnnotations();
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java
index 9750d5e2f..b69866c1b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationDeclaration.java
@@ -21,12 +21,15 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -43,8 +46,16 @@ public final class AnnotationDeclaration extends TypeDeclaration {
super(annotations, modifiers, name, members);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public AnnotationDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, String name, List<BodyDeclaration> members) {
- super(beginLine, beginColumn, endLine, endColumn, annotations, modifiers, name, members);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, name, members);
+ }
+
+ public AnnotationDeclaration(Range range, int modifiers, List<AnnotationExpr> annotations, String name, List<BodyDeclaration> members) {
+ super(range, annotations, modifiers, name, members);
}
@Override
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java
index 8b6a3f26a..ca2c6e8b5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.DocumentableNode;
import com.github.javaparser.ast.NamedNode;
import com.github.javaparser.ast.NodeWithModifiers;
@@ -34,6 +35,8 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -65,8 +68,16 @@ public final class AnnotationMemberDeclaration extends BodyDeclaration implement
setDefaultValue(defaultValue);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public AnnotationMemberDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, Type type, String name, Expression defaultValue) {
- super(beginLine, beginColumn, endLine, endColumn, annotations);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, type, name, defaultValue);
+ }
+
+ public AnnotationMemberDeclaration(Range range, int modifiers, List<AnnotationExpr> annotations, Type type, String name, Expression defaultValue) {
+ super(range, annotations);
setModifiers(modifiers);
setType(type);
setName(name);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/BaseParameter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/BaseParameter.java
index 78a9d2edc..0f67ceaf3 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/BaseParameter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/BaseParameter.java
@@ -23,10 +23,13 @@ package com.github.javaparser.ast.body;
import java.util.List;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.NamedNode;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.NodeWithModifiers;
import com.github.javaparser.ast.expr.AnnotationExpr;
+
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
public abstract class BaseParameter
@@ -57,8 +60,16 @@ public abstract class BaseParameter
setId(id);
}
- public BaseParameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, VariableDeclaratorId id) {
- super(beginLine, beginColumn, endLine, endColumn);
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
+ public BaseParameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, VariableDeclaratorId id) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, id);
+ }
+
+ public BaseParameter(final Range range, int modifiers, List<AnnotationExpr> annotations, VariableDeclaratorId id) {
+ super(range);
setModifiers(modifiers);
setAnnotations(annotations);
setId(id);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java
index a810ce7a8..82ae51f4c 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java
@@ -21,12 +21,15 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.internal.Utils;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -41,8 +44,16 @@ public abstract class BodyDeclaration extends Node implements AnnotableNode {
setAnnotations(annotations);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public BodyDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), annotations);
+ }
+
+ public BodyDeclaration(Range range, List<AnnotationExpr> annotations) {
+ super(range);
setAnnotations(annotations);
}
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 6e5695b4b..b512fef23 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
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypeParameter;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
@@ -29,6 +30,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.ensureNotNull;
/**
@@ -64,12 +66,23 @@ public final class ClassOrInterfaceDeclaration extends TypeDeclaration {
setImplements(implementsList);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ClassOrInterfaceDeclaration(final int beginLine, final int beginColumn, final int endLine,
final int endColumn, final int modifiers,
final List<AnnotationExpr> annotations, final boolean isInterface, final String name,
final List<TypeParameter> typeParameters, final List<ClassOrInterfaceType> extendsList,
final List<ClassOrInterfaceType> implementsList, final List<BodyDeclaration> members) {
- super(beginLine, beginColumn, endLine, endColumn, annotations, modifiers, name, members);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, isInterface, name, typeParameters, extendsList, implementsList, members);
+ }
+
+ public ClassOrInterfaceDeclaration(Range range, final int modifiers,
+ final List<AnnotationExpr> annotations, final boolean isInterface, final String name,
+ final List<TypeParameter> typeParameters, final List<ClassOrInterfaceType> extendsList,
+ final List<ClassOrInterfaceType> implementsList, final List<BodyDeclaration> members) {
+ super(range, annotations, modifiers, name, members);
setInterface(isInterface);
setTypeParameters(typeParameters);
setExtends(extendsList);
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 010c49757..1fa10e87e 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
@@ -23,6 +23,7 @@ package com.github.javaparser.ast.body;
import java.util.List;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.*;
import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.expr.AnnotationExpr;
@@ -32,6 +33,7 @@ import com.github.javaparser.ast.type.ReferenceType;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -71,10 +73,20 @@ public final class ConstructorDeclaration extends BodyDeclaration implements Doc
setBlock(block);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ConstructorDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers,
List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, String name,
List<Parameter> parameters, List<ReferenceType> throws_, BlockStmt block) {
- super(beginLine, beginColumn, endLine, endColumn, annotations);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, typeParameters, name, parameters, throws_, block);
+ }
+
+ public ConstructorDeclaration(Range range, int modifiers,
+ List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, String name,
+ List<Parameter> parameters, List<ReferenceType> throws_, BlockStmt block) {
+ super(range, annotations);
setModifiers(modifiers);
setTypeParameters(typeParameters);
setName(name);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyMemberDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyMemberDeclaration.java
index 6360a4bb5..1abd174d5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyMemberDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyMemberDeclaration.java
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.DocumentableNode;
import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -35,8 +38,16 @@ public final class EmptyMemberDeclaration extends BodyDeclaration implements Doc
super(null);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public EmptyMemberDeclaration(int beginLine, int beginColumn, int endLine, int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn, null);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public EmptyMemberDeclaration(Range range) {
+ super(range, null);
}
@Override
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyTypeDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyTypeDeclaration.java
index 70a62697d..05e57f4cd 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyTypeDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyTypeDeclaration.java
@@ -21,10 +21,13 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -34,8 +37,16 @@ public final class EmptyTypeDeclaration extends TypeDeclaration {
super(null, 0, null, null);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public EmptyTypeDeclaration(int beginLine, int beginColumn, int endLine, int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn, null, 0, null, null);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public EmptyTypeDeclaration(Range range) {
+ super(range, null, 0, null, null);
}
@Override
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 aace9bb3a..38fdcb35f 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
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.DocumentableNode;
import com.github.javaparser.ast.NamedNode;
import com.github.javaparser.ast.comments.JavadocComment;
@@ -31,6 +32,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.ensureNotNull;
/**
@@ -58,8 +60,16 @@ public final class EnumConstantDeclaration extends BodyDeclaration implements Do
setClassBody(classBody);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public EnumConstantDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations, String name, List<Expression> args, List<BodyDeclaration> classBody) {
- super(beginLine, beginColumn, endLine, endColumn, annotations);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), annotations, name, args, classBody);
+ }
+
+ public EnumConstantDeclaration(Range range, List<AnnotationExpr> annotations, String name, List<Expression> args, List<BodyDeclaration> classBody) {
+ super(range, annotations);
setName(name);
setArgs(args);
setClassBody(classBody);
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 01ed2520f..fc863e98b 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
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.visitor.GenericVisitor;
@@ -28,6 +29,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -52,8 +54,16 @@ public final class EnumDeclaration extends TypeDeclaration {
setEntries(entries);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public EnumDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, String name, List<ClassOrInterfaceType> implementsList, List<EnumConstantDeclaration> entries, List<BodyDeclaration> members) {
- super(beginLine, beginColumn, endLine, endColumn, annotations, modifiers, name, members);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, name, implementsList, entries, members);
+ }
+
+ public EnumDeclaration(Range range, int modifiers, List<AnnotationExpr> annotations, String name, List<ClassOrInterfaceType> implementsList, List<EnumConstantDeclaration> entries, List<BodyDeclaration> members) {
+ super(range, annotations, modifiers, name, members);
setImplements(implementsList);
setEntries(entries);
}
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 32379396c..a966e430c 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
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.DocumentableNode;
import com.github.javaparser.ast.NodeWithModifiers;
import com.github.javaparser.ast.TypedNode;
@@ -33,6 +34,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.ArrayList;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -70,8 +72,16 @@ public final class FieldDeclaration extends BodyDeclaration implements Documenta
setVariables(variables);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public FieldDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, Type type, List<VariableDeclarator> variables) {
- super(beginLine, beginColumn, endLine, endColumn, annotations);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, type, variables);
+ }
+
+ public FieldDeclaration(Range range, int modifiers, List<AnnotationExpr> annotations, Type type, List<VariableDeclarator> variables) {
+ super(range, annotations);
setModifiers(modifiers);
setType(type);
setVariables(variables);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java
index 10fb62942..5d8885092 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java
@@ -21,12 +21,15 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.DocumentableNode;
import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -45,8 +48,16 @@ public final class InitializerDeclaration extends BodyDeclaration implements Doc
setBlock(block);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public InitializerDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, boolean isStatic, BlockStmt block) {
- super(beginLine, beginColumn, endLine, endColumn, null);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), isStatic, block);
+ }
+
+ public InitializerDeclaration(Range range, boolean isStatic, BlockStmt block) {
+ super(range, null);
setStatic(isStatic);
setBlock(block);
}
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 166754699..7c2e606c3 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
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.*;
import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.expr.AnnotationExpr;
@@ -33,6 +34,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.ensureNotNull;
/**
@@ -88,11 +90,22 @@ public final class MethodDeclaration extends BodyDeclaration implements Document
setBody(body);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public MethodDeclaration(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final int modifiers, final List<AnnotationExpr> annotations,
final List<TypeParameter> typeParameters, final Type type, final String name,
final List<Parameter> parameters, final int arrayCount, final List<ReferenceType> throws_, final BlockStmt body) {
- super(beginLine, beginColumn, endLine, endColumn, annotations);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, typeParameters, type, name, parameters, arrayCount, throws_, body);
+ }
+
+ public MethodDeclaration(Range range,
+ final int modifiers, final List<AnnotationExpr> annotations,
+ final List<TypeParameter> typeParameters, final Type type, final String name,
+ final List<Parameter> parameters, final int arrayCount, final List<ReferenceType> throws_, final BlockStmt body) {
+ super(range, annotations);
setModifiers(modifiers);
setTypeParameters(typeParameters);
setType(type);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/MultiTypeParameter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/MultiTypeParameter.java
index 2e0c97d77..a9fbf8518 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/MultiTypeParameter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/MultiTypeParameter.java
@@ -21,14 +21,15 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.AnnotationExpr;
-import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.type.UnionType;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.ensureNotNull;
public class MultiTypeParameter extends BaseParameter {
@@ -41,8 +42,16 @@ public class MultiTypeParameter extends BaseParameter {
this.type = type;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public MultiTypeParameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, UnionType type, VariableDeclaratorId id) {
- super(beginLine, beginColumn, endLine, endColumn, modifiers, annotations, id);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, type, id);
+ }
+
+ public MultiTypeParameter(Range range, int modifiers, List<AnnotationExpr> annotations, UnionType type, VariableDeclaratorId id) {
+ super(range, modifiers, annotations, id);
this.type = type;
}
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 fdfc63423..4cdbbadd5 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
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypedNode;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.type.Type;
@@ -29,6 +30,8 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -50,8 +53,16 @@ public final class Parameter extends BaseParameter implements TypedNode {
setType(type);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public Parameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, Type type, boolean isVarArgs, VariableDeclaratorId id) {
- super(beginLine, beginColumn, endLine, endColumn, modifiers, annotations, id);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, type, isVarArgs, id);
+ }
+
+ public Parameter(final Range range, int modifiers, List<AnnotationExpr> annotations, Type type, boolean isVarArgs, VariableDeclaratorId id) {
+ super(range, modifiers, annotations, id);
setType(type);
setVarArgs(isVarArgs);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java
index 9517910c7..691ccb273 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.DocumentableNode;
import com.github.javaparser.ast.NamedNode;
import com.github.javaparser.ast.NodeWithModifiers;
@@ -28,9 +29,9 @@ import com.github.javaparser.ast.comments.JavadocComment;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.expr.NameExpr;
-import java.util.Collections;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -61,11 +62,21 @@ public abstract class TypeDeclaration extends BodyDeclaration implements NamedNo
setMembers(members);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public TypeDeclaration(int beginLine, int beginColumn, int endLine,
int endColumn, List<AnnotationExpr> annotations,
int modifiers, String name,
List<BodyDeclaration> members) {
- super(beginLine, beginColumn, endLine, endColumn, annotations);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), annotations, modifiers, name, members);
+ }
+
+ public TypeDeclaration(Range range, List<AnnotationExpr> annotations,
+ int modifiers, String name,
+ List<BodyDeclaration> members) {
+ super(range, annotations);
setName(name);
setModifiers(modifiers);
setMembers(members);
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 1890d9bda..0fae31531 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
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -53,8 +56,16 @@ public final class VariableDeclarator extends Node {
setInit(init);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public VariableDeclarator(int beginLine, int beginColumn, int endLine, int endColumn, VariableDeclaratorId id, Expression init) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), id, init);
+ }
+
+ public VariableDeclarator(Range range, VariableDeclaratorId id, Expression init) {
+ super(range);
setId(id);
setInit(init);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclaratorId.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclaratorId.java
index 1e1a8390b..eae209bc5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclaratorId.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclaratorId.java
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.body;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.NamedNode;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -42,8 +45,16 @@ public final class VariableDeclaratorId extends Node implements NamedNode {
setName(name);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public VariableDeclaratorId(int beginLine, int beginColumn, int endLine, int endColumn, String name, int arrayCount) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name, arrayCount);
+ }
+
+ public VariableDeclaratorId(Range range, String name, int arrayCount) {
+ super(range);
setName(name);
setArrayCount(arrayCount);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java
index 299493b87..d6d62f114 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.comments;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* <p>
* AST node that represent block comments.
@@ -42,8 +45,16 @@ public final class BlockComment extends Comment {
super(content);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public BlockComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) {
- super(beginLine, beginColumn, endLine, endColumn, content);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), content);
+ }
+
+ public BlockComment(Range range, String content) {
+ super(range, content);
}
@Override
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java
index 135972b92..720f1fd52 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java
@@ -21,8 +21,11 @@
package com.github.javaparser.ast.comments;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.Node;
+import static com.github.javaparser.Position.pos;
+
/**
* Abstract class for all AST nodes that represent comments.
*
@@ -43,8 +46,16 @@ public abstract class Comment extends Node {
this.content = content;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public Comment(int beginLine, int beginColumn, int endLine, int endColumn, String content) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), content);
+ }
+
+ public Comment(Range range, String content) {
+ super(range);
this.content = content;
}
@@ -72,10 +83,8 @@ public abstract class Comment extends Node {
return false;
}
- public LineComment asLineComment()
- {
- if (isLineComment())
- {
+ public LineComment asLineComment() {
+ if (isLineComment()) {
return (LineComment) this;
} else {
throw new UnsupportedOperationException("Not a line comment");
@@ -89,17 +98,14 @@ public abstract class Comment extends Node {
public void setCommentedNode(Node commentedNode)
{
- if (commentedNode==null)
- {
- this.commentedNode = commentedNode;
+ if (commentedNode==null) {
+ this.commentedNode = null;
return;
}
- if (commentedNode==this)
- {
+ if (commentedNode==this) {
throw new IllegalArgumentException();
}
- if (commentedNode instanceof Comment)
- {
+ if (commentedNode instanceof Comment) {
throw new IllegalArgumentException();
}
this.commentedNode = commentedNode;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsCollection.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsCollection.java
index 13f6f8bd1..06168ec18 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsCollection.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsCollection.java
@@ -60,10 +60,10 @@ public class CommentsCollection {
for (Comment c : getAll()){
// we tolerate a difference of one element in the end column:
// it depends how \r and \n are calculated...
- if ( c.getBeginLine()==comment.getBeginLine() &&
- c.getBeginColumn()==comment.getBeginColumn() &&
- c.getEndLine()==comment.getEndLine() &&
- Math.abs(c.getEndColumn()-comment.getEndColumn())<2 ){
+ if ( c.getBegin().line==comment.getBegin().line &&
+ c.getBegin().column==comment.getBegin().column &&
+ c.getEnd().line==comment.getEnd().line &&
+ Math.abs(c.getEnd().column-comment.getEnd().column)<2 ){
return true;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsParser.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsParser.java
index de8c7b88b..efd31fc96 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsParser.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/CommentsParser.java
@@ -24,6 +24,9 @@ package com.github.javaparser.ast.comments;
import java.io.*;
import java.util.*;
+import static com.github.javaparser.Position.pos;
+import static com.github.javaparser.Range.range;
+
/**
* This parser cares exclusively about comments.
*/
@@ -121,14 +124,12 @@ public class CommentsParser {
case CODE:
if (parserState.isLastChar('/') && c == '/') {
currentLineComment = new LineComment();
- currentLineComment.setBeginLine(currLine);
- currentLineComment.setBeginColumn(currCol - 1);
+ currentLineComment.setBegin(pos(currLine, currCol - 1));
state = State.IN_LINE_COMMENT;
currentContent = new StringBuilder();
} else if (parserState.isLastChar('/') && c == '*') {
currentBlockComment = new BlockComment();
- currentBlockComment.setBeginLine(currLine);
- currentBlockComment.setBeginColumn(currCol - 1);
+ currentBlockComment.setBegin(pos(currLine, currCol - 1));
state = State.IN_BLOCK_COMMENT;
currentContent = new StringBuilder();
} else if (c == '"') {
@@ -142,8 +143,7 @@ public class CommentsParser {
case IN_LINE_COMMENT:
if (c=='\n' || c=='\r'){
currentLineComment.setContent(currentContent.toString());
- currentLineComment.setEndLine(currLine);
- currentLineComment.setEndColumn(currCol);
+ currentLineComment.setEnd(pos(currLine, currCol));
comments.addComment(currentLineComment);
state = State.CODE;
} else {
@@ -164,15 +164,11 @@ public class CommentsParser {
if (content.startsWith("*")){
JavadocComment javadocComment = new JavadocComment();
javadocComment.setContent(content.substring(1));
- javadocComment.setBeginLine(currentBlockComment.getBeginLine());
- javadocComment.setBeginColumn(currentBlockComment.getBeginColumn());
- javadocComment.setEndLine(currLine);
- javadocComment.setEndColumn(currCol+1);
+ javadocComment.setRange(range(pos(currentBlockComment.getBegin().line, currentBlockComment.getBegin().column), pos(currLine, currCol+1)));
comments.addComment(javadocComment);
} else {
currentBlockComment.setContent(content);
- currentBlockComment.setEndLine(currLine);
- currentBlockComment.setEndColumn(currCol+1);
+ currentBlockComment.setEnd(pos(currLine, currCol+1));
comments.addComment(currentBlockComment);
}
state = State.CODE;
@@ -217,8 +213,7 @@ public class CommentsParser {
if (state==State.IN_LINE_COMMENT){
currentLineComment.setContent(currentContent.toString());
- currentLineComment.setEndLine(currLine);
- currentLineComment.setEndColumn(currCol);
+ currentLineComment.setEnd(pos(currLine, currCol));
comments.addComment(currentLineComment);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java
index a070321ff..be160a8cc 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.comments;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -36,8 +39,16 @@ public final class JavadocComment extends Comment {
super(content);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public JavadocComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) {
- super(beginLine, beginColumn, endLine, endColumn, content);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), content);
+ }
+
+ public JavadocComment(Range range, String content) {
+ super(range, content);
}
@Override
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java
index bff1ae553..79fdc40c7 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.comments;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* <p>
* AST node that represent line comments.
@@ -41,8 +44,16 @@ public final class LineComment extends Comment {
super(content);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public LineComment(int beginLine, int beginColumn, int endLine, int endColumn, String content) {
- super(beginLine, beginColumn, endLine, endColumn, content);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), content);
+ }
+
+ public LineComment(Range range, String content) {
+ super(range, content);
}
@Override
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java
index 8c65e926f..01cd8efd0 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java
@@ -21,6 +21,10 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
+
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -30,9 +34,17 @@ public abstract class AnnotationExpr extends Expression {
public AnnotationExpr() {}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public AnnotationExpr(int beginLine, int beginColumn, int endLine,
- int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ int endColumn) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public AnnotationExpr(Range range) {
+ super(range);
}
public NameExpr getName() {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java
index 7026d15eb..170bd5583 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -41,8 +44,16 @@ public final class ArrayAccessExpr extends Expression {
setIndex(index);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ArrayAccessExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression name, Expression index) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name, index);
+ }
+
+ public ArrayAccessExpr(Range range, Expression name, Expression index) {
+ super(range);
setName(name);
setIndex(index);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java
index 4672cae0c..a4b8dd514 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypedNode;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
@@ -28,6 +29,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -55,8 +57,16 @@ public final class ArrayCreationExpr extends Expression implements TypedNode {
setDimensions(null);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ArrayCreationExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type, int arrayCount, ArrayInitializerExpr initializer) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), type, arrayCount, initializer);
+ }
+
+ public ArrayCreationExpr(Range range, Type type, int arrayCount, ArrayInitializerExpr initializer) {
+ super(range);
setType(type);
setArrayCount(arrayCount);
setInitializer(initializer);
@@ -70,8 +80,16 @@ public final class ArrayCreationExpr extends Expression implements TypedNode {
setInitializer(null);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ArrayCreationExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type, List<Expression> dimensions, int arrayCount) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), type, dimensions, arrayCount);
+ }
+
+ public ArrayCreationExpr(Range range, Type type, List<Expression> dimensions, int arrayCount) {
+ super(range);
setType(type);
setArrayCount(arrayCount);
setDimensions(dimensions);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java
index 04096266c..80c0475e4 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java
@@ -21,11 +21,13 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.ensureNotNull;
/**
@@ -42,8 +44,16 @@ public final class ArrayInitializerExpr extends Expression {
setValues(values);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ArrayInitializerExpr(int beginLine, int beginColumn, int endLine, int endColumn, List<Expression> values) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), values);
+ }
+
+ public ArrayInitializerExpr(Range range, List<Expression> values) {
+ super(range);
setValues(values);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java
index b6be13719..87f5064a8 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/AssignExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -59,8 +62,16 @@ public final class AssignExpr extends Expression {
setOperator(op);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public AssignExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression target, Expression value, Operator op) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), target, value, op);
+ }
+
+ public AssignExpr(Range range, Expression target, Expression value, Operator op) {
+ super(range);
setTarget(target);
setValue(value);
setOperator(op);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java
index 218706593..3698368d3 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -66,8 +69,16 @@ public final class BinaryExpr extends Expression {
setOperator(op);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public BinaryExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression left, Expression right, Operator op) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), left, right, op);
+ }
+
+ public BinaryExpr(Range range, Expression left, Expression right, Operator op) {
+ super(range);
setLeft(left);
setRight(right);
setOperator(op);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java
index e92244a62..ffa56f108 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -38,8 +41,16 @@ public final class BooleanLiteralExpr extends LiteralExpr {
setValue(value);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public BooleanLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, boolean value) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), value);
+ }
+
+ public BooleanLiteralExpr(Range range, boolean value) {
+ super(range);
setValue(value);
}
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 d4a3cdbf4..fbc776845 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
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypedNode;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -43,8 +46,16 @@ public final class CastExpr extends Expression implements TypedNode {
setExpr(expr);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public CastExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type, Expression expr) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), type, expr);
+ }
+
+ public CastExpr(Range range, Type type, Expression expr) {
+ super(range);
setType(type);
setExpr(expr);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java
index 061805d47..82ca7691d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -36,8 +39,16 @@ public final class CharLiteralExpr extends StringLiteralExpr {
super(value);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public CharLiteralExpr(int beginLine, int beginColumn, int endLine, int endColumn, String value) {
- super(beginLine, beginColumn, endLine, endColumn, value);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), value);
+ }
+
+ public CharLiteralExpr(Range range, String value) {
+ super(range, value);
}
@Override
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java
index 3407e98d5..ad97aef38 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypedNode;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* Defines an expression that accesses the class of a type.
* Example:
@@ -45,8 +48,16 @@ public final class ClassExpr extends Expression implements TypedNode {
setType(type);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ClassExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), type);
+ }
+
+ public ClassExpr(Range range, Type type) {
+ super(range);
setType(type);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java
index 31db61cca..d89fd1ac8 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -44,8 +47,16 @@ public final class ConditionalExpr extends Expression {
setElseExpr(elseExpr);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ConditionalExpr(int beginLine, int beginColumn, int endLine, int endColumn, Expression condition, Expression thenExpr, Expression elseExpr) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), condition, thenExpr, elseExpr);
+ }
+
+ public ConditionalExpr(Range range, Expression condition, Expression thenExpr, Expression elseExpr) {
+ super(range);
setCondition(condition);
setThenExpr(thenExpr);
setElseExpr(elseExpr);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java
index ce6962d7b..85ffb015b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -36,9 +39,16 @@ public final class DoubleLiteralExpr extends StringLiteralExpr {
super(value);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public DoubleLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String value) {
- super(beginLine, beginColumn, endLine, endColumn, value);
+ final String value) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), value);
+ }
+ public DoubleLiteralExpr(final Range range, final String value) {
+ super(range, value);
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java
index 72f9de2a1..dab7f294b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -38,9 +41,17 @@ public final class EnclosedExpr extends Expression {
setInner(inner);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public EnclosedExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression inner) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression inner) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), inner);
+ }
+
+ public EnclosedExpr(final Range range, final Expression inner) {
+ super(range);
setInner(inner);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java
index 8b36d6b1d..45fe84216 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java
@@ -21,8 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.Node;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -31,8 +35,16 @@ public abstract class Expression extends Node {
public Expression() {
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public Expression(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public Expression(Range range) {
+ super(range);
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java
index 6e581f675..f1d4fa49e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java
@@ -21,12 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -48,9 +50,17 @@ public final class FieldAccessExpr extends Expression {
setField(field);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public FieldAccessExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression scope, final List<Type> typeArgs, final String field) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression scope, final List<Type> typeArgs, final String field) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), scope, typeArgs, field);
+ }
+
+ public FieldAccessExpr(final Range range, final Expression scope, final List<Type> typeArgs, final String field) {
+ super(range);
setScope(scope);
setTypeArgs(typeArgs);
setField(field);
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 459c1a24b..d0426d64c 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
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypedNode;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -43,9 +46,17 @@ public final class InstanceOfExpr extends Expression implements TypedNode {
setType(type);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public InstanceOfExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression expr, final Type type) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression expr, final Type type) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), expr, type);
+ }
+
+ public InstanceOfExpr(final Range range, final Expression expr, final Type type) {
+ super(range);
setExpr(expr);
setType(type);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java
index b326c5770..7f1e1a45f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -40,9 +43,17 @@ public class IntegerLiteralExpr extends StringLiteralExpr {
super(value);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public IntegerLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String value) {
- super(beginLine, beginColumn, endLine, endColumn, value);
+ final String value) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), value);
+ }
+
+ public IntegerLiteralExpr(final Range range, final String value) {
+ super(range, value);
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralMinValueExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralMinValueExpr.java
index 238b56431..ba7b1bf92 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralMinValueExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralMinValueExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -33,8 +36,16 @@ public final class IntegerLiteralMinValueExpr extends IntegerLiteralExpr {
super(MIN_VALUE);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public IntegerLiteralMinValueExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn, MIN_VALUE);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public IntegerLiteralMinValueExpr(final Range range) {
+ super(range, MIN_VALUE);
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java
index 5cc6c00fd..dc6218510 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.body.Parameter;
import com.github.javaparser.ast.stmt.Statement;
import com.github.javaparser.ast.visitor.GenericVisitor;
@@ -28,6 +29,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -46,11 +48,20 @@ public class LambdaExpr extends Expression {
public LambdaExpr() {
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public LambdaExpr(int beginLine, int beginColumn, int endLine,
- int endColumn, List<Parameter> parameters, Statement body,
+ int endColumn, List<Parameter> parameters, Statement body,
+ boolean parametersEnclosed) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), parameters, body, parametersEnclosed);
+ }
+
+ public LambdaExpr(Range range, List<Parameter> parameters, Statement body,
boolean parametersEnclosed) {
- super(beginLine, beginColumn, endLine, endColumn);
+ super(range);
setParameters(parameters);
setBody(body);
setParametersEnclosed(parametersEnclosed);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java
index 7827f7866..a8b296e96 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java
@@ -21,6 +21,10 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
+
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -29,7 +33,15 @@ public abstract class LiteralExpr extends Expression {
public LiteralExpr() {
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public LiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public LiteralExpr(Range range) {
+ super(range);
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java
index 15ea255ba..4328e3123 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -40,9 +43,17 @@ public class LongLiteralExpr extends StringLiteralExpr {
super(value);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public LongLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String value) {
- super(beginLine, beginColumn, endLine, endColumn, value);
+ final String value) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), value);
+ }
+
+ public LongLiteralExpr(final Range range, final String value) {
+ super(range, value);
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralMinValueExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralMinValueExpr.java
index f351f7a59..aa1ea6938 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralMinValueExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralMinValueExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -33,8 +36,16 @@ public final class LongLiteralMinValueExpr extends LongLiteralExpr {
super(MIN_VALUE);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public LongLiteralMinValueExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn, MIN_VALUE);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public LongLiteralMinValueExpr(final Range range) {
+ super(range, MIN_VALUE);
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java
index c1a354530..34576373f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MarkerAnnotationExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -36,9 +39,17 @@ public final class MarkerAnnotationExpr extends AnnotationExpr {
setName(name);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public MarkerAnnotationExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final NameExpr name) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final NameExpr name) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name);
+ }
+
+ public MarkerAnnotationExpr(final Range range, final NameExpr name) {
+ super(range);
setName(name);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java
index 324ce7da7..628b5c3dd 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.NamedNode;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -43,9 +46,17 @@ public final class MemberValuePair extends Node implements NamedNode {
setValue(value);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public MemberValuePair(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String name, final Expression value) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final String name, final Expression value) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name, value);
+ }
+
+ public MemberValuePair(final Range range, final String name, final Expression value) {
+ super(range);
setName(name);
setValue(value);
}
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 4b30715e3..10148ec4e 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
@@ -21,12 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -56,9 +58,17 @@ public final class MethodCallExpr extends Expression {
setArgs(args);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public MethodCallExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression scope, final List<Type> typeArgs, final String name, final List<Expression> args) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression scope, final List<Type> typeArgs, final String name, final List<Expression> args) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), scope, typeArgs, name, args);
+ }
+
+ public MethodCallExpr(final Range range, final Expression scope, final List<Type> typeArgs, final String name, final List<Expression> args) {
+ super(range);
setScope(scope);
setTypeArgs(typeArgs);
setName(name);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java
index 8fac1249e..a7493a162 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java
@@ -21,12 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypeParameter;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -50,11 +52,19 @@ public class MethodReferenceExpr extends Expression {
public MethodReferenceExpr() {
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public MethodReferenceExpr(int beginLine, int beginColumn, int endLine,
int endColumn, Expression scope,
List<TypeParameter> typeParameters, String identifier) {
-
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), scope, typeParameters, identifier);
+ }
+
+ public MethodReferenceExpr(Range range, Expression scope,
+ List<TypeParameter> typeParameters, String identifier) {
+ super(range);
setIdentifier(identifier);
setScope(scope);
setTypeParameters(typeParameters);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java
index cd15262d8..36425de9a 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NameExpr.java
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.NamedNode;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -39,9 +43,17 @@ public class NameExpr extends Expression implements NamedNode {
this.name = name;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public NameExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String name) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final String name) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name);
+ }
+
+ public NameExpr(Range range, final String name) {
+ super(range);
this.name = name;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java
index fcd1b90bf..c70ff612c 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java
@@ -21,11 +21,13 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -43,9 +45,17 @@ public final class NormalAnnotationExpr extends AnnotationExpr {
setPairs(pairs);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public NormalAnnotationExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final NameExpr name, final List<MemberValuePair> pairs) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final NameExpr name, final List<MemberValuePair> pairs) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name, pairs);
+ }
+
+ public NormalAnnotationExpr(final Range range, final NameExpr name, final List<MemberValuePair> pairs) {
+ super(range);
setName(name);
setPairs(pairs);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java
index c7bc177d5..3becbab54 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -32,8 +35,16 @@ public final class NullLiteralExpr extends LiteralExpr {
public NullLiteralExpr() {
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public NullLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public NullLiteralExpr(final Range range) {
+ super(range);
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
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 f1ea0d8ad..43d8d07f8 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
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.body.BodyDeclaration;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.type.Type;
@@ -29,6 +30,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -68,10 +70,20 @@ public final class ObjectCreationExpr extends Expression {
setArgs(args);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ObjectCreationExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
+ final Expression scope, final ClassOrInterfaceType type, final List<Type> typeArgs,
+ final List<Expression> args, final List<BodyDeclaration> anonymousBody) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), scope, type, typeArgs, args, anonymousBody);
+ }
+
+ public ObjectCreationExpr(final Range range,
final Expression scope, final ClassOrInterfaceType type, final List<Type> typeArgs,
final List<Expression> args, final List<BodyDeclaration> anonymousBody) {
- super(beginLine, beginColumn, endLine, endColumn);
+ super(range);
setScope(scope);
setType(type);
setTypeArgs(typeArgs);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/QualifiedNameExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/QualifiedNameExpr.java
index 00a65aa7f..ff52f6c8f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/QualifiedNameExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/QualifiedNameExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -39,9 +42,17 @@ public final class QualifiedNameExpr extends NameExpr {
setQualifier(scope);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public QualifiedNameExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final NameExpr scope, final String name) {
- super(beginLine, beginColumn, endLine, endColumn, name);
+ final NameExpr scope, final String name) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), scope, name);
+ }
+
+ public QualifiedNameExpr(final Range range, final NameExpr scope, final String name) {
+ super(range, name);
setQualifier(scope);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java
index bd8adb116..235f1d3ed 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -39,9 +42,17 @@ public final class SingleMemberAnnotationExpr extends AnnotationExpr {
setMemberValue(memberValue);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public SingleMemberAnnotationExpr(final int beginLine, final int beginColumn, final int endLine,
- final int endColumn, final NameExpr name, final Expression memberValue) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int endColumn, final NameExpr name, final Expression memberValue) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), name, memberValue);
+ }
+
+ public SingleMemberAnnotationExpr(final Range range, final NameExpr name, final Expression memberValue) {
+ super(range);
setName(name);
setMemberValue(memberValue);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java
index feb67d36f..af4625566 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -42,9 +45,16 @@ public class StringLiteralExpr extends LiteralExpr {
this.value = value;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public StringLiteralExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String value) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final String value) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), value);
+ }
+ public StringLiteralExpr(final Range range, final String value) {
+ super(range);
this.value = value;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java
index 791d28bc9..0e513ef9f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -38,9 +41,17 @@ public final class SuperExpr extends Expression {
setClassExpr(classExpr);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public SuperExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression classExpr) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression classExpr) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), classExpr);
+ }
+
+ public SuperExpr(final Range range, final Expression classExpr) {
+ super(range);
setClassExpr(classExpr);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java
index c269376c9..99d1c9b17 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -38,9 +41,17 @@ public final class ThisExpr extends Expression {
setClassExpr(classExpr);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ThisExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final Expression classExpr) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), classExpr);
+ }
+
+ public ThisExpr(final Range range, final Expression classExpr) {
+ super(range);
setClassExpr(classExpr);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java
index 482ca9cad..8a46522b0 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypedNode;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* This class is just instantiated as scopes for MethodReferenceExpr nodes to encapsulate Types.
* @author Raquel Pau
@@ -37,8 +40,16 @@ public class TypeExpr extends Expression implements TypedNode {
public TypeExpr(){}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public TypeExpr(int beginLine, int beginColumn, int endLine, int endColumn, Type type) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), type);
+ }
+
+ public TypeExpr(Range range, Type type) {
+ super(range);
setType(type);
}
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 e5f9abede..a5aa16b0a 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
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -52,9 +55,17 @@ public final class UnaryExpr extends Expression {
setOperator(op);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public UnaryExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final Expression expr, final Operator op) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), expr, op);
+ }
+
+ public UnaryExpr(final Range range, final Expression expr, final Operator op) {
+ super(range);
setExpr(expr);
setOperator(op);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java
index d633619a3..12afaa9f0 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.expr;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.NodeWithModifiers;
import com.github.javaparser.ast.TypedNode;
import com.github.javaparser.ast.body.ModifierSet;
@@ -29,9 +30,9 @@ import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
-import java.util.Collections;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -61,10 +62,20 @@ public final class VariableDeclarationExpr extends Expression implements TypedNo
setVars(vars);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public VariableDeclarationExpr(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final int modifiers, final List<AnnotationExpr> annotations, final Type type,
final List<VariableDeclarator> vars) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), modifiers, annotations, type, vars);
+ }
+
+ public VariableDeclarationExpr(final Range range,
+ final int modifiers, final List<AnnotationExpr> annotations, final Type type,
+ final List<VariableDeclarator> vars) {
+ super(range);
setModifiers(modifiers);
setAnnotations(annotations);
setType(type);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/internal/Utils.java b/javaparser-core/src/main/java/com/github/javaparser/ast/internal/Utils.java
index d5e7e4e3c..983afefc0 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/internal/Utils.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/internal/Utils.java
@@ -27,7 +27,6 @@ import java.util.List;
/**
* @author Federico Tomassetti
- * @since 3.0.0
*/
public class Utils {
public static <T> List<T> ensureNotNull(List<T> list) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java
index 60f61bca5..7f578bca1 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java
@@ -21,10 +21,15 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+import static com.github.javaparser.Range.range;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -46,9 +51,17 @@ public final class AssertStmt extends Statement {
setMessage(msg);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public AssertStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression check, final Expression msg) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression check, final Expression msg) {
+ this(range(beginLine, beginColumn, endLine, endColumn), check, msg);
+ }
+
+ public AssertStmt(final Range range, final Expression check, final Expression msg) {
+ super(range);
setCheck(check);
setMessage(msg);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java
index 74fc41f78..0a2baf8d9 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java
@@ -21,11 +21,13 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -42,9 +44,17 @@ public final class BlockStmt extends Statement {
setStmts(stmts);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public BlockStmt(final int beginLine, final int beginColumn,
- final int endLine, final int endColumn, final List<Statement> stmts) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int endLine, final int endColumn, final List<Statement> stmts) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), stmts);
+ }
+
+ public BlockStmt(final Range range, final List<Statement> stmts) {
+ super(range);
setStmts(stmts);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java
index 1a80f3e67..da23dc897 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java
@@ -21,9 +21,13 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -38,8 +42,16 @@ public final class BreakStmt extends Statement {
this.id = id;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public BreakStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn, final String id) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), id);
+ }
+
+ public BreakStmt(final Range range, final String id) {
+ super(range);
this.id = id;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/CatchClause.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/CatchClause.java
index 209de1809..ef44ca5cd 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/CatchClause.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/CatchClause.java
@@ -21,18 +21,19 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.Node;
-import com.github.javaparser.ast.body.MultiTypeParameter;
import com.github.javaparser.ast.body.Parameter;
import com.github.javaparser.ast.body.VariableDeclaratorId;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.type.Type;
-import com.github.javaparser.ast.type.UnionType;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -50,11 +51,21 @@ public final class CatchClause extends Node {
setCatchBlock(catchBlock);
}
- public CatchClause(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final int exceptModifier, final List<AnnotationExpr> exceptAnnotations, final Type exceptTypes,
- final VariableDeclaratorId exceptId, final BlockStmt catchBlock) {
- super(beginLine, beginColumn, endLine, endColumn);
- setParam(new Parameter(beginLine, beginColumn, endLine, endColumn, exceptModifier, exceptAnnotations, exceptTypes, false, exceptId));
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
+ public CatchClause(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
+ final int exceptModifier, final List<AnnotationExpr> exceptAnnotations, final Type exceptTypes,
+ final VariableDeclaratorId exceptId, final BlockStmt catchBlock) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), exceptModifier, exceptAnnotations, exceptTypes, exceptId, catchBlock);
+ }
+
+ public CatchClause(final Range range,
+ final int exceptModifier, final List<AnnotationExpr> exceptAnnotations, final Type exceptTypes,
+ final VariableDeclaratorId exceptId, final BlockStmt catchBlock) {
+ super(range);
+ setParam(new Parameter(range, exceptModifier, exceptAnnotations, exceptTypes, false, exceptId));
setCatchBlock(catchBlock);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java
index 81760d0a0..6d8841c5b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java
@@ -21,9 +21,13 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -38,9 +42,17 @@ public final class ContinueStmt extends Statement {
this.id = id;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ContinueStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String id) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final String id) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), id);
+ }
+
+ public ContinueStmt(Range range, final String id) {
+ super(range);
this.id = id;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java
index 0a6a77040..5c39a12b8 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -42,9 +46,17 @@ public final class DoStmt extends Statement {
setCondition(condition);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public DoStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Statement body, final Expression condition) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Statement body, final Expression condition) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), body, condition);
+ }
+
+ public DoStmt(Range range, final Statement body, final Expression condition) {
+ super(range);
setBody(body);
setCondition(condition);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java
index fb16c4d98..d6a261ed0 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java
@@ -21,9 +21,13 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -32,8 +36,16 @@ public final class EmptyStmt extends Statement {
public EmptyStmt() {
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public EmptyStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
+ }
+
+ public EmptyStmt(Range range) {
+ super(range);
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
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 a275ab103..88c1062b1 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
@@ -21,6 +21,8 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
@@ -28,6 +30,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -53,11 +56,20 @@ public final class ExplicitConstructorInvocationStmt extends Statement {
setArgs(args);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ExplicitConstructorInvocationStmt(final int beginLine,
- final int beginColumn, final int endLine, final int endColumn,
- final List<Type> typeArgs, final boolean isThis,
- final Expression expr, final List<Expression> args) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int beginColumn, final int endLine, final int endColumn,
+ final List<Type> typeArgs, final boolean isThis,
+ final Expression expr, final List<Expression> args) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), typeArgs, isThis, expr, args);
+ }
+ public ExplicitConstructorInvocationStmt(Range range,
+ final List<Type> typeArgs, final boolean isThis,
+ final Expression expr, final List<Expression> args) {
+ super(range);
setTypeArgs(typeArgs);
setThis(isThis);
setExpr(expr);
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 3c441e2a3..7c2bfdfe2 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
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -39,9 +43,17 @@ public final class ExpressionStmt extends Statement {
setExpression(expr);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ExpressionStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression expr) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression expr) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), expr);
+ }
+ public ExpressionStmt(Range range,
+ final Expression expr) {
+ super(range);
setExpression(expr);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java
index cef6f27de..a5fbc19eb 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java
@@ -21,12 +21,15 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -53,11 +56,21 @@ public final class ForStmt extends Statement {
setBody(body);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ForStmt(final int beginLine, final int beginColumn,
- final int endLine, final int endColumn,
- final List<Expression> init, final Expression compare,
- final List<Expression> update, final Statement body) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int endLine, final int endColumn,
+ final List<Expression> init, final Expression compare,
+ final List<Expression> update, final Statement body) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), init, compare, update, body);
+ }
+
+ public ForStmt(Range range,
+ final List<Expression> init, final Expression compare,
+ final List<Expression> update, final Statement body) {
+ super(range);
setCompare(compare);
setInit(init);
setUpdate(update);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java
index 245622fc5..edda7de21 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForeachStmt.java
@@ -21,11 +21,15 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.VariableDeclarationExpr;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -47,11 +51,21 @@ public final class ForeachStmt extends Statement {
setBody(body);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ForeachStmt(final int beginLine, final int beginColumn,
- final int endLine, final int endColumn,
- final VariableDeclarationExpr var, final Expression iterable,
- final Statement body) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int endLine, final int endColumn,
+ final VariableDeclarationExpr var, final Expression iterable,
+ final Statement body) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), var, iterable, body);
+ }
+
+ public ForeachStmt(Range range,
+ final VariableDeclarationExpr var, final Expression iterable,
+ final Statement body) {
+ super(range);
setVariable(var);
setIterable(iterable);
setBody(body);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java
index ccddd903e..23af28583 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -45,9 +49,18 @@ public final class IfStmt extends Statement {
setElseStmt(elseStmt);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public IfStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression condition, final Statement thenStmt, final Statement elseStmt) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression condition, final Statement thenStmt, final Statement elseStmt) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), condition, thenStmt, elseStmt);
+ }
+
+ public IfStmt(Range range,
+ final Expression condition, final Statement thenStmt, final Statement elseStmt) {
+ super(range);
setCondition(condition);
setThenStmt(thenStmt);
setElseStmt(elseStmt);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java
index 85d8e7b99..aae6b9b33 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java
@@ -21,9 +21,13 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -41,9 +45,17 @@ public final class LabeledStmt extends Statement {
setStmt(stmt);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public LabeledStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final String label, final Statement stmt) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final String label, final Statement stmt) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), label, stmt);
+ }
+
+ public LabeledStmt(Range range, final String label, final Statement stmt) {
+ super(range);
setLabel(label);
setStmt(stmt);
}
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 3ac6fa65e..acaec1893 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
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -39,9 +43,17 @@ public final class ReturnStmt extends Statement {
setExpr(expr);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ReturnStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression expr) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression expr) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), expr);
+ }
+
+ public ReturnStmt(Range range, final Expression expr) {
+ super(range);
setExpr(expr);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java
index 30c462d05..5ab9e24e2 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java
@@ -21,8 +21,13 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.Node;
+import static com.github.javaparser.Position.pos;
+import static com.github.javaparser.Range.*;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -31,8 +36,16 @@ public abstract class Statement extends Node {
public Statement() {
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public Statement(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(range(beginLine, beginColumn, endLine, endColumn));
+ }
+
+ public Statement(final Range range) {
+ super(range);
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java
index 853a79e97..b1103dd94 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java
@@ -21,12 +21,15 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -46,10 +49,19 @@ public final class SwitchEntryStmt extends Statement {
setStmts(stmts);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public SwitchEntryStmt(final int beginLine, final int beginColumn,
- final int endLine, final int endColumn, final Expression label,
- final List<Statement> stmts) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int endLine, final int endColumn, final Expression label,
+ final List<Statement> stmts) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), label, stmts);
+ }
+
+ public SwitchEntryStmt(Range range, final Expression label,
+ final List<Statement> stmts) {
+ super(range);
setLabel(label);
setStmts(stmts);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java
index a730b1fff..4ded7bedf 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java
@@ -21,12 +21,15 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -47,10 +50,19 @@ public final class SwitchStmt extends Statement {
setEntries(entries);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public SwitchStmt(final int beginLine, final int beginColumn,
- final int endLine, final int endColumn, final Expression selector,
- final List<SwitchEntryStmt> entries) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int endLine, final int endColumn, final Expression selector,
+ final List<SwitchEntryStmt> entries) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), selector, entries);
+ }
+
+ public SwitchStmt(Range range, final Expression selector,
+ final List<SwitchEntryStmt> entries) {
+ super(range);
setSelector(selector);
setEntries(entries);
}
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 e91fc0b19..79c0d8876 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
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -42,10 +46,19 @@ public final class SynchronizedStmt extends Statement {
setBlock(block);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public SynchronizedStmt(final int beginLine, final int beginColumn,
- final int endLine, final int endColumn, final Expression expr,
- final BlockStmt block) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int endLine, final int endColumn, final Expression expr,
+ final BlockStmt block) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), expr, block);
+ }
+
+ public SynchronizedStmt(Range range, final Expression expr,
+ final BlockStmt block) {
+ super(range);
setExpr(expr);
setBlock(block);
}
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 48283b16d..5d30cc345 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
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -39,9 +43,17 @@ public final class ThrowStmt extends Statement {
setExpr(expr);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ThrowStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression expr) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression expr) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), expr);
+ }
+
+ public ThrowStmt(Range range, final Expression expr) {
+ super(range);
setExpr(expr);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java
index f6a709a56..d5bc33a1e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java
@@ -21,12 +21,15 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import com.github.javaparser.ast.expr.VariableDeclarationExpr;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -52,10 +55,19 @@ public final class TryStmt extends Statement {
setFinallyBlock(finallyBlock);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public TryStmt(final int beginLine, final int beginColumn,
- final int endLine, final int endColumn, List<VariableDeclarationExpr> resources,
- final BlockStmt tryBlock, final List<CatchClause> catchs, final BlockStmt finallyBlock) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final int endLine, final int endColumn, List<VariableDeclarationExpr> resources,
+ final BlockStmt tryBlock, final List<CatchClause> catchs, final BlockStmt finallyBlock) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), resources, tryBlock, catchs, finallyBlock);
+ }
+
+ public TryStmt(Range range, List<VariableDeclarationExpr> resources,
+ final BlockStmt tryBlock, final List<CatchClause> catchs, final BlockStmt finallyBlock) {
+ super(range);
setResources(resources);
setTryBlock(tryBlock);
setCatchs(catchs);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TypeDeclarationStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TypeDeclarationStmt.java
index 79b507a1f..0533cfabb 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TypeDeclarationStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TypeDeclarationStmt.java
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.body.TypeDeclaration;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -39,9 +43,17 @@ public final class TypeDeclarationStmt extends Statement {
setTypeDeclaration(typeDecl);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public TypeDeclarationStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final TypeDeclaration typeDecl) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final TypeDeclaration typeDecl) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), typeDecl);
+ }
+
+ public TypeDeclarationStmt(Range range, final TypeDeclaration typeDecl) {
+ super(range);
setTypeDeclaration(typeDecl);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java
index 51b2a1a23..653fc03a6 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java
@@ -21,10 +21,14 @@
package com.github.javaparser.ast.stmt;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -42,9 +46,17 @@ public final class WhileStmt extends Statement {
setBody(body);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public WhileStmt(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final Expression condition, final Statement body) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final Expression condition, final Statement body) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), condition, body);
+ }
+
+ public WhileStmt(Range range, final Expression condition, final Statement body) {
+ super(range);
setCondition(condition);
setBody(body);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java
index d725c8289..096ffd086 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.type;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.NamedNode;
import com.github.javaparser.ast.TypeArguments;
import com.github.javaparser.ast.visitor.GenericVisitor;
@@ -28,6 +29,8 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -58,12 +61,20 @@ public final class ClassOrInterfaceType extends Type implements NamedNode {
@Deprecated
public ClassOrInterfaceType(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final ClassOrInterfaceType scope, final String name, final List<Type> typeArgs) {
- this(beginLine, beginColumn, endLine, endColumn, scope, name, TypeArguments.withArguments(typeArgs));
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), scope, name, TypeArguments.withArguments(typeArgs));
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ClassOrInterfaceType(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
- final ClassOrInterfaceType scope, final String name, final TypeArguments typeArguments) {
- super(beginLine, beginColumn, endLine, endColumn);
+ final ClassOrInterfaceType scope, final String name, final TypeArguments typeArgs) {
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), scope, name, typeArgs);
+ }
+
+ public ClassOrInterfaceType(final Range range, final ClassOrInterfaceType scope, final String name, final TypeArguments typeArguments) {
+ super(range);
setScope(scope);
setName(name);
setTypeArguments(typeArguments);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java
index 0cd6fde81..47e582974 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java
@@ -1,11 +1,14 @@
package com.github.javaparser.ast.type;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* Represents a set of types. A given value of this type has to be assignable to at all of the element types.
* As of Java 8 it is used in casts or while expressing bounds for generic types.
@@ -22,9 +25,17 @@ public class IntersectionType extends Type {
private List<ReferenceType> elements;
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public IntersectionType(int beginLine, int beginColumn, int endLine,
int endColumn, List<ReferenceType> elements) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), elements);
+ }
+
+ public IntersectionType(Range range, List<ReferenceType> elements) {
+ super(range);
setElements(elements);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java
index 561a89657..4d2d5e922 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java
@@ -23,9 +23,12 @@ package com.github.javaparser.ast.type;
import java.util.HashMap;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -47,7 +50,7 @@ public final class PrimitiveType extends Type {
return new ClassOrInterfaceType(nameOfBoxedType);
}
- private Primitive(String nameOfBoxedType) {
+ Primitive(String nameOfBoxedType) {
this.nameOfBoxedType = nameOfBoxedType;
}
}
@@ -68,9 +71,17 @@ public final class PrimitiveType extends Type {
this.type = type;
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public PrimitiveType(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final Primitive type) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), type);
+ }
+
+ public PrimitiveType(Range range, final Primitive type) {
+ super(range);
this.type = type;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java
index 4b68eb289..0dd665541 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java
@@ -21,6 +21,7 @@
package com.github.javaparser.ast.type;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.TypedNode;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.visitor.GenericVisitor;
@@ -28,6 +29,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -53,9 +55,17 @@ public final class ReferenceType extends Type implements TypedNode {
setArrayCount(arrayCount);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public ReferenceType(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final Type type, final int arrayCount) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), type, arrayCount);
+ }
+
+ public ReferenceType(final Range range, final Type type, final int arrayCount) {
+ super(range);
setType(type);
setArrayCount(arrayCount);
}
@@ -64,7 +74,13 @@ public final class ReferenceType extends Type implements TypedNode {
int endColumn, Type type, int arrayCount,
List<AnnotationExpr> annotations,
List<List<AnnotationExpr>> arraysAnnotations) {
- super(beginLine, beginColumn, endLine, endColumn, annotations);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), type, arrayCount, annotations, arraysAnnotations);
+ }
+
+ public ReferenceType(Range range, Type type, int arrayCount,
+ List<AnnotationExpr> annotations,
+ List<List<AnnotationExpr>> arraysAnnotations) {
+ super(range, annotations);
setType(type);
setArrayCount(arrayCount);
this.arraysAnnotations = arraysAnnotations;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java
index fc9dbae23..2d935e4de 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java
@@ -21,11 +21,14 @@
package com.github.javaparser.ast.type;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.expr.AnnotationExpr;
import java.util.List;
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.ast.internal.Utils.*;
/**
@@ -42,15 +45,20 @@ public abstract class Type extends Node {
this.annotations = annotation;
}
- public Type(int beginLine, int beginColumn, int endLine, int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ public Type(Range range) {
+ super(range);
}
-
+
+ @Deprecated
public Type(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations) {
- super(beginLine, beginColumn, endLine, endColumn);
- this.annotations = annotations;
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), annotations);
}
+ public Type(Range range, List<AnnotationExpr> annotations) {
+ super(range);
+ this.annotations = annotations;
+ }
+
public List<AnnotationExpr> getAnnotations() {
annotations = ensureNotNull(annotations);
return annotations;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java
index 83eeee6ce..a3e977772 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnionType.java
@@ -1,23 +1,32 @@
package com.github.javaparser.ast.type;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.List;
+import static com.github.javaparser.Position.pos;
+
/**
* Represents a set of types. A given value of this type has to be assignable to at least one of the element types.
* As of Java 8 it is only used in catch clauses.
- *
- * @since 3.0.0
*/
public class UnionType extends Type {
private List<ReferenceType> elements;
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public UnionType(int beginLine, int beginColumn, int endLine,
int endColumn, List<ReferenceType> elements) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), elements);
+ }
+
+ public UnionType(Range range, List<ReferenceType> elements) {
+ super(range);
setElements(elements);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java
index 5dacbe1e7..9202239d3 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java
@@ -21,9 +21,13 @@
package com.github.javaparser.ast.type;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -32,8 +36,16 @@ public final class VoidType extends Type {
public VoidType() {
}
+ public VoidType(Range range) {
+ super(range);
+ }
+
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public VoidType(final int beginLine, final int beginColumn, final int endLine, final int endColumn) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)));
}
@Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
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 8016ed70e..3ab21b924 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
@@ -21,9 +21,12 @@
package com.github.javaparser.ast.type;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import static com.github.javaparser.Position.pos;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -45,9 +48,18 @@ public final class WildcardType extends Type {
setSuper(sup);
}
+ /**
+ * @deprecated prefer using Range objects.
+ */
+ @Deprecated
public WildcardType(final int beginLine, final int beginColumn, final int endLine, final int endColumn,
final ReferenceType ext, final ReferenceType sup) {
- super(beginLine, beginColumn, endLine, endColumn);
+ this(new Range(pos(beginLine, beginColumn), pos(endLine, endColumn)), ext, sup);
+ }
+
+ public WildcardType(final Range range,
+ final ReferenceType ext, final ReferenceType sup) {
+ super(range);
setExtends(ext);
setSuper(sup);
}
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 1e46d0dd5..d55551442 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
@@ -64,7 +64,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
List<TypeDeclaration> types = visit(_n.getTypes(), _arg);
return new CompilationUnit(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
package_, imports, types
);
}
@@ -76,7 +76,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
PackageDeclaration r = new PackageDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
annotations, name
);
r.setComment(comment);
@@ -89,7 +89,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ImportDeclaration r = new ImportDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
name, _n.isStatic(), _n.isAsterisk()
);
r.setComment(comment);
@@ -101,8 +101,8 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
List<ClassOrInterfaceType> typeBound = visit(_n.getTypeBound(), _arg);
List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
- TypeParameter r = new TypeParameter(_n.getBeginLine(),
- _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ TypeParameter r = new TypeParameter(_n.getBegin().line,
+ _n.getBegin().column, _n.getEnd().line, _n.getEnd().column,
_n.getName(), typeBound, annotations);
Comment comment = cloneNodes(_n.getComment(), _arg);
@@ -112,12 +112,12 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
@Override
public Node visit(LineComment _n, Object _arg) {
- return new LineComment(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getContent());
+ return new LineComment(_n.getRange(), _n.getContent());
}
@Override
public Node visit(BlockComment _n, Object _arg) {
- return new BlockComment(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getContent());
+ return new BlockComment(_n.getRange(), _n.getContent());
}
@Override
@@ -131,7 +131,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ClassOrInterfaceDeclaration r = new ClassOrInterfaceDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, _n.isInterface(), _n.getName(), typeParameters, extendsList, implementsList, members
);
r.setComment(comment);
@@ -148,7 +148,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
EnumDeclaration r = new EnumDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, _n.getName(), implementsList, entries, members
);
r.setComment(comment);
@@ -161,7 +161,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
EmptyTypeDeclaration r = new EmptyTypeDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn()
+ _n.getRange()
);
r.setComment(comment);
return r;
@@ -176,7 +176,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
EnumConstantDeclaration r = new EnumConstantDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
annotations, _n.getName(), args, classBody
);
r.setComment(comment);
@@ -191,7 +191,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
AnnotationDeclaration r = new AnnotationDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, _n.getName(), members
);
r.setComment(comment);
@@ -207,7 +207,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
AnnotationMemberDeclaration r = new AnnotationMemberDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, type_, _n.getName(), defaultValue
);
r.setComment(comment);
@@ -223,7 +223,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
FieldDeclaration r = new FieldDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, type_, variables
);
r.setComment(comment);
@@ -237,7 +237,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
VariableDeclarator r = new VariableDeclarator(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
id, init
);
r.setComment(comment);
@@ -249,7 +249,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
VariableDeclaratorId r = new VariableDeclaratorId(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getName(), _n.getArrayCount()
);
r.setComment(comment);
@@ -267,7 +267,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ConstructorDeclaration r = new ConstructorDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, typeParameters, _n.getName(), parameters, throws_, block
);
r.setComment(comment);
@@ -286,7 +286,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
MethodDeclaration r = new MethodDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, typeParameters, type_, _n.getName(), parameters, _n.getArrayCount(), throws_, block
);
r.setComment(comment);
@@ -301,7 +301,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
Parameter r = new Parameter(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, type_, _n.isVarArgs(), id
);
r.setComment(comment);
@@ -316,7 +316,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
MultiTypeParameter r = new MultiTypeParameter(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, type, id
);
r.setComment(comment);
@@ -329,7 +329,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
EmptyMemberDeclaration r = new EmptyMemberDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn()
+ _n.getRange()
);
r.setComment(comment);
return r;
@@ -342,7 +342,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
InitializerDeclaration r = new InitializerDeclaration(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.isStatic(), block
);
r.setComment(comment);
@@ -353,7 +353,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(JavadocComment _n, Object _arg) {
Comment comment = cloneNodes(_n.getComment(), _arg);
JavadocComment r = new JavadocComment(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getContent()
);
r.setComment(comment);
@@ -367,7 +367,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ClassOrInterfaceType r = new ClassOrInterfaceType(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
scope, _n.getName(), _n.getTypeArguments()
);
r.setComment(comment);
@@ -379,7 +379,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
PrimitiveType r = new PrimitiveType(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getType()
);
r.setComment(comment);
@@ -399,8 +399,8 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
}
}
- ReferenceType r = new ReferenceType(_n.getBeginLine(),
- _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), type_,
+ ReferenceType r = new ReferenceType(_n.getBegin().line,
+ _n.getBegin().column, _n.getEnd().line, _n.getEnd().column, type_,
_n.getArrayCount(), ann, _arraysAnnotations);
Comment comment = cloneNodes(_n.getComment(), _arg);
r.setComment(comment);
@@ -411,8 +411,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(IntersectionType _n, Object _arg) {
List<ReferenceType> elements = visit(_n.getElements(), _arg);
- IntersectionType r = new IntersectionType(_n.getBeginLine(),
- _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ IntersectionType r = new IntersectionType(_n.getRange(),
elements);
Comment comment = cloneNodes(_n.getComment(), _arg);
r.setComment(comment);
@@ -423,8 +422,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(UnionType _n, Object _arg) {
List<ReferenceType> elements = visit(_n.getElements(), _arg);
- UnionType r = new UnionType(_n.getBeginLine(),
- _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ UnionType r = new UnionType(_n.getRange(),
elements);
Comment comment = cloneNodes(_n.getComment(), _arg);
r.setComment(comment);
@@ -435,7 +433,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(VoidType _n, Object _arg) {
Comment comment = cloneNodes(_n.getComment(), _arg);
- VoidType r = new VoidType(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn());
+ VoidType r = new VoidType(_n.getRange());
r.setComment(comment);
return r;
}
@@ -447,7 +445,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
WildcardType r = new WildcardType(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
ext, sup
);
r.setComment(comment);
@@ -470,7 +468,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ArrayAccessExpr r = new ArrayAccessExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
name, index
);
r.setComment(comment);
@@ -481,8 +479,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(ArrayCreationExpr _n, Object _arg) {
Type type_ = cloneNodes(_n.getType(), _arg);
List<Expression> dimensions = visit(_n.getDimensions(), _arg);
- ArrayCreationExpr r = new ArrayCreationExpr(_n.getBeginLine(),
- _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), type_,
+ ArrayCreationExpr r = new ArrayCreationExpr(_n.getRange(), type_,
dimensions, _n.getArrayCount());
if (_n.getInitializer() != null) {// ArrayCreationExpr has two mutually
// exclusive constructors
@@ -508,7 +505,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ArrayInitializerExpr r = new ArrayInitializerExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
values
);
r.setComment(comment);
@@ -522,7 +519,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
AssignExpr r = new AssignExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
target, value, _n.getOperator());
r.setComment(comment);
return r;
@@ -535,7 +532,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
BinaryExpr r = new BinaryExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
left, right, _n.getOperator()
);
r.setComment(comment);
@@ -549,7 +546,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
CastExpr r = new CastExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
type_, expr
);
r.setComment(comment);
@@ -562,7 +559,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ClassExpr r = new ClassExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
type_
);
r.setComment(comment);
@@ -577,7 +574,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ConditionalExpr r = new ConditionalExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
condition, thenExpr, elseExpr
);
r.setComment(comment);
@@ -590,7 +587,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
EnclosedExpr r = new EnclosedExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
inner
);
r.setComment(comment);
@@ -604,7 +601,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
FieldAccessExpr r = new FieldAccessExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
scope, typeArgs, _n.getField()
);
r.setComment(comment);
@@ -618,7 +615,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
InstanceOfExpr r = new InstanceOfExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
expr, type_
);
r.setComment(comment);
@@ -629,7 +626,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(StringLiteralExpr _n, Object _arg) {
Comment comment = cloneNodes(_n.getComment(), _arg);
StringLiteralExpr r = new StringLiteralExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getValue()
);
r.setComment(comment);
@@ -641,7 +638,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
IntegerLiteralExpr r = new IntegerLiteralExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getValue()
);
r.setComment(comment);
@@ -653,7 +650,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
LongLiteralExpr r = new LongLiteralExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getValue()
);
r.setComment(comment);
@@ -664,7 +661,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(IntegerLiteralMinValueExpr _n, Object _arg) {
Comment comment = cloneNodes(_n.getComment(), _arg);
- IntegerLiteralMinValueExpr r = new IntegerLiteralMinValueExpr(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn());
+ IntegerLiteralMinValueExpr r = new IntegerLiteralMinValueExpr(_n.getRange());
r.setComment(comment);
return r;
}
@@ -673,7 +670,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(LongLiteralMinValueExpr _n, Object _arg) {
Comment comment = cloneNodes(_n.getComment(), _arg);
- LongLiteralMinValueExpr r = new LongLiteralMinValueExpr(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn());
+ LongLiteralMinValueExpr r = new LongLiteralMinValueExpr(_n.getRange());
r.setComment(comment);
return r;
}
@@ -683,7 +680,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
CharLiteralExpr r = new CharLiteralExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getValue()
);
r.setComment(comment);
@@ -695,7 +692,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
DoubleLiteralExpr r = new DoubleLiteralExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getValue()
);
r.setComment(comment);
@@ -707,7 +704,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
BooleanLiteralExpr r = new BooleanLiteralExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getValue()
);
r.setComment(comment);
@@ -718,7 +715,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(NullLiteralExpr _n, Object _arg) {
Comment comment = cloneNodes(_n.getComment(), _arg);
- NullLiteralExpr r = new NullLiteralExpr(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn());
+ NullLiteralExpr r = new NullLiteralExpr(_n.getRange());
r.setComment(comment);
return r;
}
@@ -731,7 +728,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
MethodCallExpr r = new MethodCallExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
scope, typeArgs, _n.getName(), args
);
r.setComment(comment);
@@ -743,7 +740,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
NameExpr r = new NameExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getName()
);
r.setComment(comment);
@@ -760,7 +757,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ObjectCreationExpr r = new ObjectCreationExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
scope, type_, typeArgs, args, anonymousBody
);
r.setComment(comment);
@@ -773,7 +770,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
QualifiedNameExpr r = new QualifiedNameExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
scope, _n.getName()
);
r.setComment(comment);
@@ -786,7 +783,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ThisExpr r = new ThisExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
classExpr
);
r.setComment(comment);
@@ -799,7 +796,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
SuperExpr r = new SuperExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
classExpr
);
r.setComment(comment);
@@ -812,7 +809,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
UnaryExpr r = new UnaryExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
expr, _n.getOperator()
);
r.setComment(comment);
@@ -827,7 +824,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
VariableDeclarationExpr r = new VariableDeclarationExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getModifiers(), annotations, type_, vars
);
r.setComment(comment);
@@ -840,7 +837,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
MarkerAnnotationExpr r = new MarkerAnnotationExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
name
);
r.setComment(comment);
@@ -854,7 +851,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
SingleMemberAnnotationExpr r = new SingleMemberAnnotationExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
name, memberValue
);
r.setComment(comment);
@@ -868,7 +865,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
NormalAnnotationExpr r = new NormalAnnotationExpr(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
name, pairs
);
r.setComment(comment);
@@ -881,7 +878,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
MemberValuePair r = new MemberValuePair(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getName(), value
);
r.setComment(comment);
@@ -896,7 +893,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ExplicitConstructorInvocationStmt r = new ExplicitConstructorInvocationStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
typeArgs, _n.isThis(), expr, args
);
r.setComment(comment);
@@ -909,7 +906,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
TypeDeclarationStmt r = new TypeDeclarationStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
typeDecl
);
r.setComment(comment);
@@ -923,7 +920,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
AssertStmt r = new AssertStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
check, message
);
r.setComment(comment);
@@ -936,7 +933,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
BlockStmt r = new BlockStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
stmts
);
r.setComment(comment);
@@ -949,7 +946,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
LabeledStmt r = new LabeledStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getLabel(), stmt
);
r.setComment(comment);
@@ -960,7 +957,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
public Node visit(EmptyStmt _n, Object _arg) {
Comment comment = cloneNodes(_n.getComment(), _arg);
- EmptyStmt r = new EmptyStmt(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn());
+ EmptyStmt r = new EmptyStmt(_n.getRange());
r.setComment(comment);
return r;
}
@@ -971,7 +968,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ExpressionStmt r = new ExpressionStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
expr
);
r.setComment(comment);
@@ -985,7 +982,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
SwitchStmt r = new SwitchStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
selector, entries
);
r.setComment(comment);
@@ -999,7 +996,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
SwitchEntryStmt r = new SwitchEntryStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
label, stmts
);
r.setComment(comment);
@@ -1011,7 +1008,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
BreakStmt r = new BreakStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getId()
);
r.setComment(comment);
@@ -1024,7 +1021,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ReturnStmt r = new ReturnStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
expr
);
r.setComment(comment);
@@ -1039,7 +1036,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
IfStmt r = new IfStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
condition, thenStmt, elseStmt
);
r.setComment(comment);
@@ -1053,7 +1050,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
WhileStmt r = new WhileStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
condition, body
);
r.setComment(comment);
@@ -1065,7 +1062,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ContinueStmt r = new ContinueStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
_n.getId()
);
r.setComment(comment);
@@ -1079,7 +1076,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
DoStmt r = new DoStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
body, condition
);
r.setComment(comment);
@@ -1094,7 +1091,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ForeachStmt r = new ForeachStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
var, iterable, body
);
r.setComment(comment);
@@ -1110,7 +1107,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ForStmt r = new ForStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
init, compare, update, body
);
r.setComment(comment);
@@ -1123,7 +1120,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
ThrowStmt r = new ThrowStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
expr
);
r.setComment(comment);
@@ -1137,7 +1134,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
SynchronizedStmt r = new SynchronizedStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
expr, block
);
r.setComment(comment);
@@ -1153,7 +1150,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
TryStmt r = new TryStmt(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
resources, tryBlock, catchs, finallyBlock
);
r.setComment(comment);
@@ -1167,7 +1164,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Comment comment = cloneNodes(_n.getComment(), _arg);
CatchClause r = new CatchClause(
- _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
+ _n.getRange(),
param.getModifiers(), param.getAnnotations(), param.getType(), param.getId(), catchBlock
);
r.setComment(comment);
@@ -1181,11 +1178,8 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Statement body = cloneNodes(_n.getBody(), _arg);
- LambdaExpr r = new LambdaExpr(_n.getBeginLine(), _n.getBeginColumn(),
- _n.getEndLine(), _n.getEndColumn(), lambdaParameters, body,
+ return new LambdaExpr(_n.getRange(), lambdaParameters, body,
_n.isParametersEnclosed());
-
- return r;
}
@Override
@@ -1194,10 +1188,8 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
List<TypeParameter> typeParams = visit(_n.getTypeParameters(), arg);
Expression scope = cloneNodes(_n.getScope(), arg);
- MethodReferenceExpr r = new MethodReferenceExpr(_n.getBeginLine(),
- _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), scope,
+ return new MethodReferenceExpr(_n.getRange(), scope,
typeParams, _n.getIdentifier());
- return r;
}
@Override
@@ -1205,10 +1197,7 @@ public class CloneVisitor implements GenericVisitor<Node, Object> {
Type t = cloneNodes(n.getType(), arg);
- TypeExpr r = new TypeExpr(n.getBeginLine(), n.getBeginColumn(),
- n.getEndLine(), n.getEndColumn(), t);
-
- return r;
+ return new TypeExpr(n.getRange(), t);
}
public <T extends Node> List<T> visit(List<T> _nodes, Object _arg) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/DumpVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/DumpVisitor.java
index f33000e65..cfd8edf98 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/DumpVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/DumpVisitor.java
@@ -1586,9 +1586,8 @@ public class DumpVisitor implements VoidVisitor<Object> {
public void visit(LambdaExpr n, Object arg) {
printJavaComment(n.getComment(), arg);
- List<Parameter> parameters = n.getParameters();
- boolean printPar = false;
- printPar = n.isParametersEnclosed();
+ final List<Parameter> parameters = n.getParameters();
+ final boolean printPar = n.isParametersEnclosed();
if (printPar) {
printer.print("(");
@@ -1607,7 +1606,7 @@ public class DumpVisitor implements VoidVisitor<Object> {
}
printer.print(" -> ");
- Statement body = n.getBody();
+ final Statement body = n.getBody();
if (body instanceof ExpressionStmt) {
// Print the expression directly
((ExpressionStmt) body).getExpression().accept(this, 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 49665689f..b484aad57 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
@@ -69,7 +69,6 @@ import com.github.javaparser.ast.stmt.TypeDeclarationStmt;
import com.github.javaparser.ast.stmt.WhileStmt;
import com.github.javaparser.ast.type.*;
-import java.util.Iterator;
import java.util.List;
/**
@@ -95,18 +94,12 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
if (!nodeEquals(n1.getComment(), n2.getComment())) {
return false;
}
- if (!nodesEquals(n1.getOrphanComments(), n2.getOrphanComments())){
- return false;
- }
- return true;
- }
+ return nodesEquals(n1.getOrphanComments(), n2.getOrphanComments());
+ }
private <T extends Node> boolean nodesEquals(final List<T> nodes1, final List<T> nodes2) {
if (nodes1 == null) {
- if (nodes2 == null) {
- return true;
- }
- return false;
+ return nodes2 == null;
} else if (nodes2 == null) {
return false;
}
@@ -125,12 +118,7 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
if (n1 == n2) {
return true;
}
- if (n1 == null) {
- if (n2 == null) {
- return true;
- }
- return false;
- } else if (n2 == null) {
+ if (n1 == null || n2 == null) {
return false;
}
if (n1.getClass() != n2.getClass()) {
@@ -139,19 +127,14 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
if (!commonNodeEquality(n1, n2)){
return false;
}
- return n1.accept(this, n2).booleanValue();
+ return n1.accept(this, n2);
}
private boolean objEquals(final Object n1, final Object n2) {
if (n1 == n2) {
return true;
}
- if (n1 == null) {
- if (n2 == null) {
- return true;
- }
- return false;
- } else if (n2 == null) {
+ if (n1 == null || n2 == null) {
return false;
}
return n1.equals(n2);
@@ -161,90 +144,90 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
final CompilationUnit n2 = (CompilationUnit) arg;
if (!nodeEquals(n1.getPackage(), n2.getPackage())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getImports(), n2.getImports())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypes(), n2.getTypes())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getComments(), n2.getComments())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final PackageDeclaration n1, final Node arg) {
final PackageDeclaration n2 = (PackageDeclaration) arg;
if (!nodeEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ImportDeclaration n1, final Node arg) {
final ImportDeclaration n2 = (ImportDeclaration) arg;
if (!nodeEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final TypeParameter n1, final Node arg) {
final TypeParameter n2 = (TypeParameter) arg;
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeBound(), n2.getTypeBound())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final LineComment n1, final Node arg) {
final LineComment n2 = (LineComment) arg;
if (!objEquals(n1.getContent(), n2.getContent())) {
- return Boolean.FALSE;
+ return false;
}
- if (!objEquals(n1.getBeginLine(), n2.getBeginLine())) {
- return Boolean.FALSE;
+ if (!objEquals(n1.getBegin().line, n2.getBegin().line)) {
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final BlockComment n1, final Node arg) {
final BlockComment n2 = (BlockComment) arg;
if (!objEquals(n1.getContent(), n2.getContent())) {
- return Boolean.FALSE;
+ return false;
}
- if (!objEquals(n1.getBeginLine(), n2.getBeginLine())) {
- return Boolean.FALSE;
+ if (!objEquals(n1.getBegin().line, n2.getBegin().line)) {
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ClassOrInterfaceDeclaration n1, final Node arg) {
@@ -253,38 +236,38 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
// javadoc are checked at CompilationUnit
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (n1.isInterface() != n2.isInterface()) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getExtends(), n2.getExtends())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getImplements(), n2.getImplements())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final EnumDeclaration n1, final Node arg) {
@@ -293,34 +276,34 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
// javadoc are checked at CompilationUnit
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getImplements(), n2.getImplements())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getEntries(), n2.getEntries())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final EmptyTypeDeclaration n1, final Node arg) {
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final EnumConstantDeclaration n1, final Node arg) {
@@ -329,22 +312,22 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
// javadoc are checked at CompilationUnit
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getClassBody(), n2.getClassBody())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final AnnotationDeclaration n1, final Node arg) {
@@ -353,22 +336,22 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
// javadoc are checked at CompilationUnit
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final AnnotationMemberDeclaration n1, final Node arg) {
@@ -377,26 +360,26 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
// javadoc are checked at CompilationUnit
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getDefaultValue(), n2.getDefaultValue())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final FieldDeclaration n1, final Node arg) {
@@ -405,50 +388,50 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
// javadoc are checked at CompilationUnit
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getVariables(), n2.getVariables())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final VariableDeclarator n1, final Node arg) {
final VariableDeclarator n2 = (VariableDeclarator) arg;
if (!nodeEquals(n1.getId(), n2.getId())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getInit(), n2.getInit())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final VariableDeclaratorId n1, final Node arg) {
final VariableDeclaratorId n2 = (VariableDeclaratorId) arg;
if (n1.getArrayCount() != n2.getArrayCount()) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ConstructorDeclaration n1, final Node arg) {
@@ -457,34 +440,34 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
// javadoc are checked at CompilationUnit
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getBlock(), n2.getBlock())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getThrows(), n2.getThrows())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final MethodDeclaration n1, final Node arg) {
@@ -493,50 +476,50 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
// javadoc are checked at CompilationUnit
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (n1.getArrayCount() != n2.getArrayCount()) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getThrows(), n2.getThrows())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
- return Boolean.FALSE;
+ return false;
}
if(n1.isDefault() != n2.isDefault()){
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final Parameter n1, final Node arg) {
final Parameter n2 = (Parameter) arg;
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
return visit((BaseParameter) n1, arg);
}
@@ -544,7 +527,7 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
@Override public Boolean visit(MultiTypeParameter n1, Node arg) {
MultiTypeParameter n2 = (MultiTypeParameter) arg;
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
return visit((BaseParameter) n1, arg);
}
@@ -553,113 +536,113 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
final BaseParameter n2 = (BaseParameter) arg;
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getId(), n2.getId())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final EmptyMemberDeclaration n1, final Node arg) {
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final InitializerDeclaration n1, final Node arg) {
final InitializerDeclaration n2 = (InitializerDeclaration) arg;
if (!nodeEquals(n1.getBlock(), n2.getBlock())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final JavadocComment n1, final Node arg) {
final JavadocComment n2 = (JavadocComment) arg;
if (!objEquals(n1.getContent(), n2.getContent())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ClassOrInterfaceType n1, final Node arg) {
final ClassOrInterfaceType n2 = (ClassOrInterfaceType) arg;
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getScope(), n2.getScope())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final PrimitiveType n1, final Node arg) {
final PrimitiveType n2 = (PrimitiveType) arg;
if (n1.getType() != n2.getType()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ReferenceType n1, final Node arg) {
final ReferenceType n2 = (ReferenceType) arg;
if (n1.getArrayCount() != n2.getArrayCount()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
List<List<AnnotationExpr>> n1a = n1.getArraysAnnotations();
List<List<AnnotationExpr>> n2a = n2.getArraysAnnotations();
if (n1a !=null && n2a!= null) {
if(n1a.size() != n2a.size()){
- return Boolean.FALSE;
+ return false;
}
else{
int i = 0;
for(List<AnnotationExpr> aux: n1a){
if(!nodesEquals(aux, n2a.get(i))){
- return Boolean.FALSE;
+ return false;
}
i++;
}
}
}
else if (n1a != n2a){
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final IntersectionType n1, final Node arg) {
@@ -670,21 +653,21 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
if (n1Elements !=null && n2Elements != null) {
if(n1Elements.size() != n2Elements.size()){
- return Boolean.FALSE;
+ return false;
}
else{
int i = 0;
for(ReferenceType aux: n1Elements){
if(aux.accept(this, n2Elements.get(i))) {
- return Boolean.FALSE;
+ return false;
}
i++;
}
}
} else if (n1Elements != n2Elements){
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final UnionType n1, final Node arg) {
@@ -695,818 +678,818 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Node> {
if (n1Elements !=null && n2Elements != null) {
if(n1Elements.size() != n2Elements.size()){
- return Boolean.FALSE;
+ return false;
}
else{
int i = 0;
for(ReferenceType aux: n1Elements){
if(aux.accept(this, n2Elements.get(i))) {
- return Boolean.FALSE;
+ return false;
}
i++;
}
}
} else if (n1Elements != n2Elements){
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override
public Boolean visit(VoidType n1, Node arg) {
VoidType n2 = (VoidType) arg;
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final WildcardType n1, final Node arg) {
final WildcardType n2 = (WildcardType) arg;
if (!nodeEquals(n1.getExtends(), n2.getExtends())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getSuper(), n2.getSuper())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final UnknownType n1, final Node arg) {
final UnknownType n2 = (UnknownType) arg;
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ArrayAccessExpr n1, final Node arg) {
final ArrayAccessExpr n2 = (ArrayAccessExpr) arg;
if (!nodeEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getIndex(), n2.getIndex())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ArrayCreationExpr n1, final Node arg) {
final ArrayCreationExpr n2 = (ArrayCreationExpr) arg;
if (n1.getArrayCount() != n2.getArrayCount()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getInitializer(), n2.getInitializer())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getDimensions(), n2.getDimensions())) {
- return Boolean.FALSE;
+ return false;
}
List<List<AnnotationExpr>> n1a = n1.getArraysAnnotations();
List<List<AnnotationExpr>> n2a = n2.getArraysAnnotations();
if (n1a !=null && n2a!= null) {
if(n1a.size() != n2a.size()){
- return Boolean.FALSE;
+ return false;
}
else{
int i = 0;
for(List<AnnotationExpr> aux: n1a){
if(!nodesEquals(aux, n2a.get(i))){
- return Boolean.FALSE;
+ return false;
}
i++;
}
}
}
else if (n1a != n2a){
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ArrayInitializerExpr n1, final Node arg) {
final ArrayInitializerExpr n2 = (ArrayInitializerExpr) arg;
if (!nodesEquals(n1.getValues(), n2.getValues())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final AssignExpr n1, final Node arg) {
final AssignExpr n2 = (AssignExpr) arg;
if (n1.getOperator() != n2.getOperator()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getTarget(), n2.getTarget())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final BinaryExpr n1, final Node arg) {
final BinaryExpr n2 = (BinaryExpr) arg;
if (n1.getOperator() != n2.getOperator()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getLeft(), n2.getLeft())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getRight(), n2.getRight())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final CastExpr n1, final Node arg) {
final CastExpr n2 = (CastExpr) arg;
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ClassExpr n1, final Node arg) {
final ClassExpr n2 = (ClassExpr) arg;
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ConditionalExpr n1, final Node arg) {
final ConditionalExpr n2 = (ConditionalExpr) arg;
if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getThenExpr(), n2.getThenExpr())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getElseExpr(), n2.getElseExpr())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final EnclosedExpr n1, final Node arg) {
final EnclosedExpr n2 = (EnclosedExpr) arg;
if (!nodeEquals(n1.getInner(), n2.getInner())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final FieldAccessExpr n1, final Node arg) {
final FieldAccessExpr n2 = (FieldAccessExpr) arg;
if (!nodeEquals(n1.getScope(), n2.getScope())) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getField(), n2.getField())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final InstanceOfExpr n1, final Node arg) {
final InstanceOfExpr n2 = (InstanceOfExpr) arg;
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final StringLiteralExpr n1, final Node arg) {
final StringLiteralExpr n2 = (StringLiteralExpr) arg;
if (!objEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final IntegerLiteralExpr n1, final Node arg) {
final IntegerLiteralExpr n2 = (IntegerLiteralExpr) arg;
if (!objEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final LongLiteralExpr n1, final Node arg) {
final LongLiteralExpr n2 = (LongLiteralExpr) arg;
if (!objEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final IntegerLiteralMinValueExpr n1, final Node arg) {
final IntegerLiteralMinValueExpr n2 = (IntegerLiteralMinValueExpr) arg;
if (!objEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final LongLiteralMinValueExpr n1, final Node arg) {
final LongLiteralMinValueExpr n2 = (LongLiteralMinValueExpr) arg;
if (!objEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final CharLiteralExpr n1, final Node arg) {
final CharLiteralExpr n2 = (CharLiteralExpr) arg;
if (!objEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final DoubleLiteralExpr n1, final Node arg) {
final DoubleLiteralExpr n2 = (DoubleLiteralExpr) arg;
if (!objEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final BooleanLiteralExpr n1, final Node arg) {
final BooleanLiteralExpr n2 = (BooleanLiteralExpr) arg;
if (n1.getValue() != n2.getValue()) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final NullLiteralExpr n1, final Node arg) {
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final MethodCallExpr n1, final Node arg) {
final MethodCallExpr n2 = (MethodCallExpr) arg;
if (!nodeEquals(n1.getScope(), n2.getScope())) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final NameExpr n1, final Node arg) {
final NameExpr n2 = (NameExpr) arg;
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ObjectCreationExpr n1, final Node arg) {
final ObjectCreationExpr n2 = (ObjectCreationExpr) arg;
if (!nodeEquals(n1.getScope(), n2.getScope())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnonymousClassBody(), n2.getAnonymousClassBody())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final QualifiedNameExpr n1, final Node arg) {
final QualifiedNameExpr n2 = (QualifiedNameExpr) arg;
if (!nodeEquals(n1.getQualifier(), n2.getQualifier())) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ThisExpr n1, final Node arg) {
final ThisExpr n2 = (ThisExpr) arg;
if (!nodeEquals(n1.getClassExpr(), n2.getClassExpr())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final SuperExpr n1, final Node arg) {
final SuperExpr n2 = (SuperExpr) arg;
if (!nodeEquals(n1.getClassExpr(), n2.getClassExpr())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final UnaryExpr n1, final Node arg) {
final UnaryExpr n2 = (UnaryExpr) arg;
if (n1.getOperator() != n2.getOperator()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final VariableDeclarationExpr n1, final Node arg) {
final VariableDeclarationExpr n2 = (VariableDeclarationExpr) arg;
if (n1.getModifiers() != n2.getModifiers()) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getVars(), n2.getVars())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final MarkerAnnotationExpr n1, final Node arg) {
final MarkerAnnotationExpr n2 = (MarkerAnnotationExpr) arg;
if (!nodeEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final SingleMemberAnnotationExpr n1, final Node arg) {
final SingleMemberAnnotationExpr n2 = (SingleMemberAnnotationExpr) arg;
if (!nodeEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getMemberValue(), n2.getMemberValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final NormalAnnotationExpr n1, final Node arg) {
final NormalAnnotationExpr n2 = (NormalAnnotationExpr) arg;
if (!nodeEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getPairs(), n2.getPairs())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final MemberValuePair n1, final Node arg) {
final MemberValuePair n2 = (MemberValuePair) arg;
if (!objEquals(n1.getName(), n2.getName())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getValue(), n2.getValue())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ExplicitConstructorInvocationStmt n1, final Node arg) {
final ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg;
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final TypeDeclarationStmt n1, final Node arg) {
final TypeDeclarationStmt n2 = (TypeDeclarationStmt) arg;
if (!nodeEquals(n1.getTypeDeclaration(), n2.getTypeDeclaration())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final AssertStmt n1, final Node arg) {
final AssertStmt n2 = (AssertStmt) arg;
if (!nodeEquals(n1.getCheck(), n2.getCheck())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getMessage(), n2.getMessage())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final BlockStmt n1, final Node arg) {
final BlockStmt n2 = (BlockStmt) arg;
if (!nodesEquals(n1.getStmts(), n2.getStmts())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final LabeledStmt n1, final Node arg) {
final LabeledStmt n2 = (LabeledStmt) arg;
if (!nodeEquals(n1.getStmt(), n2.getStmt())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final EmptyStmt n1, final Node arg) {
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ExpressionStmt n1, final Node arg) {
final ExpressionStmt n2 = (ExpressionStmt) arg;
if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final SwitchStmt n1, final Node arg) {
final SwitchStmt n2 = (SwitchStmt) arg;
if (!nodeEquals(n1.getSelector(), n2.getSelector())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getEntries(), n2.getEntries())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final SwitchEntryStmt n1, final Node arg) {
final SwitchEntryStmt n2 = (SwitchEntryStmt) arg;
if (!nodeEquals(n1.getLabel(), n2.getLabel())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getStmts(), n2.getStmts())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final BreakStmt n1, final Node arg) {
final BreakStmt n2 = (BreakStmt) arg;
if (!objEquals(n1.getId(), n2.getId())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ReturnStmt n1, final Node arg) {
final ReturnStmt n2 = (ReturnStmt) arg;
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final IfStmt n1, final Node arg) {
final IfStmt n2 = (IfStmt) arg;
if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getThenStmt(), n2.getThenStmt())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getElseStmt(), n2.getElseStmt())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final WhileStmt n1, final Node arg) {
final WhileStmt n2 = (WhileStmt) arg;
if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ContinueStmt n1, final Node arg) {
final ContinueStmt n2 = (ContinueStmt) arg;
if (!objEquals(n1.getId(), n2.getId())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final DoStmt n1, final Node arg) {
final DoStmt n2 = (DoStmt) arg;
if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ForeachStmt n1, final Node arg) {
final ForeachStmt n2 = (ForeachStmt) arg;
if (!nodeEquals(n1.getVariable(), n2.getVariable())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getIterable(), n2.getIterable())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ForStmt n1, final Node arg) {
final ForStmt n2 = (ForStmt) arg;
if (!nodesEquals(n1.getInit(), n2.getInit())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getCompare(), n2.getCompare())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getUpdate(), n2.getUpdate())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final ThrowStmt n1, final Node arg) {
final ThrowStmt n2 = (ThrowStmt) arg;
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final SynchronizedStmt n1, final Node arg) {
final SynchronizedStmt n2 = (SynchronizedStmt) arg;
if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getBlock(), n2.getBlock())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final TryStmt n1, final Node arg) {
final TryStmt n2 = (TryStmt) arg;
if (!nodeEquals(n1.getTryBlock(), n2.getTryBlock())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getCatchs(), n2.getCatchs())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getFinallyBlock(), n2.getFinallyBlock())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override public Boolean visit(final CatchClause n1, final Node arg) {
final CatchClause n2 = (CatchClause) arg;
if (!nodeEquals(n1.getParam(), n2.getParam())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getCatchBlock(), n2.getCatchBlock())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override
public Boolean visit(LambdaExpr n1, Node arg) {
LambdaExpr n2 = (LambdaExpr) arg;
if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
- return Boolean.FALSE;
+ return false;
}
if(n1.isParametersEnclosed() != n2.isParametersEnclosed()){
- return Boolean.FALSE;
+ return false;
}
if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override
public Boolean visit(MethodReferenceExpr n1, Node arg) {
MethodReferenceExpr n2 = (MethodReferenceExpr) arg;
if (!nodeEquals(n1.getScope(), n2.getScope())) {
- return Boolean.FALSE;
+ return false;
}
if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
- return Boolean.FALSE;
+ return false;
}
if (!objEquals(n1.getIdentifier(), n2.getIdentifier())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
@Override
public Boolean visit(TypeExpr n, Node arg) {
TypeExpr n2 = (TypeExpr) arg;
if (!nodeEquals(n.getType(), n2.getType())) {
- return Boolean.FALSE;
+ return false;
}
- return Boolean.TRUE;
+ return true;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitor.java
index 2527e2ae2..e8c036d4f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitor.java
@@ -76,183 +76,183 @@ public interface GenericVisitor<R, A> {
//- Compilation Unit ----------------------------------
- public R visit(CompilationUnit n, A arg);
+ R visit(CompilationUnit n, A arg);
- public R visit(PackageDeclaration n, A arg);
+ R visit(PackageDeclaration n, A arg);
- public R visit(ImportDeclaration n, A arg);
+ R visit(ImportDeclaration n, A arg);
- public R visit(TypeParameter n, A arg);
+ R visit(TypeParameter n, A arg);
- public R visit(LineComment n, A arg);
+ R visit(LineComment n, A arg);
- public R visit(BlockComment n, A arg);
+ R visit(BlockComment n, A arg);
//- Body ----------------------------------------------
- public R visit(ClassOrInterfaceDeclaration n, A arg);
+ R visit(ClassOrInterfaceDeclaration n, A arg);
- public R visit(EnumDeclaration n, A arg);
+ R visit(EnumDeclaration n, A arg);
- public R visit(EmptyTypeDeclaration n, A arg);
+ R visit(EmptyTypeDeclaration n, A arg);
- public R visit(EnumConstantDeclaration n, A arg);
+ R visit(EnumConstantDeclaration n, A arg);
- public R visit(AnnotationDeclaration n, A arg);
+ R visit(AnnotationDeclaration n, A arg);
- public R visit(AnnotationMemberDeclaration n, A arg);
+ R visit(AnnotationMemberDeclaration n, A arg);
- public R visit(FieldDeclaration n, A arg);
+ R visit(FieldDeclaration n, A arg);
- public R visit(VariableDeclarator n, A arg);
+ R visit(VariableDeclarator n, A arg);
- public R visit(VariableDeclaratorId n, A arg);
+ R visit(VariableDeclaratorId n, A arg);
- public R visit(ConstructorDeclaration n, A arg);
+ R visit(ConstructorDeclaration n, A arg);
- public R visit(MethodDeclaration n, A arg);
+ R visit(MethodDeclaration n, A arg);
- public R visit(Parameter n, A arg);
+ R visit(Parameter n, A arg);
- public R visit(MultiTypeParameter n, A arg);
+ R visit(MultiTypeParameter n, A arg);
- public R visit(EmptyMemberDeclaration n, A arg);
+ R visit(EmptyMemberDeclaration n, A arg);
- public R visit(InitializerDeclaration n, A arg);
+ R visit(InitializerDeclaration n, A arg);
- public R visit(JavadocComment n, A arg);
+ R visit(JavadocComment n, A arg);
//- Type ----------------------------------------------
- public R visit(ClassOrInterfaceType n, A arg);
+ R visit(ClassOrInterfaceType n, A arg);
- public R visit(PrimitiveType n, A arg);
+ R visit(PrimitiveType n, A arg);
- public R visit(ReferenceType n, A arg);
+ R visit(ReferenceType n, A arg);
- public R visit(IntersectionType n, A arg);
+ R visit(IntersectionType n, A arg);
- public R visit(UnionType n, A arg);
+ R visit(UnionType n, A arg);
- public R visit(VoidType n, A arg);
+ R visit(VoidType n, A arg);
- public R visit(WildcardType n, A arg);
+ R visit(WildcardType n, A arg);
- public R visit(UnknownType n, A arg);
+ R visit(UnknownType n, A arg);
//- Expression ----------------------------------------
- public R visit(ArrayAccessExpr n, A arg);
+ R visit(ArrayAccessExpr n, A arg);
- public R visit(ArrayCreationExpr n, A arg);
+ R visit(ArrayCreationExpr n, A arg);
- public R visit(ArrayInitializerExpr n, A arg);
+ R visit(ArrayInitializerExpr n, A arg);
- public R visit(AssignExpr n, A arg);
+ R visit(AssignExpr n, A arg);
- public R visit(BinaryExpr n, A arg);
+ R visit(BinaryExpr n, A arg);
- public R visit(CastExpr n, A arg);
+ R visit(CastExpr n, A arg);
- public R visit(ClassExpr n, A arg);
+ R visit(ClassExpr n, A arg);
- public R visit(ConditionalExpr n, A arg);
+ R visit(ConditionalExpr n, A arg);
- public R visit(EnclosedExpr n, A arg);
+ R visit(EnclosedExpr n, A arg);
- public R visit(FieldAccessExpr n, A arg);
+ R visit(FieldAccessExpr n, A arg);
- public R visit(InstanceOfExpr n, A arg);
+ R visit(InstanceOfExpr n, A arg);
- public R visit(StringLiteralExpr n, A arg);
+ R visit(StringLiteralExpr n, A arg);
- public R visit(IntegerLiteralExpr n, A arg);
+ R visit(IntegerLiteralExpr n, A arg);
- public R visit(LongLiteralExpr n, A arg);
+ R visit(LongLiteralExpr n, A arg);
- public R visit(IntegerLiteralMinValueExpr n, A arg);
+ R visit(IntegerLiteralMinValueExpr n, A arg);
- public R visit(LongLiteralMinValueExpr n, A arg);
+ R visit(LongLiteralMinValueExpr n, A arg);
- public R visit(CharLiteralExpr n, A arg);
+ R visit(CharLiteralExpr n, A arg);
- public R visit(DoubleLiteralExpr n, A arg);
+ R visit(DoubleLiteralExpr n, A arg);
- public R visit(BooleanLiteralExpr n, A arg);
+ R visit(BooleanLiteralExpr n, A arg);
- public R visit(NullLiteralExpr n, A arg);
+ R visit(NullLiteralExpr n, A arg);
- public R visit(MethodCallExpr n, A arg);
+ R visit(MethodCallExpr n, A arg);
- public R visit(NameExpr n, A arg);
+ R visit(NameExpr n, A arg);
- public R visit(ObjectCreationExpr n, A arg);
+ R visit(ObjectCreationExpr n, A arg);
- public R visit(QualifiedNameExpr n, A arg);
+ R visit(QualifiedNameExpr n, A arg);
- public R visit(ThisExpr n, A arg);
+ R visit(ThisExpr n, A arg);
- public R visit(SuperExpr n, A arg);
+ R visit(SuperExpr n, A arg);
- public R visit(UnaryExpr n, A arg);
+ R visit(UnaryExpr n, A arg);
- public R visit(VariableDeclarationExpr n, A arg);
+ R visit(VariableDeclarationExpr n, A arg);
- public R visit(MarkerAnnotationExpr n, A arg);
+ R visit(MarkerAnnotationExpr n, A arg);
- public R visit(SingleMemberAnnotationExpr n, A arg);
+ R visit(SingleMemberAnnotationExpr n, A arg);
- public R visit(NormalAnnotationExpr n, A arg);
+ R visit(NormalAnnotationExpr n, A arg);
- public R visit(MemberValuePair n, A arg);
+ R visit(MemberValuePair n, A arg);
//- Statements ----------------------------------------
- public R visit(ExplicitConstructorInvocationStmt n, A arg);
+ R visit(ExplicitConstructorInvocationStmt n, A arg);
- public R visit(TypeDeclarationStmt n, A arg);
+ R visit(TypeDeclarationStmt n, A arg);
- public R visit(AssertStmt n, A arg);
+ R visit(AssertStmt n, A arg);
- public R visit(BlockStmt n, A arg);
+ R visit(BlockStmt n, A arg);
- public R visit(LabeledStmt n, A arg);
+ R visit(LabeledStmt n, A arg);
- public R visit(EmptyStmt n, A arg);
+ R visit(EmptyStmt n, A arg);
- public R visit(ExpressionStmt n, A arg);
+ R visit(ExpressionStmt n, A arg);
- public R visit(SwitchStmt n, A arg);
+ R visit(SwitchStmt n, A arg);
- public R visit(SwitchEntryStmt n, A arg);
+ R visit(SwitchEntryStmt n, A arg);
- public R visit(BreakStmt n, A arg);
+ R visit(BreakStmt n, A arg);
- public R visit(ReturnStmt n, A arg);
+ R visit(ReturnStmt n, A arg);
- public R visit(IfStmt n, A arg);
+ R visit(IfStmt n, A arg);
- public R visit(WhileStmt n, A arg);
+ R visit(WhileStmt n, A arg);
- public R visit(ContinueStmt n, A arg);
+ R visit(ContinueStmt n, A arg);
- public R visit(DoStmt n, A arg);
+ R visit(DoStmt n, A arg);
- public R visit(ForeachStmt n, A arg);
+ R visit(ForeachStmt n, A arg);
- public R visit(ForStmt n, A arg);
+ R visit(ForStmt n, A arg);
- public R visit(ThrowStmt n, A arg);
+ R visit(ThrowStmt n, A arg);
- public R visit(SynchronizedStmt n, A arg);
+ R visit(SynchronizedStmt n, A arg);
- public R visit(TryStmt n, A arg);
+ R visit(TryStmt n, A arg);
- public R visit(CatchClause n, A arg);
+ R visit(CatchClause n, A arg);
- public R visit(LambdaExpr n, A arg);
+ R visit(LambdaExpr n, A arg);
- public R visit(MethodReferenceExpr n, A arg);
+ R visit(MethodReferenceExpr n, A arg);
- public R visit(TypeExpr n, A arg);
+ R visit(TypeExpr n, A arg);
}
diff --git a/javaparser-core/src/main/javacc/java_1_8.jj b/javaparser-core/src/main/javacc/java_1_8.jj
index c364e6acf..31e68c1ea 100644
--- a/javaparser-core/src/main/javacc/java_1_8.jj
+++ b/javaparser-core/src/main/javacc/java_1_8.jj
@@ -53,6 +53,8 @@ import com.github.javaparser.ast.comments.*;
import com.github.javaparser.ast.expr.*;
import com.github.javaparser.ast.stmt.*;
import com.github.javaparser.ast.type.*;
+import static com.github.javaparser.Range.*;
+import static com.github.javaparser.Position.*;
/**
* <p>This class was generated automatically by javacc, do not edit.</p>
@@ -83,12 +85,10 @@ final class ASTParser {
final int modifiers;
final List annotations;
- final int beginLine;
- final int beginColumn;
+ final Position begin;
- public Modifier(int beginLine, int beginColumn, int modifiers, List annotations) {
- this.beginLine = beginLine;
- this.beginColumn = beginColumn;
+ public Modifier(Position begin, int modifiers, List annotations) {
+ this.begin = begin;
this.modifiers = modifiers;
this.annotations = annotations;
}
@@ -129,20 +129,19 @@ final class ASTParser {
if (ret instanceof EnclosedExpr) {
Expression inner = ((EnclosedExpr) ret).getInner();
if (inner != null && inner instanceof NameExpr) {
- VariableDeclaratorId id = new VariableDeclaratorId(inner.getBeginLine(), inner.getBeginColumn(), inner.getEndLine(), inner.getEndColumn(), ((NameExpr)inner).getName(), 0);
- List params = add(null, new Parameter(ret.getBeginLine(), ret.getBeginColumn(), ret.getEndLine(), ret.getEndColumn(), 0, null, new UnknownType(), false, id));
- ret = new LambdaExpr(ret.getBeginLine(), ret.getBeginColumn(), lambdaBody.getEndLine(), lambdaBody.getEndColumn(), params, lambdaBody, true);
+ VariableDeclaratorId id = new VariableDeclaratorId(inner.getRange(), ((NameExpr)inner).getName(), 0);
+ List params = add(null, new Parameter(ret.getRange(), 0, null, new UnknownType(), false, id));
+ ret = new LambdaExpr(range(ret.getBegin(), lambdaBody.getEnd()), params, lambdaBody, true);
} else {
- ret = new LambdaExpr(ret.getBeginLine(), ret.getBeginColumn(), lambdaBody.getEndLine(), lambdaBody.getEndColumn(), null, lambdaBody, true);
+ ret = new LambdaExpr(range(ret.getBegin(), lambdaBody.getEnd()), null, lambdaBody, true);
}
} else if (ret instanceof NameExpr) {
- VariableDeclaratorId id = new VariableDeclaratorId(ret.getBeginLine(), ret.getBeginColumn(), ret.getEndLine(), ret.getEndColumn(), ((NameExpr)ret).getName(), 0);
- List params = add(null, new Parameter(ret.getBeginLine(), ret.getBeginColumn(), ret.getEndLine(), ret.getEndColumn(), 0, null, new UnknownType(), false, id));
- ret = new LambdaExpr(ret.getBeginLine(), ret.getBeginColumn(), ret.getEndLine(), ret.getEndColumn(), params, lambdaBody, false);
+ VariableDeclaratorId id = new VariableDeclaratorId(ret.getRange(), ((NameExpr)ret).getName(), 0);
+ List params = add(null, new Parameter(ret.getRange(), 0, null, new UnknownType(), false, id));
+ ret = new LambdaExpr(ret.getRange(), params, lambdaBody, false);
} else if (ret instanceof LambdaExpr) {
((LambdaExpr) ret).setBody(lambdaBody);
- ret.setEndLine(lambdaBody.getEndLine());
- ret.setEndColumn(lambdaBody.getEndColumn());
+ ret.setEnd(lambdaBody.getEnd());
} else {
throw new ParseException("Failed to parse lambda expression! Please create an issue at https://github.com/javaparser/javaparser/issues");
}
@@ -1175,12 +1174,12 @@ CompilationUnit CompilationUnit():
int column = 0;
}
{
- [ LOOKAHEAD(PackageDeclaration()) pakage = PackageDeclaration() {line = pakage.getBeginLine(); column = pakage.getBeginColumn();} ]
- ( in = ImportDeclaration() { if(line==-1){line = in.getBeginLine(); column = in.getBeginColumn();} imports = add(imports, in); } |
- in = EmptyImportDeclaration() { if(line==-1){line = in.getBeginLine(); column = in.getBeginColumn();} imports = add(imports, in); } )*
- ( tn = TypeDeclaration() { if(line==-1){line = tn.getBeginLine(); column = tn.getBeginColumn();} types = add(types, tn); } )*
+ [ LOOKAHEAD(PackageDeclaration()) pakage = PackageDeclaration() {line = pakage.getBegin().line; column = pakage.getBegin().column;} ]
+ ( in = ImportDeclaration() { if(line==-1){line = in.getBegin().line; column = in.getBegin().column;} imports = add(imports, in); } |
+ in = EmptyImportDeclaration() { if(line==-1){line = in.getBegin().line; column = in.getBegin().column;} imports = add(imports, in); } )*
+ ( tn = TypeDeclaration() { if(line==-1){line = tn.getBegin().line; column = tn.getBegin().column;} types = add(types, tn); } )*
(<EOF> | "\u001A" /** ctrl+z char **/)
- { return new CompilationUnit(line == -1 ? 0 : line, column, token.endLine, token.endColumn,pakage, imports, types); }
+ { return new CompilationUnit(line == -1 ? Range.UNKNOWN : range(line, column, token.endLine, token.endColumn),pakage, imports, types); }
}
ImportDeclaration EmptyImportDeclaration():
@@ -1190,7 +1189,7 @@ ImportDeclaration EmptyImportDeclaration():
}
{
";"
- { return ImportDeclaration.createEmptyDeclaration(line, column, token.endLine, token.endColumn); }
+ { return ImportDeclaration.createEmptyDeclaration(range(line, column, token.endLine, token.endColumn)); }
}
PackageDeclaration PackageDeclaration():
@@ -1204,7 +1203,7 @@ PackageDeclaration PackageDeclaration():
{
( ann = Annotation() { annotations = add(annotations, ann); } )*
"package" {line=token.beginLine; column=token.beginColumn;} name = Name() ";"
- { return new PackageDeclaration(line, column, token.endLine, token.endColumn,annotations, name); }
+ { return new PackageDeclaration(range(line, column, token.endLine, token.endColumn),annotations, name); }
}
ImportDeclaration ImportDeclaration():
@@ -1217,7 +1216,7 @@ ImportDeclaration ImportDeclaration():
}
{
"import" {line=token.beginLine; column=token.beginColumn;} [ "static" { isStatic = true; } ] name = Name() [ "." "*" { isAsterisk = true; } ] ";"
- { return new ImportDeclaration(line, column, token.endLine, token.endColumn,name, isStatic, isAsterisk); }
+ { return new ImportDeclaration(range(line, column, token.endLine, token.endColumn),name, isStatic, isAsterisk); }
}
/*
@@ -1260,12 +1259,12 @@ Modifier Modifiers():
|
"strictfp" { modifiers = addModifier(modifiers, ModifierSet.STRICTFP, token); if(beginLine==-1) {beginLine=token.beginLine; beginColumn=token.beginColumn;} }
|
- ann = Annotation() { annotations = add(annotations, ann); if(beginLine==-1) {beginLine=ann.getBeginLine(); beginColumn=ann.getBeginColumn();} }
+ ann = Annotation() { annotations = add(annotations, ann); if(beginLine==-1) {beginLine=ann.getBegin().line; beginColumn=ann.getBegin().column;} }
)
)*
{
- return new Modifier(beginLine, beginColumn, modifiers, annotations);
+ return new Modifier(pos(beginLine, beginColumn), modifiers, annotations);
}
}
@@ -1280,7 +1279,7 @@ TypeDeclaration TypeDeclaration():
{
{ }
(
- ";" { ret = new EmptyTypeDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
+ ";" { ret = new EmptyTypeDeclaration(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn)); }
|
modifier = Modifiers()
(
@@ -1303,8 +1302,8 @@ ClassOrInterfaceDeclaration ClassOrInterfaceDeclaration(Modifier modifier):
List extList = null;
List impList = null;
List members;
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
}
{
( "class" | "interface" { isInterface = true; } ) { if (line == -1) {line=token.beginLine; column=token.beginColumn;} }
@@ -1314,7 +1313,7 @@ ClassOrInterfaceDeclaration ClassOrInterfaceDeclaration(Modifier modifier):
[ impList = ImplementsList(isInterface) ]
members = ClassOrInterfaceBody(isInterface)
- { ClassOrInterfaceDeclaration tmp = new ClassOrInterfaceDeclaration(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, isInterface, null, typePar, extList, impList, members);
+ { ClassOrInterfaceDeclaration tmp = new ClassOrInterfaceDeclaration(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, isInterface, null, typePar, extList, impList, members);
tmp.setNameExpr(name);
return tmp;
}
@@ -1361,8 +1360,8 @@ EnumDeclaration EnumDeclaration(Modifier modifier):
List entries = null;
BodyDeclaration member;
List members = null;
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
}
{
"enum" { if (line == -1) {line=token.beginLine; column=token.beginColumn;} }
@@ -1380,7 +1379,7 @@ EnumDeclaration EnumDeclaration(Modifier modifier):
"}"
{
- EnumDeclaration tmp = new EnumDeclaration(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, null, impList, entries, members);
+ EnumDeclaration tmp = new EnumDeclaration(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, null, impList, entries, members);
tmp.setNameExpr(name);
return tmp;
}
@@ -1400,11 +1399,11 @@ EnumConstantDeclaration EnumConstantDeclaration():
}
{
{ }
- ( ann = Annotation() { annotations = add(annotations, ann); if(line==-1){line=ann.getBeginLine(); column=ann.getBeginColumn();} } )*
+ ( ann = Annotation() { annotations = add(annotations, ann); if(line==-1){line=ann.getBegin().line; column=ann.getBegin().column;} } )*
<IDENTIFIER> { name = token.image; if(line==-1){line=token.beginLine; column=token.beginColumn;} }
[ args = Arguments() ] [ classBody = ClassOrInterfaceBody(false) ]
{
- EnumConstantDeclaration tmp = new EnumConstantDeclaration(line, column, token.endLine, token.endColumn, annotations, name, args, classBody);
+ EnumConstantDeclaration tmp = new EnumConstantDeclaration(range(line, column, token.endLine, token.endColumn), annotations, name, args, classBody);
return tmp;
}
@@ -1436,7 +1435,7 @@ TypeParameter TypeParameter():
}
{
<IDENTIFIER> { name = token.image; line=token.beginLine; column=token.beginColumn;} [ typeBound = TypeBound() ]
- { return new TypeParameter(line, column, token.endLine, token.endColumn,name, typeBound); }
+ { return new TypeParameter(range(line, column, token.endLine, token.endColumn),name, typeBound); }
}
List TypeBound():
@@ -1526,7 +1525,7 @@ BodyDeclaration ClassOrInterfaceBodyDeclaration(boolean isInterface):
}
}
|
- ";" { ret = new EmptyMemberDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
+ ";" { ret = new EmptyMemberDeclaration(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn)); }
)
{ return ret; }
}
@@ -1544,10 +1543,10 @@ FieldDeclaration FieldDeclaration(Modifier modifier):
( "," val = VariableDeclarator() { variables.add(val); } )* ";"
{
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
- if (line == -1) { line=type.getBeginLine(); column=type.getBeginColumn(); }
- return new FieldDeclaration(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, variables);
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
+ if (line == -1) { line=type.getBegin().line; column=type.getBegin().column; }
+ return new FieldDeclaration(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, type, variables);
}
}
@@ -1558,7 +1557,7 @@ VariableDeclarator VariableDeclarator():
}
{
id = VariableDeclaratorId() [ "=" init = VariableInitializer() ]
- { return new VariableDeclarator(id.getBeginLine(), id.getBeginColumn(), token.endLine, token.endColumn, id, init); }
+ { return new VariableDeclarator(range(id.getBegin().line, id.getBegin().column, token.endLine, token.endColumn), id, init); }
}
VariableDeclaratorId VariableDeclaratorId():
@@ -1570,7 +1569,7 @@ VariableDeclaratorId VariableDeclaratorId():
}
{
<IDENTIFIER> { name = token.image; line=token.beginLine; column=token.beginColumn;} ( "[" "]" { arrayCount++; } )*
- { return new VariableDeclaratorId(line, column, token.endLine, token.endColumn,name, arrayCount); }
+ { return new VariableDeclaratorId(range(line, column, token.endLine, token.endColumn),name, arrayCount); }
}
Expression VariableInitializer():
@@ -1595,7 +1594,7 @@ ArrayInitializerExpr ArrayInitializer():
}
{
"{" {line=token.beginLine; column=token.beginColumn;} [ val = VariableInitializer() { values = add(values, val); } ( LOOKAHEAD(2) "," val = VariableInitializer() { values = add(values, val); } )* ] [ "," ] "}"
- { return new ArrayInitializerExpr(line, column, token.endLine, token.endColumn,values); }
+ { return new ArrayInitializerExpr(range(line, column, token.endLine, token.endColumn),values); }
}
MethodDeclaration MethodDeclaration(Modifier modifier):
@@ -1607,20 +1606,20 @@ MethodDeclaration MethodDeclaration(Modifier modifier):
int arrayCount = 0;
List throws_ = null;
BlockStmt block = null;
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
Type throwType;
}
{
// Modifiers already matched in the caller!
[ typeParameters = TypeParameters() { int[] lineCol=(int[])typeParameters.remove(0); if(line==-1){ line=lineCol[0]; column=lineCol[1];} } ]
- type = ResultType() { if(line==-1){line=type.getBeginLine(); column=type.getBeginColumn();}}
+ type = ResultType() { if(line==-1){line=type.getBegin().line; column=type.getBegin().column;}}
name = Name() parameters = FormalParameters() ( "[" "]" { arrayCount++; } )*
[ "throws" throwType = ReferenceTypeWithAnnotations() { throws_ = add(throws_, throwType); }
("," throwType = ReferenceTypeWithAnnotations() { throws_ = add(throws_, throwType); })* ]
( block = Block() | ";" )
{
- MethodDeclaration tmp = new MethodDeclaration(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, typeParameters, type, null, parameters, arrayCount, throws_, block);
+ MethodDeclaration tmp = new MethodDeclaration(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, typeParameters, type, null, parameters, arrayCount, throws_, block);
tmp.setNameExpr(name);
return tmp;
}
@@ -1672,9 +1671,9 @@ List InferredLambdaParameters():
}
{
","
- id = VariableDeclaratorId() { ret = add(ret, new Parameter(id.getBeginLine(), id.getBeginColumn(), id.getEndLine(), id.getEndColumn(), 0, null, new UnknownType(), false, id));}
+ id = VariableDeclaratorId() { ret = add(ret, new Parameter(range(id.getBegin(), id.getEnd()), 0, null, new UnknownType(), false, id));}
(
- "," id = VariableDeclaratorId() { ret = add(ret, new Parameter(id.getBeginLine(), id.getBeginColumn(), id.getEndLine(), id.getEndColumn(), 0, null, new UnknownType(), false, id)); }
+ "," id = VariableDeclaratorId() { ret = add(ret, new Parameter(range(id.getBegin(), id.getEnd()), 0, null, new UnknownType(), false, id)); }
)*
{ return ret; }
}
@@ -1690,10 +1689,10 @@ Parameter FormalParameter():
modifier = Modifiers() type = Type() [ "..." { isVarArg = true;} ] id = VariableDeclaratorId()
{
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
- if(line==-1){ line=type.getBeginLine(); column=type.getBeginColumn(); }
- return new Parameter(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, isVarArg, id);
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
+ if(line==-1){ line=type.getBegin().line; column=type.getBegin().column; }
+ return new Parameter(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, type, isVarArg, id);
}
}
@@ -1705,8 +1704,8 @@ ConstructorDeclaration ConstructorDeclaration(Modifier modifier):
List throws_ = null;
ExplicitConstructorInvocationStmt exConsInv = null;
List stmts;
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
int bbLine = 0;
int bbColumn = 0;
int beLine = 0;
@@ -1727,7 +1726,7 @@ ConstructorDeclaration ConstructorDeclaration(Modifier modifier):
if (exConsInv != null) {
stmts = add(0, stmts, exConsInv);
}
- ConstructorDeclaration tmp = new ConstructorDeclaration(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, typeParameters, null, parameters, throws_, new BlockStmt(bbLine, bbColumn, token.endLine, token.endColumn, stmts));
+ ConstructorDeclaration tmp = new ConstructorDeclaration(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, typeParameters, null, parameters, throws_, new BlockStmt(range(bbLine, bbColumn, token.endLine, token.endColumn), stmts));
tmp.setNameExpr(name);
return tmp;
}
@@ -1752,13 +1751,13 @@ ExplicitConstructorInvocationStmt ExplicitConstructorInvocation():
[
LOOKAHEAD( PrimaryExpressionWithoutSuperSuffix() "." )
expr = PrimaryExpressionWithoutSuperSuffix() "."
- { line=expr.getBeginLine(); column=expr.getBeginColumn(); }
+ { line=expr.getBegin().line; column=expr.getBegin().column; }
]
[ typeArgs = TypeArguments() {int[] lineCol=(int[])typeArgs.remove(0); if (line == -1) {line=lineCol[0]; column=lineCol[1];}} ]
<SUPER> {if (line == -1) {line=token.beginLine; column=token.beginColumn;}}
args = Arguments() ";"
)
- { return new ExplicitConstructorInvocationStmt(line, column, token.endLine, token.endColumn,typeArgs, isThis, expr, args); }
+ { return new ExplicitConstructorInvocationStmt(range(line, column, token.endLine, token.endColumn),typeArgs, isThis, expr, args); }
}
List Statements():
@@ -1779,8 +1778,8 @@ InitializerDeclaration InitializerDeclaration():
boolean isStatic = false;
}
{
- [ "static" { isStatic = true; line=token.beginLine; column=token.beginColumn;} ] block = Block() {if(line==-1){line=block.getBeginLine(); column=block.getBeginColumn();}}
- { return new InitializerDeclaration(line, column, token.endLine, token.endColumn, isStatic, block); }
+ [ "static" { isStatic = true; line=token.beginLine; column=token.beginColumn;} ] block = Block() {if(line==-1){line=block.getBegin().line; column=block.getBegin().column;}}
+ { return new InitializerDeclaration(range(line, column, token.endLine, token.endColumn), isStatic, block); }
}
@@ -1815,7 +1814,7 @@ ReferenceType ReferenceType():
|
type = ClassOrInterfaceType() ( LOOKAHEAD(2) (ann = Annotation() { annotations = add(annotations, ann); })* "[" "]" { arrayCount++; accum = add(accum, annotations); annotations= null;} )*
)
- { return new ReferenceType(type.getBeginLine(), type.getBeginColumn(), token.endLine, token.endColumn, type, arrayCount, null, accum); }
+ { return new ReferenceType(range(type.getBegin().line, type.getBegin().column, token.endLine, token.endColumn), type, arrayCount, null, accum); }
}
IntersectionType IntersectionType():
@@ -1827,10 +1826,10 @@ IntersectionType IntersectionType():
}
{
elementType=ReferenceType() {
- line=elementType.getBeginLine(); column=elementType.getBeginColumn();
+ line=elementType.getBegin().line; column=elementType.getBegin().column;
elements = add(elements, elementType); }
"&" (elementType=ReferenceType() { elements = add(elements, elementType); } )+
- { return new IntersectionType(line, column, token.endLine, token.endColumn, elements); }
+ { return new IntersectionType(range(line, column, token.endLine, token.endColumn), elements); }
}
ClassOrInterfaceType ClassOrInterfaceType():
@@ -1847,13 +1846,13 @@ ClassOrInterfaceType ClassOrInterfaceType():
<IDENTIFIER> {line=token.beginLine; column=token.beginColumn;} { name = token.image; }
[ LOOKAHEAD(2) typeArgs = TypeArguments() {typeArgs.remove(0);} ]
{
- ret = new ClassOrInterfaceType(line, column, token.endLine, token.endColumn,null, name, createTypeArguments(typeArgs));
+ ret = new ClassOrInterfaceType(range(line, column, token.endLine, token.endColumn),null, name, createTypeArguments(typeArgs));
}
(
LOOKAHEAD(2) "." (ann = Annotation() { annotations = add(annotations, ann);})* <IDENTIFIER> { name = token.image; }
[ LOOKAHEAD(2) typeArgs = TypeArguments() {typeArgs.remove(0);} ]
{
- ret = new ClassOrInterfaceType(line, column, token.endLine, token.endColumn,ret, name, createTypeArguments(typeArgs));
+ ret = new ClassOrInterfaceType(range(line, column, token.endLine, token.endColumn),ret, name, createTypeArguments(typeArgs));
ret.setAnnotations(annotations);
annotations = null;
}
@@ -1932,7 +1931,7 @@ WildcardType Wildcard():
}
]
{
- return new WildcardType(line, column, token.endLine, token.endColumn,ext, sup);
+ return new WildcardType(range(line, column, token.endLine, token.endColumn),ext, sup);
}
}
@@ -1942,21 +1941,21 @@ PrimitiveType PrimitiveType():
}
{
(
- "boolean" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Boolean); }
+ "boolean" { ret = new PrimitiveType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), PrimitiveType.Primitive.Boolean); }
|
- "char" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Char); }
+ "char" { ret = new PrimitiveType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), PrimitiveType.Primitive.Char); }
|
- "byte" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Byte); }
+ "byte" { ret = new PrimitiveType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), PrimitiveType.Primitive.Byte); }
|
- "short" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Short); }
+ "short" { ret = new PrimitiveType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), PrimitiveType.Primitive.Short); }
|
- "int" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Int); }
+ "int" { ret = new PrimitiveType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), PrimitiveType.Primitive.Int); }
|
- "long" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Long); }
+ "long" { ret = new PrimitiveType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), PrimitiveType.Primitive.Long); }
|
- "float" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Float); }
+ "float" { ret = new PrimitiveType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), PrimitiveType.Primitive.Float); }
|
- "double" { ret = new PrimitiveType(token.beginLine, token.beginColumn, token.endLine, token.endColumn, PrimitiveType.Primitive.Double); }
+ "double" { ret = new PrimitiveType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), PrimitiveType.Primitive.Double); }
)
{ return ret; }
}
@@ -1967,7 +1966,7 @@ Type ResultType():
}
{
(
- "void" { ret = new VoidType(token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
+ "void" { ret = new VoidType(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn)); }
|
ret = Type()
)
@@ -1983,8 +1982,8 @@ NameExpr Name():
NameExpr ret;
}
{
- <IDENTIFIER> { ret = new NameExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); }
- ( LOOKAHEAD(2) "." <IDENTIFIER> { ret = new QualifiedNameExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, token.image); } )*
+ <IDENTIFIER> { ret = new NameExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), token.image); }
+ ( LOOKAHEAD(2) "." <IDENTIFIER> { ret = new QualifiedNameExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, token.image); } )*
{ return ret; }
}
@@ -2006,7 +2005,7 @@ NameExpr SimpleName():
NameExpr ret;
}
{
- <IDENTIFIER> { ret = new NameExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image); }
+ <IDENTIFIER> { ret = new NameExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), token.image); }
{ return ret; }
}
@@ -2051,7 +2050,7 @@ Expression Expression():
[
(
LOOKAHEAD(2)
- op = AssignmentOperator() value = Expression() { ret = new AssignExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, value, op); }
+ op = AssignmentOperator() value = Expression() { ret = new AssignExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, value, op); }
|
"->" lambdaBody = LambdaBody()
{
@@ -2073,7 +2072,7 @@ Expression Expression():
}
| "::" [typeArgs = TypeParameters() {typeArgs.remove(0);} ] (<IDENTIFIER> | "new")
{
- ret = new MethodReferenceExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, typeArgs, token.image);
+ ret = new MethodReferenceExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, typeArgs, token.image);
}
)
]
@@ -2111,7 +2110,7 @@ Expression ConditionalExpression():
}
{
ret = ConditionalOrExpression()
- [ "?" left = Expression() ":" right = ConditionalExpression() { ret = new ConditionalExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, left, right); } ]
+ [ "?" left = Expression() ":" right = ConditionalExpression() { ret = new ConditionalExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, left, right); } ]
{ return ret; }
}
@@ -2121,7 +2120,7 @@ Expression ConditionalOrExpression():
Expression right;
}
{
- ret = ConditionalAndExpression() ( "||" right = ConditionalAndExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.or); } )*
+ ret = ConditionalAndExpression() ( "||" right = ConditionalAndExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, BinaryExpr.Operator.or); } )*
{ return ret; }
}
@@ -2131,7 +2130,7 @@ Expression ConditionalAndExpression():
Expression right;
}
{
- ret = InclusiveOrExpression() ( "&&" right = InclusiveOrExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.and); } )*
+ ret = InclusiveOrExpression() ( "&&" right = InclusiveOrExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, BinaryExpr.Operator.and); } )*
{ return ret; }
}
@@ -2141,7 +2140,7 @@ Expression InclusiveOrExpression():
Expression right;
}
{
- ret = ExclusiveOrExpression() ( "|" right = ExclusiveOrExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binOr); } )*
+ ret = ExclusiveOrExpression() ( "|" right = ExclusiveOrExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, BinaryExpr.Operator.binOr); } )*
{ return ret; }
}
@@ -2151,7 +2150,7 @@ Expression ExclusiveOrExpression():
Expression right;
}
{
- ret = AndExpression() ( "^" right = AndExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.xor); } )*
+ ret = AndExpression() ( "^" right = AndExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, BinaryExpr.Operator.xor); } )*
{ return ret; }
}
@@ -2161,7 +2160,7 @@ Expression AndExpression():
Expression right;
}
{
- ret = EqualityExpression() ( "&" right = EqualityExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binAnd); } )*
+ ret = EqualityExpression() ( "&" right = EqualityExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, BinaryExpr.Operator.binAnd); } )*
{ return ret; }
}
@@ -2176,7 +2175,7 @@ Expression EqualityExpression():
(
( "==" { op = BinaryExpr.Operator.equals; } |
"!=" { op = BinaryExpr.Operator.notEquals; }
- ) right = InstanceOfExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); }
+ ) right = InstanceOfExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, op); }
)*
{ return ret; }
}
@@ -2187,7 +2186,7 @@ Expression InstanceOfExpression():
Type type;
}
{
- ret = RelationalExpression() [ "instanceof" type = Type() { ret = new InstanceOfExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, type); } ]
+ ret = RelationalExpression() [ "instanceof" type = Type() { ret = new InstanceOfExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, type); } ]
{ return ret; }
}
@@ -2204,7 +2203,7 @@ Expression RelationalExpression():
">" { op = BinaryExpr.Operator.greater; } |
"<=" { op = BinaryExpr.Operator.lessEquals; } |
">=" { op = BinaryExpr.Operator.greaterEquals; }
- ) right = ShiftExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); }
+ ) right = ShiftExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, op); }
)*
{ return ret; }
}
@@ -2221,7 +2220,7 @@ Expression ShiftExpression():
( "<<" { op = BinaryExpr.Operator.lShift; } |
RSIGNEDSHIFT() { op = BinaryExpr.Operator.rSignedShift; } |
RUNSIGNEDSHIFT() { op = BinaryExpr.Operator.rUnsignedShift; }
- ) right = AdditiveExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); }
+ ) right = AdditiveExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, op); }
)*
{ return ret; }
}
@@ -2237,7 +2236,7 @@ Expression AdditiveExpression():
(
( "+" { op = BinaryExpr.Operator.plus; } |
"-" { op = BinaryExpr.Operator.minus; }
- ) right = MultiplicativeExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); }
+ ) right = MultiplicativeExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, op); }
)*
{ return ret; }
}
@@ -2254,7 +2253,7 @@ Expression MultiplicativeExpression():
( "*" { op = BinaryExpr.Operator.times; } |
"/" { op = BinaryExpr.Operator.divide; } |
"%" { op = BinaryExpr.Operator.remainder; }
- ) right = UnaryExpression() { ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op); }
+ ) right = UnaryExpression() { ret = new BinaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, right, op); }
)*
{ return ret; }
}
@@ -2278,14 +2277,14 @@ Expression UnaryExpression():
{
if(op == UnaryExpr.Operator.negative) {
if (ret instanceof IntegerLiteralExpr && ((IntegerLiteralExpr)ret).isMinValue()) {
- ret = new IntegerLiteralMinValueExpr(line, column, token.endLine, token.endColumn);
+ ret = new IntegerLiteralMinValueExpr(range(line, column, token.endLine, token.endColumn));
} else if (ret instanceof LongLiteralExpr && ((LongLiteralExpr)ret).isMinValue()) {
- ret = new LongLiteralMinValueExpr(line, column, token.endLine, token.endColumn);
+ ret = new LongLiteralMinValueExpr(range(line, column, token.endLine, token.endColumn));
} else {
- ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, op);
+ ret = new UnaryExpr(range(line, column, token.endLine, token.endColumn),ret, op);
}
} else {
- ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, op);
+ ret = new UnaryExpr(range(line, column, token.endLine, token.endColumn),ret, op);
}
}
|
@@ -2301,7 +2300,7 @@ Expression PreIncrementExpression():
int column;
}
{
- "++" {line=token.beginLine; column=token.beginColumn;} ret = UnaryExpression() { ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, UnaryExpr.Operator.preIncrement); }
+ "++" {line=token.beginLine; column=token.beginColumn;} ret = UnaryExpression() { ret = new UnaryExpr(range(line, column, token.endLine, token.endColumn),ret, UnaryExpr.Operator.preIncrement); }
{ return ret; }
}
@@ -2312,7 +2311,7 @@ Expression PreDecrementExpression():
int column;
}
{
- "--" {line=token.beginLine; column=token.beginColumn;} ret = UnaryExpression() { ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, UnaryExpr.Operator.preDecrement); }
+ "--" {line=token.beginLine; column=token.beginColumn;} ret = UnaryExpression() { ret = new UnaryExpr(range(line, column, token.endLine, token.endColumn),ret, UnaryExpr.Operator.preDecrement); }
{ return ret; }
}
@@ -2327,7 +2326,7 @@ Expression UnaryExpressionNotPlusMinus():
(
( "~" { op = UnaryExpr.Operator.inverse; line=token.beginLine; column=token.beginColumn;} |
"!" { op = UnaryExpr.Operator.not; line=token.beginLine; column=token.beginColumn;}
- ) ret = UnaryExpression() { ret = new UnaryExpr(line, column, token.endLine, token.endColumn,ret, op); }
+ ) ret = UnaryExpression() { ret = new UnaryExpr(range(line, column, token.endLine, token.endColumn),ret, op); }
|
LOOKAHEAD( CastExpression() )
ret = CastExpression()
@@ -2348,7 +2347,7 @@ Expression PostfixExpression():
LOOKAHEAD(2)
( "++" { op = UnaryExpr.Operator.posIncrement; } |
"--" { op = UnaryExpr.Operator.posDecrement; }
- ) { ret = new UnaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, op); }
+ ) { ret = new UnaryExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, op); }
]
{ return ret; }
}
@@ -2370,7 +2369,7 @@ Expression CastExpression():
(ann = Annotation() { annotations = add(annotations, ann);})*
(
LOOKAHEAD(2)
- type = PrimitiveType() ")" ret = UnaryExpression() { type.setAnnotations(annotations); ret = new CastExpr(line, column, token.endLine, token.endColumn, type, ret); }
+ type = PrimitiveType() ")" ret = UnaryExpression() { type.setAnnotations(annotations); ret = new CastExpr(range(line, column, token.endLine, token.endColumn), type, ret); }
|
type = ReferenceType() { typesOfMultiCast = add(typesOfMultiCast, type); type.setAnnotations(annotations); }
( "&" type = ReferenceType() {
@@ -2379,9 +2378,9 @@ Expression CastExpression():
)*
")" ret = UnaryExpressionNotPlusMinus() {
if (typesOfMultiCast.size() > 1) {
- type = new IntersectionType(line, column, token.endLine, token.endColumn, typesOfMultiCast);
+ type = new IntersectionType(range(line, column, token.endLine, token.endColumn), typesOfMultiCast);
}
- ret = new CastExpr(line, column, token.endLine, token.endColumn, type, ret);
+ ret = new CastExpr(range(line, column, token.endLine, token.endColumn), type, ret);
}
)
{ return ret; }
@@ -2427,9 +2426,9 @@ Expression PrimaryPrefix():
(
ret = Literal()
|
- "this" { ret = new ThisExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, null); }
+ "this" { ret = new ThisExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), null); }
|
- "super" { ret = new SuperExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, null); }
+ "super" { ret = new SuperExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), null); }
(
"."
[ typeArgs = TypeArguments() {typeArgs.remove(0);} ]
@@ -2437,11 +2436,11 @@ Expression PrimaryPrefix():
[ args = Arguments() {hasArgs=true;} ]
{
if (hasArgs) {
- MethodCallExpr m = new MethodCallExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, typeArgs, null, args);
+ MethodCallExpr m = new MethodCallExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, typeArgs, null, args);
m.setNameExpr(name);
ret = m;
} else {
- FieldAccessExpr f = new FieldAccessExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, null, null);
+ FieldAccessExpr f = new FieldAccessExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, null, null);
f.setFieldExpr(name);
ret = f;
}
@@ -2449,9 +2448,9 @@ Expression PrimaryPrefix():
|
"::" [typeArgs = TypeParameters() { typeArgs.remove(0); }] (<IDENTIFIER> | "new")
{
- ret = new MethodReferenceExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, typeArgs, token.image);
+ ret = new MethodReferenceExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, typeArgs, token.image);
}
- | args = Arguments() {new MethodCallExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, typeArgs, null, args);}
+ | args = Arguments() {new MethodCallExpr(range(ret.getBegin().line, ret.getBegin().column, token.endLine, token.endColumn), ret, typeArgs, null, args);}
)
|
@@ -2463,18 +2462,18 @@ Expression PrimaryPrefix():
]
")"
{
- if(!isLambda) { ret = new EnclosedExpr(line, column, token.endLine, token.endColumn,ret);}
+ if(!isLambda) { ret = new EnclosedExpr(range(line, column, token.endLine, token.endColumn),ret);}
else{
if(ret != null){
if(ret instanceof NameExpr)
{
- id = new VariableDeclaratorId(ret.getBeginLine(), ret.getBeginColumn(), ret.getEndLine(), ret.getEndColumn(), ((NameExpr)ret).getName(), 0);
- p = new Parameter(ret.getBeginLine(), ret.getBeginColumn(), ret.getEndLine(), ret.getEndColumn(), 0, null, new UnknownType(), false, id);
+ id = new VariableDeclaratorId(range(ret.getBegin(), ret.getEnd()), ((NameExpr)ret).getName(), 0);
+ p = new Parameter(range(ret.getBegin(), ret.getEnd()), 0, null, new UnknownType(), false, id);
}
}
args = add(0, args, p);
- ret = new LambdaExpr(p.getBeginLine(), p.getBeginColumn(), token.endLine, token.endColumn, args, null, true);
+ ret = new LambdaExpr(range(p.getBegin().line, p.getBegin().column, token.endLine, token.endColumn), args, null, true);
}
}
@@ -2482,13 +2481,13 @@ Expression PrimaryPrefix():
ret = AllocationExpression(null)
|
LOOKAHEAD( ResultType() "." "class" )
- type = ResultType() "." "class" { ret = new ClassExpr(type.getBeginLine(), type.getBeginColumn(), token.endLine, token.endColumn, type); }
+ type = ResultType() "." "class" { ret = new ClassExpr(range(type.getBegin().line, type.getBegin().column, token.endLine, token.endColumn), type); }
| LOOKAHEAD (ResultType() "::" )
type = ResultType() "::" [typeArgs = TypeParameters() { typeArgs.remove(0); }] (<IDENTIFIER> | "new")
{
- ret = new TypeExpr(type.getBeginLine(), type.getBeginColumn(), type.getEndLine(), type.getEndColumn(), type);
- ret = new MethodReferenceExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, typeArgs, token.image);
+ ret = new TypeExpr(type.getRange(), type);
+ ret = new MethodReferenceExpr(ret.getRange(), ret, typeArgs, token.image);
}
|
@@ -2496,7 +2495,7 @@ Expression PrimaryPrefix():
[ args = Arguments() {hasArgs=true;} ]
{
if (hasArgs) {
- MethodCallExpr m = new MethodCallExpr(line, column, token.endLine, token.endColumn, null, null, null, args);
+ MethodCallExpr m = new MethodCallExpr(range(line, column, token.endLine, token.endColumn), null, null, null, args);
m.setNameExpr(name);
ret = m;
} else {
@@ -2516,7 +2515,7 @@ Expression PrimarySuffix(Expression scope):
LOOKAHEAD(2)
ret = PrimarySuffixWithoutSuper(scope)
|
- "." "super" { ret = new SuperExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope); }
+ "." "super" { ret = new SuperExpr(range(scope.getBegin().line, scope.getBegin().column, token.endLine, token.endColumn), scope); }
)
{ return ret; }
}
@@ -2533,7 +2532,7 @@ Expression PrimarySuffixWithoutSuper(Expression scope):
(
"."
(
- "this" { ret = new ThisExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope); }
+ "this" { ret = new ThisExpr(range(scope.getBegin().line, scope.getBegin().column, token.endLine, token.endColumn), scope); }
|
ret = AllocationExpression(scope)
|
@@ -2543,18 +2542,18 @@ Expression PrimarySuffixWithoutSuper(Expression scope):
[ args = Arguments() {hasArgs=true;} ]
{
if (hasArgs) {
- MethodCallExpr m = new MethodCallExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, typeArgs, null, args);
+ MethodCallExpr m = new MethodCallExpr(range(scope.getBegin().line, scope.getBegin().column, token.endLine, token.endColumn), scope, typeArgs, null, args);
m.setNameExpr(name);
ret = m;
} else {
- FieldAccessExpr f = new FieldAccessExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, typeArgs, null);
+ FieldAccessExpr f = new FieldAccessExpr(range(scope.getBegin().line, scope.getBegin().column, token.endLine, token.endColumn), scope, typeArgs, null);
f.setFieldExpr(name);
ret = f;
}
}
)
|
- "["ret = Expression() "]" { ret = new ArrayAccessExpr(scope.getBeginLine(), scope.getBeginColumn(), token.endLine, token.endColumn, scope, ret); }
+ "["ret = Expression() "]" { ret = new ArrayAccessExpr(range(scope.getBegin().line, scope.getBegin().column, token.endLine, token.endColumn), scope, ret); }
)
{ return ret; }
}
@@ -2566,23 +2565,23 @@ Expression Literal():
{
(
<INTEGER_LITERAL> {
- ret = new IntegerLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image);
+ ret = new IntegerLiteralExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), token.image);
}
|
<LONG_LITERAL> {
- ret = new LongLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image);
+ ret = new LongLiteralExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), token.image);
}
|
<FLOATING_POINT_LITERAL> {
- ret = new DoubleLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image);
+ ret = new DoubleLiteralExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), token.image);
}
|
<CHARACTER_LITERAL> {
- ret = new CharLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image.substring(1, token.image.length()-1));
+ ret = new CharLiteralExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), token.image.substring(1, token.image.length()-1));
}
|
<STRING_LITERAL> {
- ret = new StringLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, token.image.substring(1, token.image.length()-1));
+ ret = new StringLiteralExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), token.image.substring(1, token.image.length()-1));
}
|
ret = BooleanLiteral()
@@ -2598,9 +2597,9 @@ Expression BooleanLiteral():
}
{
(
- "true" { ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, true); }
+ "true" { ret = new BooleanLiteralExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), true); }
|
- "false" { ret = new BooleanLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn, false); }
+ "false" { ret = new BooleanLiteralExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn), false); }
)
{ return ret; }
}
@@ -2609,7 +2608,7 @@ Expression NullLiteral():
{}
{
"null"
- { return new NullLiteralExpr(token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
+ { return new NullLiteralExpr(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn)); }
}
List Arguments():
@@ -2646,14 +2645,14 @@ Expression AllocationExpression(Expression scope):
AnnotationExpr ann;
}
{
- "new" { if(scope==null) {line=token.beginLine; column=token.beginColumn;} else {line=scope.getBeginLine(); column=scope.getBeginColumn();} }
+ "new" { if(scope==null) {line=token.beginLine; column=token.beginColumn;} else {line=scope.getBegin().line; column=scope.getBegin().column;} }
(ann = Annotation() { annotations = add(annotations, ann);})*
(
type = PrimitiveType() {type.setAnnotations(annotations); }
arr = ArrayDimsAndInits()
{
- arrayExpr = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, null, 0);
+ arrayExpr = new ArrayCreationExpr(range(line, column, token.endLine, token.endColumn), type, null, 0);
arrayExpr.setArraysAnnotations((List)arr[2]);
if (arr[0] instanceof Integer) {
arrayExpr.setArrayCount(((Integer)arr[0]).intValue());
@@ -2669,7 +2668,7 @@ Expression AllocationExpression(Expression scope):
type = ClassOrInterfaceType()
(
- arr = ArrayDimsAndInits() {type.setAnnotations(annotations); arrayExpr = new ArrayCreationExpr(line, column, token.endLine, token.endColumn, type, null, 0); }
+ arr = ArrayDimsAndInits() {type.setAnnotations(annotations); arrayExpr = new ArrayCreationExpr(range(line, column, token.endLine, token.endColumn), type, null, 0); }
{
arrayExpr.setArraysAnnotations((List)arr[2]);
if (arr[0] instanceof Integer) {
@@ -2683,7 +2682,7 @@ Expression AllocationExpression(Expression scope):
}
|
args = Arguments() [ LOOKAHEAD(2) anonymousBody = ClassOrInterfaceBody(false) ]
- { type.setAnnotations(annotations); ret = new ObjectCreationExpr(line, column, token.endLine, token.endColumn, scope, (ClassOrInterfaceType) type, typeArgs, args, anonymousBody); }
+ { type.setAnnotations(annotations); ret = new ObjectCreationExpr(range(line, column, token.endLine, token.endColumn), scope, (ClassOrInterfaceType) type, typeArgs, args, anonymousBody); }
)
)
{ return ret; }
@@ -2707,9 +2706,9 @@ Object[] ArrayDimsAndInits():
(ann = Annotation() { annotations = add(annotations, ann); })*
(
LOOKAHEAD(2)
- ( LOOKAHEAD(2) "[" expr = Expression() { accum = add(accum, annotations); annotations=null; inits = add(inits, expr); } "]" )+ ( LOOKAHEAD(2) (ann = Annotation() { annotations = add(annotations, ann); })* "[" "]" { i++; } )* { accum = add(accum, annotations); annotations=null; ret[0] = inits; ret[1] = new Integer(i); }
+ ( LOOKAHEAD(2) "[" expr = Expression() { accum = add(accum, annotations); annotations=null; inits = add(inits, expr); } "]" )+ ( LOOKAHEAD(2) (ann = Annotation() { annotations = add(annotations, ann); })* "[" "]" { i++; } )* { accum = add(accum, annotations); annotations=null; ret[0] = inits; ret[1] = Integer.valueOf(i); }
|
- ( "[" "]" { i++; } )+ expr = ArrayInitializer() { accum = add(accum, annotations);annotations=null; ret[0] = new Integer(i); ret[1] = expr; }
+ ( "[" "]" { i++; } )+ expr = ArrayInitializer() { accum = add(accum, annotations);annotations=null; ret[0] = Integer.valueOf(i); ret[1] = expr; }
)
{ ret[2]=accum; return ret; }
}
@@ -2770,7 +2769,7 @@ AssertStmt AssertStatement():
}
{
"assert" {line=token.beginLine; column=token.beginColumn;} check = Expression() [ ":" msg = Expression() ] ";"
- { return new AssertStmt(line, column, token.endLine, token.endColumn,check, msg); }
+ { return new AssertStmt(range(line, column, token.endLine, token.endColumn),check, msg); }
}
LabeledStmt LabeledStatement():
@@ -2782,7 +2781,7 @@ LabeledStmt LabeledStatement():
}
{
<IDENTIFIER> {line=token.beginLine; column=token.beginColumn;} { label = token.image; } ":" stmt = Statement()
- { return new LabeledStmt(line, column, token.endLine, token.endColumn,label, stmt); }
+ { return new LabeledStmt(range(line, column, token.endLine, token.endColumn),label, stmt); }
}
BlockStmt Block():
@@ -2795,7 +2794,7 @@ BlockStmt Block():
"{" {beginLine=token.beginLine; beginColumn=token.beginColumn;}
stmts = Statements()
"}"
- { return new BlockStmt(beginLine, beginColumn, token.endLine, token.endColumn, stmts); }
+ { return new BlockStmt(range(beginLine, beginColumn, token.endLine, token.endColumn), stmts); }
}
/*
@@ -2813,11 +2812,11 @@ Statement BlockStatement():
LOOKAHEAD( Modifiers() ("class" | "interface") )
{ }
modifier = Modifiers()
- typeDecl = ClassOrInterfaceDeclaration(modifier) { ret = new TypeDeclarationStmt(typeDecl.getBeginLine(), typeDecl.getBeginColumn(), token.endLine, token.endColumn, typeDecl); }
+ typeDecl = ClassOrInterfaceDeclaration(modifier) { ret = new TypeDeclarationStmt(range(typeDecl.getBegin().line, typeDecl.getBegin().column, token.endLine, token.endColumn), typeDecl); }
|
LOOKAHEAD(VariableDeclarationExpression() )
expr = VariableDeclarationExpression() ";"
- { ret = new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr); }
+ { ret = new ExpressionStmt(range(expr.getBegin().line, expr.getBegin().column, token.endLine, token.endColumn), expr); }
|
ret = Statement()
)
@@ -2834,10 +2833,10 @@ VariableDeclarationExpr VariableDeclarationExpression():
{
modifier = Modifiers() type = Type() var = VariableDeclarator() { vars.add(var); } ( "," var = VariableDeclarator() { vars.add(var); } )*
{
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
- if(line==-1) {line=type.getBeginLine(); column=type.getBeginColumn(); }
- return new VariableDeclarationExpr(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, vars);
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
+ if(line==-1) {line=type.getBegin().line; column=type.getBegin().column; }
+ return new VariableDeclarationExpr(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, type, vars);
}
}
@@ -2845,7 +2844,7 @@ EmptyStmt EmptyStatement():
{}
{
";"
- { return new EmptyStmt(token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
+ { return new EmptyStmt(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn)); }
}
Statement LambdaBody():
@@ -2857,7 +2856,7 @@ Statement LambdaBody():
(
expr = Expression()
{
- n = new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr);
+ n = new ExpressionStmt(range(expr.getBegin().line, expr.getBegin().column, token.endLine, token.endColumn), expr);
}
| n = Block()
)
@@ -2892,12 +2891,12 @@ ExpressionStmt StatementExpression():
|
expr = PrimaryExpression()
[
- "++" { expr = new UnaryExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, UnaryExpr.Operator.posIncrement); }
+ "++" { expr = new UnaryExpr(range(expr.getBegin().line, expr.getBegin().column, token.endLine, token.endColumn), expr, UnaryExpr.Operator.posIncrement); }
|
- "--" { expr = new UnaryExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, UnaryExpr.Operator.posDecrement); }
+ "--" { expr = new UnaryExpr(range(expr.getBegin().line, expr.getBegin().column, token.endLine, token.endColumn), expr, UnaryExpr.Operator.posDecrement); }
|
- op = AssignmentOperator() value = Expression() { expr = new AssignExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, value, op); }
- | "::" [typeArgs = TypeParameters() { typeArgs.remove(0); } ] (<IDENTIFIER > | "new"){expr = new MethodReferenceExpr(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr, typeArgs, token.image); }
+ op = AssignmentOperator() value = Expression() { expr = new AssignExpr(range(expr.getBegin().line, expr.getBegin().column, token.endLine, token.endColumn), expr, value, op); }
+ | "::" [typeArgs = TypeParameters() { typeArgs.remove(0); } ] (<IDENTIFIER > | "new"){expr = new MethodReferenceExpr(range(expr.getBegin().line, expr.getBegin().column, token.endLine, token.endColumn), expr, typeArgs, token.image); }
|
"->" lambdaBody = LambdaBody()
@@ -2915,7 +2914,7 @@ ExpressionStmt StatementExpression():
]
)
";"
- { return new ExpressionStmt(expr.getBeginLine(), expr.getBeginColumn(), token.endLine, token.endColumn, expr); }
+ { return new ExpressionStmt(range(expr.getBegin().line, expr.getBegin().column, token.endLine, token.endColumn), expr); }
}
SwitchStmt SwitchStatement():
@@ -2931,7 +2930,7 @@ SwitchStmt SwitchStatement():
( entry = SwitchEntry() { entries = add(entries, entry); } )*
"}"
- { return new SwitchStmt(line, column, token.endLine, token.endColumn,selector, entries); }
+ { return new SwitchStmt(range(line, column, token.endLine, token.endColumn),selector, entries); }
}
SwitchEntryStmt SwitchEntry():
@@ -2949,7 +2948,7 @@ SwitchEntryStmt SwitchEntry():
)
":" stmts = Statements()
- { return new SwitchEntryStmt(line, column, token.endLine, token.endColumn,label, stmts); }
+ { return new SwitchEntryStmt(range(line, column, token.endLine, token.endColumn),label, stmts); }
}
IfStmt IfStatement():
@@ -2970,7 +2969,7 @@ IfStmt IfStatement():
{
"if" {line=token.beginLine; column=token.beginColumn;} "(" condition = Expression() ")" {} thenStmt = Statement() [ LOOKAHEAD(1) "else" {} elseStmt = Statement() ]
{
- IfStmt tmp = new IfStmt(line, column, token.endLine, token.endColumn,condition, thenStmt, elseStmt);
+ IfStmt tmp = new IfStmt(range(line, column, token.endLine, token.endColumn),condition, thenStmt, elseStmt);
thenStmt.setComment(thenCmmt);
if (elseStmt != null)
@@ -2988,7 +2987,7 @@ WhileStmt WhileStatement():
}
{
"while" {line=token.beginLine; column=token.beginColumn;} "(" condition = Expression() ")" body = Statement()
- { return new WhileStmt(line, column, token.endLine, token.endColumn,condition, body); }
+ { return new WhileStmt(range(line, column, token.endLine, token.endColumn),condition, body); }
}
DoStmt DoStatement():
@@ -3000,7 +2999,7 @@ DoStmt DoStatement():
}
{
"do" {line=token.beginLine; column=token.beginColumn;} body = Statement() "while" "(" condition = Expression() ")" ";"
- { return new DoStmt(line, column, token.endLine, token.endColumn,body, condition); }
+ { return new DoStmt(range(line, column, token.endLine, token.endColumn),body, condition); }
}
Statement ForStatement():
@@ -3028,9 +3027,9 @@ Statement ForStatement():
{
if (varExpr != null) {
- return new ForeachStmt(line, column, token.endLine, token.endColumn,varExpr, expr, body);
+ return new ForeachStmt(range(line, column, token.endLine, token.endColumn),varExpr, expr, body);
}
- return new ForStmt(line, column, token.endLine, token.endColumn,init, expr, update, body);
+ return new ForStmt(range(line, column, token.endLine, token.endColumn),init, expr, update, body);
}
}
@@ -3078,7 +3077,7 @@ BreakStmt BreakStatement():
}
{
"break" {line=token.beginLine; column=token.beginColumn;} [ <IDENTIFIER> { id = token.image; } ] ";"
- { return new BreakStmt(line, column, token.endLine, token.endColumn,id); }
+ { return new BreakStmt(range(line, column, token.endLine, token.endColumn),id); }
}
ContinueStmt ContinueStatement():
@@ -3089,7 +3088,7 @@ ContinueStmt ContinueStatement():
}
{
"continue" {line=token.beginLine; column=token.beginColumn;} [ <IDENTIFIER> { id = token.image; } ] ";"
- { return new ContinueStmt(line, column, token.endLine, token.endColumn,id); }
+ { return new ContinueStmt(range(line, column, token.endLine, token.endColumn),id); }
}
ReturnStmt ReturnStatement():
@@ -3100,7 +3099,7 @@ ReturnStmt ReturnStatement():
}
{
"return" {line=token.beginLine; column=token.beginColumn;} [ expr = Expression() ] ";"
- { return new ReturnStmt(line, column, token.endLine, token.endColumn,expr); }
+ { return new ReturnStmt(range(line, column, token.endLine, token.endColumn),expr); }
}
ThrowStmt ThrowStatement():
@@ -3111,7 +3110,7 @@ ThrowStmt ThrowStatement():
}
{
"throw" {line=token.beginLine; column=token.beginColumn;} expr = Expression() ";"
- { return new ThrowStmt(line, column, token.endLine, token.endColumn,expr); }
+ { return new ThrowStmt(range(line, column, token.endLine, token.endColumn),expr); }
}
SynchronizedStmt SynchronizedStatement():
@@ -3123,7 +3122,7 @@ SynchronizedStmt SynchronizedStatement():
}
{
"synchronized" {line=token.beginLine; column=token.beginColumn;} "(" expr = Expression() ")" block = Block()
- { return new SynchronizedStmt(line, column, token.endLine, token.endColumn,expr, block); }
+ { return new SynchronizedStmt(range(line, column, token.endLine, token.endColumn),expr, block); }
}
TryStmt TryStatement():
@@ -3169,14 +3168,14 @@ TryStmt TryStatement():
} else {
type = (Type)exceptTypes.get(0);
}
- catchs = add(catchs, new CatchClause(cLine, cColumn, token.endLine, token.endColumn, exceptModifier.modifiers, exceptModifier.annotations, type, exceptId, catchBlock));
+ catchs = add(catchs, new CatchClause(range(cLine, cColumn, token.endLine, token.endColumn), exceptModifier.modifiers, exceptModifier.annotations, type, exceptId, catchBlock));
exceptTypes = new LinkedList(); }
)*
[ "finally" finallyBlock = Block() ]
|
"finally" finallyBlock = Block()
)
- { return new TryStmt(line, column, token.endLine, token.endColumn, resources, tryBlock, catchs, finallyBlock); }
+ { return new TryStmt(range(line, column, token.endLine, token.endColumn), resources, tryBlock, catchs, finallyBlock); }
}
@@ -3255,7 +3254,7 @@ NormalAnnotationExpr NormalAnnotation():
}
{
"@" {line=token.beginLine; column=token.beginColumn;} name = Name() "(" [ pairs = MemberValuePairs() ] ")"
- { return new NormalAnnotationExpr(line, column, token.endLine, token.endColumn,name, pairs); }
+ { return new NormalAnnotationExpr(range(line, column, token.endLine, token.endColumn),name, pairs); }
}
MarkerAnnotationExpr MarkerAnnotation():
@@ -3266,7 +3265,7 @@ MarkerAnnotationExpr MarkerAnnotation():
}
{
"@" {line=token.beginLine; column=token.beginColumn;} name = Name()
- { return new MarkerAnnotationExpr(line, column, token.endLine, token.endColumn,name); }
+ { return new MarkerAnnotationExpr(range(line, column, token.endLine, token.endColumn),name); }
}
SingleMemberAnnotationExpr SingleMemberAnnotation():
@@ -3278,7 +3277,7 @@ SingleMemberAnnotationExpr SingleMemberAnnotation():
}
{
"@" {line=token.beginLine; column=token.beginColumn;} name = Name() "(" memberVal = MemberValue() ")"
- { return new SingleMemberAnnotationExpr(line, column, token.endLine, token.endColumn,name, memberVal); }
+ { return new SingleMemberAnnotationExpr(range(line, column, token.endLine, token.endColumn),name, memberVal); }
}
List MemberValuePairs():
@@ -3300,7 +3299,7 @@ MemberValuePair MemberValuePair():
}
{
<IDENTIFIER> { name = token.image; line=token.beginLine; column=token.beginColumn;} "=" value = MemberValue()
- { return new MemberValuePair(line, column, token.endLine, token.endColumn,name, value); }
+ { return new MemberValuePair(range(line, column, token.endLine, token.endColumn),name, value); }
}
Expression MemberValue():
@@ -3329,7 +3328,7 @@ Expression MemberValueArrayInitializer():
"{" {line=token.beginLine; column=token.beginColumn;}
( member = MemberValue() { ret.add(member); } ( LOOKAHEAD(2) "," member = MemberValue() { ret.add(member); } )* )? [ "," ]
"}"
- { return new ArrayInitializerExpr(line, column, token.endLine, token.endColumn,ret); }
+ { return new ArrayInitializerExpr(range(line, column, token.endLine, token.endColumn),ret); }
}
@@ -3339,15 +3338,15 @@ AnnotationDeclaration AnnotationTypeDeclaration(Modifier modifier):
{
NameExpr name;
List members;
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
}
{
"@" { if (line == -1) {line=token.beginLine; column=token.beginColumn;} }
"interface" name = Name() members = AnnotationTypeBody()
{
- AnnotationDeclaration tmp = new AnnotationDeclaration(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, null, members);
+ AnnotationDeclaration tmp = new AnnotationDeclaration(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, null, members);
tmp.setNameExpr(name);
return tmp;
}
@@ -3372,7 +3371,7 @@ BodyDeclaration AnnotationBodyDeclaration():
{
{ }
(
- ";" { ret = new EmptyTypeDeclaration(token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
+ ";" { ret = new EmptyTypeDeclaration(range(token.beginLine, token.beginColumn, token.endLine, token.endColumn)); }
|
modifier = Modifiers()
(
@@ -3401,10 +3400,10 @@ AnnotationMemberDeclaration AnnotationTypeMemberDeclaration(Modifier modifier):
type = Type() <IDENTIFIER> { name = token.image; } "(" ")" [ defaultVal = DefaultValue() ] ";"
{
- int line = modifier.beginLine;
- int column = modifier.beginColumn;
- { if (line == -1) {line=type.getBeginLine(); column=type.getBeginColumn();} }
- return new AnnotationMemberDeclaration(line, column, token.endLine, token.endColumn, modifier.modifiers, modifier.annotations, type, name, defaultVal);
+ int line = modifier.begin.line;
+ int column = modifier.begin.column;
+ { if (line == -1) {line=type.getBegin().line; column=type.getBegin().column;} }
+ return new AnnotationMemberDeclaration(range(line, column, token.endLine, token.endColumn), modifier.modifiers, modifier.annotations, type, name, defaultVal);
}
}