aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny van Bruggen <hexagonaal@gmail.com>2016-12-05 19:47:51 +0100
committerDanny van Bruggen <hexagonaal@gmail.com>2016-12-05 19:47:52 +0100
commit4296abb695b767f7471dd255d0679516183b062a (patch)
treebd3410d3ef085c1476eee70f25f2cd8f908efb7f
parent8bbe507b2fc32110d17bdae06c986613a3f8d0f1 (diff)
downloadplatform_external_javaparser-4296abb695b767f7471dd255d0679516183b062a.tar.gz
platform_external_javaparser-4296abb695b767f7471dd255d0679516183b062a.tar.bz2
platform_external_javaparser-4296abb695b767f7471dd255d0679516183b062a.zip
Reformat all source in Intellij Idea
-rw-r--r--javaparser-core/pom.xml3
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/JavaParser.java31
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ParseProblemException.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ParseResult.java7
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ParseStart.java26
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/Position.java213
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/Providers.java89
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/Range.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/AccessSpecifier.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/ArrayBracketPair.java9
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/CompilationUnit.java66
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/DataKey.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/Node.java58
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java9
-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/body/AnnotationDeclaration.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/AnnotationMemberDeclaration.java9
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/BodyDeclaration.java11
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/ClassOrInterfaceDeclaration.java28
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/ConstructorDeclaration.java12
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyMemberDeclaration.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/EmptyTypeDeclaration.java7
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/EnumDeclaration.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/FieldDeclaration.java36
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/InitializerDeclaration.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java22
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/Parameter.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/TypeDeclaration.java129
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclarator.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/body/VariableDeclaratorId.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/BlockComment.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java29
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/JavadocComment.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/comments/LineComment.java7
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/AnnotationExpr.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayAccessExpr.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayCreationExpr.java18
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ArrayInitializerExpr.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/BinaryExpr.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/BooleanLiteralExpr.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/CharLiteralExpr.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ClassExpr.java9
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ConditionalExpr.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/DoubleLiteralExpr.java32
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/EnclosedExpr.java52
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/Expression.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/FieldAccessExpr.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/IntegerLiteralExpr.java46
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java104
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/LiteralExpr.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/LongLiteralExpr.java58
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/MemberValuePair.java72
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java24
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodReferenceExpr.java12
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/NormalAnnotationExpr.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/NullLiteralExpr.java26
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ObjectCreationExpr.java18
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/SimpleName.java1
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/SingleMemberAnnotationExpr.java52
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/StringLiteralExpr.java61
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/SuperExpr.java52
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/ThisExpr.java60
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/TypeExpr.java5
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/UnaryExpr.java84
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/expr/VariableDeclarationExpr.java28
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/imports/EmptyImportDeclaration.java3
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/imports/ImportDeclaration.java11
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleStaticImportDeclaration.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleTypeImportDeclaration.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/imports/StaticImportOnDemandDeclaration.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/imports/TypeImportOnDemandDeclaration.java18
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithAnnotations.java22
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithDeclaration.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithElementType.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithExtends.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithIdentifier.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithImplements.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java27
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithModifiers.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithName.java10
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalBlockStmt.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithParameters.java10
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java6
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrownExceptions.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithType.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeArguments.java14
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeParameters.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/observing/PropagatingAstObserver.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/AssertStmt.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BlockStmt.java1
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/BreakStmt.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/CatchClause.java67
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ContinueStmt.java40
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/DoStmt.java72
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/EmptyStmt.java26
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExplicitConstructorInvocationStmt.java114
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java58
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/IfStmt.java106
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/LabeledStmt.java72
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java50
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchEntryStmt.java78
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SwitchStmt.java98
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ThrowStmt.java58
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java160
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TypeDeclarationStmt.java54
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/stmt/WhileStmt.java72
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/ClassOrInterfaceType.java7
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/IntersectionType.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/PrimitiveType.java8
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/ReferenceType.java10
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/Type.java4
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java154
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java3
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/VoidType.java28
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/type/WildcardType.java68
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java2224
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/EqualsVisitor.java2015
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitor.java228
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java59
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/Visitable.java21
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitor.java186
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java40
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrinterConfiguration.java2
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/utils/ClassUtils.java16
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/utils/Pair.java13
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/utils/Utils.java107
-rw-r--r--javaparser-testing/pom.xml3
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/ast/NodeListTest.java11
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/ast/imports/ImportDeclarationTest.java10
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/ast/junit/visitor/TreeVisitorTest.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/BasicJBehaveTest.java8
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/CommentParsingTest.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/ComparingTest.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/ManipulationTest.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/ParsingTest.java6
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/PositionRangeTest.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/PrettyPrintingTest.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/VisitorTest.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/CommentParsingSteps.java141
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ComparingSteps.java8
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ExistenceOfParentNodeVerifier.java4
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ManipulationSteps.java64
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ParsingSteps.java94
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PositionRangeSteps.java167
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PrettyPrintingSteps.java21
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/SharedSteps.java58
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/VisitorSteps.java10
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/bdd/visitors/PositionTestVisitor.java230
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/ast/CompilationUnitTest.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/ast/ParseResultTest.java5
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/CloneVisitorTest.java160
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/Visitors.java4
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/builders/ClassOrInterfaceDeclarationBuildersTest.java40
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/builders/CompilationUnitBuildersTest.java63
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/builders/EnumDeclarationBuildersTest.java31
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/builders/FieldDeclarationBuildersTest.java210
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithAnnotationsBuildersTest.java109
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithMembersBuildersTest.java237
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithParametersBuildersTest.java95
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithThrownExceptionsBuildersTest.java49
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/remove/NodeRemovalTest.java99
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/ClassCreator.java8
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_1.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_2.java15
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodPrinter.java2
-rw-r--r--javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/TestFileToken.java5
-rw-r--r--javaparser-testing/src/test/resources/com/github/javaparser/bdd/samples/JavaConcepts.java41
-rw-r--r--pom.xml383
175 files changed, 5414 insertions, 5334 deletions
diff --git a/javaparser-core/pom.xml b/javaparser-core/pom.xml
index 6d7691d0a..957452237 100644
--- a/javaparser-core/pom.xml
+++ b/javaparser-core/pom.xml
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>javaparser-parent</artifactId>
<groupId>com.github.javaparser</groupId>
diff --git a/javaparser-core/src/main/java/com/github/javaparser/JavaParser.java b/javaparser-core/src/main/java/com/github/javaparser/JavaParser.java
index ba65bc7cb..774dda878 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/JavaParser.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/JavaParser.java
@@ -21,28 +21,6 @@
package com.github.javaparser;
-import static com.github.javaparser.ParseStart.ANNOTATION;
-import static com.github.javaparser.ParseStart.ANNOTATION_BODY;
-import static com.github.javaparser.ParseStart.BLOCK;
-import static com.github.javaparser.ParseStart.CLASS_BODY;
-import static com.github.javaparser.ParseStart.CLASS_OR_INTERFACE_TYPE;
-import static com.github.javaparser.ParseStart.COMPILATION_UNIT;
-import static com.github.javaparser.ParseStart.EXPRESSION;
-import static com.github.javaparser.ParseStart.IMPORT_DECLARATION;
-import static com.github.javaparser.ParseStart.INTERFACE_BODY;
-import static com.github.javaparser.ParseStart.STATEMENT;
-import static com.github.javaparser.Providers.UTF8;
-import static com.github.javaparser.Providers.provider;
-import static com.github.javaparser.utils.Utils.assertNotNull;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.nio.charset.Charset;
-import java.nio.file.Path;
-
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.body.BodyDeclaration;
@@ -54,6 +32,15 @@ import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.ast.stmt.Statement;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
+import java.io.*;
+import java.nio.charset.Charset;
+import java.nio.file.Path;
+
+import static com.github.javaparser.ParseStart.*;
+import static com.github.javaparser.Providers.UTF8;
+import static com.github.javaparser.Providers.provider;
+import static com.github.javaparser.utils.Utils.assertNotNull;
+
/**
* Parse Java source code and creates Abstract Syntax Trees.
*
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ParseProblemException.java b/javaparser-core/src/main/java/com/github/javaparser/ParseProblemException.java
index 984ffa41b..a3301eb59 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ParseProblemException.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ParseProblemException.java
@@ -1,13 +1,11 @@
package com.github.javaparser;
import java.util.List;
-import java.util.Optional;
+import static com.github.javaparser.utils.Utils.EOL;
import static com.github.javaparser.utils.Utils.assertNotNull;
import static java.util.Collections.singletonList;
-import static com.github.javaparser.utils.Utils.EOL;
-
/**
* Thrown when parsing problems occur during parsing with the static methods on JavaParser.
*/
@@ -28,7 +26,7 @@ public class ParseProblemException extends RuntimeException {
private static String createMessage(List<Problem> problems) {
StringBuilder message = new StringBuilder();
- for(Problem problem: problems){
+ for (Problem problem : problems) {
message.append(problem.toString()).append(EOL);
}
return message.toString();
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ParseResult.java b/javaparser-core/src/main/java/com/github/javaparser/ParseResult.java
index 68a3d7e99..6176dc73a 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ParseResult.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ParseResult.java
@@ -1,12 +1,12 @@
package com.github.javaparser;
-import static com.github.javaparser.utils.Utils.EOL;
-import static java.util.Collections.singletonList;
+import com.github.javaparser.ast.comments.CommentsCollection;
import java.util.List;
import java.util.Optional;
-import com.github.javaparser.ast.comments.CommentsCollection;
+import static com.github.javaparser.utils.Utils.EOL;
+import static java.util.Collections.singletonList;
/**
* The results given when parsing with an instance of JavaParser.
@@ -19,6 +19,7 @@ public class ParseResult<T> {
/**
* General constructor.
+ *
* @param result the AST, or empty if it wasn't created.
* @param problems a list of encountered parsing problems.
* @param tokens the complete list of tokens that were parsed, or empty if parsing failed completely.
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ParseStart.java b/javaparser-core/src/main/java/com/github/javaparser/ParseStart.java
index 3cc3edd16..d83cead06 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ParseStart.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ParseStart.java
@@ -1,11 +1,10 @@
package com.github.javaparser;
import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.body.TypeDeclaration;
-import com.github.javaparser.ast.imports.ImportDeclaration;
import com.github.javaparser.ast.body.BodyDeclaration;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.expr.Expression;
+import com.github.javaparser.ast.imports.ImportDeclaration;
import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.ast.stmt.Statement;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
@@ -16,20 +15,21 @@ import com.github.javaparser.ast.type.ClassOrInterfaceType;
* For example,
* COMPILATION_UNIT indicates a complete Java file,
* and CLASS_BODY would indicate the part of a class that is within { and }.
+ *
* @see JavaParser#parse(ParseStart, Provider)
*/
@FunctionalInterface
public interface ParseStart<R> {
- ParseStart<CompilationUnit> COMPILATION_UNIT = ASTParser::CompilationUnit;
- ParseStart<BlockStmt> BLOCK = ASTParser::Block;
- ParseStart<Statement> STATEMENT = ASTParser::BlockStatement;
- ParseStart<ImportDeclaration> IMPORT_DECLARATION= ASTParser::ImportDeclaration;
- ParseStart<Expression> EXPRESSION = ASTParser::Expression;
- ParseStart<AnnotationExpr> ANNOTATION = ASTParser::Annotation;
- ParseStart<BodyDeclaration<?>> ANNOTATION_BODY = ASTParser::AnnotationBodyDeclaration;
- ParseStart<BodyDeclaration<?>> CLASS_BODY = p -> p.ClassOrInterfaceBodyDeclaration(false);
- ParseStart<BodyDeclaration<?>> INTERFACE_BODY = p -> p.ClassOrInterfaceBodyDeclaration(true);
- ParseStart<ClassOrInterfaceType> CLASS_OR_INTERFACE_TYPE = ASTParser::ClassOrInterfaceType;
+ ParseStart<CompilationUnit> COMPILATION_UNIT = ASTParser::CompilationUnit;
+ ParseStart<BlockStmt> BLOCK = ASTParser::Block;
+ ParseStart<Statement> STATEMENT = ASTParser::BlockStatement;
+ ParseStart<ImportDeclaration> IMPORT_DECLARATION = ASTParser::ImportDeclaration;
+ ParseStart<Expression> EXPRESSION = ASTParser::Expression;
+ ParseStart<AnnotationExpr> ANNOTATION = ASTParser::Annotation;
+ ParseStart<BodyDeclaration<?>> ANNOTATION_BODY = ASTParser::AnnotationBodyDeclaration;
+ ParseStart<BodyDeclaration<?>> CLASS_BODY = p -> p.ClassOrInterfaceBodyDeclaration(false);
+ ParseStart<BodyDeclaration<?>> INTERFACE_BODY = p -> p.ClassOrInterfaceBodyDeclaration(true);
+ ParseStart<ClassOrInterfaceType> CLASS_OR_INTERFACE_TYPE = ASTParser::ClassOrInterfaceType;
- R parse(ASTParser parser) throws ParseException;
+ R parse(ASTParser parser) throws ParseException;
}
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 1735795d6..53df6e2af 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/Position.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/Position.java
@@ -29,110 +29,111 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
* 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;
-
- /**
- * The first position in the file
- */
- public static final Position HOME = new Position(1, 1);
-
- 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);
- }
-
- /**
- * Check if the position is usable. Does not know what it is pointing at, so it can't check if the position is after the end of the source.
- */
- public boolean valid() {
- return line > 0 && column > 0;
- }
-
- public boolean invalid() {
- return !valid();
- }
-
- public Position orIfInvalid(Position anotherPosition) {
- if (valid()) {
- return this;
- }
- return anotherPosition;
- }
-
- public boolean isAfter(Position position) {
- assertNotNull(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) {
- assertNotNull(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;
- }
-
- @Override
- public int compareTo(Position o) {
- assertNotNull(o);
- if (isBefore(o)) {
- return -1;
- }
- if (isAfter(o)) {
- return 1;
- }
- return 0;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Position position = (Position) o;
-
- return line == position.line && column == position.column;
- }
-
- @Override
- public int hashCode() {
- return 31 * line + column;
- }
-
- @Override
- public String toString() {
- return "(line " + line + ",col " + column + ")";
- }
+ public final int line;
+ public final int column;
+
+ /**
+ * The first position in the file
+ */
+ public static final Position HOME = new Position(1, 1);
+
+ 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);
+ }
+
+ /**
+ * Check if the position is usable. Does not know what it is pointing at, so it can't check if the position is after
+ * the end of the source.
+ */
+ public boolean valid() {
+ return line > 0 && column > 0;
+ }
+
+ public boolean invalid() {
+ return !valid();
+ }
+
+ public Position orIfInvalid(Position anotherPosition) {
+ if (valid()) {
+ return this;
+ }
+ return anotherPosition;
+ }
+
+ public boolean isAfter(Position position) {
+ assertNotNull(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) {
+ assertNotNull(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;
+ }
+
+ @Override
+ public int compareTo(Position o) {
+ assertNotNull(o);
+ if (isBefore(o)) {
+ return -1;
+ }
+ if (isAfter(o)) {
+ return 1;
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Position position = (Position) o;
+
+ return line == position.line && column == position.column;
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * line + column;
+ }
+
+ @Override
+ public String toString() {
+ return "(line " + line + ",col " + column + ")";
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/Providers.java b/javaparser-core/src/main/java/com/github/javaparser/Providers.java
index b5e731c09..5af42c466 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/Providers.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/Providers.java
@@ -3,7 +3,6 @@ package com.github.javaparser;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.file.Files;
-import java.nio.file.OpenOption;
import java.nio.file.Path;
import static com.github.javaparser.utils.Utils.assertNotNull;
@@ -13,49 +12,49 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
* Providers that have no parameter for encoding but need it will use UTF-8.
*/
public final class Providers {
- public static final Charset UTF8 = Charset.forName("utf-8");
-
- private Providers() {
- }
-
- public static Provider provider(Reader reader) {
- return new StreamProvider(assertNotNull(reader));
- }
-
- public static Provider provider(InputStream input, Charset encoding) {
- assertNotNull(input);
- assertNotNull(encoding);
- try {
- return new StreamProvider(input, encoding.name());
- } catch (IOException e) {
- // The only one that is thrown is UnsupportedCharacterEncodingException,
- // and that's a fundamental problem, so runtime exception.
- throw new RuntimeException(e);
- }
- }
-
- public static Provider provider(InputStream input) {
- return provider(input, UTF8);
- }
-
- public static Provider provider(File file, Charset encoding) throws FileNotFoundException {
- return provider(new FileInputStream(assertNotNull(file)), assertNotNull(encoding));
- }
-
- public static Provider provider(File file) throws FileNotFoundException {
- return provider(assertNotNull(file), UTF8);
- }
-
- public static Provider provider(Path path, Charset encoding) throws IOException {
- return provider(Files.newInputStream(assertNotNull(path)), assertNotNull(encoding));
- }
-
- public static Provider provider(Path path) throws IOException {
- return provider(assertNotNull(path), UTF8);
- }
-
- public static Provider provider(String source) {
- return new StringProvider(assertNotNull(source));
- }
+ public static final Charset UTF8 = Charset.forName("utf-8");
+
+ private Providers() {
+ }
+
+ public static Provider provider(Reader reader) {
+ return new StreamProvider(assertNotNull(reader));
+ }
+
+ public static Provider provider(InputStream input, Charset encoding) {
+ assertNotNull(input);
+ assertNotNull(encoding);
+ try {
+ return new StreamProvider(input, encoding.name());
+ } catch (IOException e) {
+ // The only one that is thrown is UnsupportedCharacterEncodingException,
+ // and that's a fundamental problem, so runtime exception.
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static Provider provider(InputStream input) {
+ return provider(input, UTF8);
+ }
+
+ public static Provider provider(File file, Charset encoding) throws FileNotFoundException {
+ return provider(new FileInputStream(assertNotNull(file)), assertNotNull(encoding));
+ }
+
+ public static Provider provider(File file) throws FileNotFoundException {
+ return provider(assertNotNull(file), UTF8);
+ }
+
+ public static Provider provider(Path path, Charset encoding) throws IOException {
+ return provider(Files.newInputStream(assertNotNull(path)), assertNotNull(encoding));
+ }
+
+ public static Provider provider(Path path) throws IOException {
+ return provider(assertNotNull(path), UTF8);
+ }
+
+ public static Provider provider(String source) {
+ return new StringProvider(assertNotNull(source));
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/Range.java b/javaparser-core/src/main/java/com/github/javaparser/Range.java
index f0021690b..95fefbfc2 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/Range.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/Range.java
@@ -82,6 +82,6 @@ public class Range {
@Override
public String toString() {
- return begin+"-"+end;
+ 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 b3011a45c..cad626b95 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast;
/**
@@ -41,7 +41,7 @@ public enum AccessSpecifier {
this.codeRepresenation = codeRepresentation;
}
- public String asString(){
+ public String asString() {
return this.codeRepresenation;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayBracketPair.java b/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayBracketPair.java
index ce756bc62..ab2eafdcf 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayBracketPair.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayBracketPair.java
@@ -15,6 +15,7 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* In, for example, <code>int[] a[];</code> there are two ArrayBracketPair objects,
* one for the [] after int, one for the [] after a.
+ *
* @deprecated will be removed in 3.0
*/
@Deprecated
@@ -34,12 +35,14 @@ public class ArrayBracketPair extends Node implements NodeWithAnnotations<ArrayB
setAnnotations(annotations);
}
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
return v.visit(this, arg);
}
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
}
public NodeList<AnnotationExpr> getAnnotations() {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java b/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java
index 3adf21af2..b5f1a7e2f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/ArrayCreationLevel.java
@@ -55,10 +55,10 @@ public class ArrayCreationLevel extends Node implements NodeWithAnnotations<Arra
public <A> void accept(final VoidVisitor<A> v, final A arg) {
v.visit(this, arg);
}
-
+
/**
* Sets the dimension
- *
+ *
* @param dimension the dimension, can be null
* @return this, the ArrayCreationLevel
*/
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 29206e8c0..2f57030b2 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
@@ -47,7 +47,7 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
* compilation unit.
* </p>
* The CompilationUnit is constructed following the syntax:<br>
- *
+ * <p>
* <pre>
* {@code
* CompilationUnit ::= ( }{@link PackageDeclaration}{@code )?
@@ -55,7 +55,7 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
* ( }{@link TypeDeclaration}{@code )*
* }
* </pre>
- *
+ *
* @author Julio Vilmar Gesser
*/
public final class CompilationUnit extends Node {
@@ -97,7 +97,7 @@ public final class CompilationUnit extends Node {
* Including javadocs, line comments and block comments of all types,
* inner-classes and other members.<br>
* If there is no comment, an empty list is returned.
- *
+ *
* @return list with all comments of this compilation unit.
* @see JavadocComment
* @see com.github.javaparser.ast.comments.LineComment
@@ -110,7 +110,7 @@ public final class CompilationUnit extends Node {
/**
* Retrieves the list of imports declared in this compilation unit or
* <code>null</code> if there is no import.
- *
+ *
* @return the list of imports or <code>null</code> if there is no import
*/
public NodeList<ImportDeclaration> getImports() {
@@ -125,7 +125,7 @@ public final class CompilationUnit extends Node {
* Retrieves the package declaration of this compilation unit.<br>
* If this compilation unit has no package declaration (default package),
* <code>null</code> is returned.
- *
+ *
* @return the package declaration or <code>null</code>
*/
public Optional<PackageDeclaration> getPackage() {
@@ -135,7 +135,7 @@ public final class CompilationUnit extends Node {
/**
* Return the list of types declared in this compilation unit.<br>
* If there is no types declared, <code>null</code> is returned.
- *
+ *
* @return the list of types or <code>null</code> null if there is no type
* @see AnnotationDeclaration
* @see ClassOrInterfaceDeclaration
@@ -149,8 +149,8 @@ public final class CompilationUnit extends Node {
/**
* Convenience method that wraps <code>getTypes()</code>.<br>
* If <code>i</code> is out of bounds, throws <code>IndexOutOfBoundsException.</code>
- * @param i
- * the index of the type declaration to retrieve
+ *
+ * @param i the index of the type declaration to retrieve
*/
public TypeDeclaration<?> getType(int i) {
return getTypes().get(i);
@@ -159,9 +159,8 @@ public final class CompilationUnit extends Node {
/**
* Sets the list of imports of this compilation unit. The list is initially
* <code>null</code>.
- *
- * @param imports
- * the list of imports
+ *
+ * @param imports the list of imports
*/
public CompilationUnit setImports(NodeList<ImportDeclaration> imports) {
notifyPropertyChange(ObservableProperty.IMPORTS, this.imports, imports);
@@ -172,10 +171,8 @@ public final class CompilationUnit extends Node {
/**
* Sets or clear the package declarations of this compilation unit.
- *
- * @param pakage
- * the packageDeclaration declaration to set or <code>null</code> to default
- * package
+ *
+ * @param pakage the packageDeclaration declaration to set or <code>null</code> to default package
*/
public CompilationUnit setPackage(PackageDeclaration pakage) {
notifyPropertyChange(ObservableProperty.PACKAGE_DECLARATION, this.packageDeclaration, pakage);
@@ -186,9 +183,8 @@ public final class CompilationUnit extends Node {
/**
* Sets the list of types declared in this compilation unit.
- *
- * @param types
- * the lis of types
+ *
+ * @param types the lis of types
*/
public CompilationUnit setTypes(NodeList<TypeDeclaration<?>> types) {
notifyPropertyChange(ObservableProperty.TYPES, this.types, types);
@@ -199,7 +195,7 @@ public final class CompilationUnit extends Node {
/**
* sets the package declaration of this compilation unit
- *
+ *
* @param name the name of the package
* @return this, the {@link CompilationUnit}
*/
@@ -211,7 +207,7 @@ public final class CompilationUnit extends Node {
/**
* Add an import to the list of {@link ImportDeclaration} of this compilation unit<br>
* shorthand for {@link #addImport(String, boolean, boolean)} with name,false,false
- *
+ *
* @param name the import name
* @return this, the {@link CompilationUnit}
*/
@@ -222,7 +218,7 @@ public final class CompilationUnit extends Node {
/**
* Add an import to the list of {@link ImportDeclaration} of this compilation unit<br>
* shorthand for {@link #addImport(String)} with clazz.getName()
- *
+ *
* @param clazz the class to import
* @return this, the {@link CompilationUnit}
*/
@@ -238,9 +234,9 @@ public final class CompilationUnit extends Node {
/**
* Add an import to the list of {@link ImportDeclaration} of this compilation unit<br>
* <b>This method check if no import with the same name is already in the list</b>
- *
+ *
* @param name the import name
- * @param isStatic is it an "import static"
+ * @param isStatic is it an "import static"
* @param isAsterisk does the import end with ".*"
* @return this, the {@link CompilationUnit}
*/
@@ -266,7 +262,7 @@ public final class CompilationUnit extends Node {
/**
* Add a public class to the types of this compilation unit
- *
+ *
* @param name the class name
* @return the newly created class
*/
@@ -276,7 +272,7 @@ public final class CompilationUnit extends Node {
/**
* Add a class to the types of this compilation unit
- *
+ *
* @param name the class name
* @param modifiers the modifiers (like Modifier.PUBLIC)
* @return the newly created class
@@ -293,7 +289,7 @@ public final class CompilationUnit extends Node {
/**
* Add a public interface class to the types of this compilation unit
- *
+ *
* @param name the interface name
* @return the newly created class
*/
@@ -303,7 +299,7 @@ public final class CompilationUnit extends Node {
/**
* Add an interface to the types of this compilation unit
- *
+ *
* @param name the interface name
* @param modifiers the modifiers (like Modifier.PUBLIC)
* @return the newly created class
@@ -320,7 +316,7 @@ public final class CompilationUnit extends Node {
/**
* Add a public enum to the types of this compilation unit
- *
+ *
* @param name the enum name
* @return the newly created class
*/
@@ -330,7 +326,7 @@ public final class CompilationUnit extends Node {
/**
* Add an enum to the types of this compilation unit
- *
+ *
* @param name the enum name
* @param modifiers the modifiers (like Modifier.PUBLIC)
* @return the newly created class
@@ -345,7 +341,7 @@ public final class CompilationUnit extends Node {
/**
* Add a public annotation declaration to the types of this compilation unit
- *
+ *
* @param name the annotation name
* @return the newly created class
*/
@@ -355,7 +351,7 @@ public final class CompilationUnit extends Node {
/**
* Add an annotation declaration to the types of this compilation unit
- *
+ *
* @param name the annotation name
* @param modifiers the modifiers (like Modifier.PUBLIC)
* @return the newly created class
@@ -370,7 +366,7 @@ public final class CompilationUnit extends Node {
/**
* Try to get a class by its name
- *
+ *
* @param className the class name (case-sensitive)
* @return null if not found, the class otherwise
*/
@@ -382,7 +378,7 @@ public final class CompilationUnit extends Node {
/**
* Try to get an interface by its name
- *
+ *
* @param interfaceName the interface name (case-sensitive)
* @return null if not found, the interface otherwise
*/
@@ -394,7 +390,7 @@ public final class CompilationUnit extends Node {
/**
* Try to get an enum by its name
- *
+ *
* @param enumName the enum name (case-sensitive)
* @return null if not found, the enum otherwise
*/
@@ -406,7 +402,7 @@ public final class CompilationUnit extends Node {
/**
* Try to get an annotation by its name
- *
+ *
* @param annotationName the annotation name (case-sensitive)
* @return null if not found, the annotation otherwise
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/DataKey.java b/javaparser-core/src/main/java/com/github/javaparser/ast/DataKey.java
index 560cb0ad7..e151b5556 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/DataKey.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/DataKey.java
@@ -7,24 +7,21 @@ package com.github.javaparser.ast;
* force the creation of a subtype. That subtype is used to test for identity when looking for the
* user data because actual object identity would suffer from problems under serialization.
* So, the correct way to declare a DataKey is like this:
- *
+ * <p>
* <pre>
* <code>
* public static final DataKey&lt;Role&gt; ROLE = new DataKey&lt;Role&gt;() { };
* </code>
* </pre>
- *
+ * <p>
* This code was taken from the <a href="http://wicket.apache.org/">Wicket project</a>.
*
- * @param <T>
- * The type of the object which is stored
- *
+ * @param <T> The type of the object which is stored
* @see Node#getData(DataKey)
*/
public abstract class DataKey<T> {
@Override
- public int hashCode()
- {
+ public int hashCode() {
return getClass().hashCode();
}
@@ -32,8 +29,7 @@ public abstract class DataKey<T> {
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj)
- {
+ public boolean equals(Object obj) {
return obj != null && getClass().equals(obj.getClass());
}
}
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 a191a49d1..dc6f5b7c5 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
@@ -36,19 +36,21 @@ import com.github.javaparser.ast.visitor.Visitable;
import com.github.javaparser.printer.PrettyPrinter;
import com.github.javaparser.printer.PrettyPrinterConfiguration;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
import java.util.*;
import static java.util.Collections.unmodifiableList;
-import java.lang.reflect.*;
-
/**
* Abstract class for all nodes of the AST.
- *
+ * <p>
* Each Node can have one associated comment which describe it and
* a number of "orphan comments" which it contains but are not specifically
* associated to any element.
- *
+ *
* @author Julio Vilmar Gesser
*/
// Use <Node> to prevent Node from becoming generic.
@@ -151,9 +153,8 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
}
/**
- * @param range the range of characters in the source code that this node covers.
- * null can be used to indicate that no range information is known,
- * or that it is not of interest.
+ * @param range the range of characters in the source code that this node covers. null can be used to indicate that
+ * no range information is known, or that it is not of interest.
*/
public Node setRange(Range range) {
notifyPropertyChange(ObservableProperty.RANGE, this.range, range);
@@ -201,7 +202,7 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
/**
* Return the String representation of this node.
- *
+ *
* @return the String representation of this node
*/
@Override
@@ -262,13 +263,13 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
/**
* This is a list of Comment which are inside the node and are not associated
* with any meaningful AST Node.
- *
+ * <p>
* For example, comments at the end of methods (immediately before the parenthesis)
* or at the end of CompilationUnit are orphan comments.
- *
+ * <p>
* When more than one comment preceeds a statement, the one immediately preceding it
* it is associated with the statements, while the others are orphans.
- *
+ *
* @return all comments that cannot be attributed to a concept
*/
public List<Comment> getOrphanComments() {
@@ -279,7 +280,7 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
* This is the list of Comment which are contained in the Node either because
* they are properly associated to one of its children or because they are floating
* around inside the Node
- *
+ *
* @return all Comments within the node as a list
*/
public List<Comment> getAllContainedComments() {
@@ -367,11 +368,8 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
/**
* Gets data for this component using the given key.
*
- * @param <M>
- * The type of the data.
- *
- * @param key
- * The key for the data
+ * @param <M> The type of the data.
+ * @param key The key for the data
* @return The data or null of no data was found for the given key
* @see DataKey
*/
@@ -386,13 +384,9 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
* Sets data for this component using the given key.
* For information on creating DataKey, see {@link DataKey}.
*
- * @param <M>
- * The type of data
- *
- * @param key
- * The singleton key for the data
- * @param object
- * The data object
+ * @param <M> The type of data
+ * @param key The singleton key for the data
+ * @param object The data object
* @throws IllegalArgumentException
* @see DataKey
*/
@@ -405,7 +399,7 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
/**
* Try to remove this node from the parent
- *
+ *
* @return true if removed, false otherwise
* @throws RuntimeException if it fails in an unexpected way
*/
@@ -420,14 +414,14 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
// we are going to look to remove the node either by checking if it is part of a NodeList
// of if there is an explicit setter for it
- for (Method method : parentClass.getMethods()){
+ for (Method method : parentClass.getMethods()) {
if (!removed && !java.lang.reflect.Modifier.isStatic(method.getModifiers())) {
// looking for methods returning a NodeList
if (method.getParameterCount() == 0 && NodeList.class.isAssignableFrom(method.getReturnType())) {
try {
NodeList result = (NodeList) method.invoke(parentNode);
removed = result.remove(this);
- } catch (IllegalAccessException|InvocationTargetException e) {
+ } catch (IllegalAccessException | InvocationTargetException e) {
// nothing to do here
}
} else if ((method.getReturnType().isAssignableFrom(this.getClass()) || isOptionalAssignableFrom(method.getGenericReturnType(), this.getClass()))
@@ -456,14 +450,14 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
result = (Node) o;
} else continue;
} else continue;
- }else {
+ } else {
result = (Node) resultRaw;
}
if (this == result) {
optSetter.get().invoke(parentNode, (Object) null);
removed = true;
}
- } catch (IllegalAccessException|InvocationTargetException e) {
+ } catch (IllegalAccessException | InvocationTargetException e) {
// nothing to do here
}
}
@@ -559,18 +553,18 @@ public abstract class Node implements Cloneable, HasParentNode<Node>, Visitable
if (!(type instanceof ParameterizedType)) {
return Optional.empty();
}
- ParameterizedType parameterizedType = (ParameterizedType)type;
+ ParameterizedType parameterizedType = (ParameterizedType) type;
if (!(parameterizedType.getRawType() instanceof Class)) {
return Optional.empty();
}
- Class rawType = (Class)parameterizedType.getRawType();
+ Class rawType = (Class) parameterizedType.getRawType();
if (!(rawType.equals(Optional.class))) {
return Optional.empty();
}
if (!(parameterizedType.getActualTypeArguments()[0] instanceof Class)) {
return Optional.empty();
}
- Class parameterType = (Class)parameterizedType.getActualTypeArguments()[0];
+ Class parameterType = (Class) parameterizedType.getActualTypeArguments()[0];
return Optional.of(parameterType);
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java b/javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java
index 7c02b14a1..d5790d5e7 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java
@@ -153,7 +153,7 @@ public class NodeList<N extends Node> implements List<N>, Iterable<N>, HasParent
/**
* Sets the parentNode
- *
+ *
* @param parentNode the parentNode
* @return this, the NodeList
*/
@@ -225,7 +225,7 @@ public class NodeList<N extends Node> implements List<N>, Iterable<N>, HasParent
@Override
public boolean remove(Object o) {
if (o instanceof Node) {
- return remove((Node)o);
+ return remove((Node) o);
} else {
return false;
}
@@ -302,7 +302,7 @@ public class NodeList<N extends Node> implements List<N>, Iterable<N>, HasParent
*/
@Override
public void replaceAll(UnaryOperator<N> operator) {
- for (int i=0; i<this.size(); i++) {
+ for (int i = 0; i < this.size(); i++) {
set(i, operator.apply(this.get(i)));
}
}
@@ -315,14 +315,13 @@ public class NodeList<N extends Node> implements List<N>, Iterable<N>, HasParent
@Override
public boolean removeIf(Predicate<? super N> filter) {
boolean changed = false;
- for (Object e : this.stream().filter(filter).toArray()){
+ for (Object e : this.stream().filter(filter).toArray()) {
changed = remove(e) || changed;
}
return changed;
}
/**
- *
* @see java.util.List#clear()
*/
@Override
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 9da240e50..2405e66e9 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast;
import com.github.javaparser.Range;
@@ -47,9 +47,10 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
* PackageDeclaration ::= ( }{@link AnnotationExpr}{@code )* "package" }{@link NameExpr}{@code ) ";"
* }
* </pre>
+ *
* @author Julio Vilmar Gesser
*/
-public final class PackageDeclaration extends Node implements
+public final class PackageDeclaration extends Node implements
NodeWithAnnotations<PackageDeclaration>,
NodeWithName<PackageDeclaration> {
@@ -88,7 +89,7 @@ public final class PackageDeclaration extends Node implements
/**
* Retrieves the list of annotations declared before the package
* declaration. Return <code>null</code> if there are no annotations.
- *
+ *
* @return list of annotations or <code>null</code>
*/
public NodeList<AnnotationExpr> getAnnotations() {
@@ -113,8 +114,7 @@ public final class PackageDeclaration extends Node implements
}
/**
- * @param annotations
- * the annotations to set
+ * @param annotations the annotations to set
*/
public PackageDeclaration setAnnotations(NodeList<AnnotationExpr> annotations) {
notifyPropertyChange(ObservableProperty.ANNOTATIONS, this.annotations, annotations);
@@ -125,9 +125,8 @@ public final class PackageDeclaration extends Node implements
/**
* Sets the name of this package declaration.
- *
- * @param name
- * the name to set
+ *
+ * @param name the name to set
*/
@Override
public PackageDeclaration setName(Name name) {
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 604983bd6..0775cf6df 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
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 20f9f1636..f602c92c6 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
@@ -46,10 +46,10 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
*/
-public final class AnnotationMemberDeclaration extends BodyDeclaration<AnnotationMemberDeclaration> implements
+public final class AnnotationMemberDeclaration extends BodyDeclaration<AnnotationMemberDeclaration> implements
NodeWithJavaDoc<AnnotationMemberDeclaration>,
NodeWithSimpleName<AnnotationMemberDeclaration>,
- NodeWithType<AnnotationMemberDeclaration, Type<?>>,
+ NodeWithType<AnnotationMemberDeclaration, Type<?>>,
NodeWithModifiers<AnnotationMemberDeclaration> {
private EnumSet<Modifier> modifiers;
@@ -113,9 +113,9 @@ public final class AnnotationMemberDeclaration extends BodyDeclaration<Annotatio
/**
* Return the modifiers of this member declaration.
- *
- * @see Modifier
+ *
* @return modifiers
+ * @see Modifier
*/
@Override
public EnumSet<Modifier> getModifiers() {
@@ -134,6 +134,7 @@ public final class AnnotationMemberDeclaration extends BodyDeclaration<Annotatio
/**
* Sets the default value
+ *
* @param defaultValue the default value, can be null
* @return this, the AnnotationMemberDeclaration
*/
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 a750fd89e..28d9d64c7 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
@@ -50,7 +50,7 @@ public abstract class BodyDeclaration<T extends Node> extends Node implements No
public BodyDeclaration(Range range, NodeList<AnnotationExpr> annotations) {
super(range);
- setAnnotations(annotations);
+ setAnnotations(annotations);
}
@Override
@@ -59,16 +59,15 @@ public abstract class BodyDeclaration<T extends Node> extends Node implements No
}
/**
- *
- * @param annotations a null value is currently treated as an empty list. This behavior could change
- * in the future, so please avoid passing null
+ * @param annotations a null value is currently treated as an empty list. This behavior could change in the future,
+ * so please avoid passing null
*/
@SuppressWarnings("unchecked")
@Override
public final T setAnnotations(NodeList<AnnotationExpr> annotations) {
notifyPropertyChange(ObservableProperty.ANNOTATIONS, this.annotations, annotations);
this.annotations = assertNotNull(annotations);
- setAsParentNodeOf(this.annotations);
+ setAsParentNodeOf(this.annotations);
return (T) this;
}
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 8065a4110..e21d3a9a6 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
@@ -44,8 +44,8 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
*/
-public final class ClassOrInterfaceDeclaration extends TypeDeclaration<ClassOrInterfaceDeclaration> implements
- NodeWithImplements<ClassOrInterfaceDeclaration>,
+public final class ClassOrInterfaceDeclaration extends TypeDeclaration<ClassOrInterfaceDeclaration> implements
+ NodeWithImplements<ClassOrInterfaceDeclaration>,
NodeWithExtends<ClassOrInterfaceDeclaration>,
NodeWithTypeParameters<ClassOrInterfaceDeclaration> {
@@ -59,27 +59,27 @@ public final class ClassOrInterfaceDeclaration extends TypeDeclaration<ClassOrIn
private NodeList<ClassOrInterfaceType> implementedTypes;
public ClassOrInterfaceDeclaration() {
- this(null,
- EnumSet.noneOf(Modifier.class),
- new NodeList<>(),
- false,
+ this(null,
+ EnumSet.noneOf(Modifier.class),
+ new NodeList<>(),
+ false,
new SimpleName(),
new NodeList<>(),
- new NodeList<>(),
- new NodeList<>(),
- new NodeList<>());
+ new NodeList<>(),
+ new NodeList<>(),
+ new NodeList<>());
}
public ClassOrInterfaceDeclaration(final EnumSet<Modifier> modifiers, final boolean isInterface,
final String name) {
- this(null,
- modifiers,
- new NodeList<>(),
+ this(null,
+ modifiers,
+ new NodeList<>(),
isInterface,
new SimpleName(name),
new NodeList<>(),
- new NodeList<>(),
- new NodeList<>(),
+ new NodeList<>(),
+ new NodeList<>(),
new NodeList<>());
}
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 8d3d4339e..062a90c99 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
@@ -45,10 +45,10 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
*/
-public final class ConstructorDeclaration extends BodyDeclaration<ConstructorDeclaration> implements
- NodeWithJavaDoc<ConstructorDeclaration>,
+public final class ConstructorDeclaration extends BodyDeclaration<ConstructorDeclaration> implements
+ NodeWithJavaDoc<ConstructorDeclaration>,
NodeWithDeclaration,
- NodeWithSimpleName<ConstructorDeclaration>,
+ NodeWithSimpleName<ConstructorDeclaration>,
NodeWithModifiers<ConstructorDeclaration>,
NodeWithParameters<ConstructorDeclaration>,
NodeWithThrownExceptions<ConstructorDeclaration>,
@@ -127,9 +127,9 @@ public final class ConstructorDeclaration extends BodyDeclaration<ConstructorDec
/**
* Return the modifiers of this member declaration.
- *
- * @see Modifier
+ *
* @return modifiers
+ * @see Modifier
*/
@Override
public EnumSet<Modifier> getModifiers() {
@@ -194,7 +194,7 @@ public final class ConstructorDeclaration extends BodyDeclaration<ConstructorDec
/**
* The declaration returned has this schema:
- *
+ * <p>
* [accessSpecifier] className ([paramType [paramName]])
* [throws exceptionsList]
*/
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 63b8a40d3..00ba4a63a 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
@@ -54,7 +54,7 @@ public final class EmptyMemberDeclaration extends BodyDeclaration<EmptyMemberDec
@Override
public JavadocComment getJavaDoc() {
- if(getComment() instanceof JavadocComment){
+ if (getComment() instanceof JavadocComment) {
return (JavadocComment) getComment();
}
return null;
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 f5c411d9f..d821d9304 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
@@ -18,20 +18,17 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
-package com.github.javaparser.ast.body;
-import java.util.EnumSet;
+package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.NodeList;
-import com.github.javaparser.ast.expr.NameExpr;
import com.github.javaparser.ast.expr.SimpleName;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
-import static com.github.javaparser.ast.NodeList.*;
+import java.util.EnumSet;
/**
* @author Julio Vilmar Gesser
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 cc2d7a950..6c2d41ba8 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
@@ -41,7 +41,7 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
*/
-public final class EnumDeclaration extends TypeDeclaration<EnumDeclaration> implements
+public final class EnumDeclaration extends TypeDeclaration<EnumDeclaration> implements
NodeWithImplements<EnumDeclaration> {
private NodeList<ClassOrInterfaceType> implementedTypes;
@@ -49,10 +49,10 @@ public final class EnumDeclaration extends TypeDeclaration<EnumDeclaration> impl
private NodeList<EnumConstantDeclaration> entries;
public EnumDeclaration() {
- this(null,
- EnumSet.noneOf(Modifier.class),
- new NodeList<>(),
- new SimpleName(),
+ this(null,
+ EnumSet.noneOf(Modifier.class),
+ new NodeList<>(),
+ new SimpleName(),
new NodeList<>(),
new NodeList<>(),
new NodeList<>());
@@ -115,7 +115,7 @@ public final class EnumDeclaration extends TypeDeclaration<EnumDeclaration> impl
public EnumDeclaration setEntries(NodeList<EnumConstantDeclaration> entries) {
notifyPropertyChange(ObservableProperty.ENTRIES, this.entries, entries);
this.entries = assertNotNull(entries);
- setAsParentNodeOf(this.entries);
+ setAsParentNodeOf(this.entries);
return this;
}
@@ -123,7 +123,7 @@ public final class EnumDeclaration extends TypeDeclaration<EnumDeclaration> impl
public EnumDeclaration setImplements(NodeList<ClassOrInterfaceType> implementsList) {
notifyPropertyChange(ObservableProperty.IMPLEMENTED_TYPES, this.implementedTypes, implementsList);
this.implementedTypes = assertNotNull(implementsList);
- setAsParentNodeOf(this.implementedTypes);
+ setAsParentNodeOf(this.implementedTypes);
return this;
}
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 53fcd7221..f98ecd955 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
@@ -117,12 +117,9 @@ public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> im
/**
* Creates a {@link FieldDeclaration}.
*
- * @param modifiers
- * modifiers
- * @param type
- * type
- * @param name
- * field name
+ * @param modifiers modifiers
+ * @param type type
+ * @param name field name
*/
public FieldDeclaration(EnumSet<Modifier> modifiers, Type<?> type, String name) {
this(assertNotNull(modifiers), assertNotNull(type), new VariableDeclarator(new VariableDeclaratorId(assertNotNull(name))));
@@ -140,9 +137,9 @@ public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> im
/**
* Return the modifiers of this member declaration.
- *
- * @see Modifier
+ *
* @return modifiers
+ * @see Modifier
*/
@Override
public EnumSet<Modifier> getModifiers() {
@@ -180,10 +177,10 @@ public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> im
/**
* Create a getter for this field, <b>will only work if this field declares only 1 identifier and if this field is
* already added to a ClassOrInterfaceDeclaration</b>
- *
+ *
* @return the {@link MethodDeclaration} created
* @throws IllegalStateException if there is more than 1 variable identifier or if this field isn't attached to a
- * class or enum
+ * class or enum
*/
public MethodDeclaration createGetter() {
if (getVariables().size() != 1)
@@ -212,10 +209,10 @@ public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> im
/**
* Create a setter for this field, <b>will only work if this field declares only 1 identifier and if this field is
* already added to a ClassOrInterfaceDeclaration</b>
- *
+ *
* @return the {@link MethodDeclaration} created
* @throws IllegalStateException if there is more than 1 variable identifier or if this field isn't attached to a
- * class or enum
+ * class or enum
*/
public MethodDeclaration createSetter() {
if (getVariables().size() != 1)
@@ -244,14 +241,18 @@ public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> im
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public Type<?> getElementType() {
return elementType;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public FieldDeclaration setElementType(final Type<?> elementType) {
@@ -263,13 +264,16 @@ public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> im
/**
* @return the array brackets in this position: <code>class C { int[] abc; }</code>
- * @deprecated will be removed in 3.0 */
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
public NodeList<ArrayBracketPair> getArrayBracketPairsAfterElementType() {
return arrayBracketPairsAfterElementType;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public FieldDeclaration setArrayBracketPairsAfterElementType(NodeList<ArrayBracketPair> arrayBracketPairsAfterType) {
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 81848001c..f5655ee4a 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
@@ -77,7 +77,7 @@ public final class InitializerDeclaration extends BodyDeclaration<InitializerDec
public InitializerDeclaration setBlock(BlockStmt block) {
notifyPropertyChange(ObservableProperty.BLOCK, this.block, block);
this.block = assertNotNull(block);
- setAsParentNodeOf(this.block);
+ setAsParentNodeOf(this.block);
return this;
}
@@ -89,7 +89,7 @@ public final class InitializerDeclaration extends BodyDeclaration<InitializerDec
@Override
public JavadocComment getJavaDoc() {
- if(getComment() instanceof JavadocComment){
+ if (getComment() instanceof JavadocComment) {
return (JavadocComment) getComment();
}
return null;
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 72fea6614..032d50324 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
@@ -228,7 +228,9 @@ public final class MethodDeclaration extends BodyDeclaration<MethodDeclaration>
getArrayBracketPairsAfterParameterList());
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public Type<?> getElementType() {
@@ -294,7 +296,9 @@ public final class MethodDeclaration extends BodyDeclaration<MethodDeclaration>
return this;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public MethodDeclaration setElementType(final Type<?> elementType) {
@@ -411,14 +415,17 @@ public final class MethodDeclaration extends BodyDeclaration<MethodDeclaration>
/**
* @return the array brackets in this position: <code>class C { int[] abc; }</code>
- * @deprecated will be removed in 3.0 */
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public NodeList<ArrayBracketPair> getArrayBracketPairsAfterElementType() {
return arrayBracketPairsAfterType;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public MethodDeclaration setArrayBracketPairsAfterElementType(NodeList<ArrayBracketPair> arrayBracketPairsAfterType) {
@@ -429,13 +436,16 @@ public final class MethodDeclaration extends BodyDeclaration<MethodDeclaration>
/**
* @return the array brackets in this position: <code>int abc()[] {...}</code>
- * @deprecated will be removed in 3.0 */
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
public NodeList<ArrayBracketPair> getArrayBracketPairsAfterParameterList() {
return arrayBracketPairsAfterParameterList;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
public MethodDeclaration setArrayBracketPairsAfterParameterList(NodeList<ArrayBracketPair> arrayBracketPairsAfterParameterList) {
this.arrayBracketPairsAfterParameterList = assertNotNull(arrayBracketPairsAfterParameterList);
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 1867228d0..1bbc6fa47 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
@@ -233,14 +233,18 @@ public final class Parameter extends Node implements
return this;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public Type getElementType() {
return elementType;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public Parameter setElementType(final Type<?> elementType) {
@@ -250,14 +254,18 @@ public final class Parameter extends Node implements
return this;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public NodeList<ArrayBracketPair> getArrayBracketPairsAfterElementType() {
return arrayBracketPairsAfterType;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public Parameter setArrayBracketPairsAfterElementType(NodeList<ArrayBracketPair> arrayBracketPairsAfterType) {
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 9a832db68..c87524cc7 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
@@ -43,25 +43,25 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
*/
-public abstract class TypeDeclaration<T extends Node> extends BodyDeclaration<T> implements
- NodeWithSimpleName<T>,
- NodeWithJavaDoc<T>,
- NodeWithModifiers<T>,
+public abstract class TypeDeclaration<T extends Node> extends BodyDeclaration<T> implements
+ NodeWithSimpleName<T>,
+ NodeWithJavaDoc<T>,
+ NodeWithModifiers<T>,
NodeWithMembers<T> {
- private SimpleName name;
+ private SimpleName name;
private EnumSet<Modifier> modifiers;
private NodeList<BodyDeclaration<?>> members;
- public TypeDeclaration() {
- this(null,
+ public TypeDeclaration() {
+ this(null,
new NodeList<>(),
EnumSet.noneOf(Modifier.class),
new SimpleName(),
new NodeList<>());
- }
+ }
public TypeDeclaration(EnumSet<Modifier> modifiers, String name) {
this(null,
@@ -69,9 +69,9 @@ public abstract class TypeDeclaration<T extends Node> extends BodyDeclaration<T>
modifiers,
new SimpleName(name),
new NodeList<>());
- }
+ }
- public TypeDeclaration(NodeList<AnnotationExpr> annotations,
+ public TypeDeclaration(NodeList<AnnotationExpr> annotations,
EnumSet<Modifier> modifiers, SimpleName name,
NodeList<BodyDeclaration<?>> members) {
this(null,
@@ -79,82 +79,81 @@ public abstract class TypeDeclaration<T extends Node> extends BodyDeclaration<T>
modifiers,
name,
members);
- }
+ }
- public TypeDeclaration(Range range, NodeList<AnnotationExpr> annotations,
+ public TypeDeclaration(Range range, NodeList<AnnotationExpr> annotations,
EnumSet<Modifier> modifiers, SimpleName name,
NodeList<BodyDeclaration<?>> members) {
- super(range, annotations);
- setName(name);
- setModifiers(modifiers);
- setMembers(members);
- }
-
- /**
- * Adds the given declaration to the specified type.
- *
- * @param decl
- * member declaration
- */
- public TypeDeclaration<T> addMember(BodyDeclaration<?> decl) {
- NodeList<BodyDeclaration<?>> members = getMembers();
- members.add(decl);
- return this;
- }
-
- @Override
- public NodeList<BodyDeclaration<?>> getMembers() {
- return members;
- }
-
- /**
+ super(range, annotations);
+ setName(name);
+ setModifiers(modifiers);
+ setMembers(members);
+ }
+
+ /**
+ * Adds the given declaration to the specified type.
+ *
+ * @param decl member declaration
+ */
+ public TypeDeclaration<T> addMember(BodyDeclaration<?> decl) {
+ NodeList<BodyDeclaration<?>> members = getMembers();
+ members.add(decl);
+ return this;
+ }
+
+ @Override
+ public NodeList<BodyDeclaration<?>> getMembers() {
+ return members;
+ }
+
+ /**
* Return the modifiers of this type declaration.
- *
- * @see Modifier
+ *
* @return modifiers
+ * @see Modifier
*/
- @Override
+ @Override
public final EnumSet<Modifier> getModifiers() {
- return modifiers;
- }
+ return modifiers;
+ }
@SuppressWarnings("unchecked")
@Override
public T setMembers(NodeList<BodyDeclaration<?>> members) {
notifyPropertyChange(ObservableProperty.MEMBERS, this.members, members);
- this.members = assertNotNull(members);
- setAsParentNodeOf(this.members);
+ this.members = assertNotNull(members);
+ setAsParentNodeOf(this.members);
return (T) this;
- }
+ }
@SuppressWarnings("unchecked")
@Override
public T setModifiers(EnumSet<Modifier> modifiers) {
notifyPropertyChange(ObservableProperty.MODIFIERS, this.modifiers, modifiers);
- this.modifiers = assertNotNull(modifiers);
+ this.modifiers = assertNotNull(modifiers);
return (T) this;
- }
+ }
- @Override
+ @Override
public T setName(SimpleName name) {
- notifyPropertyChange(ObservableProperty.NAME, this.name, name);
- this.name = assertNotNull(name);
- setAsParentNodeOf(name);
+ notifyPropertyChange(ObservableProperty.NAME, this.name, name);
+ this.name = assertNotNull(name);
+ setAsParentNodeOf(name);
return (T) this;
- }
-
- @Override
- public final SimpleName getName() {
- return name;
- }
-
- @Override
- public JavadocComment getJavaDoc() {
- if(getComment() instanceof JavadocComment){
- return (JavadocComment) getComment();
- }
- return null;
- }
+ }
+
+ @Override
+ public final SimpleName getName() {
+ return name;
+ }
+
+ @Override
+ public JavadocComment getJavaDoc() {
+ if (getComment() instanceof JavadocComment) {
+ return (JavadocComment) getComment();
+ }
+ return null;
+ }
@Override
public List<NodeList<?>> getNodeLists() {
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 8e3c53d2c..c0b25e9cb 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
@@ -69,8 +69,8 @@ public final class VariableDeclarator extends Node implements
* Defines the declaration of a variable.
*
* @param identifier The identifier for this variable. IE. The variables name.
- * @param initializer What this variable should be initialized to. An {@link com.github.javaparser.ast.expr.AssignExpr} is
- * unnecessary as the <code>=</code> operator is already added.
+ * @param initializer What this variable should be initialized to. An {@link com.github.javaparser.ast.expr.AssignExpr}
+ * is unnecessary as the <code>=</code> operator is already added.
*/
public VariableDeclarator(VariableDeclaratorId identifier, Expression initializer) {
this(null, identifier, initializer);
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 a63b04122..d320921b6 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.body;
import com.github.javaparser.Range;
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 3ea258450..c9ff4094c 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.comments;
import com.github.javaparser.Range;
@@ -31,7 +31,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
* </p>
* Block comments can has multi lines and are delimited by "/&#42;" and
* "&#42;/".
- *
+ *
* @author Julio Vilmar Gesser
*/
public final class BlockComment extends Comment {
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 2ccefe706..d9664086a 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.comments;
import com.github.javaparser.Range;
@@ -29,17 +29,17 @@ import java.util.Optional;
/**
* Abstract class for all AST nodes that represent comments.
- *
+ *
+ * @author Julio Vilmar Gesser
* @see BlockComment
* @see LineComment
* @see JavadocComment
- * @author Julio Vilmar Gesser
*/
public abstract class Comment extends Node {
private String content;
private Node commentedNode;
-
+
public Comment(Range range, String content) {
super(range);
this.content = content;
@@ -47,7 +47,7 @@ public abstract class Comment extends Node {
/**
* Return the text of the comment.
- *
+ *
* @return text of the comment
*/
public final String getContent() {
@@ -56,9 +56,8 @@ public abstract class Comment extends Node {
/**
* Sets the text of the comment.
- *
- * @param content
- * the text of the comment to set
+ *
+ * @param content the text of the comment to set
*/
public Comment setContent(String content) {
notifyPropertyChange(ObservableProperty.CONTENT, this.content, content);
@@ -66,8 +65,7 @@ public abstract class Comment extends Node {
return this;
}
- public boolean isLineComment()
- {
+ public boolean isLineComment() {
return false;
}
@@ -79,19 +77,17 @@ public abstract class Comment extends Node {
}
}
- public Optional<Node> getCommentedNode()
- {
+ public Optional<Node> getCommentedNode() {
return Optional.ofNullable(this.commentedNode);
}
/**
* Sets the commentedNode
- *
+ *
* @param commentedNode the commentedNode, can be null
* @return this, the Comment
*/
- public Comment setCommentedNode(Node commentedNode)
- {
+ public Comment setCommentedNode(Node commentedNode) {
notifyPropertyChange(ObservableProperty.COMMENTED_NODE, this.commentedNode, commentedNode);
if (commentedNode == null) {
this.commentedNode = null;
@@ -107,8 +103,7 @@ public abstract class Comment extends Node {
return this;
}
- public boolean isOrphan()
- {
+ public boolean isOrphan() {
return this.commentedNode == null;
}
}
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 490ba2d46..8993754a7 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.comments;
import com.github.javaparser.Range;
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 97b30eace..b30054789 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.comments;
import com.github.javaparser.Range;
@@ -30,7 +30,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
* AST node that represent line comments.
* </p>
* Line comments are started with "//" and finish at the end of the line ("\n").
- *
+ *
* @author Julio Vilmar Gesser
*/
public final class LineComment extends Comment {
@@ -58,8 +58,7 @@ public final class LineComment extends Comment {
}
@Override
- public boolean isLineComment()
- {
+ public boolean isLineComment() {
return true;
}
}
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 2e45244a2..0c6aaff3b 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
@@ -41,7 +41,7 @@ public abstract class AnnotationExpr extends Expression implements NodeWithName<
public AnnotationExpr(Name name) {
this(null, name);
}
-
+
public AnnotationExpr(Range range, Name name) {
super(range);
setName(name);
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 2612e96fe..afb82f7f2 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -72,14 +72,14 @@ public final class ArrayAccessExpr extends Expression {
public ArrayAccessExpr setIndex(Expression index) {
notifyPropertyChange(ObservableProperty.INDEX, this.index, index);
this.index = assertNotNull(index);
- setAsParentNodeOf(this.index);
+ setAsParentNodeOf(this.index);
return this;
}
public ArrayAccessExpr setName(Expression name) {
notifyPropertyChange(ObservableProperty.NAME, this.name, name);
this.name = assertNotNull(name);
- setAsParentNodeOf(this.name);
+ setAsParentNodeOf(this.name);
return this;
}
}
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 9271f98d0..fb16f7816 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -38,7 +38,7 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* <code>new int[5][4][][]</code> or <code>new int[][]{{1},{2,3}}</code>
- *
+ *
* @author Julio Vilmar Gesser
*/
// NOTE does not implement NodeWithType because setType is problematic
@@ -100,7 +100,9 @@ public final class ArrayCreationExpr extends Expression {
return Optional.ofNullable(initializer);
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
public Type<?> getElementType() {
return elementType;
@@ -108,23 +110,25 @@ public final class ArrayCreationExpr extends Expression {
/**
* Sets the initializer
- *
+ *
* @param initializer the initializer, can be null
* @return this, the ArrayCreationExpr
*/
public ArrayCreationExpr setInitializer(ArrayInitializerExpr initializer) {
notifyPropertyChange(ObservableProperty.INITIALIZER, this.initializer, initializer);
this.initializer = initializer;
- setAsParentNodeOf(this.initializer);
+ setAsParentNodeOf(this.initializer);
return this;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
public ArrayCreationExpr setElementType(Type<?> elementType) {
notifyPropertyChange(ObservableProperty.ELEMENT_TYPE, this.elementType, elementType);
this.elementType = assertNotNull(elementType);
- setAsParentNodeOf(this.elementType);
+ setAsParentNodeOf(this.elementType);
return this;
}
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 78c03e807..dfa942235 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -41,7 +41,7 @@ public final class ArrayInitializerExpr extends Expression {
}
public ArrayInitializerExpr(NodeList<Expression> values) {
- this(null, values);
+ this(null, values);
}
public ArrayInitializerExpr(Range range, NodeList<Expression> values) {
@@ -66,7 +66,7 @@ public final class ArrayInitializerExpr extends Expression {
public ArrayInitializerExpr setValues(NodeList<Expression> values) {
notifyPropertyChange(ObservableProperty.VALUES, this.values, values);
this.values = assertNotNull(values);
- setAsParentNodeOf(this.values);
+ setAsParentNodeOf(this.values);
return this;
}
}
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 057fdfd1c..e761422e6 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -57,7 +57,7 @@ public final class BinaryExpr extends Expression {
Operator(String codeRepresentation) {
this.codeRepresentation = codeRepresentation;
}
-
+
public String asString() {
return codeRepresentation;
}
@@ -79,9 +79,9 @@ public final class BinaryExpr extends Expression {
public BinaryExpr(Range range, Expression left, Expression right, Operator operator) {
super(range);
- setLeft(left);
- setRight(right);
- setOperator(operator);
+ setLeft(left);
+ setRight(right);
+ setOperator(operator);
}
@Override
@@ -109,7 +109,7 @@ public final class BinaryExpr extends Expression {
public BinaryExpr setLeft(Expression left) {
notifyPropertyChange(ObservableProperty.LEFT, this.left, left);
this.left = left;
- setAsParentNodeOf(this.left);
+ setAsParentNodeOf(this.left);
return this;
}
@@ -122,7 +122,7 @@ public final class BinaryExpr extends Expression {
public BinaryExpr setRight(Expression right) {
notifyPropertyChange(ObservableProperty.RIGHT, this.right, right);
this.right = right;
- setAsParentNodeOf(this.right);
+ setAsParentNodeOf(this.right);
return this;
}
}
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 1d3d6fcc5..a0814b908 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -38,7 +38,7 @@ public final class BooleanLiteralExpr extends LiteralExpr {
}
public BooleanLiteralExpr(boolean value) {
- this(null, value);
+ this(null, value);
}
public BooleanLiteralExpr(Range range, boolean value) {
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 af2a9f4d0..ad8d60187 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
@@ -18,13 +18,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
-import com.github.javaparser.utils.Utils;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import com.github.javaparser.utils.Utils;
/**
* @author Julio Vilmar Gesser
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 37b29ba52..440352663 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -33,8 +33,9 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
* Defines an expression that accesses the class of a type.
* Example:
* <code>
- * Object.class
+ * Object.class
* </code>
+ *
* @author Julio Vilmar Gesser
*/
public final class ClassExpr extends Expression implements NodeWithType<ClassExpr, Type<?>> {
@@ -46,7 +47,7 @@ public final class ClassExpr extends Expression implements NodeWithType<ClassExp
}
public ClassExpr(Type<?> type) {
- this(null, type);
+ this(null, type);
}
public ClassExpr(Range range, Type type) {
@@ -73,7 +74,7 @@ public final class ClassExpr extends Expression implements NodeWithType<ClassExp
public ClassExpr setType(Type<?> type) {
notifyPropertyChange(ObservableProperty.TYPE, this.type, type);
this.type = type;
- setAsParentNodeOf(this.type);
+ setAsParentNodeOf(this.type);
return this;
}
}
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 caa711534..c0006b3d3 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -79,21 +79,21 @@ public final class ConditionalExpr extends Expression {
public ConditionalExpr setCondition(Expression condition) {
notifyPropertyChange(ObservableProperty.CONDITION, this.condition, condition);
this.condition = assertNotNull(condition);
- setAsParentNodeOf(this.condition);
+ setAsParentNodeOf(this.condition);
return this;
}
public ConditionalExpr setElseExpr(Expression elseExpr) {
notifyPropertyChange(ObservableProperty.ELSE_EXPR, this.elseExpr, elseExpr);
this.elseExpr = assertNotNull(elseExpr);
- setAsParentNodeOf(this.elseExpr);
+ setAsParentNodeOf(this.elseExpr);
return this;
}
public ConditionalExpr setThenExpr(Expression thenExpr) {
notifyPropertyChange(ObservableProperty.THEN_EXPR, this.thenExpr, thenExpr);
this.thenExpr = assertNotNull(thenExpr);
- setAsParentNodeOf(this.thenExpr);
+ setAsParentNodeOf(this.thenExpr);
return this;
}
}
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 9949a9fb3..5dfa1fe33 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -30,23 +30,25 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public final class DoubleLiteralExpr extends StringLiteralExpr {
- public DoubleLiteralExpr() {
+ public DoubleLiteralExpr() {
this(null, "0");
- }
+ }
- public DoubleLiteralExpr(final String value) {
- this(null, value);
- }
+ public DoubleLiteralExpr(final String value) {
+ this(null, value);
+ }
- public DoubleLiteralExpr(final Range range, final String value) {
- super(range, 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) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
}
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 e720b17ea..6487c4b60 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -33,43 +33,45 @@ import java.util.Optional;
*/
public final class EnclosedExpr extends Expression {
- private Expression inner;
+ private Expression inner;
- public EnclosedExpr() {
+ public EnclosedExpr() {
this(null, new StringLiteralExpr());
- }
+ }
- public EnclosedExpr(final Expression inner) {
- this(null, inner);
- }
+ public EnclosedExpr(final Expression inner) {
+ this(null, inner);
+ }
- public EnclosedExpr(final Range range, final Expression inner) {
- super(range);
- setInner(inner);
- }
+ public EnclosedExpr(final Range range, final Expression inner) {
+ super(range);
+ setInner(inner);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
public Optional<Expression> getInner() {
return Optional.ofNullable(inner);
- }
+ }
/**
* Sets the inner expression
- *
+ *
* @param inner the inner expression, can be null
* @return this, the EnclosedExpr
*/
- public EnclosedExpr setInner(final Expression inner) {
- notifyPropertyChange(ObservableProperty.INNER, this.inner, inner);
- this.inner = inner;
- setAsParentNodeOf(this.inner);
- return this;
- }
+ public EnclosedExpr setInner(final Expression inner) {
+ notifyPropertyChange(ObservableProperty.INNER, this.inner, inner);
+ this.inner = inner;
+ setAsParentNodeOf(this.inner);
+ return this;
+ }
}
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 310632938..393aa537b 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -29,6 +29,6 @@ import com.github.javaparser.ast.Node;
*/
public abstract class Expression extends Node {
public Expression(Range range) {
- super(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 fafdb1d88..9c8e3b4dc 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
@@ -86,13 +86,13 @@ public final class FieldAccessExpr extends Expression implements NodeWithTypeArg
public FieldAccessExpr setFieldExpr(SimpleName inner) {
notifyPropertyChange(ObservableProperty.FIELD, this.field, inner);
this.field = assertNotNull(inner);
- setAsParentNodeOf(this.field);
+ setAsParentNodeOf(this.field);
return this;
}
/**
* Sets the scope
- *
+ *
* @param scope the scope, can be null
* @return this, the FieldAccessExpr
*/
@@ -110,7 +110,7 @@ public final class FieldAccessExpr extends Expression implements NodeWithTypeArg
/**
* Sets the type arguments
- *
+ *
* @param types the type arguments, can be null
* @return this, the FieldAccessExpr
*/
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 30535fdc4..199b45566 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -30,33 +30,35 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public class IntegerLiteralExpr extends StringLiteralExpr {
- private static final String UNSIGNED_MIN_VALUE = "2147483648";
+ private static final String UNSIGNED_MIN_VALUE = "2147483648";
- static final String MIN_VALUE = "-" + UNSIGNED_MIN_VALUE;
+ static final String MIN_VALUE = "-" + UNSIGNED_MIN_VALUE;
- public IntegerLiteralExpr() {
+ public IntegerLiteralExpr() {
this(null, "0");
- }
+ }
- public IntegerLiteralExpr(final String value) {
- this(null, value);
- }
+ public IntegerLiteralExpr(final String value) {
+ this(null, value);
+ }
- public IntegerLiteralExpr(final Range range, final String value) {
- super(range, 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) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- public final boolean isMinValue() {
- return value != null && //
- value.length() == 10 && //
- value.equals(UNSIGNED_MIN_VALUE);
- }
+ public final boolean isMinValue() {
+ return value != null && //
+ value.length() == 10 && //
+ value.equals(UNSIGNED_MIN_VALUE);
+ }
}
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 6c9465cbe..e2e0045d0 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -39,71 +39,71 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
* @author Raquel Pau
*/
public class LambdaExpr extends Expression implements
- NodeWithParameters<LambdaExpr> {
+ NodeWithParameters<LambdaExpr> {
- private NodeList<Parameter> parameters;
+ private NodeList<Parameter> parameters;
- private boolean isEnclosingParameters;
+ private boolean isEnclosingParameters;
- private Statement body;
+ private Statement body;
- public LambdaExpr() {
+ public LambdaExpr() {
this(null,
new NodeList<>(),
new EmptyStmt(),
false);
- }
+ }
- public LambdaExpr(Range range, NodeList<Parameter> parameters, Statement body,
+ public LambdaExpr(Range range, NodeList<Parameter> parameters, Statement body,
boolean isEnclosingParameters) {
- super(range);
- setParameters(parameters);
- setBody(body);
+ super(range);
+ setParameters(parameters);
+ setBody(body);
setEnclosingParameters(isEnclosingParameters);
- }
+ }
@Override
- public NodeList<Parameter> getParameters() {
+ public NodeList<Parameter> getParameters() {
return parameters;
- }
-
- @Override
- public LambdaExpr setParameters(NodeList<Parameter> parameters) {
- notifyPropertyChange(ObservableProperty.PARAMETERS, this.parameters, parameters);
- this.parameters = assertNotNull(parameters);
- setAsParentNodeOf(this.parameters);
- return this;
- }
-
- public Statement getBody() {
- return body;
- }
-
- public LambdaExpr setBody(Statement body) {
- this.body = body;
- setAsParentNodeOf(this.body);
- return this;
- }
-
- @Override
- public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
- return v.visit(this, arg);
- }
-
- @Override
- public <A> void accept(VoidVisitor<A> v, A arg) {
- v.visit(this, arg);
- }
-
- public boolean isEnclosingParameters() {
- return isEnclosingParameters;
- }
-
- public LambdaExpr setEnclosingParameters(boolean enclosingParameters) {
- notifyPropertyChange(ObservableProperty.ENCLOSING_PARAMETERS, this.isEnclosingParameters, enclosingParameters);
- this.isEnclosingParameters = enclosingParameters;
- return this;
- }
+ }
+
+ @Override
+ public LambdaExpr setParameters(NodeList<Parameter> parameters) {
+ notifyPropertyChange(ObservableProperty.PARAMETERS, this.parameters, parameters);
+ this.parameters = assertNotNull(parameters);
+ setAsParentNodeOf(this.parameters);
+ return this;
+ }
+
+ public Statement getBody() {
+ return body;
+ }
+
+ public LambdaExpr setBody(Statement body) {
+ this.body = body;
+ setAsParentNodeOf(this.body);
+ return this;
+ }
+
+ @Override
+ public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
+ return v.visit(this, arg);
+ }
+
+ @Override
+ public <A> void accept(VoidVisitor<A> v, A arg) {
+ v.visit(this, arg);
+ }
+
+ public boolean isEnclosingParameters() {
+ return isEnclosingParameters;
+ }
+
+ public LambdaExpr setEnclosingParameters(boolean enclosingParameters) {
+ notifyPropertyChange(ObservableProperty.ENCLOSING_PARAMETERS, this.isEnclosingParameters, enclosingParameters);
+ this.isEnclosingParameters = enclosingParameters;
+ return this;
+ }
}
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 4bd8a3f55..33d44de3d 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -28,6 +28,6 @@ import com.github.javaparser.Range;
*/
public abstract class LiteralExpr extends Expression {
public LiteralExpr(Range range) {
- super(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 b8101ae9a..41c37ef2b 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -30,34 +30,36 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public class LongLiteralExpr extends StringLiteralExpr {
- private static final String UNSIGNED_MIN_VALUE = "9223372036854775808";
+ private static final String UNSIGNED_MIN_VALUE = "9223372036854775808";
- protected static final String MIN_VALUE = "-" + UNSIGNED_MIN_VALUE + "L";
+ protected static final String MIN_VALUE = "-" + UNSIGNED_MIN_VALUE + "L";
- public LongLiteralExpr() {
+ public LongLiteralExpr() {
this(null, "0");
- }
-
- public LongLiteralExpr(final String value) {
- super(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) {
- return v.visit(this, arg);
- }
-
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
-
- public final boolean isMinValue() {
- return value != null && //
- value.length() == 20 && //
- value.startsWith(UNSIGNED_MIN_VALUE) && //
- (value.charAt(19) == 'L' || value.charAt(19) == 'l');
- }
+ }
+
+ public LongLiteralExpr(final String value) {
+ super(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) {
+ return v.visit(this, arg);
+ }
+
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
+
+ public final boolean isMinValue() {
+ return value != null && //
+ value.length() == 20 && //
+ value.startsWith(UNSIGNED_MIN_VALUE) && //
+ (value.charAt(19) == 'L' || value.charAt(19) == 'l');
+ }
}
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 82fe6dd07..654372ff8 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -35,57 +35,59 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
*/
public final class MemberValuePair extends Node implements NodeWithSimpleName<MemberValuePair> {
- private SimpleName name;
+ private SimpleName name;
- private Expression value;
+ private Expression value;
- public MemberValuePair() {
+ public MemberValuePair() {
this(null, new SimpleName(), new StringLiteralExpr());
- }
+ }
- public MemberValuePair(final String name, final Expression value) {
+ public MemberValuePair(final String name, final Expression value) {
this(null, new SimpleName(name), value);
- }
+ }
- public MemberValuePair(final SimpleName name, final Expression value) {
+ public MemberValuePair(final SimpleName name, final Expression value) {
this(null, name, value);
- }
+ }
- public MemberValuePair(final Range range, final SimpleName name, final Expression value) {
- super(range);
- setName(name);
- setValue(value);
- }
+ public MemberValuePair(final Range range, final SimpleName name, final Expression value) {
+ super(range);
+ setName(name);
+ setValue(value);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- @Override
- public SimpleName getName() {
- return name;
- }
+ @Override
+ public SimpleName getName() {
+ return name;
+ }
- public Expression getValue() {
- return value;
- }
+ public Expression getValue() {
+ return value;
+ }
@Override
public MemberValuePair setName(final SimpleName name) {
- notifyPropertyChange(ObservableProperty.NAME, this.name, name);
- this.name = assertNotNull(name);
+ notifyPropertyChange(ObservableProperty.NAME, this.name, name);
+ this.name = assertNotNull(name);
setAsParentNodeOf(name);
return this;
- }
+ }
- public MemberValuePair setValue(final Expression value) {
+ public MemberValuePair setValue(final Expression value) {
notifyPropertyChange(ObservableProperty.VALUE, this.value, value);
- this.value = assertNotNull(value);
- setAsParentNodeOf(this.value);
- return this;
- }
+ this.value = assertNotNull(value);
+ setAsParentNodeOf(this.value);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/MethodCallExpr.java
index faffe1e0b..2b4fe69f2 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
@@ -38,7 +38,7 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
*/
-public final class MethodCallExpr extends Expression implements
+public final class MethodCallExpr extends Expression implements
NodeWithTypeArguments<MethodCallExpr>,
NodeWithArguments<MethodCallExpr>,
NodeWithSimpleName<MethodCallExpr> {
@@ -75,13 +75,13 @@ public final class MethodCallExpr extends Expression implements
arguments);
}
- public MethodCallExpr(final Range range, final Expression scope, final NodeList<Type<?>> typeArguments, final SimpleName name, final NodeList<Expression> arguments) {
- super(range);
- setScope(scope);
- setTypeArguments(typeArguments);
- setName(name);
- setArguments(arguments);
- }
+ public MethodCallExpr(final Range range, final Expression scope, final NodeList<Type<?>> typeArguments, final SimpleName name, final NodeList<Expression> arguments) {
+ super(range);
+ setScope(scope);
+ setTypeArguments(typeArguments);
+ setName(name);
+ setArguments(arguments);
+ }
@Override
public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
@@ -108,10 +108,10 @@ public final class MethodCallExpr extends Expression implements
public MethodCallExpr setArguments(final NodeList<Expression> arguments) {
notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments);
- this.arguments = assertNotNull(arguments);
- setAsParentNodeOf(this.arguments);
+ this.arguments = assertNotNull(arguments);
+ setAsParentNodeOf(this.arguments);
return this;
- }
+ }
@Override
public MethodCallExpr setName(final SimpleName name) {
@@ -135,7 +135,7 @@ public final class MethodCallExpr extends Expression implements
/**
* Sets the typeArguments
- *
+ *
* @param typeArguments the typeArguments, can be null
* @return this, the MethodCallExpr
*/
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 07d8bc233..7d3b59cfa 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -35,12 +35,12 @@ import java.util.Optional;
/**
* Method reference expressions introduced in Java 8 specifically designed to simplify lambda Expressions.
* These are some examples:
+ * <p>
+ * System.out::println;
+ * <p>
+ * (test ? stream.map(String::trim) : stream)::toArray;
*
- * System.out::println;
- *
- * (test ? stream.map(String::trim) : stream)::toArray;
* @author Raquel Pau
- *
*/
public class MethodReferenceExpr extends Expression implements
NodeWithTypeArguments<MethodReferenceExpr>,
@@ -96,7 +96,7 @@ public class MethodReferenceExpr extends Expression implements
/**
* Sets the typeArguments
- *
+ *
* @param typeArguments the typeArguments, can be null
* @return this, the MethodReferenceExpr
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java
index 8dab002bd..b2accdc01 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/Name.java
@@ -28,10 +28,10 @@ import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
-import static com.github.javaparser.utils.Utils.assertNotNull;
-
import java.util.Optional;
+import static com.github.javaparser.utils.Utils.assertNotNull;
+
/**
* A name that may consist of multiple identifiers.
* In other words: it.may.contain.dots.
@@ -41,8 +41,8 @@ import java.util.Optional;
* <p>
* You can construct one from a String with the name(...) method.
*
- * @see SimpleName
* @author Julio Vilmar Gesser
+ * @see SimpleName
*/
public class Name extends Node implements NodeWithIdentifier<Name> {
private String identifier;
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 0fee8d55d..fb9486376 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
@@ -72,7 +72,7 @@ public final class NormalAnnotationExpr extends AnnotationExpr {
/**
* adds a pair to this annotation
- *
+ *
* @return this, the {@link NormalAnnotationExpr}
*/
public NormalAnnotationExpr addPair(String key, String value) {
@@ -81,7 +81,7 @@ public final class NormalAnnotationExpr extends AnnotationExpr {
/**
* adds a pair to this annotation
- *
+ *
* @return this, the {@link NormalAnnotationExpr}
*/
public NormalAnnotationExpr addPair(String key, NameExpr value) {
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 2c88913f0..9f7d47e53 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -30,19 +30,21 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public final class NullLiteralExpr extends LiteralExpr {
- public NullLiteralExpr() {
+ public NullLiteralExpr() {
this(null);
- }
+ }
- public NullLiteralExpr(final Range range) {
- super(range);
- }
+ public NullLiteralExpr(final Range range) {
+ super(range);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
}
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 ec5fddfee..0da457fc6 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,10 +21,6 @@
package com.github.javaparser.ast.expr;
-import static com.github.javaparser.utils.Utils.assertNotNull;
-
-import java.util.Optional;
-
import com.github.javaparser.Range;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.body.BodyDeclaration;
@@ -37,11 +33,15 @@ import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import java.util.Optional;
+
+import static com.github.javaparser.utils.Utils.assertNotNull;
+
/**
* Defines constructor call expression.
* Example:
* <code>
- * new Object()
+ * new Object()
* </code>
*
* @author Julio Vilmar Gesser
@@ -72,7 +72,7 @@ public final class ObjectCreationExpr extends Expression implements
/**
* Defines a call to a constructor.
- *
+ *
* @param scope may be null
* @param type this is the class that the constructor is being called for.
* @param arguments Any arguments to pass to the constructor
@@ -137,7 +137,7 @@ public final class ObjectCreationExpr extends Expression implements
* Sets the anonymousClassBody<br>
* Null means no class body<br>
* Empty NodeList means new ClassName(){ }
- *
+ *
* @param anonymousClassBody the anonymousClassBody, can be null or empty
* @return this, the ObjectCreationExpr
*/
@@ -158,7 +158,7 @@ public final class ObjectCreationExpr extends Expression implements
/**
* Sets the scope
- *
+ *
* @param scope the scope, can be null
* @return this, the ObjectCreationExpr
*/
@@ -185,7 +185,7 @@ public final class ObjectCreationExpr extends Expression implements
/**
* Sets the typeArguments
- *
+ *
* @param typeArguments the typeArguments, can be null
* @return this, the ObjectCreationExpr
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SimpleName.java b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SimpleName.java
index 5365bd7a4..349cd7068 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SimpleName.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/expr/SimpleName.java
@@ -12,6 +12,7 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* A name that consists of a single identifier.
* In other words: it.does.NOT.contain.dots.
+ *
* @see Name
*/
public class SimpleName extends Node implements NodeWithIdentifier<SimpleName> {
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 97a0d4e2b..62a4a4bbe 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -31,37 +31,39 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public final class SingleMemberAnnotationExpr extends AnnotationExpr {
- private Expression memberValue;
+ private Expression memberValue;
- public SingleMemberAnnotationExpr() {
+ public SingleMemberAnnotationExpr() {
this(null, new Name(), new StringLiteralExpr());
- }
+ }
- public SingleMemberAnnotationExpr(final Name name, final Expression memberValue) {
+ public SingleMemberAnnotationExpr(final Name name, final Expression memberValue) {
this(null, name, memberValue);
- }
+ }
- public SingleMemberAnnotationExpr(final Range range, final Name name, final Expression memberValue) {
- super(range, name);
- setMemberValue(memberValue);
- }
+ public SingleMemberAnnotationExpr(final Range range, final Name name, final Expression memberValue) {
+ super(range, name);
+ setMemberValue(memberValue);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- public Expression getMemberValue() {
- return memberValue;
- }
+ public Expression getMemberValue() {
+ return memberValue;
+ }
- public SingleMemberAnnotationExpr setMemberValue(final Expression memberValue) {
- notifyPropertyChange(ObservableProperty.MEMBER_VALUE, this.memberValue, memberValue);
- this.memberValue = memberValue;
- setAsParentNodeOf(this.memberValue);
- return this;
- }
+ public SingleMemberAnnotationExpr setMemberValue(final Expression memberValue) {
+ notifyPropertyChange(ObservableProperty.MEMBER_VALUE, this.memberValue, memberValue);
+ this.memberValue = memberValue;
+ setAsParentNodeOf(this.memberValue);
+ return this;
+ }
}
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 596f0f8c9..c9428e07c 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -31,50 +31,53 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* Java® Language Specification 3.10.5 String Literals
+ *
* @author Julio Vilmar Gesser
*/
public class StringLiteralExpr extends LiteralExpr {
- protected String value;
+ protected String value;
- public StringLiteralExpr() {
+ public StringLiteralExpr() {
this(null, "empty");
- }
+ }
- public StringLiteralExpr(final String value) {
- this(null, value);
- }
+ public StringLiteralExpr(final String value) {
+ this(null, value);
+ }
- /**
- * Utility method that creates a new StringLiteralExpr. Escapes EOL characters.
- */
- public static StringLiteralExpr escape(String string) {
- return new StringLiteralExpr(Utils.escapeEndOfLines(string));
- }
+ /**
+ * Utility method that creates a new StringLiteralExpr. Escapes EOL characters.
+ */
+ public static StringLiteralExpr escape(String string) {
+ return new StringLiteralExpr(Utils.escapeEndOfLines(string));
+ }
- public StringLiteralExpr(final Range range, final String value) {
- super(range);
- setValue(value);
- }
+ public StringLiteralExpr(final Range range, final String value) {
+ super(range);
+ setValue(value);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- public final String getValue() {
- return value;
- }
+ public final String getValue() {
+ return value;
+ }
- public final StringLiteralExpr setValue(final String value) {
- notifyPropertyChange(ObservableProperty.VALUE, this.value, value);
+ public final StringLiteralExpr setValue(final String value) {
+ notifyPropertyChange(ObservableProperty.VALUE, this.value, value);
this.value = assertNotNull(value);
if (value.contains("\n") || value.contains("\r")) {
throw new IllegalArgumentException("Illegal literal expression: newlines (line feed or carriage return) have to be escaped");
}
return this;
- }
+ }
}
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 062eca480..ac468152c 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -33,43 +33,45 @@ import java.util.Optional;
*/
public final class SuperExpr extends Expression {
- private Expression classExpr;
+ private Expression classExpr;
- public SuperExpr() {
+ public SuperExpr() {
this(null, null);
- }
+ }
- public SuperExpr(final Expression classExpr) {
- this(null, classExpr);
- }
+ public SuperExpr(final Expression classExpr) {
+ this(null, classExpr);
+ }
- public SuperExpr(final Range range, final Expression classExpr) {
- super(range);
- setClassExpr(classExpr);
- }
+ public SuperExpr(final Range range, final Expression classExpr) {
+ super(range);
+ setClassExpr(classExpr);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
public Optional<Expression> getClassExpr() {
return Optional.ofNullable(classExpr);
- }
+ }
/**
* Sets the classExpr
- *
+ *
* @param classExpr the classExpr, can be null
* @return this, the SuperExpr
*/
- public SuperExpr setClassExpr(final Expression classExpr) {
- notifyPropertyChange(ObservableProperty.CLASS_EXPR, this.classExpr, classExpr);
- this.classExpr = classExpr;
- setAsParentNodeOf(this.classExpr);
- return this;
- }
+ public SuperExpr setClassExpr(final Expression classExpr) {
+ notifyPropertyChange(ObservableProperty.CLASS_EXPR, this.classExpr, classExpr);
+ this.classExpr = classExpr;
+ setAsParentNodeOf(this.classExpr);
+ return this;
+ }
}
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 aa3bbc193..01a7ec0e5 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
@@ -18,52 +18,54 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
-package com.github.javaparser.ast.expr;
-import java.util.Optional;
+package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
+import java.util.Optional;
+
/**
* @author Julio Vilmar Gesser
*/
public final class ThisExpr extends Expression {
- private Expression classExpr;
+ private Expression classExpr;
- public ThisExpr() {
- this(null, null);
- }
+ public ThisExpr() {
+ this(null, null);
+ }
- public ThisExpr(final Expression classExpr) {
- this(null, classExpr);
- }
+ public ThisExpr(final Expression classExpr) {
+ this(null, classExpr);
+ }
- public ThisExpr(final Range range, final Expression classExpr) {
- super(range);
- setClassExpr(classExpr);
- }
+ public ThisExpr(final Range range, final Expression classExpr) {
+ super(range);
+ setClassExpr(classExpr);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- public Optional<Expression> getClassExpr() {
- return Optional.ofNullable(classExpr);
- }
+ public Optional<Expression> getClassExpr() {
+ return Optional.ofNullable(classExpr);
+ }
- public ThisExpr setClassExpr(final Expression classExpr) {
- notifyPropertyChange(ObservableProperty.CLASS_EXPR, this.classExpr, classExpr);
- this.classExpr = classExpr;
- setAsParentNodeOf(this.classExpr);
- return this;
- }
+ public ThisExpr setClassExpr(final Expression classExpr) {
+ notifyPropertyChange(ObservableProperty.CLASS_EXPR, this.classExpr, classExpr);
+ this.classExpr = classExpr;
+ setAsParentNodeOf(this.classExpr);
+ return this;
+ }
}
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 4fbf23e43..65a8bf472 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -33,8 +33,8 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* This class is just instantiated as scopes for MethodReferenceExpr nodes to encapsulate Types.
- * @author Raquel Pau
*
+ * @author Raquel Pau
*/
public class TypeExpr extends Expression implements NodeWithType<TypeExpr, Type<?>> {
@@ -73,5 +73,4 @@ public class TypeExpr extends Expression implements NodeWithType<TypeExpr, 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 e0235cba5..63776cdc9 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.expr;
import com.github.javaparser.Range;
@@ -30,10 +30,10 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
/**
* @author Julio Vilmar Gesser
*/
-public final class UnaryExpr extends Expression implements
+public final class UnaryExpr extends Expression implements
NodeWithExpression<UnaryExpr> {
- public enum Operator {
+ public enum Operator {
PLUS("+", false),
MINUS("-", false),
PREFIX_INCREMENT("++", false),
@@ -50,7 +50,7 @@ public final class UnaryExpr extends Expression implements
this.codeRepresentation = codeRepresentation;
this.isPostfix = isPostfix;
}
-
+
public String asString() {
return codeRepresentation;
}
@@ -58,58 +58,60 @@ public final class UnaryExpr extends Expression implements
public boolean isPostfix() {
return isPostfix;
}
-
+
public boolean isPrefix() {
return !isPostfix();
}
}
- private Expression expression;
+ private Expression expression;
- private Operator operator;
+ private Operator operator;
- public UnaryExpr() {
+ public UnaryExpr() {
this(null, new IntegerLiteralExpr(), Operator.POSTFIX_INCREMENT);
- }
+ }
- public UnaryExpr(final Expression expression, final Operator operator) {
+ public UnaryExpr(final Expression expression, final Operator operator) {
this(null, expression, operator);
- }
+ }
- public UnaryExpr(final Range range, final Expression expression, final Operator operator) {
- super(range);
- setExpression(expression);
- setOperator(operator);
- }
+ public UnaryExpr(final Range range, final Expression expression, final Operator operator) {
+ super(range);
+ setExpression(expression);
+ setOperator(operator);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- @Override
- public Expression getExpression() {
- return expression;
- }
+ @Override
+ public Expression getExpression() {
+ return expression;
+ }
- public Operator getOperator() {
- return operator;
- }
+ public Operator getOperator() {
+ return operator;
+ }
@Override
- public UnaryExpr setExpression(final Expression expr) {
- notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expr);
- this.expression = expr;
- setAsParentNodeOf(this.expression);
- return this;
- }
-
- public UnaryExpr setOperator(final Operator op) {
- notifyPropertyChange(ObservableProperty.OPERATOR, this.operator, op);
- this.operator = op;
- return this;
- }
+ public UnaryExpr setExpression(final Expression expr) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expr);
+ this.expression = expr;
+ setAsParentNodeOf(this.expression);
+ return this;
+ }
+
+ public UnaryExpr setOperator(final Operator op) {
+ notifyPropertyChange(ObservableProperty.OPERATOR, this.operator, op);
+ this.operator = op;
+ return this;
+ }
}
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 5c9970600..a832f88dd 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
@@ -56,13 +56,17 @@ public final class VariableDeclarationExpr extends Expression implements
private NodeList<AnnotationExpr> annotations;
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
private Type elementType;
private NodeList<VariableDeclarator> variables;
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
private NodeList<ArrayBracketPair> arrayBracketPairsAfterType;
@@ -161,16 +165,18 @@ public final class VariableDeclarationExpr extends Expression implements
/**
* Return the modifiers of this variable declaration.
- *
- * @see Modifier
+ *
* @return modifiers
+ * @see Modifier
*/
@Override
public EnumSet<Modifier> getModifiers() {
return modifiers;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public Type getElementType() {
@@ -197,7 +203,9 @@ public final class VariableDeclarationExpr extends Expression implements
return this;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public VariableDeclarationExpr setElementType(final Type elementType) {
@@ -215,13 +223,17 @@ public final class VariableDeclarationExpr extends Expression implements
return this;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
public NodeList<ArrayBracketPair> getArrayBracketPairsAfterElementType() {
return arrayBracketPairsAfterType;
}
- /** @deprecated will be removed in 3.0 */
+ /**
+ * @deprecated will be removed in 3.0
+ */
@Deprecated
@Override
public VariableDeclarationExpr setArrayBracketPairsAfterElementType(NodeList<ArrayBracketPair> arrayBracketPairsAfterType) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/EmptyImportDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/EmptyImportDeclaration.java
index 988daf080..a137fb2d0 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/EmptyImportDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/EmptyImportDeclaration.java
@@ -7,11 +7,12 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
/**
* A stray semicolon between the imports.
* This isn't described in the JLS, but accepted by most or all tools that parse Java.
+ *
* @deprecated will be removed in 3.0
*/
@Deprecated
public class EmptyImportDeclaration extends ImportDeclaration {
-
+
public EmptyImportDeclaration() {
this(null);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/ImportDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/ImportDeclaration.java
index 5efbf1eab..57051a8bb 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/ImportDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/ImportDeclaration.java
@@ -27,18 +27,15 @@ import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.expr.NameExpr;
/**
- * <p>
- * This class is a base class for classes representing import declarations. Imports are optional for the
- * {@link CompilationUnit}.
- * </p>
- * The ImportDeclaration is constructed following the syntax:<br>
+ * <p> This class is a base class for classes representing import declarations. Imports are optional for the {@link
+ * CompilationUnit}. </p> The ImportDeclaration is constructed following the syntax:<br>
* <pre>
* {@code
* ImportDeclaration ::= "import" ( "static" )? }{@link NameExpr}{@code ( "." "*" )? ";"
* }
* </pre>
- * An EmptyImportDeclaration is simply a semicolon among the import declarations.
- * <p><a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5">JLS 7.5. Import Declarations</a></p>
+ * An EmptyImportDeclaration is simply a semicolon among the import declarations. <p><a
+ * href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5">JLS 7.5. Import Declarations</a></p>
*
* @author Julio Vilmar Gesser
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleStaticImportDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleStaticImportDeclaration.java
index 2913d410c..603e40b06 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleStaticImportDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleStaticImportDeclaration.java
@@ -9,10 +9,10 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import static com.github.javaparser.utils.Utils.assertNotNull;
/**
- * Example: <code>import static com.github.javaparser.JavaParser.parse;</code>
- * In the example, "com.github.javaparser.JavaParser" is the type,
- * and "parse" is the staticMember.
- * <p><a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.3">7.5.3. Single-Static-Import Declarations</a></p>
+ * Example: <code>import static com.github.javaparser.JavaParser.parse;</code> In the example,
+ * "com.github.javaparser.JavaParser" is the type, and "parse" is the staticMember. <p><a
+ * href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.3">7.5.3. Single-Static-Import
+ * Declarations</a></p>
*/
public class SingleStaticImportDeclaration extends NonEmptyImportDeclaration {
private ClassOrInterfaceType type;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleTypeImportDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleTypeImportDeclaration.java
index 1fbd1d80e..dee3b6be6 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleTypeImportDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/SingleTypeImportDeclaration.java
@@ -9,8 +9,8 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import static com.github.javaparser.utils.Utils.assertNotNull;
/**
- * Example: <code>import com.github.javaparser.JavaParser;</code>
- * <p><a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.1">JLS 7.5.1. Single-Type-Import Declarations</a></p>
+ * Example: <code>import com.github.javaparser.JavaParser;</code> <p><a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.1">JLS
+ * 7.5.1. Single-Type-Import Declarations</a></p>
*/
public class SingleTypeImportDeclaration extends NonEmptyImportDeclaration {
private ClassOrInterfaceType type;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/StaticImportOnDemandDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/StaticImportOnDemandDeclaration.java
index ada0a63ef..534ddf69a 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/StaticImportOnDemandDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/StaticImportOnDemandDeclaration.java
@@ -9,8 +9,8 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import static com.github.javaparser.utils.Utils.assertNotNull;
/**
- * Example: <code>import static com.github.javaparser.JavaParser.*;</code>
- * <p><a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.4">7.5.4. Static-Import-on-Demand Declarations</a></p>
+ * Example: <code>import static com.github.javaparser.JavaParser.*;</code> <p><a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.4">7.5.4.
+ * Static-Import-on-Demand Declarations</a></p>
*/
public class StaticImportOnDemandDeclaration extends NonEmptyImportDeclaration {
private ClassOrInterfaceType type;
@@ -23,7 +23,7 @@ public class StaticImportOnDemandDeclaration extends NonEmptyImportDeclaration {
super(range);
setType(type);
}
-
+
@Override
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
return v.visit(this, arg);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/TypeImportOnDemandDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/TypeImportOnDemandDeclaration.java
index e0d552c91..28a10af80 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/imports/TypeImportOnDemandDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/imports/TypeImportOnDemandDeclaration.java
@@ -10,13 +10,10 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import static com.github.javaparser.utils.Utils.assertNotNull;
/**
- * Examples:
- * <code>
- * import com.github.javaparser.*;
- * import com.github.javaparser.JavaParser.*;
- * </code>
- * Since a parser cannot differentiate between a type name and a package name, we can only store a Name.
- * <p><a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.2">JLS 7.5.2. Type-Import-on-Demand Declarations</a></p>
+ * Examples: <code> import com.github.javaparser.*; import com.github.javaparser.JavaParser.*; </code> Since a parser
+ * cannot differentiate between a type name and a package name, we can only store a Name. <p><a
+ * href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.2">JLS 7.5.2. Type-Import-on-Demand
+ * Declarations</a></p>
*/
public class TypeImportOnDemandDeclaration extends NonEmptyImportDeclaration implements NodeWithName<TypeImportOnDemandDeclaration> {
private Name name;
@@ -24,12 +21,12 @@ public class TypeImportOnDemandDeclaration extends NonEmptyImportDeclaration imp
public TypeImportOnDemandDeclaration() {
this(null, new Name());
}
-
+
public TypeImportOnDemandDeclaration(Range range, Name name) {
super(range);
setName(name);
}
-
+
@Override
public <R, A> R accept(GenericVisitor<R, A> v, A arg) {
return v.visit(this, arg);
@@ -54,8 +51,7 @@ public class TypeImportOnDemandDeclaration extends NonEmptyImportDeclaration imp
/**
* Sets the name this import.
*
- * @param name
- * the name to set
+ * @param name the name to set
*/
@Override
public TypeImportOnDemandDeclaration setName(Name name) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithAnnotations.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithAnnotations.java
index e49d580c7..e6f1578c8 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithAnnotations.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithAnnotations.java
@@ -27,7 +27,7 @@ import com.github.javaparser.ast.expr.*;
import java.lang.annotation.Annotation;
-import static com.github.javaparser.ast.expr.Name.*;
+import static com.github.javaparser.ast.expr.Name.parse;
/**
* An element which can be the target of annotations.
@@ -46,7 +46,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Annotates this
- *
+ *
* @param name the name of the annotation
* @return the {@link NormalAnnotationExpr} added
*/
@@ -60,7 +60,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Annotates this and automatically add the import
- *
+ *
* @param clazz the class of the annotation
* @return the {@link NormalAnnotationExpr} added
*/
@@ -71,7 +71,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Annotates this with a marker annotation
- *
+ *
* @param name the name of the annotation
* @return this
*/
@@ -86,7 +86,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Annotates this with a marker annotation and automatically add the import
- *
+ *
* @param clazz the class of the annotation
* @return this
*/
@@ -97,7 +97,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Annotates this with a single member annotation
- *
+ *
* @param name the name of the annotation
* @param value the value, don't forget to add \"\" for a string value
* @return this
@@ -113,7 +113,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Annotates this with a single member annotation and automatically add the import
- *
+ *
* @param clazz the class of the annotation
* @param value the value, don't forget to add \"\" for a string value
* @return this
@@ -126,7 +126,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Check whether an annotation with this name is present on this element
- *
+ *
* @param annotationName the name of the annotation
* @return true if found, false if not
*/
@@ -136,7 +136,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Check whether an annotation with this class is present on this element
- *
+ *
* @param annotationClass the class of the annotation
* @return true if found, false if not
*/
@@ -146,7 +146,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Try to find an annotation by its name
- *
+ *
* @param annotationName the name of the annotation
* @return null if not found, the annotation otherwise
*/
@@ -157,7 +157,7 @@ public interface NodeWithAnnotations<N extends Node> {
/**
* Try to find an annotation by its class
- *
+ *
* @param annotationClass the class of the annotation
* @return null if not found, the annotation otherwise
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithDeclaration.java
index 875d28de0..80887f1b5 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithDeclaration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithDeclaration.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.nodeTypes;
/**
@@ -32,6 +32,7 @@ public interface NodeWithDeclaration {
/**
* As {@link NodeWithDeclaration#getDeclarationAsString(boolean, boolean, boolean)} including
* the modifiers, the throws clause and the parameters with both type and name.
+ *
* @return String representation of declaration
*/
String getDeclarationAsString();
@@ -39,6 +40,7 @@ public interface NodeWithDeclaration {
/**
* As {@link NodeWithDeclaration#getDeclarationAsString(boolean, boolean, boolean)} including
* the parameters with both type and name.
+ *
* @param includingModifiers flag to include the modifiers (if present) in the string produced
* @param includingThrows flag to include the throws clause (if present) in the string produced
* @return String representation of declaration based on parameter flags
@@ -48,9 +50,11 @@ public interface NodeWithDeclaration {
/**
* A simple representation of the element declaration.
* It should fit one string.
+ *
* @param includingModifiers flag to include the modifiers (if present) in the string produced
* @param includingThrows flag to include the throws clause (if present) in the string produced
- * @param includingParameterName flag to include the parameter name (while the parameter type is always included) in the string produced
+ * @param includingParameterName flag to include the parameter name (while the parameter type is always included) in
+ * the string produced
* @return String representation of declaration based on parameter flags
*/
String getDeclarationAsString(boolean includingModifiers, boolean includingThrows, boolean includingParameterName);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithElementType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithElementType.java
index d5d8064bb..da0c0ae1e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithElementType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithElementType.java
@@ -29,13 +29,11 @@ import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.type.Type;
/**
- * A node having an element type.
- * In most cases, the element type is simply the type.
- * In case of arrays, the element type is the type that is inside the deepest nesting:
- * for int[][][], the element type is int.
- *
- * The main reason for this interface is to permit users to manipulate homogeneously all nodes with getElementType/setElementType
- * methods
+ * A node having an element type. In most cases, the element type is simply the type. In case of arrays, the element
+ * type is the type that is inside the deepest nesting: for int[][][], the element type is int.
+ * <p>
+ * The main reason for this interface is to permit users to manipulate homogeneously all nodes with
+ * getElementType/setElementType methods
*/
public interface NodeWithElementType<N extends Node> {
/**
@@ -55,7 +53,7 @@ public interface NodeWithElementType<N extends Node> {
/**
* Sets this type to this class and try to import it to the {@link CompilationUnit} if needed
- *
+ *
* @param typeClass the type
* @return this
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithExtends.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithExtends.java
index dd18c98d1..3652e4623 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithExtends.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithExtends.java
@@ -15,7 +15,7 @@ public interface NodeWithExtends<N extends Node> {
/**
* Add an extends to this and automatically add the import
- *
+ *
* @param clazz the class to extand from
* @return this
*/
@@ -26,7 +26,7 @@ public interface NodeWithExtends<N extends Node> {
/**
* Add an extends to this
- *
+ *
* @param name the name of the type to extends from
* @return this
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithIdentifier.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithIdentifier.java
index 0f6b3f935..d971de267 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithIdentifier.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithIdentifier.java
@@ -4,7 +4,7 @@ import com.github.javaparser.ast.Node;
public interface NodeWithIdentifier<N extends Node> {
String getIdentifier();
-
+
N setIdentifier(String identifier);
default String getId() {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithImplements.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithImplements.java
index 3135a372f..daeb4fa31 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithImplements.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithImplements.java
@@ -15,7 +15,7 @@ public interface NodeWithImplements<N extends Node> {
/**
* Add an implements to this
- *
+ *
* @param name the name of the type to extends from
* @return this
*/
@@ -29,7 +29,7 @@ public interface NodeWithImplements<N extends Node> {
/**
* Add an implements to this and automatically add the import
- *
+ *
* @param clazz the type to implements from
* @return this
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java
index 517facb45..971f37507 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithMembers.java
@@ -19,10 +19,9 @@ import static java.util.stream.Collectors.*;
/**
* A node having members.
- *
+ * <p>
* The main reason for this interface is to permit users to manipulate homogeneously all nodes with a getMembers
* method.
- *
*/
public interface NodeWithMembers<N extends Node> {
NodeList<BodyDeclaration<?>> getMembers();
@@ -102,7 +101,7 @@ public interface NodeWithMembers<N extends Node> {
/**
* Add a public field to this
- *
+ *
* @param typeClass the type of the field
* @param name the name of the field
* @return the {@link FieldDeclaration} created
@@ -166,7 +165,7 @@ public interface NodeWithMembers<N extends Node> {
/**
* Adds a constructor to this
- *
+ *
* @param modifiers the modifiers like {@link Modifier#PUBLIC}
* @return the {@link MethodDeclaration} created
*/
@@ -223,31 +222,31 @@ public interface NodeWithMembers<N extends Node> {
/**
* Try to find a {@link MethodDeclaration} by its parameters types
*
- * @param paramTypes the types of parameters like "Map&lt;Integer,String&gt;","int" to match<br>
- * void foo(Map&lt;Integer,String&gt; myMap,int number)
+ * @param paramTypes the types of parameters like "Map&lt;Integer,String&gt;","int" to match<br> void
+ * foo(Map&lt;Integer,String&gt; myMap,int number)
* @return the methods found (multiple in case of polymorphism)
*/
default List<MethodDeclaration> getMethodsByParameterTypes(String... paramTypes) {
return getMembers().stream()
.filter(m -> m instanceof MethodDeclaration
&& ((MethodDeclaration) m).getParameters().stream().map(p -> p.getType().toString())
- .collect(toSet()).equals(Stream.of(paramTypes).collect(toSet())))
+ .collect(toSet()).equals(Stream.of(paramTypes).collect(toSet())))
.map(m -> (MethodDeclaration) m).collect(toList());
}
/**
* Try to find a {@link MethodDeclaration} by its parameters types
*
- * @param paramTypes the types of parameters like "Map&lt;Integer,String&gt;","int" to match<br>
- * void foo(Map&lt;Integer,String&gt; myMap,int number)
+ * @param paramTypes the types of parameters like "Map&lt;Integer,String&gt;","int" to match<br> void
+ * foo(Map&lt;Integer,String&gt; myMap,int number)
* @return the methods found (multiple in case of polymorphism)
*/
default List<MethodDeclaration> getMethodsByParameterTypes(Class<?>... paramTypes) {
return getMembers().stream()
.filter(m -> m instanceof MethodDeclaration
&& ((MethodDeclaration) m).getParameters().stream().map(p -> p.getType().toString())
- .collect(toSet())
- .equals(Stream.of(paramTypes).map(Class::getSimpleName).collect(toSet())))
+ .collect(toSet())
+ .equals(Stream.of(paramTypes).map(Class::getSimpleName).collect(toSet())))
.map(m -> (MethodDeclaration) m).collect(toList());
}
@@ -265,13 +264,13 @@ public interface NodeWithMembers<N extends Node> {
}
/**
- * Find all fields in the members of this node.
+ * Find all fields in the members of this node.
*
- * @return the fields found. This list is immutable.
+ * @return the fields found. This list is immutable.
*/
default List<FieldDeclaration> getFields() {
return unmodifiableList(getMembers().stream()
- .filter(m -> m instanceof FieldDeclaration )
+ .filter(m -> m instanceof FieldDeclaration)
.map(m -> (FieldDeclaration) m)
.collect(toList()));
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithModifiers.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithModifiers.java
index 0735bba6d..8176fbe04 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithModifiers.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithModifiers.java
@@ -14,8 +14,8 @@ public interface NodeWithModifiers<N extends Node> {
/**
* Return the modifiers of this variable declaration.
*
- * @see Modifier
* @return modifiers
+ * @see Modifier
*/
EnumSet<Modifier> getModifiers();
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithName.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithName.java
index 40f1e2947..9a7f21c2e 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithName.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithName.java
@@ -28,22 +28,22 @@ import static com.github.javaparser.ast.expr.Name.parse;
/**
* A node having a name.
- *
+ * <p>
* The main reason for this interface is to permit users to manipulate homogeneously all nodes with a getName method.
- *
- * @since 2.0.1
+ *
+ * @since 2.0.1
*/
public interface NodeWithName<N extends Node> {
Name getName();
N setName(Name name);
- default N setName(String name){
+ default N setName(String name) {
setName(parse(name));
return (N) this;
}
- default String getNameAsString(){
+ default String getNameAsString() {
return getName().asString();
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalBlockStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalBlockStmt.java
index 34ce423d3..8a39d932d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalBlockStmt.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalBlockStmt.java
@@ -1,10 +1,10 @@
package com.github.javaparser.ast.nodeTypes;
-import java.util.Optional;
-
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.stmt.BlockStmt;
+import java.util.Optional;
+
public interface NodeWithOptionalBlockStmt<N extends Node> {
Optional<BlockStmt> getBody();
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithParameters.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithParameters.java
index a631f0b67..d50bff2cb 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithParameters.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithParameters.java
@@ -27,7 +27,7 @@ public interface NodeWithParameters<N extends Node> {
/**
* Remember to import the class in the compilation unit yourself
- *
+ *
* @param className the name of the class, ex : org.test.Foo or Foo if you added manually the import
* @param name the name of the parameter
*/
@@ -52,7 +52,7 @@ public interface NodeWithParameters<N extends Node> {
/**
* Remember to import the class in the compilation unit yourself
- *
+ *
* @param className the name of the class, ex : org.test.Foo or Foo if you added manually the import
* @param name the name of the parameter
* @return the {@link Parameter} created
@@ -68,7 +68,7 @@ public interface NodeWithParameters<N extends Node> {
/**
* Try to find a {@link Parameter} by its name
- *
+ *
* @param name the name of the param
* @return null if not found, the param found otherwise
*/
@@ -79,7 +79,7 @@ public interface NodeWithParameters<N extends Node> {
/**
* Try to find a {@link Parameter} by its type
- *
+ *
* @param type the type of the param
* @return null if not found, the param found otherwise
*/
@@ -90,7 +90,7 @@ public interface NodeWithParameters<N extends Node> {
/**
* Try to find a {@link Parameter} by its type
- *
+ *
* @param type the type of the param <b>take care about generics, it wont work</b>
* @return null if not found, the param found otherwise
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java
index ceca89a3d..7ac45c518 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithSimpleName.java
@@ -26,7 +26,7 @@ import com.github.javaparser.ast.expr.SimpleName;
/**
* A node having a name.
- *
+ * <p>
* The main reason for this interface is to permit users to manipulate homogeneously all nodes with a getName method.
*/
public interface NodeWithSimpleName<N extends Node> {
@@ -35,12 +35,12 @@ public interface NodeWithSimpleName<N extends Node> {
N setName(SimpleName name);
@SuppressWarnings("unchecked")
- default N setName(String name){
+ default N setName(String name) {
setName(new SimpleName(name));
return (N) this;
}
- default String getNameAsString(){
+ default String getNameAsString() {
return getName().getIdentifier();
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrownExceptions.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrownExceptions.java
index 0a86e8881..c3b5bca29 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrownExceptions.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithThrownExceptions.java
@@ -16,7 +16,7 @@ public interface NodeWithThrownExceptions<N extends Node> {
/**
* Adds this type to the throws clause
- *
+ *
* @param throwType the exception type
* @return this
*/
@@ -29,7 +29,7 @@ public interface NodeWithThrownExceptions<N extends Node> {
/**
* Adds this class to the throws clause
- *
+ *
* @param clazz the exception class
* @return this
*/
@@ -42,7 +42,7 @@ public interface NodeWithThrownExceptions<N extends Node> {
* Check whether this elements throws this exception class.
* Note that this is simply a text compare of the simple name of the class,
* no actual type resolution takes place.
- *
+ *
* @param clazz the class of the exception
* @return true if found in throws clause, false if not
*/
@@ -54,7 +54,7 @@ public interface NodeWithThrownExceptions<N extends Node> {
* Check whether this elements throws this exception class
* Note that this is simply a text compare,
* no actual type resolution takes place.
- *
+ *
* @param throwableName the class of the exception
* @return true if found in throws clause, false if not
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithType.java
index 7de03e2ec..3a9f21945 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithType.java
@@ -28,7 +28,7 @@ import com.github.javaparser.ast.type.Type;
/**
* A node having a type.
- *
+ * <p>
* The main reason for this interface is to permit users to manipulate homogeneously all nodes with getType/setType
* methods
*
@@ -37,14 +37,14 @@ import com.github.javaparser.ast.type.Type;
public interface NodeWithType<N extends Node, T extends Type<?>> {
/**
* Gets the type
- *
+ *
* @return the type
*/
T getType();
/**
* Sets the type
- *
+ *
* @param type the type
* @return this
*/
@@ -52,7 +52,7 @@ public interface NodeWithType<N extends Node, T extends Type<?>> {
/**
* Sets this type to this class and try to import it to the {@link CompilationUnit} if needed
- *
+ *
* @param typeClass the type
* @return this
*/
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeArguments.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeArguments.java
index 75681f6d4..2e558084a 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeArguments.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeArguments.java
@@ -21,20 +21,20 @@
package com.github.javaparser.ast.nodeTypes;
-import static com.github.javaparser.ast.NodeList.nodeList;
-
-import java.util.Optional;
-
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.type.Type;
+import java.util.Optional;
+
+import static com.github.javaparser.ast.NodeList.nodeList;
+
/**
* A node that can have type arguments.
- *
+ * <p>
* <pre>
* new X(); --> typeArguments == Optional is empty
- * new X&lt;>(); --> typeArguments = [], diamondOperator = true
+ * new X&lt;>(); --> typeArguments = [], diamondOperator = true
* new X&lt;C,D>(); --> typeArguments = [C,D], diamondOperator = false
* </pre>
*/
@@ -46,7 +46,7 @@ public interface NodeWithTypeArguments<N extends Node> {
/**
* Allows you to set the generic arguments
- *
+ *
* @param typeArguments The list of types of the generics, can be null
*/
N setTypeArguments(NodeList<Type<?>> typeArguments);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeParameters.java b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeParameters.java
index 358cd32df..7021bb018 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeParameters.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/nodeTypes/NodeWithTypeParameters.java
@@ -9,7 +9,7 @@ import com.github.javaparser.ast.type.TypeParameter;
* <pre>
* class X {} --> typeParameters == []
* class X&lt;> {} --> does not occur.
- * class X&lt;C,D> {} --> typeParameters = [C,D]
+ * class X&lt;C,D> {} --> typeParameters = [C,D]
* </pre>
*/
public interface NodeWithTypeParameters<N extends Node> {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/observing/PropagatingAstObserver.java b/javaparser-core/src/main/java/com/github/javaparser/ast/observing/PropagatingAstObserver.java
index bf4638154..d602c773f 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/observing/PropagatingAstObserver.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/observing/PropagatingAstObserver.java
@@ -14,7 +14,7 @@ public abstract class PropagatingAstObserver implements AstObserver {
*/
public static PropagatingAstObserver transformInPropagatingObserver(final AstObserver observer) {
if (observer instanceof PropagatingAstObserver) {
- return (PropagatingAstObserver)observer;
+ return (PropagatingAstObserver) observer;
}
return new PropagatingAstObserver() {
@Override
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 9a6a369a3..ff6141de0 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
@@ -86,7 +86,7 @@ public final class AssertStmt extends Statement {
/**
* Sets the message
- *
+ *
* @param msg the message, can be null
* @return this, the AssertStmt
*/
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 45da38a5b..200e712c1 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
@@ -73,5 +73,4 @@ public final class BlockStmt extends Statement implements NodeWithStatements<Blo
}
-
}
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 ca5e4fdc3..1d5cacb2d 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
@@ -66,7 +66,7 @@ public final class BreakStmt extends Statement {
/**
* Sets the identifier
- *
+ *
* @param identifier the identifier, can be null
* @return this, the BreakStmt
*/
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 2ec9ee952..b22067b91 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -46,7 +46,7 @@ public final class CatchClause extends Node implements NodeWithBlockStmt<CatchCl
private BlockStmt catchBlock;
public CatchClause() {
- this(null, new Parameter(), new BlockStmt());
+ this(null, new Parameter(), new BlockStmt());
}
public CatchClause(final Parameter parameter, final BlockStmt catchBlock) {
@@ -58,13 +58,13 @@ public final class CatchClause extends Node implements NodeWithBlockStmt<CatchCl
final ClassOrInterfaceType exceptType,
final VariableDeclaratorId exceptId,
final BlockStmt catchBlock) {
- this(null,
- new Parameter(null,
- exceptModifier,
- exceptAnnotations,
- exceptType,
- new NodeList<>(),
- false,
+ this(null,
+ new Parameter(null,
+ exceptModifier,
+ exceptAnnotations,
+ exceptType,
+ new NodeList<>(),
+ false,
exceptId),
catchBlock);
}
@@ -77,44 +77,47 @@ public final class CatchClause extends Node implements NodeWithBlockStmt<CatchCl
setBody(catchBlock);
}
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
/**
* Use {@link #getBody()} instead
*/
@Deprecated
- public BlockStmt getCatchBlock() {
- return catchBlock;
- }
-
- /**
- * Note that the type of the Parameter can be a UnionType. In this case, any annotations found at the start of the catch(@X A a |...)
- * are found directly in the Parameter. Annotations that are on the second or later type - catch(A a | @X B b ...) are found on those types.
- */
- public Parameter getParameter() {
- return parameter;
- }
+ public BlockStmt getCatchBlock() {
+ return catchBlock;
+ }
+
+ /**
+ * Note that the type of the Parameter can be a UnionType. In this case, any annotations found at the start of the
+ * catch(@X A a |...) are found directly in the Parameter. Annotations that are on the second or later type -
+ * catch(A a | @X B b ...) are found on those types.
+ */
+ public Parameter getParameter() {
+ return parameter;
+ }
/**
* Use {@link #setBody(BlockStmt)} instead
*/
@Deprecated
- public CatchClause setCatchBlock(final BlockStmt catchBlock) {
+ public CatchClause setCatchBlock(final BlockStmt catchBlock) {
return setBody(catchBlock);
- }
+ }
- public CatchClause setParameter(final Parameter parameter) {
+ public CatchClause setParameter(final Parameter parameter) {
notifyPropertyChange(ObservableProperty.PARAMETER, this.parameter, parameter);
- this.parameter = parameter;
- setAsParentNodeOf(this.parameter);
+ this.parameter = parameter;
+ setAsParentNodeOf(this.parameter);
return this;
- }
+ }
@Override
public BlockStmt getBody() {
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 aad3208aa..90cc3be99 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -35,28 +35,30 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
*/
public final class ContinueStmt extends Statement {
- private String identifier;
+ private String identifier;
- public ContinueStmt() {
+ public ContinueStmt() {
this(null, null);
- }
+ }
- public ContinueStmt(final String identifier) {
- this(null, identifier);
- }
+ public ContinueStmt(final String identifier) {
+ this(null, identifier);
+ }
- public ContinueStmt(Range range, final String identifier) {
- super(range);
- this.identifier = identifier;
- }
+ public ContinueStmt(Range range, final String identifier) {
+ super(range);
+ this.identifier = identifier;
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
public Optional<String> getIdentifier() {
return Optional.ofNullable(identifier);
@@ -64,12 +66,12 @@ public final class ContinueStmt extends Statement {
/**
* Sets the identifier
- *
+ *
* @param identifier the identifier, can be null
* @return this, the ContinueStmt
*/
public ContinueStmt setIdentifier(final String identifier) {
- notifyPropertyChange(ObservableProperty.IDENTIFIER, this.identifier, identifier);
+ notifyPropertyChange(ObservableProperty.IDENTIFIER, this.identifier, identifier);
this.identifier = assertNotNull(identifier);
return this;
}
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 a59baa6d6..384b8d825 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -34,53 +34,55 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public final class DoStmt extends Statement implements NodeWithBody<DoStmt> {
- private Statement body;
+ private Statement body;
- private Expression condition;
+ private Expression condition;
- public DoStmt() {
+ public DoStmt() {
this(null, new EmptyStmt(), new BooleanLiteralExpr());
- }
+ }
- public DoStmt(final Statement body, final Expression condition) {
+ public DoStmt(final Statement body, final Expression condition) {
this(null, body, condition);
- }
+ }
- public DoStmt(Range range, final Statement body, final Expression condition) {
- super(range);
- setBody(body);
- setCondition(condition);
- }
+ public DoStmt(Range range, final Statement body, final Expression condition) {
+ super(range);
+ setBody(body);
+ setCondition(condition);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- @Override
+ @Override
public Statement getBody() {
- return body;
- }
+ return body;
+ }
- public Expression getCondition() {
- return condition;
- }
+ public Expression getCondition() {
+ return condition;
+ }
- @Override
+ @Override
public DoStmt setBody(final Statement body) {
- notifyPropertyChange(ObservableProperty.BODY, this.body, body);
- this.body = body;
- setAsParentNodeOf(this.body);
+ notifyPropertyChange(ObservableProperty.BODY, this.body, body);
+ this.body = body;
+ setAsParentNodeOf(this.body);
return this;
- }
+ }
- public DoStmt setCondition(final Expression condition) {
- notifyPropertyChange(ObservableProperty.CONDITION, this.condition, condition);
- this.condition = condition;
- setAsParentNodeOf(this.condition);
- return this;
- }
+ public DoStmt setCondition(final Expression condition) {
+ notifyPropertyChange(ObservableProperty.CONDITION, this.condition, condition);
+ this.condition = condition;
+ setAsParentNodeOf(this.condition);
+ return this;
+ }
}
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 9a5f9d2a8..d2ed06cf5 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -30,19 +30,21 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public final class EmptyStmt extends Statement {
- public EmptyStmt() {
+ public EmptyStmt() {
this(null);
- }
+ }
- public EmptyStmt(Range range) {
- super(range);
- }
+ public EmptyStmt(Range range) {
+ super(range);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
}
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 285d5ab51..863b9b0c0 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -43,80 +43,80 @@ public final class ExplicitConstructorInvocationStmt extends Statement implement
private boolean isThis;
- private Expression expression;
+ private Expression expression;
- private NodeList<Expression> arguments;
+ private NodeList<Expression> arguments;
- public ExplicitConstructorInvocationStmt() {
- this(null, new NodeList<>(), true, null, new NodeList<>());
- }
+ public ExplicitConstructorInvocationStmt() {
+ this(null, new NodeList<>(), true, null, new NodeList<>());
+ }
- public ExplicitConstructorInvocationStmt(final boolean isThis,
+ public ExplicitConstructorInvocationStmt(final boolean isThis,
final Expression expression, final NodeList<Expression> arguments) {
- this(null, new NodeList<>(), isThis, expression, arguments);
- }
+ this(null, new NodeList<>(), isThis, expression, arguments);
+ }
- public ExplicitConstructorInvocationStmt(Range range,
+ public ExplicitConstructorInvocationStmt(Range range,
final NodeList<Type<?>> typeArguments, final boolean isThis,
final Expression expression, final NodeList<Expression> arguments) {
- super(range);
- setTypeArguments(typeArguments);
- setThis(isThis);
- setExpression(expression);
- setArguments(arguments);
- }
-
- @Override
- public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
-
- @Override
- public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
-
- public NodeList<Expression> getArguments() {
+ super(range);
+ setTypeArguments(typeArguments);
+ setThis(isThis);
+ setExpression(expression);
+ setArguments(arguments);
+ }
+
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
+
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
+
+ public NodeList<Expression> getArguments() {
return arguments;
- }
+ }
- public Expression getArgument(int i) {
- return getArguments().get(i);
- }
+ public Expression getArgument(int i) {
+ return getArguments().get(i);
+ }
public Optional<Expression> getExpression() {
return Optional.ofNullable(expression);
- }
+ }
- public boolean isThis() {
- return isThis;
- }
+ public boolean isThis() {
+ return isThis;
+ }
- public ExplicitConstructorInvocationStmt setArguments(final NodeList<Expression> arguments) {
- notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments);
- this.arguments = assertNotNull(arguments);
- setAsParentNodeOf(this.arguments);
- return this;
- }
+ public ExplicitConstructorInvocationStmt setArguments(final NodeList<Expression> arguments) {
+ notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments);
+ this.arguments = assertNotNull(arguments);
+ setAsParentNodeOf(this.arguments);
+ return this;
+ }
/**
* Sets the expression
- *
+ *
* @param expression the expression, can be null
* @return this, the ExplicitConstructorInvocationStmt
*/
- public ExplicitConstructorInvocationStmt setExpression(final Expression expression) {
- notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
- this.expression = expression;
- setAsParentNodeOf(this.expression);
- return this;
- }
-
- public ExplicitConstructorInvocationStmt setThis(final boolean isThis) {
- notifyPropertyChange(ObservableProperty.IS_THIS, this.isThis, isThis);
- this.isThis = isThis;
- return this;
- }
+ public ExplicitConstructorInvocationStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = expression;
+ setAsParentNodeOf(this.expression);
+ return this;
+ }
+
+ public ExplicitConstructorInvocationStmt setThis(final boolean isThis) {
+ notifyPropertyChange(ObservableProperty.IS_THIS, this.isThis, isThis);
+ this.isThis = isThis;
+ return this;
+ }
@Override
public Optional<NodeList<Type<?>>> getTypeArguments() {
@@ -125,13 +125,13 @@ public final class ExplicitConstructorInvocationStmt extends Statement implement
/**
* Sets the typeArguments
- *
+ *
* @param typeArguments the typeArguments, can be null
* @return this, the ExplicitConstructorInvocationStmt
*/
@Override
public ExplicitConstructorInvocationStmt setTypeArguments(final NodeList<Type<?>> typeArguments) {
- notifyPropertyChange(ObservableProperty.TYPE_ARGUMENTS, this.typeArguments, typeArguments);
+ notifyPropertyChange(ObservableProperty.TYPE_ARGUMENTS, this.typeArguments, typeArguments);
this.typeArguments = typeArguments;
setAsParentNodeOf(this.typeArguments);
return this;
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ExpressionStmt.java
index 3ffa0aaa3..f402d1340 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -37,39 +37,41 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
public final class ExpressionStmt extends Statement implements
NodeWithExpression<ExpressionStmt> {
- private Expression expression;
+ private Expression expression;
- public ExpressionStmt() {
+ public ExpressionStmt() {
this(null, new BooleanLiteralExpr());
- }
+ }
- public ExpressionStmt(final Expression expression) {
- this(null, expression);
- }
+ public ExpressionStmt(final Expression expression) {
+ this(null, expression);
+ }
- public ExpressionStmt(Range range, final Expression expression) {
- super(range);
- setExpression(expression);
- }
+ public ExpressionStmt(Range range, final Expression expression) {
+ super(range);
+ setExpression(expression);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- @Override
- public Expression getExpression() {
- return expression;
- }
+ @Override
+ public Expression getExpression() {
+ return expression;
+ }
- @Override
- public ExpressionStmt setExpression(final Expression expression) {
- notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
- this.expression = assertNotNull(expression);
- setAsParentNodeOf(this.expression);
- return this;
- }
+ @Override
+ public ExpressionStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = assertNotNull(expression);
+ setAsParentNodeOf(this.expression);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ForStmt.java
index 68310a783..e9ed8b8c1 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
@@ -107,7 +107,7 @@ public final class ForStmt extends Statement implements NodeWithBody<ForStmt> {
/**
* Sets the compare
- *
+ *
* @param compare the compare, can be null
* @return this, the ForStmt
*/
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 9a89b3346..21b3b078b 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -37,75 +37,77 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
*/
public final class IfStmt extends Statement {
- private Expression condition;
+ private Expression condition;
- private Statement thenStmt;
+ private Statement thenStmt;
- private Statement elseStmt;
+ private Statement elseStmt;
- public IfStmt() {
+ public IfStmt() {
this(null,
new BooleanLiteralExpr(),
new EmptyStmt(),
null);
- }
+ }
- public IfStmt(final Expression condition, final Statement thenStmt, final Statement elseStmt) {
+ public IfStmt(final Expression condition, final Statement thenStmt, final Statement elseStmt) {
this(null, condition, thenStmt, elseStmt);
- }
-
- public IfStmt(Range range,
- final Expression condition, final Statement thenStmt, final Statement elseStmt) {
- super(range);
- setCondition(condition);
- setThenStmt(thenStmt);
- setElseStmt(elseStmt);
- }
-
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
-
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
-
- public Expression getCondition() {
- return condition;
- }
+ }
+
+ public IfStmt(Range range,
+ final Expression condition, final Statement thenStmt, final Statement elseStmt) {
+ super(range);
+ setCondition(condition);
+ setThenStmt(thenStmt);
+ setElseStmt(elseStmt);
+ }
+
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
+
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
+
+ public Expression getCondition() {
+ return condition;
+ }
public Optional<Statement> getElseStmt() {
return Optional.ofNullable(elseStmt);
- }
+ }
- public Statement getThenStmt() {
- return thenStmt;
- }
+ public Statement getThenStmt() {
+ return thenStmt;
+ }
- public IfStmt setCondition(final Expression condition) {
- notifyPropertyChange(ObservableProperty.CONDITION, this.condition, condition);
- this.condition = assertNotNull(condition);
- setAsParentNodeOf(this.condition);
- return this;
- }
+ public IfStmt setCondition(final Expression condition) {
+ notifyPropertyChange(ObservableProperty.CONDITION, this.condition, condition);
+ this.condition = assertNotNull(condition);
+ setAsParentNodeOf(this.condition);
+ return this;
+ }
/**
* Sets the elseStmt
- *
+ *
* @param elseStmt the elseStmt, can be null
* @return this, the IfStmt
*/
- public IfStmt setElseStmt(final Statement elseStmt) {
- notifyPropertyChange(ObservableProperty.ELSE_STMT, this.elseStmt, elseStmt);
- this.elseStmt = elseStmt;
- setAsParentNodeOf(this.elseStmt);
- return this;
- }
-
- public IfStmt setThenStmt(final Statement thenStmt) {
- notifyPropertyChange(ObservableProperty.THEN_STMT, this.thenStmt, thenStmt);
- this.thenStmt = assertNotNull(thenStmt);
- setAsParentNodeOf(this.thenStmt);
- return this;
- }
+ public IfStmt setElseStmt(final Statement elseStmt) {
+ notifyPropertyChange(ObservableProperty.ELSE_STMT, this.elseStmt, elseStmt);
+ this.elseStmt = elseStmt;
+ setAsParentNodeOf(this.elseStmt);
+ return this;
+ }
+
+ public IfStmt setThenStmt(final Statement thenStmt) {
+ notifyPropertyChange(ObservableProperty.THEN_STMT, this.thenStmt, thenStmt);
+ this.thenStmt = assertNotNull(thenStmt);
+ setAsParentNodeOf(this.thenStmt);
+ return this;
+ }
}
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 182735066..78d1cf99c 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -33,50 +33,52 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
*/
public final class LabeledStmt extends Statement {
- private String label;
+ private String label;
- private Statement statement;
+ private Statement statement;
- public LabeledStmt() {
+ public LabeledStmt() {
this(null, "empty", new EmptyStmt());
- }
+ }
- public LabeledStmt(final String label, final Statement statement) {
+ public LabeledStmt(final String label, final Statement statement) {
this(null, label, statement);
- }
+ }
- public LabeledStmt(Range range, final String label, final Statement statement) {
- super(range);
- setLabel(label);
- setStatement(statement);
- }
+ public LabeledStmt(Range range, final String label, final Statement statement) {
+ super(range);
+ setLabel(label);
+ setStatement(statement);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- public String getLabel() {
- return label;
- }
+ public String getLabel() {
+ return label;
+ }
- public Statement getStatement() {
- return statement;
- }
+ public Statement getStatement() {
+ return statement;
+ }
- public LabeledStmt setLabel(final String label) {
- notifyPropertyChange(ObservableProperty.LABEL, this.label, label);
- this.label = assertNotNull(label);
- return this;
- }
+ public LabeledStmt setLabel(final String label) {
+ notifyPropertyChange(ObservableProperty.LABEL, this.label, label);
+ this.label = assertNotNull(label);
+ return this;
+ }
- public LabeledStmt setStatement(final Statement statement) {
- notifyPropertyChange(ObservableProperty.STATEMENT, this.statement, statement);
- this.statement = assertNotNull(statement);
- setAsParentNodeOf(this.statement);
- return this;
- }
+ public LabeledStmt setStatement(final Statement statement) {
+ notifyPropertyChange(ObservableProperty.STATEMENT, this.statement, statement);
+ this.statement = assertNotNull(statement);
+ setAsParentNodeOf(this.statement);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/ReturnStmt.java
index f45c2d549..43056a2b5 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
@@ -18,13 +18,12 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.NameExpr;
-import com.github.javaparser.ast.nodeTypes.NodeWithExpression;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
@@ -36,20 +35,20 @@ import java.util.Optional;
*/
public final class ReturnStmt extends Statement {
- private Expression expression;
+ private Expression expression;
- public ReturnStmt() {
+ public ReturnStmt() {
this(null, null);
- }
+ }
- public ReturnStmt(final Expression expression) {
- this(null, expression);
- }
+ public ReturnStmt(final Expression expression) {
+ this(null, expression);
+ }
- public ReturnStmt(Range range, final Expression expression) {
- super(range);
- setExpression(expression);
- }
+ public ReturnStmt(Range range, final Expression expression) {
+ super(range);
+ setExpression(expression);
+ }
/**
* Will create a NameExpr with the string param
@@ -60,27 +59,28 @@ public final class ReturnStmt extends Statement {
@Override
public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
public Optional<Expression> getExpression() {
return Optional.ofNullable(expression);
- }
+ }
/**
* Sets the expression
- *
+ *
* @param expression the expression, can be null
* @return this, the ReturnStmt
*/
- public ReturnStmt setExpression(final Expression expression) {
- notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
- this.expression = expression;
- setAsParentNodeOf(this.expression);
- return this;
- }
+ public ReturnStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = expression;
+ setAsParentNodeOf(this.expression);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/Statement.java
index 185bd8cf1..833a3d2bd 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -28,7 +28,7 @@ import com.github.javaparser.ast.Node;
* @author Julio Vilmar Gesser
*/
public abstract class Statement extends Node {
- public Statement(final Range range) {
- super(range);
- }
+ 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 c24182973..e7aad2458 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -38,60 +38,60 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
*/
public final class SwitchEntryStmt extends Statement implements NodeWithStatements<SwitchEntryStmt> {
- private Expression label;
+ private Expression label;
- private NodeList<Statement> statements;
+ private NodeList<Statement> statements;
- public SwitchEntryStmt() {
- this(null, null, new NodeList<>());
- }
+ public SwitchEntryStmt() {
+ this(null, null, new NodeList<>());
+ }
- public SwitchEntryStmt(final Expression label, final NodeList<Statement> statements) {
- this(null, label, statements);
- }
+ public SwitchEntryStmt(final Expression label, final NodeList<Statement> statements) {
+ this(null, label, statements);
+ }
- public SwitchEntryStmt(Range range, final Expression label,
- final NodeList<Statement> statements) {
- super(range);
- setLabel(label);
- setStatements(statements);
- }
+ public SwitchEntryStmt(Range range, final Expression label,
+ final NodeList<Statement> statements) {
+ super(range);
+ setLabel(label);
+ setStatements(statements);
+ }
- @Override
- public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override
- public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
public Optional<Expression> getLabel() {
return Optional.ofNullable(label);
- }
+ }
- public NodeList<Statement> getStatements() {
+ public NodeList<Statement> getStatements() {
return statements;
- }
+ }
/**
* Sets the label
- *
+ *
* @param label the label, can be null
* @return this, the SwitchEntryStmt
*/
- public SwitchEntryStmt setLabel(final Expression label) {
- notifyPropertyChange(ObservableProperty.LABEL, this.label, label);
- this.label = label;
- setAsParentNodeOf(this.label);
- return this;
- }
-
- public SwitchEntryStmt setStatements(final NodeList<Statement> statements) {
- notifyPropertyChange(ObservableProperty.STATEMENTS, this.statements, statements);
- this.statements = assertNotNull(statements);
- setAsParentNodeOf(this.statements);
+ public SwitchEntryStmt setLabel(final Expression label) {
+ notifyPropertyChange(ObservableProperty.LABEL, this.label, label);
+ this.label = label;
+ setAsParentNodeOf(this.label);
+ return this;
+ }
+
+ public SwitchEntryStmt setStatements(final NodeList<Statement> statements) {
+ notifyPropertyChange(ObservableProperty.STATEMENTS, this.statements, statements);
+ this.statements = assertNotNull(statements);
+ setAsParentNodeOf(this.statements);
return this;
- }
+ }
}
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 f94d5135f..a0bb6d0f8 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -29,66 +29,66 @@ import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
-import static com.github.javaparser.utils.Utils.*;
+import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
*/
public final class SwitchStmt extends Statement {
- private Expression selector;
+ private Expression selector;
- private NodeList<SwitchEntryStmt> entries;
+ private NodeList<SwitchEntryStmt> entries;
- public SwitchStmt() {
- this(null, new NameExpr(), new NodeList<>());
- }
+ public SwitchStmt() {
+ this(null, new NameExpr(), new NodeList<>());
+ }
- public SwitchStmt(final Expression selector,
- final NodeList<SwitchEntryStmt> entries) {
- this(null, selector, entries);
- }
+ public SwitchStmt(final Expression selector,
+ final NodeList<SwitchEntryStmt> entries) {
+ this(null, selector, entries);
+ }
- public SwitchStmt(Range range, final Expression selector,
- final NodeList<SwitchEntryStmt> entries) {
- super(range);
- setSelector(selector);
- setEntries(entries);
- }
+ public SwitchStmt(Range range, final Expression selector,
+ final NodeList<SwitchEntryStmt> entries) {
+ super(range);
+ setSelector(selector);
+ setEntries(entries);
+ }
- @Override
- public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override
- public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- public NodeList<SwitchEntryStmt> getEntries() {
+ public NodeList<SwitchEntryStmt> getEntries() {
return entries;
- }
-
- public SwitchEntryStmt getEntry(int i) {
- return getEntries().get(i);
- }
-
- public Expression getSelector() {
- return selector;
- }
-
- public SwitchStmt setEntries(final NodeList<SwitchEntryStmt> entries) {
- notifyPropertyChange(ObservableProperty.ENTRIES, this.entries, entries);
- this.entries = assertNotNull(entries);
- setAsParentNodeOf(this.entries);
- return this;
- }
-
- public SwitchStmt setSelector(final Expression selector) {
- notifyPropertyChange(ObservableProperty.SELECTOR, this.selector, selector);
- this.selector = selector;
- setAsParentNodeOf(this.selector);
- return this;
- }
+ }
+
+ public SwitchEntryStmt getEntry(int i) {
+ return getEntries().get(i);
+ }
+
+ public Expression getSelector() {
+ return selector;
+ }
+
+ public SwitchStmt setEntries(final NodeList<SwitchEntryStmt> entries) {
+ notifyPropertyChange(ObservableProperty.ENTRIES, this.entries, entries);
+ this.entries = assertNotNull(entries);
+ setAsParentNodeOf(this.entries);
+ return this;
+ }
+
+ public SwitchStmt setSelector(final Expression selector) {
+ notifyPropertyChange(ObservableProperty.SELECTOR, this.selector, selector);
+ this.selector = selector;
+ setAsParentNodeOf(this.selector);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/SynchronizedStmt.java
index c87d1b5e8..d8d3fbd13 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
@@ -35,7 +35,7 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
*/
-public final class SynchronizedStmt extends Statement implements
+public final class SynchronizedStmt extends Statement implements
NodeWithBlockStmt<SynchronizedStmt>,
NodeWithExpression<SynchronizedStmt> {
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 7fca14b60..d0b1cac3b 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -35,39 +35,41 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
public final class ThrowStmt extends Statement implements
NodeWithExpression<ThrowStmt> {
- private Expression expression;
+ private Expression expression;
- public ThrowStmt() {
+ public ThrowStmt() {
this(null, new NameExpr());
- }
+ }
- public ThrowStmt(final Expression expression) {
- this(null, expression);
- }
+ public ThrowStmt(final Expression expression) {
+ this(null, expression);
+ }
- public ThrowStmt(Range range, final Expression expression) {
- super(range);
- setExpression(expression);
- }
+ public ThrowStmt(Range range, final Expression expression) {
+ super(range);
+ setExpression(expression);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- @Override
- public Expression getExpression() {
- return expression;
- }
+ @Override
+ public Expression getExpression() {
+ return expression;
+ }
- @Override
- public ThrowStmt setExpression(final Expression expression) {
- notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
- this.expression = expression;
- setAsParentNodeOf(this.expression);
- return this;
- }
+ @Override
+ public ThrowStmt setExpression(final Expression expression) {
+ notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression);
+ this.expression = expression;
+ setAsParentNodeOf(this.expression);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java b/javaparser-core/src/main/java/com/github/javaparser/ast/stmt/TryStmt.java
index e18c8f84e..f78ef3831 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
@@ -18,110 +18,110 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
import com.github.javaparser.ast.NodeList;
+import com.github.javaparser.ast.expr.VariableDeclarationExpr;
import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
-import com.github.javaparser.ast.expr.VariableDeclarationExpr;
-
-import static com.github.javaparser.utils.Utils.*;
import java.util.Optional;
+import static com.github.javaparser.utils.Utils.assertNotNull;
+
/**
* @author Julio Vilmar Gesser
*/
public final class TryStmt extends Statement {
-
- private NodeList<VariableDeclarationExpr> resources;
- private BlockStmt tryBlock;
+ private NodeList<VariableDeclarationExpr> resources;
+
+ private BlockStmt tryBlock;
- private NodeList<CatchClause> catchClauses;
+ private NodeList<CatchClause> catchClauses;
- private BlockStmt finallyBlock;
+ private BlockStmt finallyBlock;
- public TryStmt() {
- this(null,
- new NodeList<>(),
+ public TryStmt() {
+ this(null,
+ new NodeList<>(),
new BlockStmt(),
- new NodeList<>(),
- null);
- }
-
- public TryStmt(final BlockStmt tryBlock, final NodeList<CatchClause> catchClauses,
- final BlockStmt finallyBlock) {
- this(null,
- new NodeList<>(),
- tryBlock,
+ new NodeList<>(),
+ null);
+ }
+
+ public TryStmt(final BlockStmt tryBlock, final NodeList<CatchClause> catchClauses,
+ final BlockStmt finallyBlock) {
+ this(null,
+ new NodeList<>(),
+ tryBlock,
catchClauses,
- finallyBlock);
- }
+ finallyBlock);
+ }
- public TryStmt(Range range, NodeList<VariableDeclarationExpr> resources,
+ public TryStmt(Range range, NodeList<VariableDeclarationExpr> resources,
final BlockStmt tryBlock, final NodeList<CatchClause> catchClauses, final BlockStmt finallyBlock) {
- super(range);
- setResources(resources);
- setTryBlock(tryBlock);
- setCatchClauses(catchClauses);
- setFinallyBlock(finallyBlock);
- }
-
- @Override
- public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
-
- @Override
- public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
-
- public NodeList<CatchClause> getCatchClauses() {
+ super(range);
+ setResources(resources);
+ setTryBlock(tryBlock);
+ setCatchClauses(catchClauses);
+ setFinallyBlock(finallyBlock);
+ }
+
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
+
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
+
+ public NodeList<CatchClause> getCatchClauses() {
return catchClauses;
- }
+ }
+
+ public Optional<BlockStmt> getFinallyBlock() {
+ return Optional.ofNullable(finallyBlock);
+ }
- public Optional<BlockStmt> getFinallyBlock() {
- return Optional.ofNullable(finallyBlock);
- }
+ public Optional<BlockStmt> getTryBlock() {
+ return Optional.ofNullable(tryBlock);
+ }
- public Optional<BlockStmt> getTryBlock() {
- return Optional.ofNullable(tryBlock);
- }
-
- public NodeList<VariableDeclarationExpr> getResources() {
+ public NodeList<VariableDeclarationExpr> getResources() {
return resources;
- }
-
- public TryStmt setCatchClauses(final NodeList<CatchClause> catchClauses) {
- notifyPropertyChange(ObservableProperty.CATCH_CLAUSES, this.catchClauses, catchClauses);
- this.catchClauses = assertNotNull(catchClauses);
- setAsParentNodeOf(this.catchClauses);
- return this;
- }
-
- public TryStmt setFinallyBlock(final BlockStmt finallyBlock) {
- notifyPropertyChange(ObservableProperty.FINALLY_BLOCK, this.finallyBlock, finallyBlock);
- this.finallyBlock = finallyBlock;
- setAsParentNodeOf(this.finallyBlock);
- return this;
- }
-
- public TryStmt setTryBlock(final BlockStmt tryBlock) {
- notifyPropertyChange(ObservableProperty.TRY_BLOCK, this.tryBlock, tryBlock);
- this.tryBlock = tryBlock;
- setAsParentNodeOf(this.tryBlock);
- return this;
- }
-
- public TryStmt setResources(NodeList<VariableDeclarationExpr> resources) {
- notifyPropertyChange(ObservableProperty.RESOURCES, this.resources, resources);
- this.resources = assertNotNull(resources);
- setAsParentNodeOf(this.resources);
- return this;
- }
+ }
+
+ public TryStmt setCatchClauses(final NodeList<CatchClause> catchClauses) {
+ notifyPropertyChange(ObservableProperty.CATCH_CLAUSES, this.catchClauses, catchClauses);
+ this.catchClauses = assertNotNull(catchClauses);
+ setAsParentNodeOf(this.catchClauses);
+ return this;
+ }
+
+ public TryStmt setFinallyBlock(final BlockStmt finallyBlock) {
+ notifyPropertyChange(ObservableProperty.FINALLY_BLOCK, this.finallyBlock, finallyBlock);
+ this.finallyBlock = finallyBlock;
+ setAsParentNodeOf(this.finallyBlock);
+ return this;
+ }
+
+ public TryStmt setTryBlock(final BlockStmt tryBlock) {
+ notifyPropertyChange(ObservableProperty.TRY_BLOCK, this.tryBlock, tryBlock);
+ this.tryBlock = tryBlock;
+ setAsParentNodeOf(this.tryBlock);
+ return this;
+ }
+
+ public TryStmt setResources(NodeList<VariableDeclarationExpr> resources) {
+ notifyPropertyChange(ObservableProperty.RESOURCES, this.resources, resources);
+ this.resources = assertNotNull(resources);
+ setAsParentNodeOf(this.resources);
+ return this;
+ }
}
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 7991a4698..d0bd26d4f 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -35,37 +35,39 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
*/
public final class TypeDeclarationStmt extends Statement {
- private TypeDeclaration typeDecl;
+ private TypeDeclaration typeDecl;
- public TypeDeclarationStmt() {
+ public TypeDeclarationStmt() {
this(null, new EmptyTypeDeclaration());
- }
+ }
- public TypeDeclarationStmt(final TypeDeclaration typeDecl) {
- this(null, typeDecl);
- }
+ public TypeDeclarationStmt(final TypeDeclaration typeDecl) {
+ this(null, typeDecl);
+ }
- public TypeDeclarationStmt(Range range, final TypeDeclaration typeDecl) {
- super(range);
- setTypeDeclaration(typeDecl);
- }
+ public TypeDeclarationStmt(Range range, final TypeDeclaration typeDecl) {
+ super(range);
+ setTypeDeclaration(typeDecl);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- public TypeDeclaration getTypeDeclaration() {
- return typeDecl;
- }
+ public TypeDeclaration getTypeDeclaration() {
+ return typeDecl;
+ }
- public TypeDeclarationStmt setTypeDeclaration(final TypeDeclaration typeDecl) {
- notifyPropertyChange(ObservableProperty.TYPE_DECLARATION, this.typeDecl, typeDecl);
- this.typeDecl = assertNotNull(typeDecl);
- setAsParentNodeOf(this.typeDecl);
- return this;
- }
+ public TypeDeclarationStmt setTypeDeclaration(final TypeDeclaration typeDecl) {
+ notifyPropertyChange(ObservableProperty.TYPE_DECLARATION, this.typeDecl, typeDecl);
+ this.typeDecl = assertNotNull(typeDecl);
+ setAsParentNodeOf(this.typeDecl);
+ return this;
+ }
}
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 aacc42fe3..d694ca0af 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.stmt;
import com.github.javaparser.Range;
@@ -34,53 +34,55 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public final class WhileStmt extends Statement implements NodeWithBody<WhileStmt> {
- private Expression condition;
+ private Expression condition;
- private Statement body;
+ private Statement body;
- public WhileStmt() {
+ public WhileStmt() {
this(null, new BooleanLiteralExpr(), new EmptyStmt());
- }
+ }
- public WhileStmt(final Expression condition, final Statement body) {
+ public WhileStmt(final Expression condition, final Statement body) {
this(null, condition, body);
- }
+ }
- public WhileStmt(Range range, final Expression condition, final Statement body) {
- super(range);
- setCondition(condition);
- setBody(body);
- }
+ public WhileStmt(Range range, final Expression condition, final Statement body) {
+ super(range);
+ setCondition(condition);
+ setBody(body);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
- @Override
+ @Override
public Statement getBody() {
- return body;
- }
+ return body;
+ }
- public Expression getCondition() {
- return condition;
- }
+ public Expression getCondition() {
+ return condition;
+ }
- @Override
+ @Override
public WhileStmt setBody(final Statement body) {
- notifyPropertyChange(ObservableProperty.BODY, this.body, body);
- this.body = body;
- setAsParentNodeOf(this.body);
+ notifyPropertyChange(ObservableProperty.BODY, this.body, body);
+ this.body = body;
+ setAsParentNodeOf(this.body);
return this;
- }
+ }
- public WhileStmt setCondition(final Expression condition) {
- notifyPropertyChange(ObservableProperty.CONDITION, this.condition, condition);
- this.condition = condition;
- setAsParentNodeOf(this.condition);
- return this;
- }
+ public WhileStmt setCondition(final Expression condition) {
+ notifyPropertyChange(ObservableProperty.CONDITION, this.condition, condition);
+ this.condition = condition;
+ setAsParentNodeOf(this.condition);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java
index e4e09e424..05dcae242 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/ArrayType.java
@@ -30,11 +30,13 @@ public class ArrayType extends ReferenceType<ArrayType> implements NodeWithAnnot
setAnnotations(annotations);
}
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
return v.visit(this, arg);
}
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
v.visit(this, arg);
}
@@ -50,8 +52,9 @@ public class ArrayType extends ReferenceType<ArrayType> implements NodeWithAnnot
}
/**
- * Takes lists of arrayBracketPairs, assumes the lists are ordered left to right and the pairs are ordered left to right, mirroring the actual code.
- * The type gets wrapped in ArrayTypes so that the outermost ArrayType corresponds to the rightmost ArrayBracketPair.
+ * Takes lists of arrayBracketPairs, assumes the lists are ordered left to right and the pairs are ordered left to
+ * right, mirroring the actual code. The type gets wrapped in ArrayTypes so that the outermost ArrayType corresponds
+ * to the rightmost ArrayBracketPair.
*/
@SafeVarargs
public static Type wrapInArrayTypes(Type type, NodeList<ArrayBracketPair>... arrayBracketPairLists) {
@@ -81,7 +84,7 @@ public class ArrayType extends ReferenceType<ArrayType> implements NodeWithAnnot
}
return new Pair<>(type, arrayBracketPairs);
}
-
+
public static ArrayType arrayOf(Type type, AnnotationExpr... annotations) {
return new ArrayType(type, nodeList(annotations));
}
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 a8537ad81..e5f41ac10 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
@@ -34,6 +34,7 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import java.util.Optional;
import static com.github.javaparser.utils.Utils.assertNotNull;
+
/**
* @author Julio Vilmar Gesser
*/
@@ -110,13 +111,13 @@ public final class ClassOrInterfaceType extends ReferenceType<ClassOrInterfaceTy
@Override
public ClassOrInterfaceType setName(final SimpleName name) {
notifyPropertyChange(ObservableProperty.NAME, this.name, name);
- this.name = assertNotNull(name);
+ this.name = assertNotNull(name);
return this;
}
/**
* Sets the scope
- *
+ *
* @param scope the scope, can be null
* @return this, the ClassOrInterfaceType
*/
@@ -134,7 +135,7 @@ public final class ClassOrInterfaceType extends ReferenceType<ClassOrInterfaceTy
/**
* Sets the typeArguments
- *
+ *
* @param typeArguments the typeArguments, can be null
* @return this, the ClassOrInterfaceType
*/
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 3b9b9c2a5..1b73b3c89 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
@@ -12,10 +12,10 @@ import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* 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.
- *
+ * <p>
* For example:
* <code>public class A&lt;T extends Serializable &amp; Cloneable&gt; { }</code>
- *
+ * <p>
* Or:
* <code>void foo((Serializable &amp; Cloneable)myObject);</code>
*
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 f87fae3d9..81e8e01b2 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
@@ -88,13 +88,13 @@ public final class PrimitiveType extends Type<PrimitiveType> implements NodeWith
private Primitive type;
- public PrimitiveType() {
+ public PrimitiveType() {
this(null, Primitive.INT);
- }
+ }
- public PrimitiveType(final Primitive type) {
+ public PrimitiveType(final Primitive type) {
this(null, type);
- }
+ }
public PrimitiveType(Range range, final Primitive type) {
super(range, new NodeList<>());
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 f3a57b7e1..479745e06 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.type;
import com.github.javaparser.Range;
@@ -31,9 +31,9 @@ public abstract class ReferenceType<T extends ReferenceType> extends Type<T> {
public ReferenceType() {
this(null);
- }
+ }
- public ReferenceType(final Range range) {
- super(range, new NodeList<>());
- }
+ public ReferenceType(final Range range) {
+ super(range, new NodeList<>());
+ }
}
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 fb5e819b2..45397f97d 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.type;
import com.github.javaparser.Range;
@@ -27,7 +27,7 @@ import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.observing.ObservableProperty;
-import static com.github.javaparser.utils.Utils.*;
+import static com.github.javaparser.utils.Utils.assertNotNull;
/**
* @author Julio Vilmar Gesser
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java
index 4ea864737..53ab15b7c 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/TypeParameter.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.type;
import com.github.javaparser.Range;
@@ -33,106 +33,108 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
import static com.github.javaparser.utils.Utils.assertNotNull;
/**
- * <p>
- * This class represents the declaration of a generics argument.
- * </p>
- * The TypeParameter is constructed following the syntax:<br>
+ * <p> This class represents the declaration of a generics argument. </p> The TypeParameter is constructed following the
+ * syntax:<br>
* <pre>
* {@code
- * TypeParameter ::= <IDENTIFIER> ( "extends" }{@link ClassOrInterfaceType}{@code ( "&" }{@link ClassOrInterfaceType}{@code )* )?
+ * TypeParameter ::= <IDENTIFIER> ( "extends" }{@link ClassOrInterfaceType}{@code ( "&" }{@link
+ * ClassOrInterfaceType}{@code )* )?
* }
* </pre>
+ *
* @author Julio Vilmar Gesser
*/
public final class TypeParameter extends ReferenceType<TypeParameter> implements NodeWithSimpleName<TypeParameter> {
- private SimpleName name;
+ private SimpleName name;
private NodeList<AnnotationExpr> annotations;
- private NodeList<ClassOrInterfaceType> typeBound;
-
- public TypeParameter() {
- this(null,
- new SimpleName(),
- new NodeList<>(),
- new NodeList<>());
- }
-
- public TypeParameter(final String name, final NodeList<ClassOrInterfaceType> typeBound) {
- this(null,
- new SimpleName(name),
- typeBound,
- new NodeList<>());
- }
-
- public TypeParameter(Range range, final SimpleName name, final NodeList<ClassOrInterfaceType> typeBound) {
- this(range,
- name,
- typeBound,
- new NodeList<>());
- }
-
- public TypeParameter(Range range, SimpleName name, NodeList<ClassOrInterfaceType> typeBound, NodeList<AnnotationExpr> annotations) {
- super(range);
- setName(name);
- setTypeBound(typeBound);
- setAnnotations(annotations);
- }
-
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
-
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
-
- /**
- * Return the name of the paramenter.
- *
- * @return the name of the paramenter
- */
- @Override
- public SimpleName getName() {
- return name;
- }
-
- /**
- * Return the list of {@link ClassOrInterfaceType} that this parameter
- * extends. Return <code>null</code> null if there are no type.
- *
- * @return list of types that this paramente extends or <code>null</code>
- */
- public NodeList<ClassOrInterfaceType> getTypeBound() {
+ private NodeList<ClassOrInterfaceType> typeBound;
+
+ public TypeParameter() {
+ this(null,
+ new SimpleName(),
+ new NodeList<>(),
+ new NodeList<>());
+ }
+
+ public TypeParameter(final String name, final NodeList<ClassOrInterfaceType> typeBound) {
+ this(null,
+ new SimpleName(name),
+ typeBound,
+ new NodeList<>());
+ }
+
+ public TypeParameter(Range range, final SimpleName name, final NodeList<ClassOrInterfaceType> typeBound) {
+ this(range,
+ name,
+ typeBound,
+ new NodeList<>());
+ }
+
+ public TypeParameter(Range range, SimpleName name, NodeList<ClassOrInterfaceType> typeBound, NodeList<AnnotationExpr> annotations) {
+ super(range);
+ setName(name);
+ setTypeBound(typeBound);
+ setAnnotations(annotations);
+ }
+
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
+
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
+
+ /**
+ * Return the name of the paramenter.
+ *
+ * @return the name of the paramenter
+ */
+ @Override
+ public SimpleName getName() {
+ return name;
+ }
+
+ /**
+ * Return the list of {@link ClassOrInterfaceType} that this parameter
+ * extends. Return <code>null</code> null if there are no type.
+ *
+ * @return list of types that this paramente extends or <code>null</code>
+ */
+ public NodeList<ClassOrInterfaceType> getTypeBound() {
return typeBound;
- }
+ }
@Override
public TypeParameter setName(final SimpleName name) {
- notifyPropertyChange(ObservableProperty.NAME, this.name, name);
- this.name = assertNotNull(name);
+ notifyPropertyChange(ObservableProperty.NAME, this.name, name);
+ this.name = assertNotNull(name);
setAsParentNodeOf(name);
return this;
- }
+ }
- public TypeParameter setTypeBound(final NodeList<ClassOrInterfaceType> typeBound) {
+ public TypeParameter setTypeBound(final NodeList<ClassOrInterfaceType> typeBound) {
notifyPropertyChange(ObservableProperty.TYPE_BOUND, this.typeBound, typeBound);
- this.typeBound = assertNotNull(typeBound);
- setAsParentNodeOf(typeBound);
- return this;
- }
+ this.typeBound = assertNotNull(typeBound);
+ setAsParentNodeOf(typeBound);
+ return this;
+ }
- @Override
+ @Override
public NodeList<AnnotationExpr> getAnnotations() {
return annotations;
}
- @Override
+ @Override
public TypeParameter setAnnotations(NodeList<AnnotationExpr> annotations) {
notifyPropertyChange(ObservableProperty.ANNOTATIONS, this.annotations, annotations);
- this.annotations = assertNotNull(annotations);
- setAsParentNodeOf(this.annotations);
- return this;
+ this.annotations = assertNotNull(annotations);
+ setAsParentNodeOf(this.annotations);
+ return this;
}
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java b/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java
index 47bde07d4..3fc9f8693 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/type/UnknownType.java
@@ -18,10 +18,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.type;
-import com.github.javaparser.Range;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.visitor.GenericVisitor;
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 9fa3fabff..792dcc62c 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.type;
import com.github.javaparser.Range;
@@ -32,22 +32,24 @@ import com.github.javaparser.ast.visitor.VoidVisitor;
*/
public final class VoidType extends Type<VoidType> implements NodeWithAnnotations<VoidType> {
- public static final VoidType VOID_TYPE = new VoidType();
+ public static final VoidType VOID_TYPE = new VoidType();
- public VoidType() {
+ public VoidType() {
this(null);
- }
+ }
- public VoidType(Range range) {
- super(range, new NodeList<>());
- }
+ public VoidType(Range range) {
+ super(range, new NodeList<>());
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
}
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 41199bef3..069a92514 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.type;
import com.github.javaparser.Range;
@@ -39,65 +39,67 @@ public final class WildcardType extends Type<WildcardType> implements NodeWithAn
private ReferenceType<?> superTypes;
- public WildcardType() {
+ public WildcardType() {
this(null, null, null);
- }
+ }
- public WildcardType(final ReferenceType<?> extendedTypes) {
- this(null, extendedTypes, null);
- }
+ public WildcardType(final ReferenceType<?> extendedTypes) {
+ this(null, extendedTypes, null);
+ }
- public WildcardType(final ReferenceType<?> extendedTypes, final ReferenceType<?> superTypes) {
+ public WildcardType(final ReferenceType<?> extendedTypes, final ReferenceType<?> superTypes) {
this(null, extendedTypes, superTypes);
- }
+ }
- public WildcardType(final Range range,
+ public WildcardType(final Range range,
final ReferenceType<?> extendedTypes, final ReferenceType<?> superTypes) {
- super(range, new NodeList<>());
- setExtendedTypes(extendedTypes);
- setSuperTypes(superTypes);
- }
+ super(range, new NodeList<>());
+ setExtendedTypes(extendedTypes);
+ setSuperTypes(superTypes);
+ }
- @Override public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
- return v.visit(this, arg);
- }
+ @Override
+ public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) {
+ return v.visit(this, arg);
+ }
- @Override public <A> void accept(final VoidVisitor<A> v, final A arg) {
- v.visit(this, arg);
- }
+ @Override
+ public <A> void accept(final VoidVisitor<A> v, final A arg) {
+ v.visit(this, arg);
+ }
public Optional<ReferenceType<?>> getExtendedTypes() {
return Optional.ofNullable(extendedTypes);
- }
+ }
public Optional<ReferenceType<?>> getSuperTypes() {
return Optional.ofNullable(superTypes);
- }
+ }
/**
* Sets the extends
- *
+ *
* @param ext the extends, can be null
* @return this, the WildcardType
*/
public WildcardType setExtendedTypes(final ReferenceType<?> ext) {
- notifyPropertyChange(ObservableProperty.EXTENDED_TYPES, this.extendedTypes, ext);
- this.extendedTypes = ext;
- setAsParentNodeOf(this.extendedTypes);
- return this;
- }
+ notifyPropertyChange(ObservableProperty.EXTENDED_TYPES, this.extendedTypes, ext);
+ this.extendedTypes = ext;
+ setAsParentNodeOf(this.extendedTypes);
+ return this;
+ }
/**
* Sets the super
- *
+ *
* @param sup the super, can be null
* @return this, the WildcardType
*/
public WildcardType setSuperTypes(final ReferenceType<?> sup) {
- notifyPropertyChange(ObservableProperty.SUPER, this.superTypes, sup);
- this.superTypes = sup;
- setAsParentNodeOf(this.superTypes);
- return this;
- }
+ notifyPropertyChange(ObservableProperty.SUPER, this.superTypes, sup);
+ this.superTypes = sup;
+ setAsParentNodeOf(this.superTypes);
+ return this;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java
index 3b717ea01..5cb5d7720 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.visitor;
import com.github.javaparser.ast.*;
@@ -36,709 +36,709 @@ import java.util.Optional;
public class CloneVisitor implements GenericVisitor<Visitable, Object> {
- @Override
- public Visitable visit(CompilationUnit _n, Object _arg) {
- PackageDeclaration package_ = cloneNode(_n.getPackage(), _arg);
- NodeList<ImportDeclaration> imports = cloneList(_n.getImports(), _arg);
- NodeList<TypeDeclaration<?>> types = cloneList(_n.getTypes(), _arg);
-
- return new CompilationUnit(
- _n.getRange().orElse(null),
- package_, imports, types
- );
- }
-
- @Override
- public Visitable visit(PackageDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- PackageDeclaration r = new PackageDeclaration(
- _n.getRange().orElse(null),
- annotations,
+ @Override
+ public Visitable visit(CompilationUnit _n, Object _arg) {
+ PackageDeclaration package_ = cloneNode(_n.getPackage(), _arg);
+ NodeList<ImportDeclaration> imports = cloneList(_n.getImports(), _arg);
+ NodeList<TypeDeclaration<?>> types = cloneList(_n.getTypes(), _arg);
+
+ return new CompilationUnit(
+ _n.getRange().orElse(null),
+ package_, imports, types
+ );
+ }
+
+ @Override
+ public Visitable visit(PackageDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ PackageDeclaration r = new PackageDeclaration(
+ _n.getRange().orElse(null),
+ annotations,
cloneNode(_n.getName(), _arg)
- );
- r.setComment(comment);
- return r;
- }
+ );
+ r.setComment(comment);
+ return r;
+ }
- @Override
- public Visitable visit(TypeParameter _n, Object _arg) {
+ @Override
+ public Visitable visit(TypeParameter _n, Object _arg) {
NodeList<ClassOrInterfaceType> typeBound = cloneList(_n.getTypeBound(), _arg);
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
TypeParameter r = new TypeParameter(_n.getRange().orElse(null),
_n.getName(), typeBound, annotations);
Comment comment = cloneNode(_n.getComment(), _arg);
r.setComment(comment);
- return r;
- }
+ return r;
+ }
- @Override
- public Visitable visit(LineComment _n, Object _arg) {
- return new LineComment(_n.getRange().orElse(null), _n.getContent());
- }
+ @Override
+ public Visitable visit(LineComment _n, Object _arg) {
+ return new LineComment(_n.getRange().orElse(null), _n.getContent());
+ }
- @Override
- public Visitable visit(BlockComment _n, Object _arg) {
- return new BlockComment(_n.getRange().orElse(null), _n.getContent());
- }
+ @Override
+ public Visitable visit(BlockComment _n, Object _arg) {
+ return new BlockComment(_n.getRange().orElse(null), _n.getContent());
+ }
- @Override
- public Visitable visit(ClassOrInterfaceDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- NodeList<TypeParameter> typeParameters = cloneList(_n.getTypeParameters(), _arg);
- NodeList<ClassOrInterfaceType> extendsList = cloneList(_n.getExtends(), _arg);
- NodeList<ClassOrInterfaceType> implementsList = cloneList(_n.getImplements(), _arg);
- NodeList<BodyDeclaration<?>> members = cloneList(_n.getMembers(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ @Override
+ public Visitable visit(ClassOrInterfaceDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ NodeList<TypeParameter> typeParameters = cloneList(_n.getTypeParameters(), _arg);
+ NodeList<ClassOrInterfaceType> extendsList = cloneList(_n.getExtends(), _arg);
+ NodeList<ClassOrInterfaceType> implementsList = cloneList(_n.getImplements(), _arg);
+ NodeList<BodyDeclaration<?>> members = cloneList(_n.getMembers(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
SimpleName nameExpr_ = cloneNode(_n.getName(), _arg);
ClassOrInterfaceDeclaration r = new ClassOrInterfaceDeclaration(
- _n.getRange().orElse(null),
- _n.getModifiers(), annotations, _n.isInterface(), nameExpr_, typeParameters, extendsList, implementsList, members
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(EnumDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- NodeList<ClassOrInterfaceType> implementsList = cloneList(_n.getImplements(), _arg);
+ _n.getRange().orElse(null),
+ _n.getModifiers(), annotations, _n.isInterface(), nameExpr_, typeParameters, extendsList, implementsList, members
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(EnumDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ NodeList<ClassOrInterfaceType> implementsList = cloneList(_n.getImplements(), _arg);
NodeList<EnumConstantDeclaration> entries = cloneList(_n.getEntries(), _arg);
- NodeList<BodyDeclaration<?>> members = cloneList(_n.getMembers(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ NodeList<BodyDeclaration<?>> members = cloneList(_n.getMembers(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
SimpleName nameExpr_ = cloneNode(_n.getName(), _arg);
- EnumDeclaration r = new EnumDeclaration(
- _n.getRange().orElse(null),
- _n.getModifiers(), annotations, nameExpr_, implementsList, entries, members
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(EmptyTypeDeclaration _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- EmptyTypeDeclaration r = new EmptyTypeDeclaration(
- _n.getRange().orElse(null)
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(EnumConstantDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
- NodeList<BodyDeclaration<?>> classBody = cloneList(_n.getClassBody(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- EnumConstantDeclaration r = new EnumConstantDeclaration(
- _n.getRange().orElse(null),
- annotations,
- cloneNode(_n.getName(), _arg),
- args,
- classBody
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(AnnotationDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- NodeList<BodyDeclaration<?>> members = cloneList(_n.getMembers(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ EnumDeclaration r = new EnumDeclaration(
+ _n.getRange().orElse(null),
+ _n.getModifiers(), annotations, nameExpr_, implementsList, entries, members
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(EmptyTypeDeclaration _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ EmptyTypeDeclaration r = new EmptyTypeDeclaration(
+ _n.getRange().orElse(null)
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(EnumConstantDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
+ NodeList<BodyDeclaration<?>> classBody = cloneList(_n.getClassBody(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ EnumConstantDeclaration r = new EnumConstantDeclaration(
+ _n.getRange().orElse(null),
+ annotations,
+ cloneNode(_n.getName(), _arg),
+ args,
+ classBody
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(AnnotationDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ NodeList<BodyDeclaration<?>> members = cloneList(_n.getMembers(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
SimpleName nameExpr_ = cloneNode(_n.getName(), _arg);
- AnnotationDeclaration r = new AnnotationDeclaration(
- _n.getRange().orElse(null),
- _n.getModifiers(), annotations, nameExpr_, members
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(AnnotationMemberDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- Type<?> type_ = cloneNode(_n.getType(), _arg);
+ AnnotationDeclaration r = new AnnotationDeclaration(
+ _n.getRange().orElse(null),
+ _n.getModifiers(), annotations, nameExpr_, members
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(AnnotationMemberDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ Type<?> type_ = cloneNode(_n.getType(), _arg);
Expression defaultValue = cloneNode(_n.getDefaultValue(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- AnnotationMemberDeclaration r = new AnnotationMemberDeclaration(
- _n.getRange().orElse(null),
- _n.getModifiers(), annotations, type_, _n.getName(), defaultValue
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(FieldDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations_ = cloneList(_n.getAnnotations(), _arg);
- Type<?> elementType_ = cloneNode(_n.getElementType(), _arg);
- NodeList<VariableDeclarator> variables_ = cloneList(_n.getVariables(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ AnnotationMemberDeclaration r = new AnnotationMemberDeclaration(
+ _n.getRange().orElse(null),
+ _n.getModifiers(), annotations, type_, _n.getName(), defaultValue
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(FieldDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations_ = cloneList(_n.getAnnotations(), _arg);
+ Type<?> elementType_ = cloneNode(_n.getElementType(), _arg);
+ NodeList<VariableDeclarator> variables_ = cloneList(_n.getVariables(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
NodeList<ArrayBracketPair> arrayBracketPairsAfterType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
FieldDeclaration r = new FieldDeclaration(
- _n.getRange().orElse(null),
- _n.getModifiers(),
- annotations_,
- elementType_,
+ _n.getRange().orElse(null),
+ _n.getModifiers(),
+ annotations_,
+ elementType_,
variables_,
arrayBracketPairsAfterType_
-
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(VariableDeclarator _n, Object _arg) {
- VariableDeclaratorId id = cloneNode(_n.getIdentifier(), _arg);
- Expression init = cloneNode(_n.getInitializer(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- VariableDeclarator r = new VariableDeclarator(
- _n.getRange().orElse(null),
- id, init
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(VariableDeclaratorId _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
- NodeList<ArrayBracketPair> arrayBracketPairsAfterId_ = cloneList(_n.getArrayBracketPairsAfterId(), _arg);
-
- VariableDeclaratorId r = new VariableDeclaratorId(
- _n.getRange().orElse(null),
- _n.getName(),
- arrayBracketPairsAfterId_
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ConstructorDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- NodeList<TypeParameter> typeParameters = cloneList(_n.getTypeParameters(), _arg);
- NodeList<Parameter> parameters= cloneList(_n.getParameters(), _arg);
+
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(VariableDeclarator _n, Object _arg) {
+ VariableDeclaratorId id = cloneNode(_n.getIdentifier(), _arg);
+ Expression init = cloneNode(_n.getInitializer(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ VariableDeclarator r = new VariableDeclarator(
+ _n.getRange().orElse(null),
+ id, init
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(VariableDeclaratorId _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ NodeList<ArrayBracketPair> arrayBracketPairsAfterId_ = cloneList(_n.getArrayBracketPairsAfterId(), _arg);
+
+ VariableDeclaratorId r = new VariableDeclaratorId(
+ _n.getRange().orElse(null),
+ _n.getName(),
+ arrayBracketPairsAfterId_
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ConstructorDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ NodeList<TypeParameter> typeParameters = cloneList(_n.getTypeParameters(), _arg);
+ NodeList<Parameter> parameters = cloneList(_n.getParameters(), _arg);
NodeList<ReferenceType<?>> throws_ = cloneList(_n.getThrownExceptions(), _arg);
- BlockStmt block = cloneNode(_n.getBody(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ BlockStmt block = cloneNode(_n.getBody(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
SimpleName nameExpr_ = cloneNode(_n.getName(), _arg);
- ConstructorDeclaration r = new ConstructorDeclaration(
- _n.getRange().orElse(null),
- _n.getModifiers(), annotations, typeParameters, nameExpr_, parameters, throws_, block
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(MethodDeclaration _n, Object _arg) {
- NodeList<AnnotationExpr> annotations_ = cloneList(_n.getAnnotations(), _arg);
- NodeList<TypeParameter> typeParameters_ = cloneList(_n.getTypeParameters(), _arg);
- Type<?> type_ = cloneNode(_n.getElementType(), _arg);
+ ConstructorDeclaration r = new ConstructorDeclaration(
+ _n.getRange().orElse(null),
+ _n.getModifiers(), annotations, typeParameters, nameExpr_, parameters, throws_, block
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(MethodDeclaration _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations_ = cloneList(_n.getAnnotations(), _arg);
+ NodeList<TypeParameter> typeParameters_ = cloneList(_n.getTypeParameters(), _arg);
+ Type<?> type_ = cloneNode(_n.getElementType(), _arg);
SimpleName nameExpr_ = cloneNode(_n.getName(), _arg);
- NodeList<Parameter> parameters_ = cloneList(_n.getParameters(), _arg);
+ NodeList<Parameter> parameters_ = cloneList(_n.getParameters(), _arg);
NodeList<ReferenceType<?>> throws_ = cloneList(_n.getThrownExceptions(), _arg);
- BlockStmt block_ = cloneNode(_n.getBody(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
- NodeList<ArrayBracketPair> arrayBracketPairsAfterElementType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
- NodeList<ArrayBracketPair> arrayBracketPairsAfterParameterList_ = cloneList(_n.getArrayBracketPairsAfterParameterList(), _arg);
-
- MethodDeclaration r = new MethodDeclaration(
- _n.getRange().orElse(null),
- _n.getModifiers(),
- annotations_,
- typeParameters_,
+ BlockStmt block_ = cloneNode(_n.getBody(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ NodeList<ArrayBracketPair> arrayBracketPairsAfterElementType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
+ NodeList<ArrayBracketPair> arrayBracketPairsAfterParameterList_ = cloneList(_n.getArrayBracketPairsAfterParameterList(), _arg);
+
+ MethodDeclaration r = new MethodDeclaration(
+ _n.getRange().orElse(null),
+ _n.getModifiers(),
+ annotations_,
+ typeParameters_,
type_,
arrayBracketPairsAfterElementType_,
- nameExpr_,
+ nameExpr_,
_n.isDefault(),
- parameters_,
- arrayBracketPairsAfterParameterList_,
- throws_,
+ parameters_,
+ arrayBracketPairsAfterParameterList_,
+ throws_,
block_
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(Parameter _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- Type<?> type_ = cloneNode(_n.getElementType(), _arg);
- VariableDeclaratorId id = cloneNode(_n.getIdentifier(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
- NodeList<ArrayBracketPair> arrayBracketPairsAfterType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(Parameter _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ Type<?> type_ = cloneNode(_n.getElementType(), _arg);
+ VariableDeclaratorId id = cloneNode(_n.getIdentifier(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ NodeList<ArrayBracketPair> arrayBracketPairsAfterType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
Parameter r = new Parameter(
- _n.getRange().orElse(null),
- _n.getModifiers(),
- annotations,
+ _n.getRange().orElse(null),
+ _n.getModifiers(),
+ annotations,
type_,
arrayBracketPairsAfterType_,
- _n.isVarArgs(),
+ _n.isVarArgs(),
id
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(EmptyMemberDeclaration _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- EmptyMemberDeclaration r = new EmptyMemberDeclaration(
- _n.getRange().orElse(null)
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(InitializerDeclaration _n, Object _arg) {
- BlockStmt block = cloneNode(_n.getBlock(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- InitializerDeclaration r = new InitializerDeclaration(
- _n.getRange().orElse(null),
- _n.isStatic(), block
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(JavadocComment _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
- JavadocComment r = new JavadocComment(
- _n.getRange().orElse(null),
- _n.getContent()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ClassOrInterfaceType _n, Object _arg) {
- ClassOrInterfaceType scope = cloneNode(_n.getScope(), _arg);
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(EmptyMemberDeclaration _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ EmptyMemberDeclaration r = new EmptyMemberDeclaration(
+ _n.getRange().orElse(null)
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(InitializerDeclaration _n, Object _arg) {
+ BlockStmt block = cloneNode(_n.getBlock(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ InitializerDeclaration r = new InitializerDeclaration(
+ _n.getRange().orElse(null),
+ _n.isStatic(), block
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(JavadocComment _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ JavadocComment r = new JavadocComment(
+ _n.getRange().orElse(null),
+ _n.getContent()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ClassOrInterfaceType _n, Object _arg) {
+ ClassOrInterfaceType scope = cloneNode(_n.getScope(), _arg);
NodeList<Type<?>> typeArguments = cloneList(_n.getTypeArguments().orElse(null), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ClassOrInterfaceType r = new ClassOrInterfaceType(
- _n.getRange().orElse(null),
- scope,
- _n.getName(),
- typeArguments
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(PrimitiveType _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
-
- PrimitiveType r = new PrimitiveType(
- _n.getRange().orElse(null),
- _n.getType()
- );
- r.setComment(comment);
- r.setAnnotations(annotations);
- return r;
- }
-
- @Override
- public Visitable visit(ArrayType _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- Type<?> type_ = cloneNode(_n.getComponentType(), _arg);
-
- ArrayType r = new ArrayType(_n.getRange().orElse(null), type_, annotations);
- Comment comment = cloneNode(_n.getComment(), _arg);
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ArrayCreationLevel _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- Expression dimension_ = cloneNode(_n.getDimension(), _arg);
-
- ArrayCreationLevel r = new ArrayCreationLevel(_n.getRange().orElse(null), dimension_, annotations);
-
- Comment comment = cloneNode(_n.getComment(), _arg);
- r.setComment(comment);
- return r;
- }
-
- @Override
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ClassOrInterfaceType r = new ClassOrInterfaceType(
+ _n.getRange().orElse(null),
+ scope,
+ _n.getName(),
+ typeArguments
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(PrimitiveType _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+
+ PrimitiveType r = new PrimitiveType(
+ _n.getRange().orElse(null),
+ _n.getType()
+ );
+ r.setComment(comment);
+ r.setAnnotations(annotations);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ArrayType _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ Type<?> type_ = cloneNode(_n.getComponentType(), _arg);
+
+ ArrayType r = new ArrayType(_n.getRange().orElse(null), type_, annotations);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ArrayCreationLevel _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ Expression dimension_ = cloneNode(_n.getDimension(), _arg);
+
+ ArrayCreationLevel r = new ArrayCreationLevel(_n.getRange().orElse(null), dimension_, annotations);
+
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
public Visitable visit(IntersectionType _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- NodeList<ReferenceType<?>> elements= cloneList(_n.getElements(), _arg);
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ NodeList<ReferenceType<?>> elements = cloneList(_n.getElements(), _arg);
IntersectionType r = new IntersectionType(_n.getRange().orElse(null), elements);
Comment comment = cloneNode(_n.getComment(), _arg);
r.setComment(comment);
- r.setAnnotations(annotations);
+ r.setAnnotations(annotations);
return r;
}
@Override
public Visitable visit(UnionType _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- NodeList<ReferenceType<?>> elements= cloneList(_n.getElements(), _arg);
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ NodeList<ReferenceType<?>> elements = cloneList(_n.getElements(), _arg);
UnionType r = new UnionType(_n.getRange().orElse(null), elements);
Comment comment = cloneNode(_n.getComment(), _arg);
r.setComment(comment);
- r.setAnnotations(annotations);
- return r;
- }
-
- @Override
- public Visitable visit(VoidType _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- VoidType r = new VoidType(_n.getRange().orElse(null));
- r.setAnnotations(annotations);
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(WildcardType _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- ReferenceType ext = cloneNode(_n.getExtendedTypes(), _arg);
- ReferenceType sup = cloneNode(_n.getSuperTypes(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- WildcardType r = new WildcardType(
- _n.getRange().orElse(null),
- ext, sup
- );
- r.setComment(comment);
- r.setAnnotations(annotations);
- return r;
- }
-
- @Override
- public Visitable visit(UnknownType _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- UnknownType r = new UnknownType();
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ArrayAccessExpr _n, Object _arg) {
- Expression name = cloneNode(_n.getName(), _arg);
- Expression index = cloneNode(_n.getIndex(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ArrayAccessExpr r = new ArrayAccessExpr(
- _n.getRange().orElse(null),
- name, index
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ArrayCreationExpr _n, Object _arg) {
- Type<?> type_ = cloneNode(_n.getElementType(), _arg);
+ r.setAnnotations(annotations);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(VoidType _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ VoidType r = new VoidType(_n.getRange().orElse(null));
+ r.setAnnotations(annotations);
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(WildcardType _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ ReferenceType ext = cloneNode(_n.getExtendedTypes(), _arg);
+ ReferenceType sup = cloneNode(_n.getSuperTypes(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ WildcardType r = new WildcardType(
+ _n.getRange().orElse(null),
+ ext, sup
+ );
+ r.setComment(comment);
+ r.setAnnotations(annotations);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(UnknownType _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ UnknownType r = new UnknownType();
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ArrayAccessExpr _n, Object _arg) {
+ Expression name = cloneNode(_n.getName(), _arg);
+ Expression index = cloneNode(_n.getIndex(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ArrayAccessExpr r = new ArrayAccessExpr(
+ _n.getRange().orElse(null),
+ name, index
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ArrayCreationExpr _n, Object _arg) {
+ Type<?> type_ = cloneNode(_n.getElementType(), _arg);
NodeList<ArrayCreationLevel> levels_ = cloneList(_n.getLevels(), _arg);
- ArrayInitializerExpr initializer_ = cloneNode(_n.getInitializer(), _arg);
+ ArrayInitializerExpr initializer_ = cloneNode(_n.getInitializer(), _arg);
- ArrayCreationExpr r = new ArrayCreationExpr(_n.getRange().orElse(null), type_, levels_, initializer_);
+ ArrayCreationExpr r = new ArrayCreationExpr(_n.getRange().orElse(null), type_, levels_, initializer_);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
r.setComment(comment);
- return r;
- }
+ return r;
+ }
- @Override
- public Visitable visit(ArrayInitializerExpr _n, Object _arg) {
+ @Override
+ public Visitable visit(ArrayInitializerExpr _n, Object _arg) {
NodeList<Expression> values = cloneList(_n.getValues(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ArrayInitializerExpr r = new ArrayInitializerExpr(
- _n.getRange().orElse(null),
- values
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(AssignExpr _n, Object _arg) {
- Expression target = cloneNode(_n.getTarget(), _arg);
- Expression value = cloneNode(_n.getValue(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- AssignExpr r = new AssignExpr(
- _n.getRange().orElse(null),
- target, value, _n.getOperator());
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(BinaryExpr _n, Object _arg) {
- Expression left = cloneNode(_n.getLeft(), _arg);
- Expression right = cloneNode(_n.getRight(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- BinaryExpr r = new BinaryExpr(
- _n.getRange().orElse(null),
- left, right, _n.getOperator()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(CastExpr _n, Object _arg) {
- Type<?> type_ = cloneNode(_n.getType(), _arg);
- Expression expr = cloneNode(_n.getExpression(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- CastExpr r = new CastExpr(
- _n.getRange().orElse(null),
- type_, expr
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ClassExpr _n, Object _arg) {
- Type<?> type_ = cloneNode(_n.getType(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ClassExpr r = new ClassExpr(
- _n.getRange().orElse(null),
- type_
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ConditionalExpr _n, Object _arg) {
- Expression condition = cloneNode(_n.getCondition(), _arg);
- Expression thenExpr = cloneNode(_n.getThenExpr(), _arg);
- Expression elseExpr = cloneNode(_n.getElseExpr(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ConditionalExpr r = new ConditionalExpr(
- _n.getRange().orElse(null),
- condition, thenExpr, elseExpr
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(EnclosedExpr _n, Object _arg) {
- Expression inner = cloneNode(_n.getInner(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- EnclosedExpr r = new EnclosedExpr(
- _n.getRange().orElse(null),
- inner
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(FieldAccessExpr _n, Object _arg) {
- Expression scope_ = cloneNode(_n.getScope(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ArrayInitializerExpr r = new ArrayInitializerExpr(
+ _n.getRange().orElse(null),
+ values
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(AssignExpr _n, Object _arg) {
+ Expression target = cloneNode(_n.getTarget(), _arg);
+ Expression value = cloneNode(_n.getValue(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ AssignExpr r = new AssignExpr(
+ _n.getRange().orElse(null),
+ target, value, _n.getOperator());
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(BinaryExpr _n, Object _arg) {
+ Expression left = cloneNode(_n.getLeft(), _arg);
+ Expression right = cloneNode(_n.getRight(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ BinaryExpr r = new BinaryExpr(
+ _n.getRange().orElse(null),
+ left, right, _n.getOperator()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(CastExpr _n, Object _arg) {
+ Type<?> type_ = cloneNode(_n.getType(), _arg);
+ Expression expr = cloneNode(_n.getExpression(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ CastExpr r = new CastExpr(
+ _n.getRange().orElse(null),
+ type_, expr
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ClassExpr _n, Object _arg) {
+ Type<?> type_ = cloneNode(_n.getType(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ClassExpr r = new ClassExpr(
+ _n.getRange().orElse(null),
+ type_
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ConditionalExpr _n, Object _arg) {
+ Expression condition = cloneNode(_n.getCondition(), _arg);
+ Expression thenExpr = cloneNode(_n.getThenExpr(), _arg);
+ Expression elseExpr = cloneNode(_n.getElseExpr(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ConditionalExpr r = new ConditionalExpr(
+ _n.getRange().orElse(null),
+ condition, thenExpr, elseExpr
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(EnclosedExpr _n, Object _arg) {
+ Expression inner = cloneNode(_n.getInner(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ EnclosedExpr r = new EnclosedExpr(
+ _n.getRange().orElse(null),
+ inner
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(FieldAccessExpr _n, Object _arg) {
+ Expression scope_ = cloneNode(_n.getScope(), _arg);
NodeList<Type<?>> typeArguments_ = cloneList(_n.getTypeArguments().orElse(null), _arg);
SimpleName fieldExpr_ = cloneNode(_n.getField(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
- FieldAccessExpr r = new FieldAccessExpr(
- _n.getRange().orElse(null),
- scope_,
- typeArguments_,
+ FieldAccessExpr r = new FieldAccessExpr(
+ _n.getRange().orElse(null),
+ scope_,
+ typeArguments_,
fieldExpr_
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(InstanceOfExpr _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpression(), _arg);
- ReferenceType<?> type_ = cloneNode(_n.getType(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- InstanceOfExpr r = new InstanceOfExpr(
- _n.getRange().orElse(null),
- expr, type_
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(StringLiteralExpr _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
- StringLiteralExpr r = new StringLiteralExpr(
- _n.getRange().orElse(null),
- _n.getValue()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(IntegerLiteralExpr _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- IntegerLiteralExpr r = new IntegerLiteralExpr(
- _n.getRange().orElse(null),
- _n.getValue()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(LongLiteralExpr _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- LongLiteralExpr r = new LongLiteralExpr(
- _n.getRange().orElse(null),
- _n.getValue()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(CharLiteralExpr _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- CharLiteralExpr r = new CharLiteralExpr(
- _n.getRange().orElse(null),
- _n.getValue()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(DoubleLiteralExpr _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- DoubleLiteralExpr r = new DoubleLiteralExpr(
- _n.getRange().orElse(null),
- _n.getValue()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(BooleanLiteralExpr _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- BooleanLiteralExpr r = new BooleanLiteralExpr(
- _n.getRange().orElse(null),
- _n.getValue()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(NullLiteralExpr _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- NullLiteralExpr r = new NullLiteralExpr(_n.getRange().orElse(null));
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(MethodCallExpr _n, Object _arg) {
- Expression scope_ = cloneNode(_n.getScope(), _arg);
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(InstanceOfExpr _n, Object _arg) {
+ Expression expr = cloneNode(_n.getExpression(), _arg);
+ ReferenceType<?> type_ = cloneNode(_n.getType(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ InstanceOfExpr r = new InstanceOfExpr(
+ _n.getRange().orElse(null),
+ expr, type_
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(StringLiteralExpr _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ StringLiteralExpr r = new StringLiteralExpr(
+ _n.getRange().orElse(null),
+ _n.getValue()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(IntegerLiteralExpr _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ IntegerLiteralExpr r = new IntegerLiteralExpr(
+ _n.getRange().orElse(null),
+ _n.getValue()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(LongLiteralExpr _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ LongLiteralExpr r = new LongLiteralExpr(
+ _n.getRange().orElse(null),
+ _n.getValue()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(CharLiteralExpr _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ CharLiteralExpr r = new CharLiteralExpr(
+ _n.getRange().orElse(null),
+ _n.getValue()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(DoubleLiteralExpr _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ DoubleLiteralExpr r = new DoubleLiteralExpr(
+ _n.getRange().orElse(null),
+ _n.getValue()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(BooleanLiteralExpr _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ BooleanLiteralExpr r = new BooleanLiteralExpr(
+ _n.getRange().orElse(null),
+ _n.getValue()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(NullLiteralExpr _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ NullLiteralExpr r = new NullLiteralExpr(_n.getRange().orElse(null));
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(MethodCallExpr _n, Object _arg) {
+ Expression scope_ = cloneNode(_n.getScope(), _arg);
NodeList<Type<?>> typeArguments_ = cloneList(_n.getTypeArguments().orElse(null), _arg);
NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
SimpleName nameExpr = cloneNode(_n.getName(), _arg);
Comment comment = cloneNode(_n.getComment(), _arg);
- MethodCallExpr r = new MethodCallExpr(
- _n.getRange().orElse(null),
- scope_,
- typeArguments_,
+ MethodCallExpr r = new MethodCallExpr(
+ _n.getRange().orElse(null),
+ scope_,
+ typeArguments_,
nameExpr,
args
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(NameExpr _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- NameExpr r = new NameExpr(
- _n.getRange().orElse(null),
- _n.getName()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ObjectCreationExpr _n, Object _arg) {
- Expression scope = cloneNode(_n.getScope(), _arg);
- ClassOrInterfaceType type_ = cloneNode(_n.getType(), _arg);
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(NameExpr _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ NameExpr r = new NameExpr(
+ _n.getRange().orElse(null),
+ _n.getName()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ObjectCreationExpr _n, Object _arg) {
+ Expression scope = cloneNode(_n.getScope(), _arg);
+ ClassOrInterfaceType type_ = cloneNode(_n.getType(), _arg);
NodeList<Type<?>> typeArguments = cloneList(_n.getTypeArguments().orElse(null), _arg);
NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
NodeList<BodyDeclaration<?>> anonymousBody = cloneList(_n.getAnonymousClassBody().orElse(null), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ObjectCreationExpr r = new ObjectCreationExpr(
- _n.getRange().orElse(null),
- scope, type_, typeArguments, args, anonymousBody
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(Name _n, Object _arg) {
- Name scope = cloneNode(_n.getQualifier(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- Name r = new Name(
- _n.getRange().orElse(null),
- scope,
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ObjectCreationExpr r = new ObjectCreationExpr(
+ _n.getRange().orElse(null),
+ scope, type_, typeArguments, args, anonymousBody
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(Name _n, Object _arg) {
+ Name scope = cloneNode(_n.getQualifier(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ Name r = new Name(
+ _n.getRange().orElse(null),
+ scope,
_n.getIdentifier()
- );
- r.setComment(comment);
- return r;
- }
+ );
+ r.setComment(comment);
+ return r;
+ }
@Override
public Visitable visit(SimpleName n, Object arg) {
@@ -746,510 +746,510 @@ public class CloneVisitor implements GenericVisitor<Visitable, Object> {
}
@Override
- public Visitable visit(ThisExpr _n, Object _arg) {
- Expression classExpr = cloneNode(_n.getClassExpr(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ThisExpr r = new ThisExpr(
- _n.getRange().orElse(null),
- classExpr
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(SuperExpr _n, Object _arg) {
- Expression classExpr = cloneNode(_n.getClassExpr(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- SuperExpr r = new SuperExpr(
- _n.getRange().orElse(null),
- classExpr
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(UnaryExpr _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpression(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- UnaryExpr r = new UnaryExpr(
- _n.getRange().orElse(null),
- expr, _n.getOperator()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(VariableDeclarationExpr _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
- Type<?> type_ = cloneNode(_n.getElementType(), _arg);
- NodeList<VariableDeclarator> variables_ = cloneList(_n.getVariables(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
- NodeList<ArrayBracketPair> arrayBracketPairsAfterType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
-
- VariableDeclarationExpr r = new VariableDeclarationExpr(
- _n.getRange().orElse(null),
- _n.getModifiers(),
- annotations,
- type_,
+ public Visitable visit(ThisExpr _n, Object _arg) {
+ Expression classExpr = cloneNode(_n.getClassExpr(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ThisExpr r = new ThisExpr(
+ _n.getRange().orElse(null),
+ classExpr
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(SuperExpr _n, Object _arg) {
+ Expression classExpr = cloneNode(_n.getClassExpr(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ SuperExpr r = new SuperExpr(
+ _n.getRange().orElse(null),
+ classExpr
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(UnaryExpr _n, Object _arg) {
+ Expression expr = cloneNode(_n.getExpression(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ UnaryExpr r = new UnaryExpr(
+ _n.getRange().orElse(null),
+ expr, _n.getOperator()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(VariableDeclarationExpr _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+ Type<?> type_ = cloneNode(_n.getElementType(), _arg);
+ NodeList<VariableDeclarator> variables_ = cloneList(_n.getVariables(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ NodeList<ArrayBracketPair> arrayBracketPairsAfterType_ = cloneList(_n.getArrayBracketPairsAfterElementType(), _arg);
+
+ VariableDeclarationExpr r = new VariableDeclarationExpr(
+ _n.getRange().orElse(null),
+ _n.getModifiers(),
+ annotations,
+ type_,
variables_,
arrayBracketPairsAfterType_
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(MarkerAnnotationExpr _n, Object _arg) {
- Name name = cloneNode(_n.getName(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- MarkerAnnotationExpr r = new MarkerAnnotationExpr(
- _n.getRange().orElse(null),
- name
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(SingleMemberAnnotationExpr _n, Object _arg) {
- Name name = cloneNode(_n.getName(), _arg);
- Expression memberValue = cloneNode(_n.getMemberValue(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- SingleMemberAnnotationExpr r = new SingleMemberAnnotationExpr(
- _n.getRange().orElse(null),
- name, memberValue
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(NormalAnnotationExpr _n, Object _arg) {
- Name name = cloneNode(_n.getName(), _arg);
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(MarkerAnnotationExpr _n, Object _arg) {
+ Name name = cloneNode(_n.getName(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ MarkerAnnotationExpr r = new MarkerAnnotationExpr(
+ _n.getRange().orElse(null),
+ name
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(SingleMemberAnnotationExpr _n, Object _arg) {
+ Name name = cloneNode(_n.getName(), _arg);
+ Expression memberValue = cloneNode(_n.getMemberValue(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ SingleMemberAnnotationExpr r = new SingleMemberAnnotationExpr(
+ _n.getRange().orElse(null),
+ name, memberValue
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(NormalAnnotationExpr _n, Object _arg) {
+ Name name = cloneNode(_n.getName(), _arg);
NodeList<MemberValuePair> pairs = cloneList(_n.getPairs(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- NormalAnnotationExpr r = new NormalAnnotationExpr(
- _n.getRange().orElse(null),
- name, pairs
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(MemberValuePair _n, Object _arg) {
- Expression value = cloneNode(_n.getValue(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- MemberValuePair r = new MemberValuePair(
- _n.getRange().orElse(null),
- _n.getName(), value
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ExplicitConstructorInvocationStmt _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ NormalAnnotationExpr r = new NormalAnnotationExpr(
+ _n.getRange().orElse(null),
+ name, pairs
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(MemberValuePair _n, Object _arg) {
+ Expression value = cloneNode(_n.getValue(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ MemberValuePair r = new MemberValuePair(
+ _n.getRange().orElse(null),
+ _n.getName(), value
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ExplicitConstructorInvocationStmt _n, Object _arg) {
NodeList<Type<?>> typeArguments_ = cloneList(_n.getTypeArguments().orElse(null), _arg);
- Expression expr_ = cloneNode(_n.getExpression(), _arg);
+ Expression expr_ = cloneNode(_n.getExpression(), _arg);
NodeList<Expression> args = cloneList(_n.getArguments(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
- ExplicitConstructorInvocationStmt r = new ExplicitConstructorInvocationStmt(
- _n.getRange().orElse(null),
- typeArguments_,
- _n.isThis(),
- expr_,
+ ExplicitConstructorInvocationStmt r = new ExplicitConstructorInvocationStmt(
+ _n.getRange().orElse(null),
+ typeArguments_,
+ _n.isThis(),
+ expr_,
args
- );
- r.setComment(comment);
- return r;
- }
+ );
+ r.setComment(comment);
+ return r;
+ }
- @Override
- public Visitable visit(TypeDeclarationStmt _n, Object _arg) {
+ @Override
+ public Visitable visit(TypeDeclarationStmt _n, Object _arg) {
TypeDeclaration<?> typeDecl = cloneNode(_n.getTypeDeclaration(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- TypeDeclarationStmt r = new TypeDeclarationStmt(
- _n.getRange().orElse(null),
- typeDecl
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(AssertStmt _n, Object _arg) {
- Expression check = cloneNode(_n.getCheck(), _arg);
- Expression message = cloneNode(_n.getMessage(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- AssertStmt r = new AssertStmt(
- _n.getRange().orElse(null),
- check, message
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(BlockStmt _n, Object _arg) {
- NodeList<Statement> stmts = cloneList(_n.getStatements(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- BlockStmt r = new BlockStmt(
- _n.getRange().orElse(null),
- stmts
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(LabeledStmt _n, Object _arg) {
- Statement stmt = cloneNode(_n.getStatement(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- LabeledStmt r = new LabeledStmt(
- _n.getRange().orElse(null),
- _n.getLabel(), stmt
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(EmptyStmt _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- EmptyStmt r = new EmptyStmt(_n.getRange().orElse(null));
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ExpressionStmt _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpression(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ExpressionStmt r = new ExpressionStmt(
- _n.getRange().orElse(null),
- expr
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(SwitchStmt _n, Object _arg) {
- Expression selector = cloneNode(_n.getSelector(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ TypeDeclarationStmt r = new TypeDeclarationStmt(
+ _n.getRange().orElse(null),
+ typeDecl
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(AssertStmt _n, Object _arg) {
+ Expression check = cloneNode(_n.getCheck(), _arg);
+ Expression message = cloneNode(_n.getMessage(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ AssertStmt r = new AssertStmt(
+ _n.getRange().orElse(null),
+ check, message
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(BlockStmt _n, Object _arg) {
+ NodeList<Statement> stmts = cloneList(_n.getStatements(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ BlockStmt r = new BlockStmt(
+ _n.getRange().orElse(null),
+ stmts
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(LabeledStmt _n, Object _arg) {
+ Statement stmt = cloneNode(_n.getStatement(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ LabeledStmt r = new LabeledStmt(
+ _n.getRange().orElse(null),
+ _n.getLabel(), stmt
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(EmptyStmt _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ EmptyStmt r = new EmptyStmt(_n.getRange().orElse(null));
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ExpressionStmt _n, Object _arg) {
+ Expression expr = cloneNode(_n.getExpression(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ExpressionStmt r = new ExpressionStmt(
+ _n.getRange().orElse(null),
+ expr
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(SwitchStmt _n, Object _arg) {
+ Expression selector = cloneNode(_n.getSelector(), _arg);
NodeList<SwitchEntryStmt> entries = cloneList(_n.getEntries(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- SwitchStmt r = new SwitchStmt(
- _n.getRange().orElse(null),
- selector, entries
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(SwitchEntryStmt _n, Object _arg) {
- Expression label = cloneNode(_n.getLabel(), _arg);
- NodeList<Statement> stmts = cloneList(_n.getStatements(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- SwitchEntryStmt r = new SwitchEntryStmt(
- _n.getRange().orElse(null),
- label, stmts
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(BreakStmt _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- BreakStmt r = new BreakStmt(
- _n.getRange().orElse(null),
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ SwitchStmt r = new SwitchStmt(
+ _n.getRange().orElse(null),
+ selector, entries
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(SwitchEntryStmt _n, Object _arg) {
+ Expression label = cloneNode(_n.getLabel(), _arg);
+ NodeList<Statement> stmts = cloneList(_n.getStatements(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ SwitchEntryStmt r = new SwitchEntryStmt(
+ _n.getRange().orElse(null),
+ label, stmts
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(BreakStmt _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ BreakStmt r = new BreakStmt(
+ _n.getRange().orElse(null),
_n.getIdentifier().orElse(null)
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ReturnStmt _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpression(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ReturnStmt r = new ReturnStmt(
- _n.getRange().orElse(null),
- expr
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(IfStmt _n, Object _arg) {
- Expression condition = cloneNode(_n.getCondition(), _arg);
- Statement thenStmt = cloneNode(_n.getThenStmt(), _arg);
- Statement elseStmt = cloneNode(_n.getElseStmt(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- IfStmt r = new IfStmt(
- _n.getRange().orElse(null),
- condition, thenStmt, elseStmt
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(WhileStmt _n, Object _arg) {
- Expression condition = cloneNode(_n.getCondition(), _arg);
- Statement body = cloneNode(_n.getBody(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- WhileStmt r = new WhileStmt(
- _n.getRange().orElse(null),
- condition, body
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ContinueStmt _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ContinueStmt r = new ContinueStmt(
- _n.getRange().orElse(null),
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ReturnStmt _n, Object _arg) {
+ Expression expr = cloneNode(_n.getExpression(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ReturnStmt r = new ReturnStmt(
+ _n.getRange().orElse(null),
+ expr
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(IfStmt _n, Object _arg) {
+ Expression condition = cloneNode(_n.getCondition(), _arg);
+ Statement thenStmt = cloneNode(_n.getThenStmt(), _arg);
+ Statement elseStmt = cloneNode(_n.getElseStmt(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ IfStmt r = new IfStmt(
+ _n.getRange().orElse(null),
+ condition, thenStmt, elseStmt
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(WhileStmt _n, Object _arg) {
+ Expression condition = cloneNode(_n.getCondition(), _arg);
+ Statement body = cloneNode(_n.getBody(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ WhileStmt r = new WhileStmt(
+ _n.getRange().orElse(null),
+ condition, body
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ContinueStmt _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ContinueStmt r = new ContinueStmt(
+ _n.getRange().orElse(null),
_n.getIdentifier().orElse(null)
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(DoStmt _n, Object _arg) {
- Statement body = cloneNode(_n.getBody(), _arg);
- Expression condition = cloneNode(_n.getCondition(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- DoStmt r = new DoStmt(
- _n.getRange().orElse(null),
- body, condition
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ForeachStmt _n, Object _arg) {
- VariableDeclarationExpr var = cloneNode(_n.getVariable(), _arg);
- Expression iterable = cloneNode(_n.getIterable(), _arg);
- Statement body = cloneNode(_n.getBody(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ForeachStmt r = new ForeachStmt(
- _n.getRange().orElse(null),
- var, iterable, body
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ForStmt _n, Object _arg) {
- NodeList<Expression> init = cloneList(_n.getInitialization(), _arg);
- Expression compare = cloneNode(_n.getCompare(), _arg);
- NodeList<Expression> update = cloneList(_n.getUpdate(), _arg);
- Statement body = cloneNode(_n.getBody(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ForStmt r = new ForStmt(
- _n.getRange().orElse(null),
- init, compare, update, body
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(ThrowStmt _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpression(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- ThrowStmt r = new ThrowStmt(
- _n.getRange().orElse(null),
- expr
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(SynchronizedStmt _n, Object _arg) {
- Expression expr = cloneNode(_n.getExpression(), _arg);
- BlockStmt block = cloneNode(_n.getBody(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- SynchronizedStmt r = new SynchronizedStmt(
- _n.getRange().orElse(null),
- expr, block
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(TryStmt _n, Object _arg) {
- NodeList<VariableDeclarationExpr> resources = cloneList(_n.getResources(),_arg);
- BlockStmt tryBlock = cloneNode(_n.getTryBlock(), _arg);
- NodeList<CatchClause> catchs = cloneList(_n.getCatchClauses(), _arg);
- BlockStmt finallyBlock = cloneNode(_n.getFinallyBlock(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- TryStmt r = new TryStmt(
- _n.getRange().orElse(null),
- resources, tryBlock, catchs, finallyBlock
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(CatchClause _n, Object _arg) {
- Parameter param = cloneNode(_n.getParameter(), _arg);
- BlockStmt catchBlock = cloneNode(_n.getBody(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- CatchClause r = new CatchClause(_n.getRange().orElse(null), param, catchBlock);
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(LambdaExpr _n, Object _arg) {
- NodeList<Parameter> lambdaParameters = cloneList(_n.getParameters(), _arg);
-
- Statement body = cloneNode(_n.getBody(), _arg);
-
- return new LambdaExpr(_n.getRange().orElse(null), lambdaParameters, body,
- _n.isEnclosingParameters());
- }
-
- @Override
- public Visitable visit(MethodReferenceExpr _n, Object arg) {
-
- Expression scope = cloneNode(_n.getScope(), arg);
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(DoStmt _n, Object _arg) {
+ Statement body = cloneNode(_n.getBody(), _arg);
+ Expression condition = cloneNode(_n.getCondition(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ DoStmt r = new DoStmt(
+ _n.getRange().orElse(null),
+ body, condition
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ForeachStmt _n, Object _arg) {
+ VariableDeclarationExpr var = cloneNode(_n.getVariable(), _arg);
+ Expression iterable = cloneNode(_n.getIterable(), _arg);
+ Statement body = cloneNode(_n.getBody(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ForeachStmt r = new ForeachStmt(
+ _n.getRange().orElse(null),
+ var, iterable, body
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ForStmt _n, Object _arg) {
+ NodeList<Expression> init = cloneList(_n.getInitialization(), _arg);
+ Expression compare = cloneNode(_n.getCompare(), _arg);
+ NodeList<Expression> update = cloneList(_n.getUpdate(), _arg);
+ Statement body = cloneNode(_n.getBody(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ForStmt r = new ForStmt(
+ _n.getRange().orElse(null),
+ init, compare, update, body
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(ThrowStmt _n, Object _arg) {
+ Expression expr = cloneNode(_n.getExpression(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ ThrowStmt r = new ThrowStmt(
+ _n.getRange().orElse(null),
+ expr
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(SynchronizedStmt _n, Object _arg) {
+ Expression expr = cloneNode(_n.getExpression(), _arg);
+ BlockStmt block = cloneNode(_n.getBody(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ SynchronizedStmt r = new SynchronizedStmt(
+ _n.getRange().orElse(null),
+ expr, block
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(TryStmt _n, Object _arg) {
+ NodeList<VariableDeclarationExpr> resources = cloneList(_n.getResources(), _arg);
+ BlockStmt tryBlock = cloneNode(_n.getTryBlock(), _arg);
+ NodeList<CatchClause> catchs = cloneList(_n.getCatchClauses(), _arg);
+ BlockStmt finallyBlock = cloneNode(_n.getFinallyBlock(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ TryStmt r = new TryStmt(
+ _n.getRange().orElse(null),
+ resources, tryBlock, catchs, finallyBlock
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(CatchClause _n, Object _arg) {
+ Parameter param = cloneNode(_n.getParameter(), _arg);
+ BlockStmt catchBlock = cloneNode(_n.getBody(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ CatchClause r = new CatchClause(_n.getRange().orElse(null), param, catchBlock);
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(LambdaExpr _n, Object _arg) {
+ NodeList<Parameter> lambdaParameters = cloneList(_n.getParameters(), _arg);
+
+ Statement body = cloneNode(_n.getBody(), _arg);
+
+ return new LambdaExpr(_n.getRange().orElse(null), lambdaParameters, body,
+ _n.isEnclosingParameters());
+ }
+
+ @Override
+ public Visitable visit(MethodReferenceExpr _n, Object arg) {
+
+ Expression scope = cloneNode(_n.getScope(), arg);
NodeList<Type<?>> typeArguments = cloneList(_n.getTypeArguments().orElse(null), arg);
- return new MethodReferenceExpr(_n.getRange().orElse(null), scope,
- typeArguments, _n.getIdentifier());
- }
-
- @Override
- public Visitable visit(TypeExpr n, Object arg) {
-
- Type<?> t = cloneNode(n.getType(), arg);
-
- return new TypeExpr(n.getRange().orElse(null), t);
- }
-
- @Override
- public Visitable visit(ArrayBracketPair _n, Object _arg) {
- NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
-
- return new ArrayBracketPair(_n.getRange().orElse(null), annotations);
- }
-
- @Override
- public Visitable visit(NodeList n, Object arg) {
- NodeList<Node> newNodes = new NodeList<>(null);
- for (Object node : n) {
- Node resultNode = (Node)((Node)node).accept(this, arg);
- if(resultNode!=null){
- newNodes.add(resultNode);
- }
- }
- return newNodes;
- }
-
- @Override
- public Visitable visit(EmptyImportDeclaration _n, Object _arg) {
- Comment comment = cloneNode(_n.getComment(), _arg);
- return new EmptyImportDeclaration(_n.getRange().orElse(null)).setComment(comment);
- }
-
- @Override
- public Visitable visit(SingleStaticImportDeclaration _n, Object _arg) {
- ClassOrInterfaceType type_ = cloneNode(_n.getType(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
-
- SingleStaticImportDeclaration r = new SingleStaticImportDeclaration(
- _n.getRange().orElse(null),
- type_,
- _n.getStaticMember()
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(SingleTypeImportDeclaration _n, Object _arg) {
+ return new MethodReferenceExpr(_n.getRange().orElse(null), scope,
+ typeArguments, _n.getIdentifier());
+ }
+
+ @Override
+ public Visitable visit(TypeExpr n, Object arg) {
+
+ Type<?> t = cloneNode(n.getType(), arg);
+
+ return new TypeExpr(n.getRange().orElse(null), t);
+ }
+
+ @Override
+ public Visitable visit(ArrayBracketPair _n, Object _arg) {
+ NodeList<AnnotationExpr> annotations = cloneList(_n.getAnnotations(), _arg);
+
+ return new ArrayBracketPair(_n.getRange().orElse(null), annotations);
+ }
+
+ @Override
+ public Visitable visit(NodeList n, Object arg) {
+ NodeList<Node> newNodes = new NodeList<>(null);
+ for (Object node : n) {
+ Node resultNode = (Node) ((Node) node).accept(this, arg);
+ if (resultNode != null) {
+ newNodes.add(resultNode);
+ }
+ }
+ return newNodes;
+ }
+
+ @Override
+ public Visitable visit(EmptyImportDeclaration _n, Object _arg) {
+ Comment comment = cloneNode(_n.getComment(), _arg);
+ return new EmptyImportDeclaration(_n.getRange().orElse(null)).setComment(comment);
+ }
+
+ @Override
+ public Visitable visit(SingleStaticImportDeclaration _n, Object _arg) {
ClassOrInterfaceType type_ = cloneNode(_n.getType(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
- SingleTypeImportDeclaration r = new SingleTypeImportDeclaration(
- _n.getRange().orElse(null),
+ SingleStaticImportDeclaration r = new SingleStaticImportDeclaration(
+ _n.getRange().orElse(null),
+ type_,
+ _n.getStaticMember()
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(SingleTypeImportDeclaration _n, Object _arg) {
+ ClassOrInterfaceType type_ = cloneNode(_n.getType(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ SingleTypeImportDeclaration r = new SingleTypeImportDeclaration(
+ _n.getRange().orElse(null),
type_
- );
- r.setComment(comment);
- return r;
- }
+ );
+ r.setComment(comment);
+ return r;
+ }
- @Override
- public Visitable visit(StaticImportOnDemandDeclaration _n, Object _arg) {
+ @Override
+ public Visitable visit(StaticImportOnDemandDeclaration _n, Object _arg) {
ClassOrInterfaceType type_ = cloneNode(_n.getType(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
- StaticImportOnDemandDeclaration r = new StaticImportOnDemandDeclaration(
- _n.getRange().orElse(null),
+ StaticImportOnDemandDeclaration r = new StaticImportOnDemandDeclaration(
+ _n.getRange().orElse(null),
type_
- );
- r.setComment(comment);
- return r;
- }
-
- @Override
- public Visitable visit(TypeImportOnDemandDeclaration _n, Object _arg) {
- Name name = cloneNode(_n.getName(), _arg);
- Comment comment = cloneNode(_n.getComment(), _arg);
-
- TypeImportOnDemandDeclaration r = new TypeImportOnDemandDeclaration(
- _n.getRange().orElse(null),
- name
- );
- r.setComment(comment);
- return r;
- }
+ );
+ r.setComment(comment);
+ return r;
+ }
+
+ @Override
+ public Visitable visit(TypeImportOnDemandDeclaration _n, Object _arg) {
+ Name name = cloneNode(_n.getName(), _arg);
+ Comment comment = cloneNode(_n.getComment(), _arg);
+
+ TypeImportOnDemandDeclaration r = new TypeImportOnDemandDeclaration(
+ _n.getRange().orElse(null),
+ name
+ );
+ r.setComment(comment);
+ return r;
+ }
@SuppressWarnings("unchecked")
protected <T extends Node> T cloneNode(Optional<T> _node, Object _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 c8a0b1c86..e488abfaa 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
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.visitor;
import com.github.javaparser.ast.*;
@@ -38,15 +38,15 @@ import java.util.List;
*/
public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> {
- private static final EqualsVisitor SINGLETON = new EqualsVisitor();
+ private static final EqualsVisitor SINGLETON = new EqualsVisitor();
- public static boolean equals(final Node n1, final Node n2) {
- return SINGLETON.nodeEquals(n1, n2);
- }
+ public static boolean equals(final Node n1, final Node n2) {
+ return SINGLETON.nodeEquals(n1, n2);
+ }
- private EqualsVisitor() {
- // hide constructor
- }
+ private EqualsVisitor() {
+ // hide constructor
+ }
/**
* Check for equality that can be applied to each kind of node,
@@ -56,27 +56,27 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> {
if (!nodeEquals(n1.getComment(), n2.getComment())) {
return false;
}
- return nodesEquals(n1.getOrphanComments(), n2.getOrphanComments());
- }
-
- private <T extends Node> boolean nodesEquals(final List<T> nodes1, final List<T> nodes2) {
- if (nodes1 == null) {
- return nodes2 == null;
- } else if (nodes2 == null) {
- return false;
- }
- if (nodes1.size() != nodes2.size()) {
- return false;
- }
- for (int i = 0; i < nodes1.size(); i++) {
- if (!nodeEquals(nodes1.get(i), nodes2.get(i))) {
- return false;
- }
- }
- return true;
- }
-
- private <N extends Node> boolean nodesEquals(NodeList<N> n1, NodeList<N> n2) {
+ return nodesEquals(n1.getOrphanComments(), n2.getOrphanComments());
+ }
+
+ private <T extends Node> boolean nodesEquals(final List<T> nodes1, final List<T> nodes2) {
+ if (nodes1 == null) {
+ return nodes2 == null;
+ } else if (nodes2 == null) {
+ return false;
+ }
+ if (nodes1.size() != nodes2.size()) {
+ return false;
+ }
+ for (int i = 0; i < nodes1.size(); i++) {
+ if (!nodeEquals(nodes1.get(i), nodes2.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private <N extends Node> boolean nodesEquals(NodeList<N> n1, NodeList<N> n2) {
if (n1 == n2) {
return true;
}
@@ -84,913 +84,959 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> {
return false;
}
if (n1.size() != n2.size()) {
- return false;
- }
- for (int i = 0; i < n1.size(); i++) {
- if (!nodeEquals(n1.get(i), n2.get(i))) {
- return false;
- }
- }
- return true;
- }
-
- private <T extends Node> boolean nodeEquals(final T n1, final T n2) {
- if (n1 == n2) {
- return true;
- }
- if (n1 == null || n2 == null) {
- return false;
- }
- if (n1.getClass() != n2.getClass()) {
- return false;
- }
- if (!commonNodeEquality(n1, n2)){
- return false;
- }
- return n1.accept(this, n2);
- }
-
- private boolean objEquals(final Object n1, final Object n2) {
- if (n1 == n2) {
- return true;
- }
- if (n1 == null || n2 == null) {
- return false;
- }
- return n1.equals(n2);
- }
-
- @Override public Boolean visit(final CompilationUnit n1, final Visitable arg) {
- final CompilationUnit n2 = (CompilationUnit) arg;
+ return false;
+ }
+ for (int i = 0; i < n1.size(); i++) {
+ if (!nodeEquals(n1.get(i), n2.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private <T extends Node> boolean nodeEquals(final T n1, final T n2) {
+ if (n1 == n2) {
+ return true;
+ }
+ if (n1 == null || n2 == null) {
+ return false;
+ }
+ if (n1.getClass() != n2.getClass()) {
+ return false;
+ }
+ if (!commonNodeEquality(n1, n2)) {
+ return false;
+ }
+ return n1.accept(this, n2);
+ }
+
+ private boolean objEquals(final Object n1, final Object n2) {
+ if (n1 == n2) {
+ return true;
+ }
+ if (n1 == null || n2 == null) {
+ return false;
+ }
+ return n1.equals(n2);
+ }
+
+ @Override
+ public Boolean visit(final CompilationUnit n1, final Visitable arg) {
+ final CompilationUnit n2 = (CompilationUnit) arg;
if (!nodeEquals(n1.getPackage().orElse(null), n2.getPackage().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!nodesEquals(n1.getImports(), n2.getImports())) {
- return false;
- }
+ if (!nodesEquals(n1.getImports(), n2.getImports())) {
+ return false;
+ }
- if (!nodesEquals(n1.getTypes(), n2.getTypes())) {
- return false;
- }
+ if (!nodesEquals(n1.getTypes(), n2.getTypes())) {
+ return false;
+ }
- if (!nodesEquals(n1.getComments(), n2.getComments())) {
- return false;
- }
+ if (!nodesEquals(n1.getComments(), n2.getComments())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final PackageDeclaration n1, final Visitable arg) {
- final PackageDeclaration n2 = (PackageDeclaration) arg;
+ @Override
+ public Boolean visit(final PackageDeclaration n1, final Visitable arg) {
+ final PackageDeclaration n2 = (PackageDeclaration) arg;
- if (!nodeEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!nodeEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final TypeParameter n1, final Visitable arg) {
- final TypeParameter n2 = (TypeParameter) arg;
+ @Override
+ public Boolean visit(final TypeParameter n1, final Visitable arg) {
+ final TypeParameter n2 = (TypeParameter) arg;
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getTypeBound(), n2.getTypeBound())) {
- return false;
- }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
- return true;
- }
+ if (!nodesEquals(n1.getTypeBound(), n2.getTypeBound())) {
+ return false;
+ }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+ return true;
+ }
- @Override public Boolean visit(final LineComment n1, final Visitable arg) {
- final LineComment n2 = (LineComment) arg;
+ @Override
+ public Boolean visit(final LineComment n1, final Visitable arg) {
+ final LineComment n2 = (LineComment) arg;
- if (!objEquals(n1.getContent(), n2.getContent())) {
- return false;
- }
+ if (!objEquals(n1.getContent(), n2.getContent())) {
+ return false;
+ }
if (!objEquals(n1.getRange(), n2.getRange())) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final BlockComment n1, final Visitable arg) {
- final BlockComment n2 = (BlockComment) arg;
+ @Override
+ public Boolean visit(final BlockComment n1, final Visitable arg) {
+ final BlockComment n2 = (BlockComment) arg;
- if (!objEquals(n1.getContent(), n2.getContent())) {
- return false;
- }
+ if (!objEquals(n1.getContent(), n2.getContent())) {
+ return false;
+ }
if (!objEquals(n1.getRange(), n2.getRange())) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ClassOrInterfaceDeclaration n1, final Visitable arg) {
- final ClassOrInterfaceDeclaration n2 = (ClassOrInterfaceDeclaration) arg;
+ @Override
+ public Boolean visit(final ClassOrInterfaceDeclaration n1, final Visitable arg) {
+ final ClassOrInterfaceDeclaration n2 = (ClassOrInterfaceDeclaration) arg;
- // javadoc are checked at CompilationUnit
+ // javadoc are checked at CompilationUnit
if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
+ return false;
+ }
- if (n1.isInterface() != n2.isInterface()) {
- return false;
- }
+ if (n1.isInterface() != n2.isInterface()) {
+ return false;
+ }
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
- return false;
- }
+ if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
+ return false;
+ }
- if (!nodesEquals(n1.getExtends(), n2.getExtends())) {
- return false;
- }
+ if (!nodesEquals(n1.getExtends(), n2.getExtends())) {
+ return false;
+ }
- if (!nodesEquals(n1.getImplements(), n2.getImplements())) {
- return false;
- }
+ if (!nodesEquals(n1.getImplements(), n2.getImplements())) {
+ return false;
+ }
- if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
- return false;
- }
+ if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final EnumDeclaration n1, final Visitable arg) {
- final EnumDeclaration n2 = (EnumDeclaration) arg;
+ @Override
+ public Boolean visit(final EnumDeclaration n1, final Visitable arg) {
+ final EnumDeclaration n2 = (EnumDeclaration) arg;
- // javadoc are checked at CompilationUnit
+ // javadoc are checked at CompilationUnit
if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
+ return false;
+ }
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- if (!nodesEquals(n1.getImplements(), n2.getImplements())) {
- return false;
- }
+ if (!nodesEquals(n1.getImplements(), n2.getImplements())) {
+ return false;
+ }
- if (!nodesEquals(n1.getEntries(), n2.getEntries())) {
- return false;
- }
+ if (!nodesEquals(n1.getEntries(), n2.getEntries())) {
+ return false;
+ }
- if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
- return false;
- }
+ if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final EmptyTypeDeclaration n1, final Visitable arg) {
- return true;
- }
+ @Override
+ public Boolean visit(final EmptyTypeDeclaration n1, final Visitable arg) {
+ return true;
+ }
- @Override public Boolean visit(final EnumConstantDeclaration n1, final Visitable arg) {
- final EnumConstantDeclaration n2 = (EnumConstantDeclaration) arg;
+ @Override
+ public Boolean visit(final EnumConstantDeclaration n1, final Visitable arg) {
+ final EnumConstantDeclaration n2 = (EnumConstantDeclaration) arg;
- // javadoc are checked at CompilationUnit
+ // javadoc are checked at CompilationUnit
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
- return false;
- }
+ if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
+ return false;
+ }
- if (!nodesEquals(n1.getClassBody(), n2.getClassBody())) {
- return false;
- }
+ if (!nodesEquals(n1.getClassBody(), n2.getClassBody())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final AnnotationDeclaration n1, final Visitable arg) {
- final AnnotationDeclaration n2 = (AnnotationDeclaration) arg;
+ @Override
+ public Boolean visit(final AnnotationDeclaration n1, final Visitable arg) {
+ final AnnotationDeclaration n2 = (AnnotationDeclaration) arg;
- // javadoc are checked at CompilationUnit
+ // javadoc are checked at CompilationUnit
if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
+ return false;
+ }
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
- return false;
- }
+ if (!nodesEquals(n1.getMembers(), n2.getMembers())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final AnnotationMemberDeclaration n1, final Visitable arg) {
- final AnnotationMemberDeclaration n2 = (AnnotationMemberDeclaration) arg;
+ @Override
+ public Boolean visit(final AnnotationMemberDeclaration n1, final Visitable arg) {
+ final AnnotationMemberDeclaration n2 = (AnnotationMemberDeclaration) arg;
- // javadoc are checked at CompilationUnit
+ // javadoc are checked at CompilationUnit
if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
+ return false;
+ }
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- if (!nodeEquals(n1.getDefaultValue().orElse(null), n2.getDefaultValue().orElse(null))) {
- return false;
- }
+ if (!nodeEquals(n1.getDefaultValue().orElse(null), n2.getDefaultValue().orElse(null))) {
+ return false;
+ }
- if (!nodeEquals(n1.getType(), n2.getType())) {
- return false;
- }
+ if (!nodeEquals(n1.getType(), n2.getType())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final FieldDeclaration n1, final Visitable arg) {
- final FieldDeclaration n2 = (FieldDeclaration) arg;
+ @Override
+ public Boolean visit(final FieldDeclaration n1, final Visitable arg) {
+ final FieldDeclaration n2 = (FieldDeclaration) arg;
- // javadoc are checked at CompilationUnit
+ // javadoc are checked at CompilationUnit
if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
- return false;
- }
+ if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
+ return false;
+ }
- if (!nodesEquals(n1.getVariables(), n2.getVariables())) {
- return false;
- }
+ if (!nodesEquals(n1.getVariables(), n2.getVariables())) {
+ return false;
+ }
+
+ if (!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())) {
+ return false;
+ }
- if(!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())){
- return false;
- }
-
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final VariableDeclarator n1, final Visitable arg) {
- final VariableDeclarator n2 = (VariableDeclarator) arg;
+ @Override
+ public Boolean visit(final VariableDeclarator n1, final Visitable arg) {
+ final VariableDeclarator n2 = (VariableDeclarator) arg;
- if (!nodeEquals(n1.getIdentifier(), n2.getIdentifier())) {
- return false;
- }
+ if (!nodeEquals(n1.getIdentifier(), n2.getIdentifier())) {
+ return false;
+ }
if (!nodeEquals(n1.getInitializer().orElse(null), n2.getInitializer().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final VariableDeclaratorId n1, final Visitable arg) {
- final VariableDeclaratorId n2 = (VariableDeclaratorId) arg;
+ @Override
+ public Boolean visit(final VariableDeclaratorId n1, final Visitable arg) {
+ final VariableDeclaratorId n2 = (VariableDeclaratorId) arg;
- if(!nodesEquals(n1.getArrayBracketPairsAfterId(), n2.getArrayBracketPairsAfterId())){
- return false;
- }
+ if (!nodesEquals(n1.getArrayBracketPairsAfterId(), n2.getArrayBracketPairsAfterId())) {
+ return false;
+ }
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ConstructorDeclaration n1, final Visitable arg) {
- final ConstructorDeclaration n2 = (ConstructorDeclaration) arg;
+ @Override
+ public Boolean visit(final ConstructorDeclaration n1, final Visitable arg) {
+ final ConstructorDeclaration n2 = (ConstructorDeclaration) arg;
- // javadoc are checked at CompilationUnit
+ // javadoc are checked at CompilationUnit
if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
+ return false;
+ }
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return false;
- }
+ if (!nodeEquals(n1.getBody(), n2.getBody())) {
+ return false;
+ }
- if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
- return false;
- }
+ if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
+ return false;
+ }
- if (!nodesEquals(n1.getThrownExceptions(), n2.getThrownExceptions())) {
- return false;
- }
+ if (!nodesEquals(n1.getThrownExceptions(), n2.getThrownExceptions())) {
+ return false;
+ }
- if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
- return false;
- }
+ if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final MethodDeclaration n1, final Visitable arg) {
- final MethodDeclaration n2 = (MethodDeclaration) arg;
+ @Override
+ public Boolean visit(final MethodDeclaration n1, final Visitable arg) {
+ final MethodDeclaration n2 = (MethodDeclaration) arg;
- // javadoc are checked at CompilationUnit
+ // javadoc are checked at CompilationUnit
if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
+ return false;
+ }
- if(!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())){
- return false;
- }
+ if (!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())) {
+ return false;
+ }
- if(!nodesEquals(n1.getArrayBracketPairsAfterParameterList(), n2.getArrayBracketPairsAfterParameterList())){
- return false;
- }
+ if (!nodesEquals(n1.getArrayBracketPairsAfterParameterList(), n2.getArrayBracketPairsAfterParameterList())) {
+ return false;
+ }
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
- return false;
- }
+ if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
if (!nodeEquals(n1.getBody().orElse(null), n2.getBody().orElse(null))) {
- return false;
- }
-
- if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
- return false;
- }
-
- if (!nodesEquals(n1.getThrownExceptions(), n2.getThrownExceptions())) {
- return false;
- }
-
- if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
- return false;
- }
- if(n1.isDefault() != n2.isDefault()){
- return false;
- }
- return true;
- }
-
- @Override public Boolean visit(final Parameter n1, final Visitable arg) {
- final Parameter n2 = (Parameter) arg;
- if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
- return false;
- }
-
- if(!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())){
- return false;
- }
-
- if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
-
- if (!nodeEquals(n1.getIdentifier(), n2.getIdentifier())) {
- return false;
- }
-
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
-
- return true;
- }
-
- @Override public Boolean visit(final EmptyMemberDeclaration n1, final Visitable arg) {
- return true;
- }
-
- @Override public Boolean visit(final InitializerDeclaration n1, final Visitable arg) {
- final InitializerDeclaration n2 = (InitializerDeclaration) arg;
-
- if (!nodeEquals(n1.getBlock(), n2.getBlock())) {
- return false;
- }
-
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
-
- return true;
- }
-
- @Override public Boolean visit(final JavadocComment n1, final Visitable arg) {
- final JavadocComment n2 = (JavadocComment) arg;
-
- if (!objEquals(n1.getContent(), n2.getContent())) {
- return false;
- }
-
- return true;
- }
-
- @Override public Boolean visit(final ClassOrInterfaceType n1, final Visitable arg) {
- final ClassOrInterfaceType n2 = (ClassOrInterfaceType) arg;
-
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ return false;
+ }
+
+ if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
+ return false;
+ }
+
+ if (!nodesEquals(n1.getThrownExceptions(), n2.getThrownExceptions())) {
+ return false;
+ }
+
+ if (!nodesEquals(n1.getTypeParameters(), n2.getTypeParameters())) {
+ return false;
+ }
+ if (n1.isDefault() != n2.isDefault()) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Boolean visit(final Parameter n1, final Visitable arg) {
+ final Parameter n2 = (Parameter) arg;
+ if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
+ return false;
+ }
+
+ if (!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())) {
+ return false;
+ }
+
+ if (!n1.getModifiers().equals(n2.getModifiers())) {
+ return false;
+ }
+
+ if (!nodeEquals(n1.getIdentifier(), n2.getIdentifier())) {
+ return false;
+ }
+
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public Boolean visit(final EmptyMemberDeclaration n1, final Visitable arg) {
+ return true;
+ }
+
+ @Override
+ public Boolean visit(final InitializerDeclaration n1, final Visitable arg) {
+ final InitializerDeclaration n2 = (InitializerDeclaration) arg;
+
+ if (!nodeEquals(n1.getBlock(), n2.getBlock())) {
+ return false;
+ }
+
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public Boolean visit(final JavadocComment n1, final Visitable arg) {
+ final JavadocComment n2 = (JavadocComment) arg;
+
+ if (!objEquals(n1.getContent(), n2.getContent())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public Boolean visit(final ClassOrInterfaceType n1, final Visitable arg) {
+ final ClassOrInterfaceType n2 = (ClassOrInterfaceType) arg;
+
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
if (!nodeEquals(n1.getScope().orElse(null), n2.getScope().orElse(null))) {
- return false;
- }
+ return false;
+ }
if (!nodesEquals(n1.getTypeArguments().orElse(null), n2.getTypeArguments().orElse(null))) {
- return false;
- }
-
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
-
- return true;
- }
-
- @Override public Boolean visit(final PrimitiveType n1, final Visitable arg) {
- final PrimitiveType n2 = (PrimitiveType) arg;
-
- if (n1.getType() != n2.getType()) {
- return false;
- }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
- return true;
- }
-
- @Override
- public Boolean visit(ArrayType n1, Visitable arg) {
- final ArrayType n2 = (ArrayType) arg;
-
- if (!nodeEquals(n1.getComponentType(), n2.getComponentType())) {
- return false;
- }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
- return true;
- }
-
- @Override
- public Boolean visit(ArrayCreationLevel n1, Visitable arg) {
- final ArrayCreationLevel n2 = (ArrayCreationLevel) arg;
+ return false;
+ }
+
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public Boolean visit(final PrimitiveType n1, final Visitable arg) {
+ final PrimitiveType n2 = (PrimitiveType) arg;
+
+ if (n1.getType() != n2.getType()) {
+ return false;
+ }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Boolean visit(ArrayType n1, Visitable arg) {
+ final ArrayType n2 = (ArrayType) arg;
+
+ if (!nodeEquals(n1.getComponentType(), n2.getComponentType())) {
+ return false;
+ }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Boolean visit(ArrayCreationLevel n1, Visitable arg) {
+ final ArrayCreationLevel n2 = (ArrayCreationLevel) arg;
if (!nodeEquals(n1.getDimension().orElse(null), n2.getDimension().orElse(null))) {
- return false;
- }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
- return true;
- }
-
- @Override public Boolean visit(final IntersectionType n1, final Visitable arg) {
+ return false;
+ }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Boolean visit(final IntersectionType n1, final Visitable arg) {
final IntersectionType n2 = (IntersectionType) arg;
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
NodeList<ReferenceType<?>> n1Elements = n1.getElements();
NodeList<ReferenceType<?>> n2Elements = n2.getElements();
- if (n1Elements !=null && n2Elements != null) {
- if(n1Elements.size() != n2Elements.size()){
+ if (n1Elements != null && n2Elements != null) {
+ if (n1Elements.size() != n2Elements.size()) {
return false;
- }
- else{
+ } else {
int i = 0;
- for(ReferenceType<?> aux: n1Elements){
- if(aux.accept(this, n2Elements.get(i))) {
+ for (ReferenceType<?> aux : n1Elements) {
+ if (aux.accept(this, n2Elements.get(i))) {
return false;
}
i++;
}
}
- } else if (n1Elements != n2Elements){
+ } else if (n1Elements != n2Elements) {
return false;
}
return true;
}
- @Override public Boolean visit(final UnionType n1, final Visitable arg) {
+ @Override
+ public Boolean visit(final UnionType n1, final Visitable arg) {
final UnionType n2 = (UnionType) arg;
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
NodeList<ReferenceType<?>> n1Elements = n1.getElements();
NodeList<ReferenceType<?>> n2Elements = n2.getElements();
- if (n1Elements !=null && n2Elements != null) {
- if(n1Elements.size() != n2Elements.size()){
+ if (n1Elements != null && n2Elements != null) {
+ if (n1Elements.size() != n2Elements.size()) {
return false;
- }
- else{
+ } else {
int i = 0;
- for(ReferenceType<?> aux: n1Elements){
- if(aux.accept(this, n2Elements.get(i))) {
+ for (ReferenceType<?> aux : n1Elements) {
+ if (aux.accept(this, n2Elements.get(i))) {
return false;
}
i++;
}
}
- } else if (n1Elements != n2Elements){
+ } else if (n1Elements != n2Elements) {
return false;
}
return true;
}
- @Override
- public Boolean visit(VoidType n1, Visitable arg) {
- VoidType n2 = (VoidType) arg;
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
- return true;
- }
+ @Override
+ public Boolean visit(VoidType n1, Visitable arg) {
+ VoidType n2 = (VoidType) arg;
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+ return true;
+ }
- @Override public Boolean visit(final WildcardType n1, final Visitable arg) {
- final WildcardType n2 = (WildcardType) arg;
+ @Override
+ public Boolean visit(final WildcardType n1, final Visitable arg) {
+ final WildcardType n2 = (WildcardType) arg;
if (!nodeEquals(n1.getExtendedTypes().orElse(null), n2.getExtendedTypes().orElse(null))) {
- return false;
- }
+ return false;
+ }
if (!nodeEquals(n1.getSuperTypes().orElse(null), n2.getSuperTypes().orElse(null))) {
- return false;
- }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
- return true;
- }
+ return false;
+ }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
+ return true;
+ }
- @Override public Boolean visit(final UnknownType n1, final Visitable arg) {
- return true;
- }
+ @Override
+ public Boolean visit(final UnknownType n1, final Visitable arg) {
+ return true;
+ }
- @Override public Boolean visit(final ArrayAccessExpr n1, final Visitable arg) {
- final ArrayAccessExpr n2 = (ArrayAccessExpr) arg;
+ @Override
+ public Boolean visit(final ArrayAccessExpr n1, final Visitable arg) {
+ final ArrayAccessExpr n2 = (ArrayAccessExpr) arg;
- if (!nodeEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!nodeEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodeEquals(n1.getIndex(), n2.getIndex())) {
- return false;
- }
+ if (!nodeEquals(n1.getIndex(), n2.getIndex())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ArrayCreationExpr n1, final Visitable arg) {
- final ArrayCreationExpr n2 = (ArrayCreationExpr) arg;
+ @Override
+ public Boolean visit(final ArrayCreationExpr n1, final Visitable arg) {
+ final ArrayCreationExpr n2 = (ArrayCreationExpr) arg;
- if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
- return false;
- }
+ if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
+ return false;
+ }
- if (!nodesEquals(n1.getLevels(), n2.getLevels())) {
- return false;
- }
+ if (!nodesEquals(n1.getLevels(), n2.getLevels())) {
+ return false;
+ }
if (!nodeEquals(n1.getInitializer().orElse(null), n2.getInitializer().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ArrayInitializerExpr n1, final Visitable arg) {
- final ArrayInitializerExpr n2 = (ArrayInitializerExpr) arg;
+ @Override
+ public Boolean visit(final ArrayInitializerExpr n1, final Visitable arg) {
+ final ArrayInitializerExpr n2 = (ArrayInitializerExpr) arg;
- if (!nodesEquals(n1.getValues(), n2.getValues())) {
- return false;
- }
+ if (!nodesEquals(n1.getValues(), n2.getValues())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final AssignExpr n1, final Visitable arg) {
- final AssignExpr n2 = (AssignExpr) arg;
+ @Override
+ public Boolean visit(final AssignExpr n1, final Visitable arg) {
+ final AssignExpr n2 = (AssignExpr) arg;
- if (n1.getOperator() != n2.getOperator()) {
- return false;
- }
+ if (n1.getOperator() != n2.getOperator()) {
+ return false;
+ }
- if (!nodeEquals(n1.getTarget(), n2.getTarget())) {
- return false;
- }
+ if (!nodeEquals(n1.getTarget(), n2.getTarget())) {
+ return false;
+ }
- if (!nodeEquals(n1.getValue(), n2.getValue())) {
- return false;
- }
+ if (!nodeEquals(n1.getValue(), n2.getValue())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final BinaryExpr n1, final Visitable arg) {
- final BinaryExpr n2 = (BinaryExpr) arg;
+ @Override
+ public Boolean visit(final BinaryExpr n1, final Visitable arg) {
+ final BinaryExpr n2 = (BinaryExpr) arg;
- if (n1.getOperator() != n2.getOperator()) {
- return false;
- }
+ if (n1.getOperator() != n2.getOperator()) {
+ return false;
+ }
- if (!nodeEquals(n1.getLeft(), n2.getLeft())) {
- return false;
- }
+ if (!nodeEquals(n1.getLeft(), n2.getLeft())) {
+ return false;
+ }
- if (!nodeEquals(n1.getRight(), n2.getRight())) {
- return false;
- }
+ if (!nodeEquals(n1.getRight(), n2.getRight())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final CastExpr n1, final Visitable arg) {
- final CastExpr n2 = (CastExpr) arg;
+ @Override
+ public Boolean visit(final CastExpr n1, final Visitable arg) {
+ final CastExpr n2 = (CastExpr) arg;
- if (!nodeEquals(n1.getType(), n2.getType())) {
- return false;
- }
+ if (!nodeEquals(n1.getType(), n2.getType())) {
+ return false;
+ }
- if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
- return false;
- }
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ClassExpr n1, final Visitable arg) {
- final ClassExpr n2 = (ClassExpr) arg;
+ @Override
+ public Boolean visit(final ClassExpr n1, final Visitable arg) {
+ final ClassExpr n2 = (ClassExpr) arg;
- if (!nodeEquals(n1.getType(), n2.getType())) {
- return false;
- }
+ if (!nodeEquals(n1.getType(), n2.getType())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ConditionalExpr n1, final Visitable arg) {
- final ConditionalExpr n2 = (ConditionalExpr) arg;
+ @Override
+ public Boolean visit(final ConditionalExpr n1, final Visitable arg) {
+ final ConditionalExpr n2 = (ConditionalExpr) arg;
- if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
- return false;
- }
+ if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
+ return false;
+ }
- if (!nodeEquals(n1.getThenExpr(), n2.getThenExpr())) {
- return false;
- }
+ if (!nodeEquals(n1.getThenExpr(), n2.getThenExpr())) {
+ return false;
+ }
- if (!nodeEquals(n1.getElseExpr(), n2.getElseExpr())) {
- return false;
- }
+ if (!nodeEquals(n1.getElseExpr(), n2.getElseExpr())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final EnclosedExpr n1, final Visitable arg) {
- final EnclosedExpr n2 = (EnclosedExpr) arg;
+ @Override
+ public Boolean visit(final EnclosedExpr n1, final Visitable arg) {
+ final EnclosedExpr n2 = (EnclosedExpr) arg;
if (!nodeEquals(n1.getInner().orElse(null), n2.getInner().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final FieldAccessExpr n1, final Visitable arg) {
- final FieldAccessExpr n2 = (FieldAccessExpr) arg;
+ @Override
+ public Boolean visit(final FieldAccessExpr n1, final Visitable arg) {
+ final FieldAccessExpr n2 = (FieldAccessExpr) arg;
if (!nodeEquals(n1.getScope().orElse(null), n2.getScope().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!objEquals(n1.getField(), n2.getField())) {
- return false;
- }
+ if (!objEquals(n1.getField(), n2.getField())) {
+ return false;
+ }
if (!nodesEquals(n1.getTypeArguments().orElse(null), n2.getTypeArguments().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final InstanceOfExpr n1, final Visitable arg) {
- final InstanceOfExpr n2 = (InstanceOfExpr) arg;
+ @Override
+ public Boolean visit(final InstanceOfExpr n1, final Visitable arg) {
+ final InstanceOfExpr n2 = (InstanceOfExpr) arg;
- if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
- return false;
- }
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
+ return false;
+ }
- if (!nodeEquals(n1.getType(), n2.getType())) {
- return false;
- }
+ if (!nodeEquals(n1.getType(), n2.getType())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final StringLiteralExpr n1, final Visitable arg) {
- final StringLiteralExpr n2 = (StringLiteralExpr) arg;
+ @Override
+ public Boolean visit(final StringLiteralExpr n1, final Visitable arg) {
+ final StringLiteralExpr n2 = (StringLiteralExpr) arg;
- if (!objEquals(n1.getValue(), n2.getValue())) {
- return false;
- }
+ if (!objEquals(n1.getValue(), n2.getValue())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final IntegerLiteralExpr n1, final Visitable arg) {
- final IntegerLiteralExpr n2 = (IntegerLiteralExpr) arg;
+ @Override
+ public Boolean visit(final IntegerLiteralExpr n1, final Visitable arg) {
+ final IntegerLiteralExpr n2 = (IntegerLiteralExpr) arg;
- if (!objEquals(n1.getValue(), n2.getValue())) {
- return false;
- }
+ if (!objEquals(n1.getValue(), n2.getValue())) {
+ return false;
+ }
+
+ return true;
+ }
- return true;
- }
+ @Override
+ public Boolean visit(final LongLiteralExpr n1, final Visitable arg) {
+ final LongLiteralExpr n2 = (LongLiteralExpr) arg;
- @Override public Boolean visit(final LongLiteralExpr n1, final Visitable arg) {
- final LongLiteralExpr n2 = (LongLiteralExpr) arg;
+ if (!objEquals(n1.getValue(), n2.getValue())) {
+ return false;
+ }
- if (!objEquals(n1.getValue(), n2.getValue())) {
- return false;
- }
+ return true;
+ }
- return true;
- }
-
- @Override public Boolean visit(final CharLiteralExpr n1, final Visitable arg) {
- final CharLiteralExpr n2 = (CharLiteralExpr) arg;
+ @Override
+ public Boolean visit(final CharLiteralExpr n1, final Visitable arg) {
+ final CharLiteralExpr n2 = (CharLiteralExpr) arg;
- if (!objEquals(n1.getValue(), n2.getValue())) {
- return false;
- }
+ if (!objEquals(n1.getValue(), n2.getValue())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final DoubleLiteralExpr n1, final Visitable arg) {
- final DoubleLiteralExpr n2 = (DoubleLiteralExpr) arg;
+ @Override
+ public Boolean visit(final DoubleLiteralExpr n1, final Visitable arg) {
+ final DoubleLiteralExpr n2 = (DoubleLiteralExpr) arg;
- if (!objEquals(n1.getValue(), n2.getValue())) {
- return false;
- }
+ if (!objEquals(n1.getValue(), n2.getValue())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final BooleanLiteralExpr n1, final Visitable arg) {
- final BooleanLiteralExpr n2 = (BooleanLiteralExpr) arg;
+ @Override
+ public Boolean visit(final BooleanLiteralExpr n1, final Visitable arg) {
+ final BooleanLiteralExpr n2 = (BooleanLiteralExpr) arg;
- if (n1.getValue() != n2.getValue()) {
- return false;
- }
+ if (n1.getValue() != n2.getValue()) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final NullLiteralExpr n1, final Visitable arg) {
- return true;
- }
+ @Override
+ public Boolean visit(final NullLiteralExpr n1, final Visitable arg) {
+ return true;
+ }
- @Override public Boolean visit(final MethodCallExpr n1, final Visitable arg) {
- final MethodCallExpr n2 = (MethodCallExpr) arg;
+ @Override
+ public Boolean visit(final MethodCallExpr n1, final Visitable arg) {
+ final MethodCallExpr n2 = (MethodCallExpr) arg;
- if (!nodeEquals(n1.getScope(), n2.getScope())) {
- return false;
- }
+ if (!nodeEquals(n1.getScope(), n2.getScope())) {
+ return false;
+ }
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
- return false;
- }
+ if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
+ return false;
+ }
if (!nodesEquals(n1.getTypeArguments().orElse(null), n2.getTypeArguments().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final NameExpr n1, final Visitable arg) {
- final NameExpr n2 = (NameExpr) arg;
+ @Override
+ public Boolean visit(final NameExpr n1, final Visitable arg) {
+ final NameExpr n2 = (NameExpr) arg;
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ObjectCreationExpr n1, final Visitable arg) {
- final ObjectCreationExpr n2 = (ObjectCreationExpr) arg;
+ @Override
+ public Boolean visit(final ObjectCreationExpr n1, final Visitable arg) {
+ final ObjectCreationExpr n2 = (ObjectCreationExpr) arg;
if (!nodeEquals(n1.getScope().orElse(null), n2.getScope().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!nodeEquals(n1.getType(), n2.getType())) {
- return false;
- }
+ if (!nodeEquals(n1.getType(), n2.getType())) {
+ return false;
+ }
if (!nodesEquals(n1.getAnonymousClassBody().orElse(null), n2.getAnonymousClassBody().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
- return false;
- }
+ if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
+ return false;
+ }
if (!nodesEquals(n1.getTypeArguments().orElse(null), n2.getTypeArguments().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final Name n1, final Visitable arg) {
- final Name n2 = (Name) arg;
+ @Override
+ public Boolean visit(final Name n1, final Visitable arg) {
+ final Name n2 = (Name) arg;
if (!nodeEquals(n1.getQualifier().orElse(null), n2.getQualifier().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!objEquals(n1.getIdentifier(), n2.getIdentifier())) {
- return false;
- }
+ if (!objEquals(n1.getIdentifier(), n2.getIdentifier())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
@Override
public Boolean visit(SimpleName n, Visitable arg) {
@@ -999,397 +1045,426 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> {
return objEquals(n.getIdentifier(), n2.getIdentifier());
}
- @Override public Boolean visit(final ThisExpr n1, final Visitable arg) {
- final ThisExpr n2 = (ThisExpr) arg;
+ @Override
+ public Boolean visit(final ThisExpr n1, final Visitable arg) {
+ final ThisExpr n2 = (ThisExpr) arg;
if (!nodeEquals(n1.getClassExpr().orElse(null), n2.getClassExpr().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final SuperExpr n1, final Visitable arg) {
- final SuperExpr n2 = (SuperExpr) arg;
+ @Override
+ public Boolean visit(final SuperExpr n1, final Visitable arg) {
+ final SuperExpr n2 = (SuperExpr) arg;
if (!nodeEquals(n1.getClassExpr().orElse(null), n2.getClassExpr().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final UnaryExpr n1, final Visitable arg) {
- final UnaryExpr n2 = (UnaryExpr) arg;
+ @Override
+ public Boolean visit(final UnaryExpr n1, final Visitable arg) {
+ final UnaryExpr n2 = (UnaryExpr) arg;
- if (n1.getOperator() != n2.getOperator()) {
- return false;
- }
+ if (n1.getOperator() != n2.getOperator()) {
+ return false;
+ }
- if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
- return false;
- }
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final VariableDeclarationExpr n1, final Visitable arg) {
- final VariableDeclarationExpr n2 = (VariableDeclarationExpr) arg;
+ @Override
+ public Boolean visit(final VariableDeclarationExpr n1, final Visitable arg) {
+ final VariableDeclarationExpr n2 = (VariableDeclarationExpr) arg;
if (!n1.getModifiers().equals(n2.getModifiers())) {
- return false;
- }
+ return false;
+ }
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
- return false;
- }
+ if (!nodeEquals(n1.getElementType(), n2.getElementType())) {
+ return false;
+ }
- if (!nodesEquals(n1.getVariables(), n2.getVariables())) {
- return false;
- }
+ if (!nodesEquals(n1.getVariables(), n2.getVariables())) {
+ return false;
+ }
+
+ if (!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())) {
+ return false;
+ }
- if(!nodesEquals(n1.getArrayBracketPairsAfterElementType(), n2.getArrayBracketPairsAfterElementType())){
- return false;
- }
-
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final MarkerAnnotationExpr n1, final Visitable arg) {
- final MarkerAnnotationExpr n2 = (MarkerAnnotationExpr) arg;
+ @Override
+ public Boolean visit(final MarkerAnnotationExpr n1, final Visitable arg) {
+ final MarkerAnnotationExpr n2 = (MarkerAnnotationExpr) arg;
- if (!nodeEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!nodeEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final SingleMemberAnnotationExpr n1, final Visitable arg) {
- final SingleMemberAnnotationExpr n2 = (SingleMemberAnnotationExpr) arg;
+ @Override
+ public Boolean visit(final SingleMemberAnnotationExpr n1, final Visitable arg) {
+ final SingleMemberAnnotationExpr n2 = (SingleMemberAnnotationExpr) arg;
- if (!nodeEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!nodeEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodeEquals(n1.getMemberValue(), n2.getMemberValue())) {
- return false;
- }
+ if (!nodeEquals(n1.getMemberValue(), n2.getMemberValue())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final NormalAnnotationExpr n1, final Visitable arg) {
- final NormalAnnotationExpr n2 = (NormalAnnotationExpr) arg;
+ @Override
+ public Boolean visit(final NormalAnnotationExpr n1, final Visitable arg) {
+ final NormalAnnotationExpr n2 = (NormalAnnotationExpr) arg;
- if (!nodeEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!nodeEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodesEquals(n1.getPairs(), n2.getPairs())) {
- return false;
- }
+ if (!nodesEquals(n1.getPairs(), n2.getPairs())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final MemberValuePair n1, final Visitable arg) {
- final MemberValuePair n2 = (MemberValuePair) arg;
+ @Override
+ public Boolean visit(final MemberValuePair n1, final Visitable arg) {
+ final MemberValuePair n2 = (MemberValuePair) arg;
- if (!objEquals(n1.getName(), n2.getName())) {
- return false;
- }
+ if (!objEquals(n1.getName(), n2.getName())) {
+ return false;
+ }
- if (!nodeEquals(n1.getValue(), n2.getValue())) {
- return false;
- }
+ if (!nodeEquals(n1.getValue(), n2.getValue())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ExplicitConstructorInvocationStmt n1, final Visitable arg) {
- final ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg;
+ @Override
+ public Boolean visit(final ExplicitConstructorInvocationStmt n1, final Visitable arg) {
+ final ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg;
if (!nodeEquals(n1.getExpression().orElse(null), n2.getExpression().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
- return false;
- }
+ if (!nodesEquals(n1.getArguments(), n2.getArguments())) {
+ return false;
+ }
if (!nodesEquals(n1.getTypeArguments().orElse(null), n2.getTypeArguments().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final TypeDeclarationStmt n1, final Visitable arg) {
- final TypeDeclarationStmt n2 = (TypeDeclarationStmt) arg;
+ @Override
+ public Boolean visit(final TypeDeclarationStmt n1, final Visitable arg) {
+ final TypeDeclarationStmt n2 = (TypeDeclarationStmt) arg;
- if (!nodeEquals(n1.getTypeDeclaration(), n2.getTypeDeclaration())) {
- return false;
- }
+ if (!nodeEquals(n1.getTypeDeclaration(), n2.getTypeDeclaration())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final AssertStmt n1, final Visitable arg) {
- final AssertStmt n2 = (AssertStmt) arg;
+ @Override
+ public Boolean visit(final AssertStmt n1, final Visitable arg) {
+ final AssertStmt n2 = (AssertStmt) arg;
- if (!nodeEquals(n1.getCheck(), n2.getCheck())) {
- return false;
- }
+ if (!nodeEquals(n1.getCheck(), n2.getCheck())) {
+ return false;
+ }
if (!nodeEquals(n1.getMessage().orElse(null), n2.getMessage().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final BlockStmt n1, final Visitable arg) {
- final BlockStmt n2 = (BlockStmt) arg;
+ @Override
+ public Boolean visit(final BlockStmt n1, final Visitable arg) {
+ final BlockStmt n2 = (BlockStmt) arg;
- if (!nodesEquals(n1.getStatements(), n2.getStatements())) {
- return false;
- }
+ if (!nodesEquals(n1.getStatements(), n2.getStatements())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final LabeledStmt n1, final Visitable arg) {
- final LabeledStmt n2 = (LabeledStmt) arg;
+ @Override
+ public Boolean visit(final LabeledStmt n1, final Visitable arg) {
+ final LabeledStmt n2 = (LabeledStmt) arg;
- if (!nodeEquals(n1.getStatement(), n2.getStatement())) {
- return false;
- }
+ if (!nodeEquals(n1.getStatement(), n2.getStatement())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final EmptyStmt n1, final Visitable arg) {
- return true;
- }
+ @Override
+ public Boolean visit(final EmptyStmt n1, final Visitable arg) {
+ return true;
+ }
- @Override public Boolean visit(final ExpressionStmt n1, final Visitable arg) {
- final ExpressionStmt n2 = (ExpressionStmt) arg;
+ @Override
+ public Boolean visit(final ExpressionStmt n1, final Visitable arg) {
+ final ExpressionStmt n2 = (ExpressionStmt) arg;
- if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
- return false;
- }
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final SwitchStmt n1, final Visitable arg) {
- final SwitchStmt n2 = (SwitchStmt) arg;
+ @Override
+ public Boolean visit(final SwitchStmt n1, final Visitable arg) {
+ final SwitchStmt n2 = (SwitchStmt) arg;
- if (!nodeEquals(n1.getSelector(), n2.getSelector())) {
- return false;
- }
+ if (!nodeEquals(n1.getSelector(), n2.getSelector())) {
+ return false;
+ }
- if (!nodesEquals(n1.getEntries(), n2.getEntries())) {
- return false;
- }
+ if (!nodesEquals(n1.getEntries(), n2.getEntries())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final SwitchEntryStmt n1, final Visitable arg) {
- final SwitchEntryStmt n2 = (SwitchEntryStmt) arg;
+ @Override
+ public Boolean visit(final SwitchEntryStmt n1, final Visitable arg) {
+ final SwitchEntryStmt n2 = (SwitchEntryStmt) arg;
if (!nodeEquals(n1.getLabel().orElse(null), n2.getLabel().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!nodesEquals(n1.getStatements(), n2.getStatements())) {
- return false;
- }
+ if (!nodesEquals(n1.getStatements(), n2.getStatements())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final BreakStmt n1, final Visitable arg) {
- final BreakStmt n2 = (BreakStmt) arg;
+ @Override
+ public Boolean visit(final BreakStmt n1, final Visitable arg) {
+ final BreakStmt n2 = (BreakStmt) arg;
- if (!objEquals(n1.getIdentifier(), n2.getIdentifier())) {
- return false;
- }
+ if (!objEquals(n1.getIdentifier(), n2.getIdentifier())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ReturnStmt n1, final Visitable arg) {
- final ReturnStmt n2 = (ReturnStmt) arg;
+ @Override
+ public Boolean visit(final ReturnStmt n1, final Visitable arg) {
+ final ReturnStmt n2 = (ReturnStmt) arg;
if (!nodeEquals(n1.getExpression().orElse(null), n2.getExpression().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final IfStmt n1, final Visitable arg) {
- final IfStmt n2 = (IfStmt) arg;
+ @Override
+ public Boolean visit(final IfStmt n1, final Visitable arg) {
+ final IfStmt n2 = (IfStmt) arg;
- if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
- return false;
- }
+ if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
+ return false;
+ }
- if (!nodeEquals(n1.getThenStmt(), n2.getThenStmt())) {
- return false;
- }
+ if (!nodeEquals(n1.getThenStmt(), n2.getThenStmt())) {
+ return false;
+ }
if (!nodeEquals(n1.getElseStmt().orElse(null), n2.getElseStmt().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final WhileStmt n1, final Visitable arg) {
- final WhileStmt n2 = (WhileStmt) arg;
+ @Override
+ public Boolean visit(final WhileStmt n1, final Visitable arg) {
+ final WhileStmt n2 = (WhileStmt) arg;
- if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
- return false;
- }
+ if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
+ return false;
+ }
- if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return false;
- }
+ if (!nodeEquals(n1.getBody(), n2.getBody())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ContinueStmt n1, final Visitable arg) {
- final ContinueStmt n2 = (ContinueStmt) arg;
+ @Override
+ public Boolean visit(final ContinueStmt n1, final Visitable arg) {
+ final ContinueStmt n2 = (ContinueStmt) arg;
- if (!objEquals(n1.getIdentifier(), n2.getIdentifier())) {
- return false;
- }
+ if (!objEquals(n1.getIdentifier(), n2.getIdentifier())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final DoStmt n1, final Visitable arg) {
- final DoStmt n2 = (DoStmt) arg;
+ @Override
+ public Boolean visit(final DoStmt n1, final Visitable arg) {
+ final DoStmt n2 = (DoStmt) arg;
- if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return false;
- }
+ if (!nodeEquals(n1.getBody(), n2.getBody())) {
+ return false;
+ }
- if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
- return false;
- }
+ if (!nodeEquals(n1.getCondition(), n2.getCondition())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ForeachStmt n1, final Visitable arg) {
- final ForeachStmt n2 = (ForeachStmt) arg;
+ @Override
+ public Boolean visit(final ForeachStmt n1, final Visitable arg) {
+ final ForeachStmt n2 = (ForeachStmt) arg;
- if (!nodeEquals(n1.getVariable(), n2.getVariable())) {
- return false;
- }
+ if (!nodeEquals(n1.getVariable(), n2.getVariable())) {
+ return false;
+ }
- if (!nodeEquals(n1.getIterable(), n2.getIterable())) {
- return false;
- }
+ if (!nodeEquals(n1.getIterable(), n2.getIterable())) {
+ return false;
+ }
- if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return false;
- }
+ if (!nodeEquals(n1.getBody(), n2.getBody())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ForStmt n1, final Visitable arg) {
- final ForStmt n2 = (ForStmt) arg;
+ @Override
+ public Boolean visit(final ForStmt n1, final Visitable arg) {
+ final ForStmt n2 = (ForStmt) arg;
- if (!nodesEquals(n1.getInitialization(), n2.getInitialization())) {
- return false;
- }
+ if (!nodesEquals(n1.getInitialization(), n2.getInitialization())) {
+ return false;
+ }
if (!nodeEquals(n1.getCompare().orElse(null), n2.getCompare().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!nodesEquals(n1.getUpdate(), n2.getUpdate())) {
- return false;
- }
+ if (!nodesEquals(n1.getUpdate(), n2.getUpdate())) {
+ return false;
+ }
- if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return false;
- }
+ if (!nodeEquals(n1.getBody(), n2.getBody())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final ThrowStmt n1, final Visitable arg) {
- final ThrowStmt n2 = (ThrowStmt) arg;
+ @Override
+ public Boolean visit(final ThrowStmt n1, final Visitable arg) {
+ final ThrowStmt n2 = (ThrowStmt) arg;
- if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
- return false;
- }
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final SynchronizedStmt n1, final Visitable arg) {
- final SynchronizedStmt n2 = (SynchronizedStmt) arg;
+ @Override
+ public Boolean visit(final SynchronizedStmt n1, final Visitable arg) {
+ final SynchronizedStmt n2 = (SynchronizedStmt) arg;
- if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
- return false;
- }
+ if (!nodeEquals(n1.getExpression(), n2.getExpression())) {
+ return false;
+ }
- if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return false;
- }
+ if (!nodeEquals(n1.getBody(), n2.getBody())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final TryStmt n1, final Visitable arg) {
- final TryStmt n2 = (TryStmt) arg;
+ @Override
+ public Boolean visit(final TryStmt n1, final Visitable arg) {
+ final TryStmt n2 = (TryStmt) arg;
if (!nodeEquals(n1.getTryBlock().orElse(null), n2.getTryBlock().orElse(null))) {
- return false;
- }
+ return false;
+ }
- if (!nodesEquals(n1.getCatchClauses(), n2.getCatchClauses())) {
- return false;
- }
-
- if(!nodesEquals(n1.getResources(), n2.getResources())) {
- return false;
- }
+ if (!nodesEquals(n1.getCatchClauses(), n2.getCatchClauses())) {
+ return false;
+ }
+
+ if (!nodesEquals(n1.getResources(), n2.getResources())) {
+ return false;
+ }
if (!nodeEquals(n1.getFinallyBlock().orElse(null), n2.getFinallyBlock().orElse(null))) {
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override public Boolean visit(final CatchClause n1, final Visitable arg) {
- final CatchClause n2 = (CatchClause) arg;
+ @Override
+ public Boolean visit(final CatchClause n1, final Visitable arg) {
+ final CatchClause n2 = (CatchClause) arg;
- if (!nodeEquals(n1.getParameter(), n2.getParameter())) {
- return false;
- }
+ if (!nodeEquals(n1.getParameter(), n2.getParameter())) {
+ return false;
+ }
- if (!nodeEquals(n1.getBody(), n2.getBody())) {
- return false;
- }
+ if (!nodeEquals(n1.getBody(), n2.getBody())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
@Override
public Boolean visit(LambdaExpr n1, Visitable arg) {
@@ -1397,7 +1472,7 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> {
if (!nodesEquals(n1.getParameters(), n2.getParameters())) {
return false;
}
- if(n1.isEnclosingParameters() != n2.isEnclosingParameters()){
+ if (n1.isEnclosingParameters() != n2.isEnclosingParameters()) {
return false;
}
if (!nodeEquals(n1.getBody(), n2.getBody())) {
@@ -1430,20 +1505,20 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> {
return true;
}
- @Override
- public Boolean visit(ArrayBracketPair n1, Visitable arg) {
- ArrayBracketPair n2 = (ArrayBracketPair) arg;
- if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
- return false;
- }
+ @Override
+ public Boolean visit(ArrayBracketPair n1, Visitable arg) {
+ ArrayBracketPair n2 = (ArrayBracketPair) arg;
+ if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
@Override
- public Boolean visit(EmptyImportDeclaration n1, Visitable arg) {
- return true;
- }
+ public Boolean visit(EmptyImportDeclaration n1, Visitable arg) {
+ return true;
+ }
@Override
public Boolean visit(SingleStaticImportDeclaration n1, Visitable arg) {
@@ -1487,8 +1562,8 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> {
return false;
}
- return true;
- }
+ return true;
+ }
@Override
public Boolean visit(NodeList n, Visitable arg) {
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 818e2afc9..9b714dfa9 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
@@ -18,227 +18,193 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.visitor;
import com.github.javaparser.ast.*;
+import com.github.javaparser.ast.body.*;
import com.github.javaparser.ast.comments.BlockComment;
-import com.github.javaparser.ast.comments.LineComment;
-import com.github.javaparser.ast.imports.*;
-import com.github.javaparser.ast.type.TypeParameter;
-import com.github.javaparser.ast.body.AnnotationDeclaration;
-import com.github.javaparser.ast.body.AnnotationMemberDeclaration;
-import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
-import com.github.javaparser.ast.body.ConstructorDeclaration;
-import com.github.javaparser.ast.body.EmptyMemberDeclaration;
-import com.github.javaparser.ast.body.EmptyTypeDeclaration;
-import com.github.javaparser.ast.body.EnumConstantDeclaration;
-import com.github.javaparser.ast.body.EnumDeclaration;
-import com.github.javaparser.ast.body.FieldDeclaration;
-import com.github.javaparser.ast.body.InitializerDeclaration;
import com.github.javaparser.ast.comments.JavadocComment;
-import com.github.javaparser.ast.body.MethodDeclaration;
-import com.github.javaparser.ast.body.Parameter;
-import com.github.javaparser.ast.body.VariableDeclarator;
-import com.github.javaparser.ast.body.VariableDeclaratorId;
+import com.github.javaparser.ast.comments.LineComment;
import com.github.javaparser.ast.expr.*;
-import com.github.javaparser.ast.stmt.AssertStmt;
-import com.github.javaparser.ast.stmt.BlockStmt;
-import com.github.javaparser.ast.stmt.BreakStmt;
-import com.github.javaparser.ast.stmt.CatchClause;
-import com.github.javaparser.ast.stmt.ContinueStmt;
-import com.github.javaparser.ast.stmt.DoStmt;
-import com.github.javaparser.ast.stmt.EmptyStmt;
-import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt;
-import com.github.javaparser.ast.stmt.ExpressionStmt;
-import com.github.javaparser.ast.stmt.ForStmt;
-import com.github.javaparser.ast.stmt.ForeachStmt;
-import com.github.javaparser.ast.stmt.IfStmt;
-import com.github.javaparser.ast.stmt.LabeledStmt;
-import com.github.javaparser.ast.stmt.ReturnStmt;
-import com.github.javaparser.ast.stmt.SwitchEntryStmt;
-import com.github.javaparser.ast.stmt.SwitchStmt;
-import com.github.javaparser.ast.stmt.SynchronizedStmt;
-import com.github.javaparser.ast.stmt.ThrowStmt;
-import com.github.javaparser.ast.stmt.TryStmt;
-import com.github.javaparser.ast.stmt.TypeDeclarationStmt;
-import com.github.javaparser.ast.stmt.WhileStmt;
+import com.github.javaparser.ast.imports.*;
+import com.github.javaparser.ast.stmt.*;
import com.github.javaparser.ast.type.*;
/**
* A visitor that has a return value.
- *
+ *
* @author Julio Vilmar Gesser
*/
public interface GenericVisitor<R, A> {
- //- Compilation Unit ----------------------------------
+ //- Compilation Unit ----------------------------------
+
+ R visit(CompilationUnit n, A arg);
+
+ R visit(PackageDeclaration n, A arg);
- R visit(CompilationUnit n, A arg);
+ R visit(TypeParameter n, A arg);
- R visit(PackageDeclaration n, A arg);
+ R visit(LineComment n, A arg);
- R visit(TypeParameter n, A arg);
+ R visit(BlockComment n, A arg);
- R visit(LineComment n, A arg);
+ //- Body ----------------------------------------------
- R visit(BlockComment n, A arg);
+ R visit(ClassOrInterfaceDeclaration n, A arg);
- //- Body ----------------------------------------------
+ R visit(EnumDeclaration n, A arg);
- R visit(ClassOrInterfaceDeclaration n, A arg);
+ R visit(EmptyTypeDeclaration n, A arg);
- R visit(EnumDeclaration n, A arg);
+ R visit(EnumConstantDeclaration n, A arg);
- R visit(EmptyTypeDeclaration n, A arg);
+ R visit(AnnotationDeclaration n, A arg);
- R visit(EnumConstantDeclaration n, A arg);
+ R visit(AnnotationMemberDeclaration n, A arg);
- R visit(AnnotationDeclaration n, A arg);
+ R visit(FieldDeclaration n, A arg);
- R visit(AnnotationMemberDeclaration n, A arg);
+ R visit(VariableDeclarator n, A arg);
- R visit(FieldDeclaration n, A arg);
+ R visit(VariableDeclaratorId n, A arg);
- R visit(VariableDeclarator n, A arg);
+ R visit(ConstructorDeclaration n, A arg);
- R visit(VariableDeclaratorId n, A arg);
+ R visit(MethodDeclaration n, A arg);
- R visit(ConstructorDeclaration n, A arg);
+ R visit(Parameter n, A arg);
- R visit(MethodDeclaration n, A arg);
+ R visit(EmptyMemberDeclaration n, A arg);
- R visit(Parameter n, A arg);
-
- R visit(EmptyMemberDeclaration n, A arg);
+ R visit(InitializerDeclaration n, A arg);
- R visit(InitializerDeclaration n, A arg);
+ R visit(JavadocComment n, A arg);
- R visit(JavadocComment n, A arg);
+ //- Type ----------------------------------------------
- //- Type ----------------------------------------------
+ R visit(ClassOrInterfaceType n, A arg);
- R visit(ClassOrInterfaceType n, A arg);
+ R visit(PrimitiveType n, A arg);
- R visit(PrimitiveType n, A arg);
+ R visit(ArrayType n, A arg);
- R visit(ArrayType n, A arg);
-
- R visit(ArrayCreationLevel n, A arg);
+ R visit(ArrayCreationLevel n, A arg);
R visit(IntersectionType n, A arg);
R visit(UnionType n, A arg);
- R visit(VoidType n, A arg);
+ R visit(VoidType n, A arg);
- R visit(WildcardType n, A arg);
+ R visit(WildcardType n, A arg);
- R visit(UnknownType n, A arg);
+ R visit(UnknownType n, A arg);
- //- Expression ----------------------------------------
+ //- Expression ----------------------------------------
- R visit(ArrayAccessExpr n, A arg);
+ R visit(ArrayAccessExpr n, A arg);
- R visit(ArrayCreationExpr n, A arg);
+ R visit(ArrayCreationExpr n, A arg);
- R visit(ArrayInitializerExpr n, A arg);
+ R visit(ArrayInitializerExpr n, A arg);
- R visit(AssignExpr n, A arg);
+ R visit(AssignExpr n, A arg);
- R visit(BinaryExpr n, A arg);
+ R visit(BinaryExpr n, A arg);
- R visit(CastExpr n, A arg);
+ R visit(CastExpr n, A arg);
- R visit(ClassExpr n, A arg);
+ R visit(ClassExpr n, A arg);
- R visit(ConditionalExpr n, A arg);
+ R visit(ConditionalExpr n, A arg);
- R visit(EnclosedExpr n, A arg);
+ R visit(EnclosedExpr n, A arg);
- R visit(FieldAccessExpr n, A arg);
+ R visit(FieldAccessExpr n, A arg);
- R visit(InstanceOfExpr n, A arg);
+ R visit(InstanceOfExpr n, A arg);
- R visit(StringLiteralExpr n, A arg);
+ R visit(StringLiteralExpr n, A arg);
- R visit(IntegerLiteralExpr n, A arg);
+ R visit(IntegerLiteralExpr n, A arg);
- R visit(LongLiteralExpr n, A arg);
+ R visit(LongLiteralExpr n, A arg);
- R visit(CharLiteralExpr n, A arg);
+ R visit(CharLiteralExpr n, A arg);
- R visit(DoubleLiteralExpr n, A arg);
+ R visit(DoubleLiteralExpr n, A arg);
- R visit(BooleanLiteralExpr n, A arg);
+ R visit(BooleanLiteralExpr n, A arg);
- R visit(NullLiteralExpr n, A arg);
+ R visit(NullLiteralExpr n, A arg);
- R visit(MethodCallExpr n, A arg);
+ R visit(MethodCallExpr n, A arg);
- R visit(NameExpr n, A arg);
+ R visit(NameExpr n, A arg);
- R visit(ObjectCreationExpr n, A arg);
+ R visit(ObjectCreationExpr n, A arg);
- R visit(ThisExpr n, A arg);
+ R visit(ThisExpr n, A arg);
- R visit(SuperExpr n, A arg);
+ R visit(SuperExpr n, A arg);
- R visit(UnaryExpr n, A arg);
+ R visit(UnaryExpr n, A arg);
- R visit(VariableDeclarationExpr n, A arg);
+ R visit(VariableDeclarationExpr n, A arg);
- R visit(MarkerAnnotationExpr n, A arg);
+ R visit(MarkerAnnotationExpr n, A arg);
- R visit(SingleMemberAnnotationExpr n, A arg);
+ R visit(SingleMemberAnnotationExpr n, A arg);
- R visit(NormalAnnotationExpr n, A arg);
+ R visit(NormalAnnotationExpr n, A arg);
- R visit(MemberValuePair n, A arg);
+ R visit(MemberValuePair n, A arg);
- //- Statements ----------------------------------------
+ //- Statements ----------------------------------------
- R visit(ExplicitConstructorInvocationStmt n, A arg);
+ R visit(ExplicitConstructorInvocationStmt n, A arg);
- R visit(TypeDeclarationStmt n, A arg);
+ R visit(TypeDeclarationStmt n, A arg);
- R visit(AssertStmt n, A arg);
+ R visit(AssertStmt n, A arg);
- R visit(BlockStmt n, A arg);
+ R visit(BlockStmt n, A arg);
- R visit(LabeledStmt n, A arg);
+ R visit(LabeledStmt n, A arg);
- R visit(EmptyStmt n, A arg);
+ R visit(EmptyStmt n, A arg);
- R visit(ExpressionStmt n, A arg);
+ R visit(ExpressionStmt n, A arg);
- R visit(SwitchStmt n, A arg);
+ R visit(SwitchStmt n, A arg);
- R visit(SwitchEntryStmt n, A arg);
+ R visit(SwitchEntryStmt n, A arg);
- R visit(BreakStmt n, A arg);
+ R visit(BreakStmt n, A arg);
- R visit(ReturnStmt n, A arg);
+ R visit(ReturnStmt n, A arg);
- R visit(IfStmt n, A arg);
+ R visit(IfStmt n, A arg);
- R visit(WhileStmt n, A arg);
+ R visit(WhileStmt n, A arg);
- R visit(ContinueStmt n, A arg);
+ R visit(ContinueStmt n, A arg);
- R visit(DoStmt n, A arg);
+ R visit(DoStmt n, A arg);
- R visit(ForeachStmt n, A arg);
+ R visit(ForeachStmt n, A arg);
- R visit(ForStmt n, A arg);
+ R visit(ForStmt n, A arg);
- R visit(ThrowStmt n, A arg);
+ R visit(ThrowStmt n, A arg);
- R visit(SynchronizedStmt n, A arg);
+ R visit(SynchronizedStmt n, A arg);
- R visit(TryStmt n, A arg);
+ R visit(TryStmt n, A arg);
- R visit(CatchClause n, A arg);
+ R visit(CatchClause n, A arg);
R visit(LambdaExpr n, A arg);
@@ -246,19 +212,19 @@ public interface GenericVisitor<R, A> {
R visit(TypeExpr n, A arg);
- R visit(ArrayBracketPair arrayBracketPair, A arg);
+ R visit(ArrayBracketPair arrayBracketPair, A arg);
- R visit(NodeList n, A arg);
+ R visit(NodeList n, A arg);
- R visit(EmptyImportDeclaration n, A arg);
+ R visit(EmptyImportDeclaration n, A arg);
- R visit(SingleStaticImportDeclaration n, A arg);
+ R visit(SingleStaticImportDeclaration n, A arg);
- R visit(SingleTypeImportDeclaration n, A arg);
+ R visit(SingleTypeImportDeclaration n, A arg);
- R visit(StaticImportOnDemandDeclaration n, A arg);
+ R visit(StaticImportOnDemandDeclaration n, A arg);
- R visit(TypeImportOnDemandDeclaration n, A arg);
+ R visit(TypeImportOnDemandDeclaration n, A arg);
R visit(Name n, A arg);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java
index 7a6890252..4e89f9a53 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitorAdapter.java
@@ -39,7 +39,7 @@ import java.util.List;
* This visitor adapter can be used to save time when some specific nodes needs
* to be changed. To do that just extend this class and override the methods
* from the nodes who needs to be changed, returning the changed node.
- *
+ *
* @author Julio Vilmar Gesser
*/
public class ModifierVisitorAdapter<A> implements GenericVisitor<Visitable, A> {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
index 8358a65a7..04497d706 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
@@ -22,6 +22,7 @@
package com.github.javaparser.ast.visitor;
import com.github.javaparser.ast.Node;
+
import java.util.LinkedList;
import java.util.Queue;
@@ -30,34 +31,34 @@ import java.util.Queue;
*/
public abstract class TreeVisitor {
- /**
- * https://en.wikipedia.org/wiki/Depth-first_search
- *
- * @param node the start node, and the first one that is passed to process(node).
- */
- public void visitDepthFirst(Node node) {
- process(node);
- for (Node child : node.getChildNodes()) {
- visitDepthFirst(child);
- }
- }
-
- /**
- * https://en.wikipedia.org/wiki/Breadth-first_search
- *
- * @param node the start node, and the first one that is passed to process(node).
- */
- public void visitBreadthFirst(Node node) {
- Queue<Node> queue = new LinkedList<>();
- queue.offer(node);
- while (queue.size() > 0) {
- Node head = queue.peek();
- for (Node child : head.getChildNodes()) {
- queue.offer(child);
- }
- process(queue.poll());
- }
- }
+ /**
+ * https://en.wikipedia.org/wiki/Depth-first_search
+ *
+ * @param node the start node, and the first one that is passed to process(node).
+ */
+ public void visitDepthFirst(Node node) {
+ process(node);
+ for (Node child : node.getChildNodes()) {
+ visitDepthFirst(child);
+ }
+ }
+
+ /**
+ * https://en.wikipedia.org/wiki/Breadth-first_search
+ *
+ * @param node the start node, and the first one that is passed to process(node).
+ */
+ public void visitBreadthFirst(Node node) {
+ Queue<Node> queue = new LinkedList<>();
+ queue.offer(node);
+ while (queue.size() > 0) {
+ Node head = queue.peek();
+ for (Node child : head.getChildNodes()) {
+ queue.offer(child);
+ }
+ process(queue.poll());
+ }
+ }
- public abstract void process(Node node);
+ public abstract void process(Node node);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/Visitable.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/Visitable.java
index 9fbc6e6ff..d3e20b284 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/Visitable.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/Visitable.java
@@ -4,14 +4,10 @@ public interface Visitable {
/**
* Accept method for visitor support.
*
- * @param <R>
- * the type of the return value of the visitor
- * @param <A>
- * the type the user argument passed to the visitor
- * @param v
- * the visitor implementation
- * @param arg
- * the argument passed to the visitor (of type A)
+ * @param <R> the type of the return value of the visitor
+ * @param <A> the type the user argument passed to the visitor
+ * @param v the visitor implementation
+ * @param arg the argument passed to the visitor (of type A)
* @return the result of the visit (of type R)
*/
<R, A> R accept(GenericVisitor<R, A> v, A arg);
@@ -19,12 +15,9 @@ public interface Visitable {
/**
* Accept method for visitor support.
*
- * @param <A>
- * the type the argument passed for the visitor
- * @param v
- * the visitor implementation
- * @param arg
- * any value relevant for the visitor (of type A)
+ * @param <A> the type the argument passed for the visitor
+ * @param v the visitor implementation
+ * @param arg any value relevant for the visitor (of type A)
*/
<A> void accept(VoidVisitor<A> v, A arg);
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitor.java
index 36022f4d4..5f145f01d 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitor.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.ast.visitor;
import com.github.javaparser.ast.*;
@@ -33,178 +33,178 @@ import com.github.javaparser.ast.type.*;
/**
* A visitor that does not return anything.
- *
+ *
* @author Julio Vilmar Gesser
*/
public interface VoidVisitor<A> {
- //- Compilation Unit ----------------------------------
+ //- Compilation Unit ----------------------------------
+
+ void visit(CompilationUnit n, A arg);
+
+ void visit(PackageDeclaration n, A arg);
- void visit(CompilationUnit n, A arg);
+ void visit(TypeParameter n, A arg);
- void visit(PackageDeclaration n, A arg);
+ void visit(LineComment n, A arg);
- void visit(TypeParameter n, A arg);
+ void visit(BlockComment n, A arg);
- void visit(LineComment n, A arg);
+ //- Body ----------------------------------------------
- void visit(BlockComment n, A arg);
+ void visit(ClassOrInterfaceDeclaration n, A arg);
- //- Body ----------------------------------------------
+ void visit(EnumDeclaration n, A arg);
- void visit(ClassOrInterfaceDeclaration n, A arg);
+ void visit(EmptyTypeDeclaration n, A arg);
- void visit(EnumDeclaration n, A arg);
+ void visit(EnumConstantDeclaration n, A arg);
- void visit(EmptyTypeDeclaration n, A arg);
+ void visit(AnnotationDeclaration n, A arg);
- void visit(EnumConstantDeclaration n, A arg);
+ void visit(AnnotationMemberDeclaration n, A arg);
- void visit(AnnotationDeclaration n, A arg);
+ void visit(FieldDeclaration n, A arg);
- void visit(AnnotationMemberDeclaration n, A arg);
+ void visit(VariableDeclarator n, A arg);
- void visit(FieldDeclaration n, A arg);
+ void visit(VariableDeclaratorId n, A arg);
- void visit(VariableDeclarator n, A arg);
+ void visit(ConstructorDeclaration n, A arg);
- void visit(VariableDeclaratorId n, A arg);
+ void visit(MethodDeclaration n, A arg);
- void visit(ConstructorDeclaration n, A arg);
+ void visit(Parameter n, A arg);
- void visit(MethodDeclaration n, A arg);
+ void visit(EmptyMemberDeclaration n, A arg);
- void visit(Parameter n, A arg);
-
- void visit(EmptyMemberDeclaration n, A arg);
+ void visit(InitializerDeclaration n, A arg);
- void visit(InitializerDeclaration n, A arg);
+ void visit(JavadocComment n, A arg);
- void visit(JavadocComment n, A arg);
+ //- Type ----------------------------------------------
- //- Type ----------------------------------------------
+ void visit(ClassOrInterfaceType n, A arg);
- void visit(ClassOrInterfaceType n, A arg);
+ void visit(PrimitiveType n, A arg);
- void visit(PrimitiveType n, A arg);
+ void visit(ArrayType n, A arg);
- void visit(ArrayType n, A arg);
-
- void visit(ArrayCreationLevel n, A arg);
+ void visit(ArrayCreationLevel n, A arg);
void visit(IntersectionType n, A arg);
void visit(UnionType n, A arg);
- void visit(VoidType n, A arg);
+ void visit(VoidType n, A arg);
- void visit(WildcardType n, A arg);
+ void visit(WildcardType n, A arg);
- void visit(UnknownType n, A arg);
+ void visit(UnknownType n, A arg);
- //- Expression ----------------------------------------
+ //- Expression ----------------------------------------
- void visit(ArrayAccessExpr n, A arg);
+ void visit(ArrayAccessExpr n, A arg);
- void visit(ArrayCreationExpr n, A arg);
+ void visit(ArrayCreationExpr n, A arg);
- void visit(ArrayInitializerExpr n, A arg);
+ void visit(ArrayInitializerExpr n, A arg);
- void visit(AssignExpr n, A arg);
+ void visit(AssignExpr n, A arg);
- void visit(BinaryExpr n, A arg);
+ void visit(BinaryExpr n, A arg);
- void visit(CastExpr n, A arg);
+ void visit(CastExpr n, A arg);
- void visit(ClassExpr n, A arg);
+ void visit(ClassExpr n, A arg);
- void visit(ConditionalExpr n, A arg);
+ void visit(ConditionalExpr n, A arg);
- void visit(EnclosedExpr n, A arg);
+ void visit(EnclosedExpr n, A arg);
- void visit(FieldAccessExpr n, A arg);
+ void visit(FieldAccessExpr n, A arg);
- void visit(InstanceOfExpr n, A arg);
+ void visit(InstanceOfExpr n, A arg);
- void visit(StringLiteralExpr n, A arg);
+ void visit(StringLiteralExpr n, A arg);
- void visit(IntegerLiteralExpr n, A arg);
+ void visit(IntegerLiteralExpr n, A arg);
- void visit(LongLiteralExpr n, A arg);
+ void visit(LongLiteralExpr n, A arg);
- void visit(CharLiteralExpr n, A arg);
+ void visit(CharLiteralExpr n, A arg);
- void visit(DoubleLiteralExpr n, A arg);
+ void visit(DoubleLiteralExpr n, A arg);
- void visit(BooleanLiteralExpr n, A arg);
+ void visit(BooleanLiteralExpr n, A arg);
- void visit(NullLiteralExpr n, A arg);
+ void visit(NullLiteralExpr n, A arg);
- void visit(MethodCallExpr n, A arg);
+ void visit(MethodCallExpr n, A arg);
- void visit(NameExpr n, A arg);
+ void visit(NameExpr n, A arg);
- void visit(ObjectCreationExpr n, A arg);
+ void visit(ObjectCreationExpr n, A arg);
- void visit(ThisExpr n, A arg);
+ void visit(ThisExpr n, A arg);
- void visit(SuperExpr n, A arg);
+ void visit(SuperExpr n, A arg);
- void visit(UnaryExpr n, A arg);
+ void visit(UnaryExpr n, A arg);
- void visit(VariableDeclarationExpr n, A arg);
+ void visit(VariableDeclarationExpr n, A arg);
- void visit(MarkerAnnotationExpr n, A arg);
+ void visit(MarkerAnnotationExpr n, A arg);
- void visit(SingleMemberAnnotationExpr n, A arg);
+ void visit(SingleMemberAnnotationExpr n, A arg);
- void visit(NormalAnnotationExpr n, A arg);
+ void visit(NormalAnnotationExpr n, A arg);
- void visit(MemberValuePair n, A arg);
+ void visit(MemberValuePair n, A arg);
- //- Statements ----------------------------------------
+ //- Statements ----------------------------------------
- void visit(ExplicitConstructorInvocationStmt n, A arg);
+ void visit(ExplicitConstructorInvocationStmt n, A arg);
- void visit(TypeDeclarationStmt n, A arg);
+ void visit(TypeDeclarationStmt n, A arg);
- void visit(AssertStmt n, A arg);
+ void visit(AssertStmt n, A arg);
- void visit(BlockStmt n, A arg);
+ void visit(BlockStmt n, A arg);
- void visit(LabeledStmt n, A arg);
+ void visit(LabeledStmt n, A arg);
- void visit(EmptyStmt n, A arg);
+ void visit(EmptyStmt n, A arg);
- void visit(ExpressionStmt n, A arg);
+ void visit(ExpressionStmt n, A arg);
- void visit(SwitchStmt n, A arg);
+ void visit(SwitchStmt n, A arg);
- void visit(SwitchEntryStmt n, A arg);
+ void visit(SwitchEntryStmt n, A arg);
- void visit(BreakStmt n, A arg);
+ void visit(BreakStmt n, A arg);
- void visit(ReturnStmt n, A arg);
+ void visit(ReturnStmt n, A arg);
- void visit(IfStmt n, A arg);
+ void visit(IfStmt n, A arg);
- void visit(WhileStmt n, A arg);
+ void visit(WhileStmt n, A arg);
- void visit(ContinueStmt n, A arg);
+ void visit(ContinueStmt n, A arg);
- void visit(DoStmt n, A arg);
+ void visit(DoStmt n, A arg);
- void visit(ForeachStmt n, A arg);
+ void visit(ForeachStmt n, A arg);
- void visit(ForStmt n, A arg);
+ void visit(ForStmt n, A arg);
- void visit(ThrowStmt n, A arg);
+ void visit(ThrowStmt n, A arg);
- void visit(SynchronizedStmt n, A arg);
+ void visit(SynchronizedStmt n, A arg);
- void visit(TryStmt n, A arg);
+ void visit(TryStmt n, A arg);
- void visit(CatchClause n, A arg);
+ void visit(CatchClause n, A arg);
void visit(LambdaExpr n, A arg);
@@ -212,19 +212,19 @@ public interface VoidVisitor<A> {
void visit(TypeExpr n, A arg);
- void visit(ArrayBracketPair arrayBracketPair, A arg);
+ void visit(ArrayBracketPair arrayBracketPair, A arg);
- void visit(NodeList n, A arg);
+ void visit(NodeList n, A arg);
- void visit(EmptyImportDeclaration n, A arg);
+ void visit(EmptyImportDeclaration n, A arg);
- void visit(SingleStaticImportDeclaration n, A arg);
+ void visit(SingleStaticImportDeclaration n, A arg);
- void visit(SingleTypeImportDeclaration n, A arg);
+ void visit(SingleTypeImportDeclaration n, A arg);
- void visit(StaticImportOnDemandDeclaration n, A arg);
+ void visit(StaticImportOnDemandDeclaration n, A arg);
- void visit(TypeImportOnDemandDeclaration n, A arg);
+ void visit(TypeImportOnDemandDeclaration n, A arg);
void visit(Name n, A arg);
diff --git a/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java
index 6ca14ce63..103930873 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrintVisitor.java
@@ -103,7 +103,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
NodeList<Type<?>> typeArguments = nodeWithTypeArguments.getTypeArguments().orElse(null);
if (!isNullOrEmpty(typeArguments)) {
printer.print("<");
- for (final Iterator<Type<?>> i = typeArguments.iterator(); i.hasNext();) {
+ for (final Iterator<Type<?>> i = typeArguments.iterator(); i.hasNext(); ) {
final Type<?> t = i.next();
t.accept(this, arg);
if (i.hasNext()) {
@@ -117,7 +117,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
private void printTypeParameters(final NodeList<TypeParameter> args, final Void arg) {
if (!isNullOrEmpty(args)) {
printer.print("<");
- for (final Iterator<TypeParameter> i = args.iterator(); i.hasNext();) {
+ for (final Iterator<TypeParameter> i = args.iterator(); i.hasNext(); ) {
final TypeParameter t = i.next();
t.accept(this, arg);
if (i.hasNext()) {
@@ -131,7 +131,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
private void printArguments(final NodeList<Expression> args, final Void arg) {
printer.print("(");
if (!isNullOrEmpty(args)) {
- for (final Iterator<Expression> i = args.iterator(); i.hasNext();) {
+ for (final Iterator<Expression> i = args.iterator(); i.hasNext(); ) {
final Expression e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
@@ -161,7 +161,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
printer.println();
}
- for (final Iterator<TypeDeclaration<?>> i = n.getTypes().iterator(); i.hasNext();) {
+ for (final Iterator<TypeDeclaration<?>> i = n.getTypes().iterator(); i.hasNext(); ) {
i.next().accept(this, arg);
printer.println();
if (i.hasNext()) {
@@ -227,7 +227,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
if (!n.getExtends().isEmpty()) {
printer.print(" extends ");
- for (final Iterator<ClassOrInterfaceType> i = n.getExtends().iterator(); i.hasNext();) {
+ for (final Iterator<ClassOrInterfaceType> i = n.getExtends().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
@@ -238,7 +238,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
if (!n.getImplements().isEmpty()) {
printer.print(" implements ");
- for (final Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext();) {
+ for (final Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
@@ -306,7 +306,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
n.getName().accept(this, arg);
if (!isNullOrEmpty(n.getTypeBound())) {
printer.print(" extends ");
- for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext();) {
+ for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
@@ -413,7 +413,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
}
printer.print(" ");
- for (final Iterator<VariableDeclarator> i = n.getVariables().iterator(); i.hasNext();) {
+ for (final Iterator<VariableDeclarator> i = n.getVariables().iterator(); i.hasNext(); ) {
final VariableDeclarator var = i.next();
var.accept(this, arg);
if (i.hasNext()) {
@@ -449,7 +449,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
printer.print("{");
if (!isNullOrEmpty(n.getValues())) {
printer.print(" ");
- for (final Iterator<Expression> i = n.getValues().iterator(); i.hasNext();) {
+ for (final Iterator<Expression> i = n.getValues().iterator(); i.hasNext(); ) {
final Expression expr = i.next();
expr.accept(this, arg);
if (i.hasNext()) {
@@ -698,7 +698,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
printer.print("(");
if (!n.getParameters().isEmpty()) {
- for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) {
+ for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext(); ) {
final Parameter p = i.next();
p.accept(this, arg);
if (i.hasNext()) {
@@ -710,7 +710,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
if (!isNullOrEmpty(n.getThrownExceptions())) {
printer.print(" throws ");
- for (final Iterator<ReferenceType<?>> i = n.getThrownExceptions().iterator(); i.hasNext();) {
+ for (final Iterator<ReferenceType<?>> i = n.getThrownExceptions().iterator(); i.hasNext(); ) {
final ReferenceType<?> name = i.next();
name.accept(this, arg);
if (i.hasNext()) {
@@ -746,7 +746,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
printer.print("(");
if (!isNullOrEmpty(n.getParameters())) {
- for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext();) {
+ for (final Iterator<Parameter> i = n.getParameters().iterator(); i.hasNext(); ) {
final Parameter p = i.next();
p.accept(this, arg);
if (i.hasNext()) {
@@ -762,7 +762,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
if (!isNullOrEmpty(n.getThrownExceptions())) {
printer.print(" throws ");
- for (final Iterator<ReferenceType<?>> i = n.getThrownExceptions().iterator(); i.hasNext();) {
+ for (final Iterator<ReferenceType<?>> i = n.getThrownExceptions().iterator(); i.hasNext(); ) {
final ReferenceType name = i.next();
name.accept(this, arg);
if (i.hasNext()) {
@@ -826,7 +826,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
}
printer.print(" ");
- for (final Iterator<VariableDeclarator> i = n.getVariables().iterator(); i.hasNext();) {
+ for (final Iterator<VariableDeclarator> i = n.getVariables().iterator(); i.hasNext(); ) {
final VariableDeclarator v = i.next();
v.accept(this, arg);
if (i.hasNext()) {
@@ -964,7 +964,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
if (!n.getImplements().isEmpty()) {
printer.print(" implements ");
- for (final Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext();) {
+ for (final Iterator<ClassOrInterfaceType> i = n.getImplements().iterator(); i.hasNext(); ) {
final ClassOrInterfaceType c = i.next();
c.accept(this, arg);
if (i.hasNext()) {
@@ -977,7 +977,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
printer.indent();
if (n.getEntries() != null) {
printer.println();
- for (final Iterator<EnumConstantDeclaration> i = n.getEntries().iterator(); i.hasNext();) {
+ for (final Iterator<EnumConstantDeclaration> i = n.getEntries().iterator(); i.hasNext(); ) {
final EnumConstantDeclaration e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
@@ -1112,7 +1112,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
printJavaComment(n.getComment(), arg);
printer.print("for (");
if (n.getInitialization() != null) {
- for (final Iterator<Expression> i = n.getInitialization().iterator(); i.hasNext();) {
+ for (final Iterator<Expression> i = n.getInitialization().iterator(); i.hasNext(); ) {
final Expression e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
@@ -1126,7 +1126,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
}
printer.print("; ");
if (n.getUpdate() != null) {
- for (final Iterator<Expression> i = n.getUpdate().iterator(); i.hasNext();) {
+ for (final Iterator<Expression> i = n.getUpdate().iterator(); i.hasNext(); ) {
final Expression e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
@@ -1259,7 +1259,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
n.getName().accept(this, arg);
printer.print("(");
if (n.getPairs() != null) {
- for (final Iterator<MemberValuePair> i = n.getPairs().iterator(); i.hasNext();) {
+ for (final Iterator<MemberValuePair> i = n.getPairs().iterator(); i.hasNext(); ) {
final MemberValuePair m = i.next();
m.accept(this, arg);
if (i.hasNext()) {
@@ -1308,7 +1308,7 @@ public class PrettyPrintVisitor implements VoidVisitor<Void> {
if (printPar) {
printer.print("(");
}
- for (Iterator<Parameter> i = parameters.iterator(); i.hasNext();) {
+ for (Iterator<Parameter> i = parameters.iterator(); i.hasNext(); ) {
Parameter p = i.next();
p.accept(this, arg);
if (i.hasNext()) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrinterConfiguration.java b/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrinterConfiguration.java
index 9ef921848..6f88bf69c 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrinterConfiguration.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/printer/PrettyPrinterConfiguration.java
@@ -3,7 +3,7 @@ package com.github.javaparser.printer;
public class PrettyPrinterConfiguration {
private boolean printComments = true;
private String indent = " ";
-
+
public String getIndent() {
return indent;
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/utils/ClassUtils.java b/javaparser-core/src/main/java/com/github/javaparser/utils/ClassUtils.java
index 476986812..9a948d713 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/utils/ClassUtils.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/utils/ClassUtils.java
@@ -8,6 +8,7 @@ public class ClassUtils {
* Maps primitive {@code Class}es to their corresponding wrapper {@code Class}.
*/
private static final Map<Class<?>, Class<?>> primitiveWrapperMap = new HashMap<Class<?>, Class<?>>();
+
static {
primitiveWrapperMap.put(Boolean.TYPE, Boolean.class);
primitiveWrapperMap.put(Byte.TYPE, Byte.class);
@@ -24,6 +25,7 @@ public class ClassUtils {
* Maps wrapper {@code Class}es to their corresponding primitive types.
*/
private static final Map<Class<?>, Class<?>> wrapperPrimitiveMap = new HashMap<Class<?>, Class<?>>();
+
static {
for (final Class<?> primitiveClass : primitiveWrapperMap.keySet()) {
final Class<?> wrapperClass = primitiveWrapperMap.get(primitiveClass);
@@ -38,11 +40,9 @@ public class ClassUtils {
* {@link Character},
* {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
*
- * @param type
- * The class to query or null.
- * @return true if the given {@code type} is a primitive or primitive wrapper ({@link Boolean}, {@link Byte},
- * {@link Character},
- * {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
+ * @param type The class to query or null.
+ * @return true if the given {@code type} is a primitive or primitive wrapper ({@link Boolean}, {@link Byte}, {@link
+ * Character}, {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
*/
public static boolean isPrimitiveOrWrapper(final Class<?> type) {
if (type == null) {
@@ -56,11 +56,9 @@ public class ClassUtils {
* {@link Short},
* {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
*
- * @param type
- * The class to query or null.
+ * @param type The class to query or null.
* @return true if the given {@code type} is a primitive wrapper ({@link Boolean}, {@link Byte}, {@link Character},
- * {@link Short},
- * {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
+ * {@link Short}, {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
* @since 3.1
*/
public static boolean isPrimitiveWrapper(final Class<?> type) {
diff --git a/javaparser-core/src/main/java/com/github/javaparser/utils/Pair.java b/javaparser-core/src/main/java/com/github/javaparser/utils/Pair.java
index 40ce85d83..cf459b604 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/utils/Pair.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/utils/Pair.java
@@ -2,15 +2,16 @@ package com.github.javaparser.utils;
/**
* Simply a pair of objects.
+ *
* @param <A> type of object a.
* @param <B> type of object b.
*/
public class Pair<A, B> {
- public final A a;
- public final B b;
+ public final A a;
+ public final B b;
- public Pair(A a, B b) {
- this.a = a;
- this.b = b;
- }
+ public Pair(A a, B b) {
+ this.a = a;
+ this.b = b;
+ }
}
diff --git a/javaparser-core/src/main/java/com/github/javaparser/utils/Utils.java b/javaparser-core/src/main/java/com/github/javaparser/utils/Utils.java
index d91b99c73..8f9ef853b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/utils/Utils.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/utils/Utils.java
@@ -23,11 +23,7 @@ package com.github.javaparser.utils;
import java.io.IOException;
import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
/**
* Any kind of utility.
@@ -35,62 +31,63 @@ import java.util.List;
* @author Federico Tomassetti
*/
public class Utils {
- public static final String EOL = System.getProperty("line.separator");
- public static <T> List<T> ensureNotNull(List<T> list) {
- return list == null ? new ArrayList<>() : list;
- }
+ public static final String EOL = System.getProperty("line.separator");
- public static <E> boolean isNullOrEmpty(Collection<E> collection) {
- return collection == null || collection.isEmpty();
- }
+ public static <T> List<T> ensureNotNull(List<T> list) {
+ return list == null ? new ArrayList<>() : list;
+ }
+ public static <E> boolean isNullOrEmpty(Collection<E> collection) {
+ return collection == null || collection.isEmpty();
+ }
- public static <T> T assertNotNull(T o) {
- if (o == null) {
- throw new AssertionError("A reference was unexpectedly null.");
- }
- return o;
- }
- /**
- * @return string with ASCII characters 10 and 13 replaced by the text "\n" and "\r".
- */
- public static String escapeEndOfLines(String string) {
- StringBuilder escapedString = new StringBuilder();
- for (char c : string.toCharArray()) {
- switch (c) {
- case '\n':
- escapedString.append("\\n");
- break;
- case '\r':
- escapedString.append("\\r");
- break;
- default:
- escapedString.append(c);
- }
- }
- return escapedString.toString();
- }
+ public static <T> T assertNotNull(T o) {
+ if (o == null) {
+ throw new AssertionError("A reference was unexpectedly null.");
+ }
+ return o;
+ }
- public static String readerToString(Reader reader) throws IOException {
- final StringBuilder result = new StringBuilder();
- final char[] buffer = new char[8 * 1024];
- int numChars;
+ /**
+ * @return string with ASCII characters 10 and 13 replaced by the text "\n" and "\r".
+ */
+ public static String escapeEndOfLines(String string) {
+ StringBuilder escapedString = new StringBuilder();
+ for (char c : string.toCharArray()) {
+ switch (c) {
+ case '\n':
+ escapedString.append("\\n");
+ break;
+ case '\r':
+ escapedString.append("\\r");
+ break;
+ default:
+ escapedString.append(c);
+ }
+ }
+ return escapedString.toString();
+ }
- while ((numChars = reader.read(buffer, 0, buffer.length)) > 0) {
- result.append(buffer, 0, numChars);
- }
+ public static String readerToString(Reader reader) throws IOException {
+ final StringBuilder result = new StringBuilder();
+ final char[] buffer = new char[8 * 1024];
+ int numChars;
- return result.toString();
- }
+ while ((numChars = reader.read(buffer, 0, buffer.length)) > 0) {
+ result.append(buffer, 0, numChars);
+ }
- /**
- * Puts varargs in a mutable list.
- * This does not have the disadvantage of Arrays#asList that it has a static size.
- */
- public static <T> List<T> arrayToList(T[] array){
- List<T> list = new LinkedList<>();
- Collections.addAll(list, array);
- return list;
- }
+ return result.toString();
+ }
+
+ /**
+ * Puts varargs in a mutable list.
+ * This does not have the disadvantage of Arrays#asList that it has a static size.
+ */
+ public static <T> List<T> arrayToList(T[] array) {
+ List<T> list = new LinkedList<>();
+ Collections.addAll(list, array);
+ return list;
+ }
}
diff --git a/javaparser-testing/pom.xml b/javaparser-testing/pom.xml
index 4e216a8d4..f0ce90bec 100644
--- a/javaparser-testing/pom.xml
+++ b/javaparser-testing/pom.xml
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>javaparser-parent</artifactId>
<groupId>com.github.javaparser</groupId>
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/ast/NodeListTest.java b/javaparser-testing/src/test/java/com/github/javaparser/ast/NodeListTest.java
index 7988e3072..c6e910df7 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/ast/NodeListTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/ast/NodeListTest.java
@@ -9,7 +9,10 @@ import com.github.javaparser.ast.observing.ObservableProperty;
import com.github.javaparser.ast.type.PrimitiveType;
import org.junit.Test;
-import java.util.*;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.LinkedList;
+import java.util.List;
import static org.junit.Assert.assertEquals;
@@ -19,7 +22,7 @@ public class NodeListTest {
return new AstObserver() {
@Override
public void propertyChange(Node observedNode, ObservableProperty property, Object oldValue, Object newValue) {
- changes.add(String.format("change of property %s for %s: from '%s' to '%s'", property, observedNode, oldValue, newValue ));
+ changes.add(String.format("change of property %s for %s: from '%s' to '%s'", property, observedNode, oldValue, newValue));
}
@Override
@@ -153,7 +156,7 @@ public class NodeListTest {
cd.getMembers().register(createObserver(changes));
cd.getMembers().replaceAll(bodyDeclaration -> {
- FieldDeclaration clone = (FieldDeclaration)bodyDeclaration.clone();
+ FieldDeclaration clone = (FieldDeclaration) bodyDeclaration.clone();
VariableDeclaratorId id = clone.getVariable(0).getIdentifier();
id.setName(id.getName().getIdentifier().toUpperCase());
return clone;
@@ -171,7 +174,7 @@ public class NodeListTest {
ClassOrInterfaceDeclaration cd = cu.getClassByName("A");
cd.getMembers().register(createObserver(changes));
- cd.getMembers().removeIf(m -> ((FieldDeclaration)m).getVariable(0).getIdentifier().getName().getIdentifier().length() > 3);
+ cd.getMembers().removeIf(m -> ((FieldDeclaration) m).getVariable(0).getIdentifier().getName().getIdentifier().length() > 3);
assertEquals(Arrays.asList("'int longName;' REMOVAL in list at 1"), changes);
}
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/ast/imports/ImportDeclarationTest.java b/javaparser-testing/src/test/java/com/github/javaparser/ast/imports/ImportDeclarationTest.java
index fd4e2ed0e..eac28289e 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/ast/imports/ImportDeclarationTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/ast/imports/ImportDeclarationTest.java
@@ -1,10 +1,10 @@
package com.github.javaparser.ast.imports;
-import static org.junit.Assert.assertEquals;
-
import com.github.javaparser.JavaParser;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
public class ImportDeclarationTest {
@Test
public void singleTypeImportDeclaration() {
@@ -34,9 +34,9 @@ public class ImportDeclarationTest {
ImportDeclaration importDeclaration = JavaParser.parseImport("import static a.b.c.X.*;");
StaticImportOnDemandDeclaration i = (StaticImportOnDemandDeclaration) importDeclaration;
assertEquals("X", i.getType().getNameAsString());
- assertEquals("c", i.getType().getScope().get().getNameAsString());
- assertEquals("b", i.getType().getScope().get().getScope().get().getNameAsString());
- assertEquals("a", i.getType().getScope().get().getScope().get().getScope().get().getNameAsString());
+ assertEquals("c", i.getType().getScope().get().getNameAsString());
+ assertEquals("b", i.getType().getScope().get().getScope().get().getNameAsString());
+ assertEquals("a", i.getType().getScope().get().getScope().get().getScope().get().getNameAsString());
}
} \ No newline at end of file
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/ast/junit/visitor/TreeVisitorTest.java b/javaparser-testing/src/test/java/com/github/javaparser/ast/junit/visitor/TreeVisitorTest.java
index ade650d24..14d900257 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/ast/junit/visitor/TreeVisitorTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/ast/junit/visitor/TreeVisitorTest.java
@@ -6,7 +6,7 @@ import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.visitor.TreeVisitor;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
public class TreeVisitorTest {
@Test
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/BasicJBehaveTest.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/BasicJBehaveTest.java
index 56f4e18e8..6b1d53e4c 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/BasicJBehaveTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/BasicJBehaveTest.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd;
@@ -50,15 +50,15 @@ abstract class BasicJBehaveTest extends JUnitStories {
return new MostUsefulConfiguration()
// where to find the stories
.useStoryLoader(new LoadFromClasspath(this.getClass()))
- // Fails if Steps are not implemented
+ // Fails if Steps are not implemented
.usePendingStepStrategy(new FailingUponPendingStep())
- // CONSOLE and HTML reporting
+ // CONSOLE and HTML reporting
.useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats()
.withFormats(Format.CONSOLE, Format.HTML));
}
@Override
- public final List<String> storyPaths() {
+ public final List<String> storyPaths() {
return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()), storiesPath, "");
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/CommentParsingTest.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/CommentParsingTest.java
index 944aedac3..4d1727418 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/CommentParsingTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/CommentParsingTest.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd;
import com.github.javaparser.bdd.steps.CommentParsingSteps;
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/ComparingTest.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/ComparingTest.java
index a93a53342..6111236f4 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/ComparingTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/ComparingTest.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd;
import com.github.javaparser.bdd.steps.ComparingSteps;
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/ManipulationTest.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/ManipulationTest.java
index 649fb528c..17c408ede 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/ManipulationTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/ManipulationTest.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd;
import com.github.javaparser.bdd.steps.ManipulationSteps;
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/ParsingTest.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/ParsingTest.java
index c45380812..c14ce8b95 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/ParsingTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/ParsingTest.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd;
import com.github.javaparser.bdd.steps.ParsingSteps;
@@ -33,7 +33,7 @@ import java.util.Map;
@RunWith(JUnitReportingRunner.class)
public class ParsingTest extends BasicJBehaveTest {
-
+
@Override
public InjectableStepsFactory stepsFactory() {
Map<String, Object> state = new HashMap<>();
@@ -42,7 +42,7 @@ public class ParsingTest extends BasicJBehaveTest {
new SharedSteps(state),
new ParsingSteps(state));
}
-
+
public ParsingTest() {
super("**/bdd/parsing*.story");
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/PositionRangeTest.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/PositionRangeTest.java
index 60db842f4..37aacf0a5 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/PositionRangeTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/PositionRangeTest.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd;
import com.github.javaparser.bdd.steps.PositionRangeSteps;
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/PrettyPrintingTest.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/PrettyPrintingTest.java
index 8eca1e8e2..21957e929 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/PrettyPrintingTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/PrettyPrintingTest.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd;
import com.github.javaparser.bdd.steps.PrettyPrintingSteps;
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/VisitorTest.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/VisitorTest.java
index b295e09bb..2e492dbbb 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/VisitorTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/VisitorTest.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd;
import com.github.javaparser.bdd.steps.SharedSteps;
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/CommentParsingSteps.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/CommentParsingSteps.java
index bef5a0531..b27f42ed0 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/CommentParsingSteps.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/CommentParsingSteps.java
@@ -18,48 +18,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
-package com.github.javaparser.bdd.steps;
-
-import static com.github.javaparser.ParseStart.COMPILATION_UNIT;
-import static com.github.javaparser.Providers.provider;
-import static com.github.javaparser.Range.range;
-import static com.github.javaparser.bdd.TestUtils.getSampleStream;
-import static com.github.javaparser.bdd.steps.SharedSteps.getMemberByTypeAndPosition;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.Iterator;
-import java.util.Set;
-import com.github.javaparser.Range;
-import org.jbehave.core.annotations.Alias;
-import org.jbehave.core.annotations.Given;
-import org.jbehave.core.annotations.Then;
-import org.jbehave.core.annotations.When;
-import org.jbehave.core.model.ExamplesTable;
-import org.jbehave.core.steps.Parameters;
+package com.github.javaparser.bdd.steps;
import com.github.javaparser.JavaParser;
import com.github.javaparser.ParseResult;
import com.github.javaparser.ParserConfiguration;
+import com.github.javaparser.Range;
import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
-import com.github.javaparser.ast.body.FieldDeclaration;
-import com.github.javaparser.ast.body.MethodDeclaration;
-import com.github.javaparser.ast.body.TypeDeclaration;
-import com.github.javaparser.ast.body.VariableDeclarator;
-import com.github.javaparser.ast.comments.BlockComment;
-import com.github.javaparser.ast.comments.Comment;
-import com.github.javaparser.ast.comments.CommentsCollection;
-import com.github.javaparser.ast.comments.JavadocComment;
-import com.github.javaparser.ast.comments.LineComment;
+import com.github.javaparser.ast.body.*;
+import com.github.javaparser.ast.comments.*;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.IntegerLiteralExpr;
import com.github.javaparser.ast.stmt.BlockStmt;
@@ -67,6 +35,27 @@ import com.github.javaparser.ast.stmt.ExpressionStmt;
import com.github.javaparser.ast.type.PrimitiveType;
import com.github.javaparser.printer.PrettyPrinter;
import com.github.javaparser.printer.PrettyPrinterConfiguration;
+import org.jbehave.core.annotations.Alias;
+import org.jbehave.core.annotations.Given;
+import org.jbehave.core.annotations.Then;
+import org.jbehave.core.annotations.When;
+import org.jbehave.core.model.ExamplesTable;
+import org.jbehave.core.steps.Parameters;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.Iterator;
+import java.util.Set;
+
+import static com.github.javaparser.ParseStart.COMPILATION_UNIT;
+import static com.github.javaparser.Providers.provider;
+import static com.github.javaparser.Range.range;
+import static com.github.javaparser.bdd.TestUtils.getSampleStream;
+import static com.github.javaparser.bdd.steps.SharedSteps.getMemberByTypeAndPosition;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
public class CommentParsingSteps {
@@ -113,7 +102,7 @@ public class CommentParsingSteps {
@Then("the Java parser cannot parse it because of an error")
public void javaParserCannotParseBecauseOfLexicalErrors() {
ParseResult<CompilationUnit> result = new JavaParser(configuration).parse(COMPILATION_UNIT, provider(sourceUnderTest));
- if(result.isSuccessful()){
+ if (result.isSuccessful()) {
fail("Lexical error expected");
}
}
@@ -132,7 +121,7 @@ public class CommentParsingSteps {
}
return comment;
}
-
+
@Then("line comment $position is \"$expectedContent\"")
public void thenLineCommentIs(int position, String expectedContent) {
LineComment lineCommentUnderTest = getCommentAt(commentsCollection.getLineComments(), position - 1);
@@ -149,7 +138,7 @@ public class CommentParsingSteps {
@Then("Javadoc comment $position is \"$expectedContent\"")
public void thenJavadocCommentIs(int position, String expectedContent) {
- JavadocComment commentUnderTest = getCommentAt(commentsCollection.getJavadocComments(), position- 1);
+ JavadocComment commentUnderTest = getCommentAt(commentsCollection.getJavadocComments(), position - 1);
assertThat(commentUnderTest.getContent(), is(equalToIgnoringWhiteSpace(expectedContent)));
}
@@ -157,25 +146,25 @@ public class CommentParsingSteps {
@Then("the line comments have the following positions: $table")
public void thenTheLineCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) {
int index = 0;
- for(Parameters exampleRow : examplesTable.getRowsAsParameters()){
+ for (Parameters exampleRow : examplesTable.getRowsAsParameters()) {
Comment expectedLineComment = toComment(exampleRow, new LineComment());
Comment lineCommentUnderTest = getCommentAt(commentsCollection.getLineComments(), index);
Range underTestRange = lineCommentUnderTest.getRange().get();
Range expectedRange = expectedLineComment.getRange().get();
-
+
assertThat(underTestRange.begin.line, is(expectedRange.begin.line));
assertThat(underTestRange.begin.column, is(expectedRange.begin.column));
assertThat(underTestRange.end.line, is(expectedRange.end.line));
assertThat(underTestRange.end.column, is(expectedRange.end.column));
- index ++;
+ index++;
}
}
@Then("the block comments have the following positions: $table")
public void thenTheBlockCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) {
int index = 0;
- for(Parameters exampleRow : examplesTable.getRowsAsParameters()){
+ for (Parameters exampleRow : examplesTable.getRowsAsParameters()) {
Comment expectedLineComment = toComment(exampleRow, new BlockComment());
Comment lineCommentUnderTest = getCommentAt(commentsCollection.getBlockComments(), index);
@@ -186,14 +175,14 @@ public class CommentParsingSteps {
assertThat(underTestRange.begin.column, is(expectedRange.begin.column));
assertThat(underTestRange.end.line, is(expectedRange.end.line));
assertThat(underTestRange.end.column, is(expectedRange.end.column));
- index ++;
+ index++;
}
}
@Then("the Javadoc comments have the following positions: $table")
public void thenTheJavadocCommentsHaveTheFollowingPositions(ExamplesTable examplesTable) {
int index = 0;
- for(Parameters exampleRow : examplesTable.getRowsAsParameters()){
+ for (Parameters exampleRow : examplesTable.getRowsAsParameters()) {
Comment expectedLineComment = toComment(exampleRow, new BlockComment());
Comment lineCommentUnderTest = getCommentAt(commentsCollection.getJavadocComments(), index);
@@ -204,7 +193,7 @@ public class CommentParsingSteps {
assertThat(underTestRange.begin.column, is(expectedRange.begin.column));
assertThat(underTestRange.end.line, is(expectedRange.end.line));
assertThat(underTestRange.end.column, is(expectedRange.end.column));
- index ++;
+ index++;
}
}
@@ -259,39 +248,39 @@ public class CommentParsingSteps {
@Then("class $position is not commented")
public void thenClassIsNotCommented(int position) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(position - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(position - 1);
assertThat(classUnderTest.getComment(), is(nullValue()));
}
@Then("class $position is commented \"$expectedContent\"")
public void thenClassIsCommented(int position, String expectedContent) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(position - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(position - 1);
assertThat(classUnderTest.getComment().getContent(), is(expectedContent));
}
@Then("class $position has $expectedCount total contained comments")
public void thenClassHasTotalContainedComments(int position, int expectedCount) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(position - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(position - 1);
assertThat(classUnderTest.getAllContainedComments().size(), is(expectedCount));
}
@Then("class $position has $expectedCount orphan comment")
@Alias("class $position has $expectedCount orphan comments")
public void thenClassHasOrphanComments(int position, int expectedCount) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(position - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(position - 1);
assertThat(classUnderTest.getOrphanComments().size(), is(expectedCount));
}
@Then("class $classPosition orphan comment $commentPosition is \"$expectedContent\"")
public void thenClassOrphanCommentIs(int classPosition, int commentPosition, String expectedContent) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
- Comment commentUnderTest = classUnderTest.getOrphanComments().get(commentPosition -1 );
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ Comment commentUnderTest = classUnderTest.getOrphanComments().get(commentPosition - 1);
assertThat(commentUnderTest.getContent(), is(equalToIgnoringWhiteSpace(expectedContent)));
}
@Then("method $methodPosition in class $classPosition is commented \"$expectedContent\"")
public void thenMethodInClassIsCommented(int methodPosition, int classPosition, String expectedContent) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
MethodDeclaration.class);
assertThat(methodUnderTest.getComment().getContent(), equalToIgnoringWhiteSpace(expectedContent));
@@ -299,7 +288,7 @@ public class CommentParsingSteps {
@Then("method $methodPosition in class $classPosition has $expectedCount total contained comments")
public void thenMethodInClassHasTotalContainedComments(int methodPosition, int classPosition, int expectedCount) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
MethodDeclaration.class);
assertThat(methodUnderTest.getAllContainedComments().size(), is(expectedCount));
@@ -307,7 +296,7 @@ public class CommentParsingSteps {
@Then("comment $commentPosition in method $methodPosition in class $classPosition is \"$expectedContent\"")
public void thenCommentInMethodInClassIs(int commentPosition, int methodPosition, int classPosition, String expectedContent) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
MethodDeclaration.class);
Comment commentUnderTest = methodUnderTest.getAllContainedComments().get(commentPosition - 1);
@@ -316,7 +305,7 @@ public class CommentParsingSteps {
@Then("method $methodPosition in class $classPosition has $expectedCount orphan comments")
public void thenMethodInClassHasOrphanComments(int methodPosition, int classPosition, int expectedCount) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
MethodDeclaration.class);
assertThat(methodUnderTest.getOrphanComments().size(), is(expectedCount));
@@ -324,36 +313,36 @@ public class CommentParsingSteps {
@Then("block statement in method $methodPosition in class $classPosition has $expectedCount total contained comments")
public void thenBlockStatementInMethodInClassHasTotalContainedComments(int methodPosition, int classPosition, int expectedCount) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
MethodDeclaration.class);
- BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null);
+ BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null);
assertThat(blockStmtUnderTest.getAllContainedComments().size(), is(expectedCount));
}
@Then("block statement in method $methodPosition in class $classPosition has $expectedCount orphan comments")
public void thenBlockStatementInMethodInClassHasOrphanComments(int methodPosition, int classPosition, int expectedCount) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
MethodDeclaration.class);
- BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null);
+ BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null);
assertThat(blockStmtUnderTest.getOrphanComments().size(), is(expectedCount));
}
@Then("block statement in method $methodPosition in class $classPosition orphan comment $commentPosition is \"$expectedContent\"")
public void thenBlockStatementInMethodInClassIs(int methodPosition, int classPosition, int commentPosition, String expectedContent) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
- MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition -1,
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
MethodDeclaration.class);
- BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null);
+ BlockStmt blockStmtUnderTest = methodUnderTest.getBody().orElse(null);
Comment commentUnderTest = blockStmtUnderTest.getOrphanComments().get(commentPosition - 1);
assertThat(commentUnderTest.getContent(), is(equalToIgnoringWhiteSpace(expectedContent)));
}
@Then("type of method $methodPosition in class $classPosition is commented \"$expectedContent\"")
public void thenTypeOfMethodInClassIsCommented(int methodPosition, int classPosition, String expectedContent) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
- MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition -1,
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
MethodDeclaration.class);
Comment commentUnderTest = methodUnderTest.getType().getComment();
assertThat(commentUnderTest.getContent(), is(equalToIgnoringWhiteSpace(expectedContent)));
@@ -361,7 +350,7 @@ public class CommentParsingSteps {
@Then("field $fieldPosition in class $classPosition contains $expectedCount comments")
public void thenFieldInClassContainsComments(int fieldPosition, int classPosition, int expectedCount) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
FieldDeclaration fieldUnderTest = (FieldDeclaration) getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1,
FieldDeclaration.class);
assertThat(fieldUnderTest.getAllContainedComments().size(), is(expectedCount));
@@ -369,7 +358,7 @@ public class CommentParsingSteps {
@Then("field $fieldPosition in class $classPosition is not commented")
public void thenFieldInClassIsNotCommented(int fieldPosition, int classPosition) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
FieldDeclaration fieldUnderTest = (FieldDeclaration) getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1,
FieldDeclaration.class);
assertThat(fieldUnderTest.getComment(), is(nullValue()));
@@ -377,7 +366,7 @@ public class CommentParsingSteps {
@Then("field $fieldPosition in class $classPosition is commented \"$expectedContent\"")
public void thenFieldInClassIsCommented(int fieldPosition, int classPosition, String expectedContent) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
FieldDeclaration fieldUnderTest = (FieldDeclaration) getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1,
FieldDeclaration.class);
Comment commentUnderTest = fieldUnderTest.getComment();
@@ -386,11 +375,11 @@ public class CommentParsingSteps {
@Then("variable $variablePosition value of field $fieldPosition in class $classPosition is commented \"$expectedContent\"")
public void thenVariableValueOfFieldInClassIsCommented(int variablePosition, int fieldPosition, int classPosition, String expectedContent) {
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
FieldDeclaration fieldUnderTest = (FieldDeclaration) getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1,
FieldDeclaration.class);
VariableDeclarator variableUnderTest = fieldUnderTest.getVariable(variablePosition - 1);
- Expression valueUnderTest = variableUnderTest.getInitializer().orElse(null);
+ Expression valueUnderTest = variableUnderTest.getInitializer().orElse(null);
Comment commentUnderTest = valueUnderTest.getComment();
assertThat(commentUnderTest.getContent(), is(expectedContent));
}
@@ -398,37 +387,37 @@ public class CommentParsingSteps {
@Then("comment $commentPosition in compilation unit parent is ClassOrInterfaceDeclaration")
public void thenCommentInCompilationUnitParentIsClassOrInterfaceDeclaration(int commentPosition) {
Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1);
- assertThat(commentUnderTest.getParentNode().get(), instanceOf(ClassOrInterfaceDeclaration.class));
+ assertThat(commentUnderTest.getParentNode().get(), instanceOf(ClassOrInterfaceDeclaration.class));
}
@Then("comment $commentPosition in compilation unit commented node is ClassOrInterfaceDeclaration")
public void thenCommentInCompilationUnitCommentedNodeIsClassOrInterfaceDeclaration(int commentPosition) {
Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1);
- assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(ClassOrInterfaceDeclaration.class));
+ assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(ClassOrInterfaceDeclaration.class));
}
@Then("comment $commentPosition in compilation unit commented node is FieldDeclaration")
public void thenCommentInCompilationUnitCommentedNodeIsFieldDeclaration(int commentPosition) {
Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1);
- assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(FieldDeclaration.class));
+ assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(FieldDeclaration.class));
}
@Then("comment $commentPosition in compilation unit commented node is IntegerLiteralExpr")
public void thenCommentInCompilationUnitCommentedNodeIsIntegerLiteralExpr(int commentPosition) {
Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1);
- assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(IntegerLiteralExpr.class));
+ assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(IntegerLiteralExpr.class));
}
@Then("comment $commentPosition in compilation unit commented node is ExpressionStmt")
public void thenCommentInCompilationUnitCommentedNodeIsIntegerExpressionStmt(int commentPosition) {
Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1);
- assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(ExpressionStmt.class));
+ assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(ExpressionStmt.class));
}
@Then("comment $commentPosition in compilation unit commented node is PrimitiveType")
public void thenCommentInCompilationUnitCommentedNodeIsIntegerPrimitiveType(int commentPosition) {
Comment commentUnderTest = compilationUnit.getAllContainedComments().get(commentPosition - 1);
- assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(PrimitiveType.class));
+ assertThat(commentUnderTest.getCommentedNode().get(), instanceOf(PrimitiveType.class));
}
private Comment toComment(Parameters row, Comment comment) {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ComparingSteps.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ComparingSteps.java
index a93ec79b9..4b789a797 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ComparingSteps.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ComparingSteps.java
@@ -22,15 +22,13 @@
package com.github.javaparser.bdd.steps;
import com.github.javaparser.JavaParser;
-import com.github.javaparser.ParseProblemException;
import com.github.javaparser.ast.CompilationUnit;
-import static org.hamcrest.CoreMatchers.*;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
-import java.io.StringReader;
-
-import static org.junit.Assert.*;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
public class ComparingSteps {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ExistenceOfParentNodeVerifier.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ExistenceOfParentNodeVerifier.java
index 54be1667e..a29c0766b 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ExistenceOfParentNodeVerifier.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ExistenceOfParentNodeVerifier.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd.steps;
import com.github.javaparser.HasParentNode;
@@ -48,7 +48,7 @@ class ExistenceOfParentNodeVerifier {
private static class Verifier extends VoidVisitorAdapter<Void> {
private static void assertParentIsSet(HasParentNode<?> n) {
- assertThat(n + " has no parent set!", n.getParentNode().orElse(null), is(notNullValue()));
+ assertThat(n + " has no parent set!", n.getParentNode().orElse(null), is(notNullValue()));
}
@Override
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ManipulationSteps.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ManipulationSteps.java
index 66dca1517..f27e557be 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ManipulationSteps.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ManipulationSteps.java
@@ -18,23 +18,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
-package com.github.javaparser.bdd.steps;
-
-import static com.github.javaparser.ast.NodeList.nodeList;
-import static com.github.javaparser.ast.type.PrimitiveType.INT_TYPE;
-import static com.github.javaparser.bdd.steps.SharedSteps.getMethodByPositionAndClassPosition;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThat;
-import java.util.EnumSet;
-import java.util.Map;
-
-import org.jbehave.core.annotations.Alias;
-import org.jbehave.core.annotations.Given;
-import org.jbehave.core.annotations.Then;
-import org.jbehave.core.annotations.When;
+package com.github.javaparser.bdd.steps;
import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
@@ -45,18 +30,27 @@ import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.Parameter;
import com.github.javaparser.ast.body.TypeDeclaration;
-import com.github.javaparser.ast.expr.FieldAccessExpr;
-import com.github.javaparser.ast.expr.MethodCallExpr;
-import com.github.javaparser.ast.expr.Name;
-import com.github.javaparser.ast.expr.NameExpr;
-import com.github.javaparser.ast.expr.StringLiteralExpr;
-import com.github.javaparser.ast.expr.VariableDeclarationExpr;
+import com.github.javaparser.ast.expr.*;
import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.ast.stmt.Statement;
import com.github.javaparser.ast.stmt.TryStmt;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.type.VoidType;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
+import org.jbehave.core.annotations.Alias;
+import org.jbehave.core.annotations.Given;
+import org.jbehave.core.annotations.Then;
+import org.jbehave.core.annotations.When;
+
+import java.util.EnumSet;
+import java.util.Map;
+
+import static com.github.javaparser.ast.NodeList.nodeList;
+import static com.github.javaparser.ast.type.PrimitiveType.INT_TYPE;
+import static com.github.javaparser.bdd.steps.SharedSteps.getMethodByPositionAndClassPosition;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertThat;
public class ManipulationSteps {
@@ -71,7 +65,7 @@ public class ManipulationSteps {
/* Map that maintains shares state across step classes. If manipulating the objects in the map you must update the state */
private Map<String, Object> state;
- public ManipulationSteps(Map<String, Object> state){
+ public ManipulationSteps(Map<String, Object> state) {
this.state = state;
}
@@ -114,7 +108,7 @@ public class ManipulationSteps {
@When("is the String \"$value\" is parsed by the JavaParser using parseStatement")
public void whenIsTheStringIsParsedByTheJavaParserUsingParseStatement(String value) {
- statement= JavaParser.parseStatement(value);
+ statement = JavaParser.parseStatement(value);
}
@When("the List of VariableDeclarations are set as the resources on TryStmt")
@@ -137,7 +131,7 @@ public class ManipulationSteps {
@When("a public class called \"$className\" is added to the CompilationUnit")
public void whenAClassCalledIsAddedToTheCompilationUnit(String className) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
- TypeDeclaration<?> type = new ClassOrInterfaceDeclaration(EnumSet.of(Modifier.PUBLIC), false, "CreateClass");
+ TypeDeclaration<?> type = new ClassOrInterfaceDeclaration(EnumSet.of(Modifier.PUBLIC), false, "CreateClass");
compilationUnit.setTypes(nodeList(type));
state.put("cu1", compilationUnit);
}
@@ -145,11 +139,11 @@ public class ManipulationSteps {
@When("a public static method called \"$methodName\" returning void is added to class $position in the compilation unit")
public void whenAStaticMethodCalledReturningIsAddedToClassInTheCompilationUnit(String methodName, int position) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
- TypeDeclaration<?> type = compilationUnit.getType(position -1);
- EnumSet<Modifier> modifiers = EnumSet.of(Modifier.PUBLIC);
- MethodDeclaration method = new MethodDeclaration(modifiers, new VoidType(), methodName);
- modifiers.add(Modifier.STATIC);
- method.setModifiers(modifiers);
+ TypeDeclaration<?> type = compilationUnit.getType(position - 1);
+ EnumSet<Modifier> modifiers = EnumSet.of(Modifier.PUBLIC);
+ MethodDeclaration method = new MethodDeclaration(modifiers, new VoidType(), methodName);
+ modifiers.add(Modifier.STATIC);
+ method.setModifiers(modifiers);
type.addMember(method);
state.put("cu1", compilationUnit);
}
@@ -179,7 +173,7 @@ public class ManipulationSteps {
FieldAccessExpr field = new FieldAccessExpr(clazz, fieldName);
MethodCallExpr call = new MethodCallExpr(field, methodName);
call.addArgument(new StringLiteralExpr(stringValue));
- method.getBody().get().addStatement(call);
+ method.getBody().get().addStatement(call);
}
@When("method $methodPosition in class $classPosition has it's name converted to uppercase")
@@ -230,7 +224,7 @@ public class ManipulationSteps {
@Then("Statement $position in BlockStmt toString is \"$expectedContent\"")
public void thenTheBlockStmtContentIs(int position, String expectedContent) {
- Statement statementUnderTest = blockStmt.getStatement(position-1);
+ Statement statementUnderTest = blockStmt.getStatement(position - 1);
assertThat(statementUnderTest.toString(), is(expectedContent));
}
@@ -241,8 +235,8 @@ public class ManipulationSteps {
@Then("all the VariableDeclarations parent is the TryStmt")
public void thenAllTheVariableDeclarationsParentIsTheTryStmt() {
- for(VariableDeclarationExpr expr : variableDeclarationExprList){
- assertThat(expr.getParentNode().get(), is(tryStmt));
+ for (VariableDeclarationExpr expr : variableDeclarationExprList) {
+ assertThat(expr.getParentNode().get(), is(tryStmt));
}
}
@@ -271,7 +265,7 @@ public class ManipulationSteps {
public void thenMethodInClassParameterIsTypeIntCalled(int methodPosition, int classPosition, int parameterPosition, String expectedName) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition);
- Parameter parameter = method.getParameter(parameterPosition -1);
+ Parameter parameter = method.getParameter(parameterPosition - 1);
assertThat(parameter.getType(), is(INT_TYPE));
assertThat(parameter.getIdentifier().getNameAsString(), is(expectedName));
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ParsingSteps.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ParsingSteps.java
index 95ee3da1e..6b50302d9 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ParsingSteps.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/ParsingSteps.java
@@ -21,58 +21,38 @@
package com.github.javaparser.bdd.steps;
-import static com.github.javaparser.ParseStart.COMPILATION_UNIT;
-import static com.github.javaparser.Providers.provider;
-import static com.github.javaparser.bdd.steps.SharedSteps.getMemberByTypeAndPosition;
-import static com.github.javaparser.bdd.steps.SharedSteps.getMethodByPositionAndClassPosition;
-import static java.lang.String.format;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jbehave.core.annotations.Given;
-import org.jbehave.core.annotations.Then;
-import org.jbehave.core.annotations.When;
-
import com.github.javaparser.JavaParser;
import com.github.javaparser.ParseResult;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.PackageDeclaration;
-import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
-import com.github.javaparser.ast.body.ConstructorDeclaration;
-import com.github.javaparser.ast.body.FieldDeclaration;
-import com.github.javaparser.ast.body.MethodDeclaration;
-import com.github.javaparser.ast.body.Parameter;
-import com.github.javaparser.ast.body.TypeDeclaration;
-import com.github.javaparser.ast.body.VariableDeclarator;
-import com.github.javaparser.ast.expr.AnnotationExpr;
-import com.github.javaparser.ast.expr.ArrayCreationExpr;
-import com.github.javaparser.ast.expr.AssignExpr;
-import com.github.javaparser.ast.expr.CastExpr;
-import com.github.javaparser.ast.expr.ConditionalExpr;
-import com.github.javaparser.ast.expr.LambdaExpr;
-import com.github.javaparser.ast.expr.MethodCallExpr;
-import com.github.javaparser.ast.expr.MethodReferenceExpr;
-import com.github.javaparser.ast.expr.NameExpr;
-import com.github.javaparser.ast.expr.ObjectCreationExpr;
-import com.github.javaparser.ast.expr.VariableDeclarationExpr;
+import com.github.javaparser.ast.body.*;
+import com.github.javaparser.ast.expr.*;
import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.ast.stmt.ExpressionStmt;
import com.github.javaparser.ast.stmt.ReturnStmt;
import com.github.javaparser.ast.stmt.Statement;
+import org.jbehave.core.annotations.Given;
+import org.jbehave.core.annotations.Then;
+import org.jbehave.core.annotations.When;
+
+import java.util.List;
+import java.util.Map;
+
+import static com.github.javaparser.ParseStart.COMPILATION_UNIT;
+import static com.github.javaparser.Providers.provider;
+import static com.github.javaparser.bdd.steps.SharedSteps.getMemberByTypeAndPosition;
+import static com.github.javaparser.bdd.steps.SharedSteps.getMethodByPositionAndClassPosition;
+import static java.lang.String.format;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.*;
public class ParsingSteps {
private Map<String, Object> state;
- public ParsingSteps(Map<String, Object> state){
+ public ParsingSteps(Map<String, Object> state) {
this.state = state;
}
@@ -114,32 +94,32 @@ public class ParsingSteps {
@Then("constructor $constructorPosition in class $classPosition declaration as a String is \"$expectedString\"")
public void thenTheConstructorDeclarationAsAStringIs(int constructorPosition, int classPosition, String expectedString) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
- ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration)compilationUnit.getType(classPosition - 1);
- ConstructorDeclaration constructor = (ConstructorDeclaration)clazz.getMember(constructorPosition - 1);
+ ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) compilationUnit.getType(classPosition - 1);
+ ConstructorDeclaration constructor = (ConstructorDeclaration) clazz.getMember(constructorPosition - 1);
assertThat(constructor.getDeclarationAsString(), is(expectedString));
}
@Then("constructor $constructorPosition in class $classPosition declaration short form as a String is \"$expectedString\"")
public void thenConstructorInClassDeclarationShortFormAsAStringIs(int constructorPosition, int classPosition, String expectedString) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
- ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration)compilationUnit.getType(classPosition - 1);
- ConstructorDeclaration constructor = (ConstructorDeclaration)clazz.getMember(constructorPosition - 1);
- assertThat(constructor.getDeclarationAsString(false,false), is(expectedString));
+ ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) compilationUnit.getType(classPosition - 1);
+ ConstructorDeclaration constructor = (ConstructorDeclaration) clazz.getMember(constructorPosition - 1);
+ assertThat(constructor.getDeclarationAsString(false, false), is(expectedString));
}
@Then("method $methodPosition in class $classPosition declaration as a String is \"$expectedString\"")
public void thenMethod1InClass1DeclarationAsAStringIs(int methodPosition, int classPosition, String expectedString) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
- ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration)compilationUnit.getType(classPosition -1);
- MethodDeclaration method = (MethodDeclaration)clazz.getMember(methodPosition -1);
+ ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) compilationUnit.getType(classPosition - 1);
+ MethodDeclaration method = (MethodDeclaration) clazz.getMember(methodPosition - 1);
assertThat(method.getDeclarationAsString(), is(expectedString));
}
@Then("method $methodPosition in class $classPosition declaration as a String short form is \"$expectedString\"")
public void thenMethodInClassDeclarationAsAStringShortFormIs(int methodPosition, int classPosition, String expectedString) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
- ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration)compilationUnit.getType(classPosition - 1);
- MethodDeclaration method = (MethodDeclaration)clazz.getMember(methodPosition -1);
+ ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) compilationUnit.getType(classPosition - 1);
+ MethodDeclaration method = (MethodDeclaration) clazz.getMember(methodPosition - 1);
assertThat(method.getDeclarationAsString(false, false), is(expectedString));
}
@@ -147,7 +127,7 @@ public class ParsingSteps {
public void thenFieldInClassContainsAnnotationValueIs(int fieldPosition, int classPosition, int annotationPosition, String expectedValue) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
- TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
+ TypeDeclaration<?> classUnderTest = compilationUnit.getType(classPosition - 1);
FieldDeclaration fieldUnderTest = (FieldDeclaration) getMemberByTypeAndPosition(classUnderTest, fieldPosition - 1,
FieldDeclaration.class);
AnnotationExpr annotationUnderTest = fieldUnderTest.getAnnotation(annotationPosition - 1);
@@ -175,7 +155,7 @@ public class ParsingSteps {
ExpressionStmt statement = (ExpressionStmt) getStatementInMethodInClass(statementPosition, methodPosition, classPosition);
VariableDeclarationExpr variableDeclarationExpr = (VariableDeclarationExpr) statement.getExpression();
VariableDeclarator variableDeclarator = variableDeclarationExpr.getVariable(0);
- MethodCallExpr methodCallExpr = (MethodCallExpr) variableDeclarator.getInitializer().orElse(null);
+ MethodCallExpr methodCallExpr = (MethodCallExpr) variableDeclarator.getInitializer().orElse(null);
CastExpr castExpr = (CastExpr) methodCallExpr.getArgument(0);
LambdaExpr lambdaExpr = (LambdaExpr) castExpr.getExpression();
assertThat(lambdaExpr.getBody().toString(), is(expectedBody));
@@ -209,20 +189,20 @@ public class ParsingSteps {
public void thenLambdaInStatementInMethodInClassIsParentOfContainedBody(int statementPosition, int methodPosition, int classPosition) {
LambdaExpr lambdaExpr = getLambdaExprInStatementInMethodInClass(statementPosition, methodPosition, classPosition);
Statement body = lambdaExpr.getBody();
- assertThat(body.getParentNode().get(), is(lambdaExpr));
+ assertThat(body.getParentNode().get(), is(lambdaExpr));
}
@Then("lambda in statement $statementPosition in method $methodPosition in class $classPosition is parent of contained parameter")
public void thenLambdaInStatementInMethodInClassIsParentOfContainedParameter(int statementPosition, int methodPosition, int classPosition) {
LambdaExpr lambdaExpr = getLambdaExprInStatementInMethodInClass(statementPosition, methodPosition, classPosition);
Parameter parameter = lambdaExpr.getParameter(0);
- assertThat(parameter.getParentNode().get(), is(lambdaExpr));
+ assertThat(parameter.getParentNode().get(), is(lambdaExpr));
}
@Then("method reference in statement $statementPosition in method $methodPosition in class $classPosition scope is $expectedName")
public void thenMethodReferenceInStatementInMethodInClassIsScope(int statementPosition, int methodPosition,
int classPosition, String expectedName) {
- ExpressionStmt statementUnderTest = (ExpressionStmt)getStatementInMethodInClass(statementPosition, methodPosition, classPosition);
+ ExpressionStmt statementUnderTest = (ExpressionStmt) getStatementInMethodInClass(statementPosition, methodPosition, classPosition);
assertEquals(1, statementUnderTest.getNodesByType(MethodReferenceExpr.class).size());
MethodReferenceExpr methodReferenceUnderTest = statementUnderTest.getNodesByType(MethodReferenceExpr.class).get(0);
assertThat(methodReferenceUnderTest.getScope().toString(), is(expectedName));
@@ -263,7 +243,7 @@ public class ParsingSteps {
Statement statement = getStatementInMethodInClass(statementPosition, methodPosition, classPosition);
VariableDeclarationExpr expression = (VariableDeclarationExpr) ((ExpressionStmt) statement).getExpression();
VariableDeclarator variableDeclarator = expression.getVariable(0);
- return (LambdaExpr) variableDeclarator.getInitializer().orElse(null);
+ return (LambdaExpr) variableDeclarator.getInitializer().orElse(null);
}
@Then("all nodes refer to their parent")
@@ -284,9 +264,9 @@ public class ParsingSteps {
@Then("ThenExpr in the conditional expression of the statement $statementPosition in method $methodPosition in class $classPosition is LambdaExpr")
public void thenLambdaInConditionalExpressionInMethodInClassIsParentOfContainedParameter(int statementPosition, int methodPosition, int classPosition) {
- Statement statement = getStatementInMethodInClass(statementPosition, methodPosition, classPosition);
- ReturnStmt returnStmt = (ReturnStmt) statement;
- ConditionalExpr conditionalExpr = (ConditionalExpr) returnStmt.getExpression().orElse(null);
+ Statement statement = getStatementInMethodInClass(statementPosition, methodPosition, classPosition);
+ ReturnStmt returnStmt = (ReturnStmt) statement;
+ ConditionalExpr conditionalExpr = (ConditionalExpr) returnStmt.getExpression().orElse(null);
assertThat(conditionalExpr.getElseExpr().getClass().getName(), is(LambdaExpr.class.getName()));
}
@@ -336,7 +316,7 @@ public class ParsingSteps {
@Then("the Java parser cannot parse it because of an error")
public void javaParserCannotParseBecauseOfLexicalErrors() {
ParseResult<CompilationUnit> result = new JavaParser().parse(COMPILATION_UNIT, provider(sourceUnderTest));
- if(result.isSuccessful()) {
+ if (result.isSuccessful()) {
fail("Lexical error expected");
}
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PositionRangeSteps.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PositionRangeSteps.java
index 7cd0b6b8c..0d7fd896d 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PositionRangeSteps.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PositionRangeSteps.java
@@ -21,104 +21,109 @@
package com.github.javaparser.bdd.steps;
-import com.github.javaparser.*;
-import org.jbehave.core.annotations.*;
-
-import static com.github.javaparser.Position.*;
+import com.github.javaparser.Position;
+import com.github.javaparser.Range;
+import org.jbehave.core.annotations.BeforeScenario;
+import org.jbehave.core.annotations.Given;
+import org.jbehave.core.annotations.Then;
+import org.jbehave.core.annotations.When;
+
+import static com.github.javaparser.Position.pos;
import static com.github.javaparser.Range.range;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
public class PositionRangeSteps {
- private Position position;
- private Position secondPosition;
- private Range range;
- private Range secondRange;
-
- @BeforeScenario
- public void reset() {
- position = null;
- secondPosition = null;
- range = null;
- secondRange = null;
- }
- /*
+ private Position position;
+ private Position secondPosition;
+ private Range range;
+ private Range secondRange;
+
+ @BeforeScenario
+ public void reset() {
+ position = null;
+ secondPosition = null;
+ range = null;
+ secondRange = null;
+ }
+ /*
* Given steps
*/
- @Given("the position $line, $column")
- public void givenThePosition(int line, int column) {
- this.position = pos(line, column);
- }
+ @Given("the position $line, $column")
+ public void givenThePosition(int line, int column) {
+ this.position = pos(line, column);
+ }
- @Given("the range $line1, $column1 - $line2, $column2")
- public void givenTheRange(int line1, int column1, int line2, int column2) {
- this.range = range(line1, column1, line2, column2);
- }
+ @Given("the range $line1, $column1 - $line2, $column2")
+ public void givenTheRange(int line1, int column1, int line2, int column2) {
+ this.range = range(line1, column1, line2, column2);
+ }
/*
* When steps
*/
- @When("I compare to position $line, $column")
- public void iCompareToPosition(int line, int column) {
- secondPosition = pos(line, column);
- }
+ @When("I compare to position $line, $column")
+ public void iCompareToPosition(int line, int column) {
+ secondPosition = pos(line, column);
+ }
- @When("I compare to range $line1, $column1 - $line2, $column2")
- public void whenICompareToRange(int line1, int column1, int line2, int column2) {
- this.secondRange = range(line1, column1, line2, column2);
- }
+ @When("I compare to range $line1, $column1 - $line2, $column2")
+ public void whenICompareToRange(int line1, int column1, int line2, int column2) {
+ this.secondRange = range(line1, column1, line2, column2);
+ }
/*
* Then steps
*/
- @Then("the positions are equal")
- public void thenThePositionsAreEqual() {
- assertTrue(position.equals(secondPosition));
- }
-
- @Then("it is after the {first|} position")
- public void thenItIsAfterTheFirstPosition() {
- if (secondPosition != null) {
- assertTrue(secondPosition.isAfter(position));
- } else {
- assertTrue(secondRange.isAfter(position));
- }
- }
-
- @Then("it is before the {first|} position")
- public void thenItIsBeforeTheFirstPosition() {
- if (secondPosition != null) {
- assertTrue(secondPosition.isBefore(position));
- } else {
- assertTrue(secondRange.isBefore(position));
- }
- }
-
- @Then("the positions are not equal")
- public void thenThePositionsAreNotEqual() {
- assertFalse(position.equals(secondPosition));
- }
-
- @Then("it is not after the {first|} position")
- public void thenItIsNotAfterTheFirstPosition() {
- assertFalse(secondPosition.isAfter(position));
- }
-
- @Then("it is not before the {first|} position")
- public void thenItIsNotBeforeTheFirstPosition() {
- assertFalse(secondPosition.isBefore(position));
- }
-
- @Then("the ranges are equal")
- public void theRangesAreEqual() {
- assertTrue(range.equals(secondRange));
- }
-
- @Then("it is contained in the first range")
- public void itIsContainedInTheFirstRange() {
- assertTrue(range.contains(secondRange));
- }
+ @Then("the positions are equal")
+ public void thenThePositionsAreEqual() {
+ assertTrue(position.equals(secondPosition));
+ }
+
+ @Then("it is after the {first|} position")
+ public void thenItIsAfterTheFirstPosition() {
+ if (secondPosition != null) {
+ assertTrue(secondPosition.isAfter(position));
+ } else {
+ assertTrue(secondRange.isAfter(position));
+ }
+ }
+
+ @Then("it is before the {first|} position")
+ public void thenItIsBeforeTheFirstPosition() {
+ if (secondPosition != null) {
+ assertTrue(secondPosition.isBefore(position));
+ } else {
+ assertTrue(secondRange.isBefore(position));
+ }
+ }
+
+ @Then("the positions are not equal")
+ public void thenThePositionsAreNotEqual() {
+ assertFalse(position.equals(secondPosition));
+ }
+
+ @Then("it is not after the {first|} position")
+ public void thenItIsNotAfterTheFirstPosition() {
+ assertFalse(secondPosition.isAfter(position));
+ }
+
+ @Then("it is not before the {first|} position")
+ public void thenItIsNotBeforeTheFirstPosition() {
+ assertFalse(secondPosition.isBefore(position));
+ }
+
+ @Then("the ranges are equal")
+ public void theRangesAreEqual() {
+ assertTrue(range.equals(secondRange));
+ }
+
+ @Then("it is contained in the first range")
+ public void itIsContainedInTheFirstRange() {
+ assertTrue(range.contains(secondRange));
+ }
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PrettyPrintingSteps.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PrettyPrintingSteps.java
index 55d903a29..196baba64 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PrettyPrintingSteps.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/PrettyPrintingSteps.java
@@ -21,8 +21,14 @@
package com.github.javaparser.bdd.steps;
-import static com.github.javaparser.utils.Utils.readerToString;
-import static org.junit.Assert.assertEquals;
+import com.github.javaparser.JavaParser;
+import com.github.javaparser.ParseException;
+import com.github.javaparser.ast.CompilationUnit;
+import com.github.javaparser.ast.Node;
+import com.github.javaparser.ast.visitor.ModifierVisitorAdapter;
+import org.jbehave.core.annotations.Given;
+import org.jbehave.core.annotations.Then;
+import org.jbehave.core.annotations.When;
import java.io.File;
import java.io.FileReader;
@@ -30,15 +36,8 @@ import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
-import org.jbehave.core.annotations.Given;
-import org.jbehave.core.annotations.Then;
-import org.jbehave.core.annotations.When;
-
-import com.github.javaparser.JavaParser;
-import com.github.javaparser.ParseException;
-import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.Node;
-import com.github.javaparser.ast.visitor.ModifierVisitorAdapter;
+import static com.github.javaparser.utils.Utils.readerToString;
+import static org.junit.Assert.assertEquals;
public class PrettyPrintingSteps {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/SharedSteps.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/SharedSteps.java
index a63ed786e..b26d5106a 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/SharedSteps.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/SharedSteps.java
@@ -18,41 +18,37 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd.steps;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.hamcrest.core.IsNot.not;
-import static org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace;
-import static org.junit.Assert.assertThat;
+import com.github.javaparser.JavaParser;
+import com.github.javaparser.ast.CompilationUnit;
+import com.github.javaparser.ast.body.BodyDeclaration;
+import com.github.javaparser.ast.body.MethodDeclaration;
+import com.github.javaparser.ast.body.TypeDeclaration;
+import org.hamcrest.CoreMatchers;
+import org.jbehave.core.annotations.Given;
+import org.jbehave.core.annotations.Then;
+import org.jbehave.core.annotations.When;
import java.io.File;
import java.io.IOException;
-import java.io.StringReader;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Map;
-import com.github.javaparser.ParseProblemException;
-import org.hamcrest.CoreMatchers;
-import org.jbehave.core.annotations.Given;
-import org.jbehave.core.annotations.Then;
-import org.jbehave.core.annotations.When;
-
-import com.github.javaparser.JavaParser;
-import com.github.javaparser.ParseException;
-import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.body.BodyDeclaration;
-import com.github.javaparser.ast.body.MethodDeclaration;
-import com.github.javaparser.ast.body.TypeDeclaration;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNot.not;
+import static org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace;
+import static org.junit.Assert.assertThat;
public class SharedSteps {
/* Map that maintains shares state across step classes. If manipulating the objects in the map you must update the state */
private Map<String, Object> state;
- public SharedSteps(Map<String, Object> state){
+ public SharedSteps(Map<String, Object> state) {
this.state = state;
}
@@ -134,34 +130,34 @@ public class SharedSteps {
assertThat(compilationUnit.toString(), CoreMatchers.is(equalToIgnoringWhiteSpace(classSrc)));
}
- public static BodyDeclaration<?> getMemberByTypeAndPosition(TypeDeclaration<?> typeDeclaration, int position, Class<? extends BodyDeclaration<?>> typeClass) {
+ public static BodyDeclaration<?> getMemberByTypeAndPosition(TypeDeclaration<?> typeDeclaration, int position, Class<? extends BodyDeclaration<?>> typeClass) {
int typeCount = 0;
- for (BodyDeclaration<?> declaration : typeDeclaration.getMembers()) {
- if(declaration.getClass().equals(typeClass)){
- if(typeCount == position){
+ for (BodyDeclaration<?> declaration : typeDeclaration.getMembers()) {
+ if (declaration.getClass().equals(typeClass)) {
+ if (typeCount == position) {
return declaration;
}
typeCount++;
}
}
- throw new IllegalArgumentException("No member " + typeClass + " at position: " + position );
+ throw new IllegalArgumentException("No member " + typeClass + " at position: " + position);
}
public static MethodDeclaration getMethodByPositionAndClassPosition(CompilationUnit compilationUnit,
- int methodPosition, int classPosition) {
- TypeDeclaration<?> type = compilationUnit.getType(classPosition - 1);
+ int methodPosition, int classPosition) {
+ TypeDeclaration<?> type = compilationUnit.getType(classPosition - 1);
int memberCount = 0;
int methodCount = 0;
- for (BodyDeclaration<?> bodyDeclaration : type.getMembers()) {
- if(bodyDeclaration instanceof MethodDeclaration){
- if(methodCount == methodPosition -1) {
+ for (BodyDeclaration<?> bodyDeclaration : type.getMembers()) {
+ if (bodyDeclaration instanceof MethodDeclaration) {
+ if (methodCount == methodPosition - 1) {
return (MethodDeclaration) type.getMember(memberCount);
}
methodCount++;
}
memberCount++;
}
- throw new IllegalArgumentException("Method not found at position " +methodPosition+ "in class " + classPosition);
+ throw new IllegalArgumentException("Method not found at position " + methodPosition + "in class " + classPosition);
}
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/VisitorSteps.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/VisitorSteps.java
index 5d00a5c10..dc54eeee3 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/VisitorSteps.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/steps/VisitorSteps.java
@@ -18,15 +18,15 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd.steps;
-import com.github.javaparser.bdd.visitors.PositionTestVisitor;
import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.body.*;
+import com.github.javaparser.ast.body.VariableDeclaratorId;
import com.github.javaparser.ast.visitor.CloneVisitor;
import com.github.javaparser.ast.visitor.GenericVisitorAdapter;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
+import com.github.javaparser.bdd.visitors.PositionTestVisitor;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;
@@ -50,7 +50,7 @@ public class VisitorSteps {
/* Map that maintains shares state across step classes. If manipulating the objects in the map you must update the state */
private Map<String, Object> state;
- public VisitorSteps(Map<String, Object> state){
+ public VisitorSteps(Map<String, Object> state) {
this.state = state;
}
@@ -92,7 +92,7 @@ public class VisitorSteps {
@When("the CompilationUnit is cloned to the second CompilationUnit")
public void whenTheSecondCompilationUnitIsCloned() {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
- CompilationUnit compilationUnit2 = (CompilationUnit)compilationUnit.accept(new CloneVisitor(), null);
+ CompilationUnit compilationUnit2 = (CompilationUnit) compilationUnit.accept(new CloneVisitor(), null);
state.put("cu2", compilationUnit2);
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/bdd/visitors/PositionTestVisitor.java b/javaparser-testing/src/test/java/com/github/javaparser/bdd/visitors/PositionTestVisitor.java
index 362b90bcc..dae22cd99 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/bdd/visitors/PositionTestVisitor.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/bdd/visitors/PositionTestVisitor.java
@@ -18,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
+
package com.github.javaparser.bdd.visitors;
import com.github.javaparser.Position;
@@ -42,73 +42,87 @@ public class PositionTestVisitor extends VoidVisitorAdapter<Object> {
private int numberOfNodesVisited;
- @Override public void visit(final AnnotationDeclaration n, final Object arg) {
+ @Override
+ public void visit(final AnnotationDeclaration n, final Object arg) {
doTest(n);
doTest(n.getName());
super.visit(n, arg);
}
- @Override public void visit(final AnnotationMemberDeclaration n, final Object arg) {
+ @Override
+ public void visit(final AnnotationMemberDeclaration n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ArrayAccessExpr n, final Object arg) {
+ @Override
+ public void visit(final ArrayAccessExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ArrayCreationExpr n, final Object arg) {
+ @Override
+ public void visit(final ArrayCreationExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ArrayInitializerExpr n, final Object arg) {
+ @Override
+ public void visit(final ArrayInitializerExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final AssertStmt n, final Object arg) {
+ @Override
+ public void visit(final AssertStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final AssignExpr n, final Object arg) {
+ @Override
+ public void visit(final AssignExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final BinaryExpr n, final Object arg) {
+ @Override
+ public void visit(final BinaryExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final BlockComment n, final Object arg) {
+ @Override
+ public void visit(final BlockComment n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final BlockStmt n, final Object arg) {
+ @Override
+ public void visit(final BlockStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final BooleanLiteralExpr n, final Object arg) {
+ @Override
+ public void visit(final BooleanLiteralExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final BreakStmt n, final Object arg) {
+ @Override
+ public void visit(final BreakStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final CastExpr n, final Object arg) {
+ @Override
+ public void visit(final CastExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final CatchClause n, final Object arg) {
+ @Override
+ public void visit(final CatchClause n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
@@ -167,215 +181,257 @@ public class PositionTestVisitor extends VoidVisitorAdapter<Object> {
super.visit(n, arg);
}
- @Override public void visit(final CharLiteralExpr n, final Object arg) {
+ @Override
+ public void visit(final CharLiteralExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ClassExpr n, final Object arg) {
+ @Override
+ public void visit(final ClassExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ClassOrInterfaceDeclaration n, final Object arg) {
+ @Override
+ public void visit(final ClassOrInterfaceDeclaration n, final Object arg) {
doTest(n);
doTest(n.getName());
super.visit(n, arg);
}
- @Override public void visit(final ClassOrInterfaceType n, final Object arg) {
+ @Override
+ public void visit(final ClassOrInterfaceType n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final CompilationUnit n, final Object arg) {
+ @Override
+ public void visit(final CompilationUnit n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ConditionalExpr n, final Object arg) {
+ @Override
+ public void visit(final ConditionalExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ConstructorDeclaration n, final Object arg) {
+ @Override
+ public void visit(final ConstructorDeclaration n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ContinueStmt n, final Object arg) {
+ @Override
+ public void visit(final ContinueStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final DoStmt n, final Object arg) {
+ @Override
+ public void visit(final DoStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final DoubleLiteralExpr n, final Object arg) {
+ @Override
+ public void visit(final DoubleLiteralExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final EmptyMemberDeclaration n, final Object arg) {
+ @Override
+ public void visit(final EmptyMemberDeclaration n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final EmptyStmt n, final Object arg) {
+ @Override
+ public void visit(final EmptyStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final EmptyTypeDeclaration n, final Object arg) {
+ @Override
+ public void visit(final EmptyTypeDeclaration n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final EnclosedExpr n, final Object arg) {
+ @Override
+ public void visit(final EnclosedExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final EnumConstantDeclaration n, final Object arg) {
+ @Override
+ public void visit(final EnumConstantDeclaration n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final EnumDeclaration n, final Object arg) {
+ @Override
+ public void visit(final EnumDeclaration n, final Object arg) {
doTest(n);
doTest(n.getName());
super.visit(n, arg);
}
- @Override public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
+ @Override
+ public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ExpressionStmt n, final Object arg) {
+ @Override
+ public void visit(final ExpressionStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final FieldAccessExpr n, final Object arg) {
+ @Override
+ public void visit(final FieldAccessExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final FieldDeclaration n, final Object arg) {
+ @Override
+ public void visit(final FieldDeclaration n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ForeachStmt n, final Object arg) {
+ @Override
+ public void visit(final ForeachStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ForStmt n, final Object arg) {
+ @Override
+ public void visit(final ForStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final IfStmt n, final Object arg) {
+ @Override
+ public void visit(final IfStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final InitializerDeclaration n, final Object arg) {
+ @Override
+ public void visit(final InitializerDeclaration n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final InstanceOfExpr n, final Object arg) {
+ @Override
+ public void visit(final InstanceOfExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final IntegerLiteralExpr n, final Object arg) {
+ @Override
+ public void visit(final IntegerLiteralExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final JavadocComment n, final Object arg) {
+ @Override
+ public void visit(final JavadocComment n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final LabeledStmt n, final Object arg) {
+ @Override
+ public void visit(final LabeledStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final LineComment n, final Object arg) {
+ @Override
+ public void visit(final LineComment n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final LongLiteralExpr n, final Object arg) {
+ @Override
+ public void visit(final LongLiteralExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final MarkerAnnotationExpr n, final Object arg) {
+ @Override
+ public void visit(final MarkerAnnotationExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final MemberValuePair n, final Object arg) {
+ @Override
+ public void visit(final MemberValuePair n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final MethodCallExpr n, final Object arg) {
+ @Override
+ public void visit(final MethodCallExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final MethodDeclaration n, final Object arg) {
+ @Override
+ public void visit(final MethodDeclaration n, final Object arg) {
doTest(n);
doTest(n.getName());
super.visit(n, arg);
}
- @Override public void visit(final NameExpr n, final Object arg) {
+ @Override
+ public void visit(final NameExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final NormalAnnotationExpr n, final Object arg) {
+ @Override
+ public void visit(final NormalAnnotationExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final NullLiteralExpr n, final Object arg) {
+ @Override
+ public void visit(final NullLiteralExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ObjectCreationExpr n, final Object arg) {
+ @Override
+ public void visit(final ObjectCreationExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final PackageDeclaration n, final Object arg) {
+ @Override
+ public void visit(final PackageDeclaration n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final Parameter n, final Object arg) {
+ @Override
+ public void visit(final Parameter n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final PrimitiveType n, final Object arg) {
+ @Override
+ public void visit(final PrimitiveType n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final Name n, final Object arg) {
+ @Override
+ public void visit(final Name n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
@@ -398,7 +454,8 @@ public class PositionTestVisitor extends VoidVisitorAdapter<Object> {
super.visit(n, arg);
}
- @Override public void visit(final IntersectionType n, final Object arg) {
+ @Override
+ public void visit(final IntersectionType n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
@@ -409,97 +466,116 @@ public class PositionTestVisitor extends VoidVisitorAdapter<Object> {
super.visit(n, arg);
}
- @Override public void visit(final ReturnStmt n, final Object arg) {
+ @Override
+ public void visit(final ReturnStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final SingleMemberAnnotationExpr n, final Object arg) {
+ @Override
+ public void visit(final SingleMemberAnnotationExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final StringLiteralExpr n, final Object arg) {
+ @Override
+ public void visit(final StringLiteralExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final SuperExpr n, final Object arg) {
+ @Override
+ public void visit(final SuperExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final SwitchEntryStmt n, final Object arg) {
+ @Override
+ public void visit(final SwitchEntryStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final SwitchStmt n, final Object arg) {
+ @Override
+ public void visit(final SwitchStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final SynchronizedStmt n, final Object arg) {
+ @Override
+ public void visit(final SynchronizedStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ThisExpr n, final Object arg) {
+ @Override
+ public void visit(final ThisExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final ThrowStmt n, final Object arg) {
+ @Override
+ public void visit(final ThrowStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final TryStmt n, final Object arg) {
+ @Override
+ public void visit(final TryStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final TypeDeclarationStmt n, final Object arg) {
+ @Override
+ public void visit(final TypeDeclarationStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final TypeParameter n, final Object arg) {
+ @Override
+ public void visit(final TypeParameter n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final UnaryExpr n, final Object arg) {
+ @Override
+ public void visit(final UnaryExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final VariableDeclarationExpr n, final Object arg) {
+ @Override
+ public void visit(final VariableDeclarationExpr n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final VariableDeclarator n, final Object arg) {
+ @Override
+ public void visit(final VariableDeclarator n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final VariableDeclaratorId n, final Object arg) {
+ @Override
+ public void visit(final VariableDeclaratorId n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final VoidType n, final Object arg) {
+ @Override
+ public void visit(final VoidType n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final WhileStmt n, final Object arg) {
+ @Override
+ public void visit(final WhileStmt n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
- @Override public void visit(final WildcardType n, final Object arg) {
+ @Override
+ public void visit(final WildcardType n, final Object arg) {
doTest(n);
super.visit(n, arg);
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/CompilationUnitTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/CompilationUnitTest.java
index 1b8bbbf19..a5aa9352d 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/CompilationUnitTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/CompilationUnitTest.java
@@ -4,7 +4,7 @@ import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
public class CompilationUnitTest {
@Test
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/ParseResultTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/ParseResultTest.java
index 5fa5f0e05..eb854d3ce 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/ParseResultTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/ParseResultTest.java
@@ -5,12 +5,11 @@ import com.github.javaparser.ParseResult;
import com.github.javaparser.ParserConfiguration;
import com.github.javaparser.Problem;
import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.utils.Utils;
import org.junit.Test;
-import static com.github.javaparser.ParseStart.*;
+import static com.github.javaparser.ParseStart.COMPILATION_UNIT;
import static com.github.javaparser.Providers.provider;
-import static com.github.javaparser.utils.Utils.*;
+import static com.github.javaparser.utils.Utils.EOL;
import static org.assertj.core.api.Assertions.assertThat;
public class ParseResultTest {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/CloneVisitorTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/CloneVisitorTest.java
index eeea1c264..2ef61b061 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/CloneVisitorTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/CloneVisitorTest.java
@@ -1,96 +1,82 @@
package com.github.javaparser.junit.ast.visitor;
-import static org.junit.Assert.assertEquals;
+import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.NodeList;
+import com.github.javaparser.ast.body.*;
+import com.github.javaparser.ast.visitor.CloneVisitor;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
-import com.github.javaparser.ast.visitor.CloneVisitor;
-import com.github.javaparser.ast.body.EnumDeclaration;
-import com.github.javaparser.ast.body.TypeDeclaration;
-import com.github.javaparser.ast.body.AnnotationDeclaration;
-import com.github.javaparser.ast.body.EmptyTypeDeclaration;
-import com.github.javaparser.ast.body.BodyDeclaration;
-import com.github.javaparser.ast.body.AnnotationMemberDeclaration;
-import com.github.javaparser.ast.body.ConstructorDeclaration;
-import com.github.javaparser.ast.body.EmptyMemberDeclaration;
-import com.github.javaparser.ast.body.EnumConstantDeclaration;
-import com.github.javaparser.ast.body.FieldDeclaration;
-import com.github.javaparser.ast.body.InitializerDeclaration;
-import com.github.javaparser.ast.body.MethodDeclaration;
-
-import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
-
-public class CloneVisitorTest{
- CompilationUnit cu;
-
- @Before
- public void setUp(){
- cu = new CompilationUnit();
- }
-
- @After
- public void teardown() {
- cu = null;
- }
-
- @Test
- public void cloneJavaDocTest(){
-
- NodeList<BodyDeclaration<?>> bodyDeclarationList = new NodeList<>();
- bodyDeclarationList.add(new AnnotationMemberDeclaration().setJavaDocComment("javadoc"));
- bodyDeclarationList.add(new ConstructorDeclaration().setJavaDocComment("javadoc"));
- bodyDeclarationList.add(new EmptyMemberDeclaration().setJavaDocComment("javadoc"));
- bodyDeclarationList.add(new EnumConstantDeclaration().setJavaDocComment("javadoc"));
- bodyDeclarationList.add(new FieldDeclaration().setJavaDocComment("javadoc"));
- bodyDeclarationList.add(new InitializerDeclaration().setJavaDocComment("javadoc"));
- bodyDeclarationList.add(new MethodDeclaration().setJavaDocComment("javadoc"));
-
- NodeList<TypeDeclaration<?>> typeDeclarationList = new NodeList<>();
- AnnotationDeclaration annotationDeclaration = new AnnotationDeclaration();
- annotationDeclaration.setName("nnotationDeclarationTest");
- typeDeclarationList.add(annotationDeclaration.setJavaDocComment("javadoc"));
-
- EmptyTypeDeclaration emptyTypeDeclaration = new EmptyTypeDeclaration();
- emptyTypeDeclaration.setName("emptyTypeDeclarationTest");
- typeDeclarationList.add(emptyTypeDeclaration.setJavaDocComment("javadoc"));
-
- EnumDeclaration enumDeclaration = new EnumDeclaration();
- enumDeclaration.setName("enumDeclarationTest");
- typeDeclarationList.add(enumDeclaration.setJavaDocComment("javadoc"));
-
- ClassOrInterfaceDeclaration classOrInterfaceDeclaration = new ClassOrInterfaceDeclaration();
- classOrInterfaceDeclaration.setName("classOrInterfaceDeclarationTest");
- typeDeclarationList.add(classOrInterfaceDeclaration.setJavaDocComment("javadoc"));
-
- EmptyTypeDeclaration emptyTypeDeclaration1 = new EmptyTypeDeclaration();
- emptyTypeDeclaration1.setName("emptyTypeDeclarationTest1");
- typeDeclarationList.add(emptyTypeDeclaration.setMembers(bodyDeclarationList));
-
- cu.setTypes(typeDeclarationList);
- CompilationUnit cuClone=(CompilationUnit) new CloneVisitor().visit(cu, null);
-
- NodeList<TypeDeclaration<?>> typeDeclarationListClone = cuClone.getTypes();
- Iterator<TypeDeclaration<?>> typeItr = typeDeclarationListClone.iterator();
- TypeDeclaration<?> typeDeclaration;
- while(typeItr.hasNext()){
- typeDeclaration = typeItr.next();
- if(typeDeclaration.getMembers()==null){
- assertEquals(typeDeclaration.getComment().getContent(),"javadoc");
- }else{
- Iterator<BodyDeclaration<?>> bodyItr = typeDeclaration.getMembers().iterator();
- while(bodyItr.hasNext()){
- BodyDeclaration<?> bodyDeclaration = bodyItr.next();
- assertEquals(bodyDeclaration.getComment().getContent(),"javadoc");
- }
- }
- }
-
- }
-
+
+import static org.junit.Assert.assertEquals;
+
+public class CloneVisitorTest {
+ CompilationUnit cu;
+
+ @Before
+ public void setUp() {
+ cu = new CompilationUnit();
+ }
+
+ @After
+ public void teardown() {
+ cu = null;
+ }
+
+ @Test
+ public void cloneJavaDocTest() {
+
+ NodeList<BodyDeclaration<?>> bodyDeclarationList = new NodeList<>();
+ bodyDeclarationList.add(new AnnotationMemberDeclaration().setJavaDocComment("javadoc"));
+ bodyDeclarationList.add(new ConstructorDeclaration().setJavaDocComment("javadoc"));
+ bodyDeclarationList.add(new EmptyMemberDeclaration().setJavaDocComment("javadoc"));
+ bodyDeclarationList.add(new EnumConstantDeclaration().setJavaDocComment("javadoc"));
+ bodyDeclarationList.add(new FieldDeclaration().setJavaDocComment("javadoc"));
+ bodyDeclarationList.add(new InitializerDeclaration().setJavaDocComment("javadoc"));
+ bodyDeclarationList.add(new MethodDeclaration().setJavaDocComment("javadoc"));
+
+ NodeList<TypeDeclaration<?>> typeDeclarationList = new NodeList<>();
+ AnnotationDeclaration annotationDeclaration = new AnnotationDeclaration();
+ annotationDeclaration.setName("nnotationDeclarationTest");
+ typeDeclarationList.add(annotationDeclaration.setJavaDocComment("javadoc"));
+
+ EmptyTypeDeclaration emptyTypeDeclaration = new EmptyTypeDeclaration();
+ emptyTypeDeclaration.setName("emptyTypeDeclarationTest");
+ typeDeclarationList.add(emptyTypeDeclaration.setJavaDocComment("javadoc"));
+
+ EnumDeclaration enumDeclaration = new EnumDeclaration();
+ enumDeclaration.setName("enumDeclarationTest");
+ typeDeclarationList.add(enumDeclaration.setJavaDocComment("javadoc"));
+
+ ClassOrInterfaceDeclaration classOrInterfaceDeclaration = new ClassOrInterfaceDeclaration();
+ classOrInterfaceDeclaration.setName("classOrInterfaceDeclarationTest");
+ typeDeclarationList.add(classOrInterfaceDeclaration.setJavaDocComment("javadoc"));
+
+ EmptyTypeDeclaration emptyTypeDeclaration1 = new EmptyTypeDeclaration();
+ emptyTypeDeclaration1.setName("emptyTypeDeclarationTest1");
+ typeDeclarationList.add(emptyTypeDeclaration.setMembers(bodyDeclarationList));
+
+ cu.setTypes(typeDeclarationList);
+ CompilationUnit cuClone = (CompilationUnit) new CloneVisitor().visit(cu, null);
+
+ NodeList<TypeDeclaration<?>> typeDeclarationListClone = cuClone.getTypes();
+ Iterator<TypeDeclaration<?>> typeItr = typeDeclarationListClone.iterator();
+ TypeDeclaration<?> typeDeclaration;
+ while (typeItr.hasNext()) {
+ typeDeclaration = typeItr.next();
+ if (typeDeclaration.getMembers() == null) {
+ assertEquals(typeDeclaration.getComment().getContent(), "javadoc");
+ } else {
+ Iterator<BodyDeclaration<?>> bodyItr = typeDeclaration.getMembers().iterator();
+ while (bodyItr.hasNext()) {
+ BodyDeclaration<?> bodyDeclaration = bodyItr.next();
+ assertEquals(bodyDeclaration.getComment().getContent(), "javadoc");
+ }
+ }
+ }
+
+ }
+
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/Visitors.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/Visitors.java
index ffaae6e03..66cd96d3a 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/Visitors.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/ast/visitor/Visitors.java
@@ -1,12 +1,12 @@
package com.github.javaparser.junit.ast.visitor;
-import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.visitor.GenericVisitorAdapter;
import com.github.javaparser.ast.visitor.ModifierVisitorAdapter;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
/**
- * This class tests that all visitors implement all methods, even if the visitors are abstract, by making cnocrete subclasses of them.
+ * This class tests that all visitors implement all methods, even if the visitors are abstract, by making cnocrete
+ * subclasses of them.
*/
class GenericVisitorAdapterTest extends GenericVisitorAdapter<Object, Object> {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/ClassOrInterfaceDeclarationBuildersTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/ClassOrInterfaceDeclarationBuildersTest.java
index ac0891a72..326914a6d 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/ClassOrInterfaceDeclarationBuildersTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/ClassOrInterfaceDeclarationBuildersTest.java
@@ -1,34 +1,32 @@
package com.github.javaparser.junit.builders;
-import static com.github.javaparser.utils.Utils.*;
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-import java.util.function.Function;
-
-import com.github.javaparser.utils.Utils;
+import com.github.javaparser.ast.CompilationUnit;
+import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
+import java.util.List;
+import java.util.function.Function;
+
+import static com.github.javaparser.utils.Utils.EOL;
+import static org.junit.Assert.assertEquals;
public class ClassOrInterfaceDeclarationBuildersTest {
- CompilationUnit cu;
+ CompilationUnit cu;
- @Before
- public void setup() {
- cu = new CompilationUnit();
- }
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ }
- @After
- public void teardown() {
- cu = null;
- }
+ @After
+ public void teardown() {
+ cu = null;
+ }
- @Test
- public void testAddExtends() {
+ @Test
+ public void testAddExtends() {
ClassOrInterfaceDeclaration testClass = cu.addClass("test");
testClass.addExtends(List.class);
assertEquals(1, cu.getImports().size());
@@ -36,7 +34,7 @@ public class ClassOrInterfaceDeclarationBuildersTest {
cu.getImport(0).toString());
assertEquals(1, testClass.getExtends().size());
assertEquals(List.class.getSimpleName(), testClass.getExtends(0).getNameAsString());
- }
+ }
@Test
public void testAddImplements() {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/CompilationUnitBuildersTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/CompilationUnitBuildersTest.java
index 63fdfe0ff..1a8e5c68f 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/CompilationUnitBuildersTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/CompilationUnitBuildersTest.java
@@ -1,48 +1,45 @@
package com.github.javaparser.junit.builders;
-import static com.github.javaparser.utils.Utils.EOL;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Map;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.body.AnnotationDeclaration;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.EnumDeclaration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.List;
+import java.util.Map;
+
+import static com.github.javaparser.utils.Utils.EOL;
+import static org.junit.Assert.*;
public class CompilationUnitBuildersTest {
- CompilationUnit cu;
+ CompilationUnit cu;
- @Before
- public void setup() {
- cu = new CompilationUnit();
- }
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ }
- @After
- public void teardown() {
- cu = null;
- }
+ @After
+ public void teardown() {
+ cu = null;
+ }
- @Test
- public void testAddImport() {
- cu.addImport(Map.class);
- cu.addImport(Map.class);
- cu.addImport(List.class);
- assertEquals(2, cu.getImports().size());
- cu.addImport("myImport");
- assertEquals(3, cu.getImports().size());
- assertEquals("import " + Map.class.getName() + ";" + EOL, cu.getImport(0).toString());
- assertEquals("import " + List.class.getName() + ";" + EOL, cu.getImport(1).toString());
- assertEquals("import myImport;" + EOL, cu.getImport(2).toString());
- }
+ @Test
+ public void testAddImport() {
+ cu.addImport(Map.class);
+ cu.addImport(Map.class);
+ cu.addImport(List.class);
+ assertEquals(2, cu.getImports().size());
+ cu.addImport("myImport");
+ assertEquals(3, cu.getImports().size());
+ assertEquals("import " + Map.class.getName() + ";" + EOL, cu.getImport(0).toString());
+ assertEquals("import " + List.class.getName() + ";" + EOL, cu.getImport(1).toString());
+ assertEquals("import myImport;" + EOL, cu.getImport(2).toString());
+ }
@Test
public void testAddClass() {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/EnumDeclarationBuildersTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/EnumDeclarationBuildersTest.java
index 131942255..556a5512c 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/EnumDeclarationBuildersTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/EnumDeclarationBuildersTest.java
@@ -1,29 +1,28 @@
package com.github.javaparser.junit.builders;
-import static com.github.javaparser.utils.Utils.EOL;
-import static org.junit.Assert.assertEquals;
-
-import java.util.function.Function;
-
+import com.github.javaparser.ast.CompilationUnit;
+import com.github.javaparser.ast.body.EnumDeclaration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.body.EnumDeclaration;
+import java.util.function.Function;
+
+import static com.github.javaparser.utils.Utils.EOL;
+import static org.junit.Assert.assertEquals;
public class EnumDeclarationBuildersTest {
- CompilationUnit cu;
+ CompilationUnit cu;
- @Before
- public void setup() {
- cu = new CompilationUnit();
- }
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ }
- @After
- public void teardown() {
- cu = null;
- }
+ @After
+ public void teardown() {
+ cu = null;
+ }
@Test
public void testAddImplements() {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/FieldDeclarationBuildersTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/FieldDeclarationBuildersTest.java
index b7ccc924e..ba00a5835 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/FieldDeclarationBuildersTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/FieldDeclarationBuildersTest.java
@@ -1,118 +1,112 @@
package com.github.javaparser.junit.builders;
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
-import com.github.javaparser.ast.body.EnumDeclaration;
-import com.github.javaparser.ast.body.FieldDeclaration;
-import com.github.javaparser.ast.body.MethodDeclaration;
-import com.github.javaparser.ast.body.VariableDeclarator;
-import com.github.javaparser.ast.body.VariableDeclaratorId;
+import com.github.javaparser.ast.body.*;
import com.github.javaparser.ast.stmt.ExpressionStmt;
import com.github.javaparser.ast.stmt.ReturnStmt;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-public class FieldDeclarationBuildersTest {
- CompilationUnit cu;
- private ClassOrInterfaceDeclaration testClass;
- private EnumDeclaration testEnum;
-
- @Before
- public void setup() {
- cu = new CompilationUnit();
- testClass = cu.addClass("testClass");
- testEnum = cu.addEnum("testEnum");
- }
-
- @After
- public void teardown() {
- cu = null;
- testClass = null;
- testEnum = null;
- }
-
- @Test(expected = IllegalStateException.class)
- public void testOrphanFieldGetter() {
- new FieldDeclaration().createGetter();
- }
-
- @Test(expected = IllegalStateException.class)
- public void testOrphanFieldSetter() {
- new FieldDeclaration().createSetter();
- }
-
- @Test
- public void testCreateGetterInAClass() {
- testClass.addPrivateField(int.class, "myField").createGetter();
- assertEquals(2, testClass.getMembers().size());
- assertEquals(MethodDeclaration.class, testClass.getMember(1).getClass());
- List<MethodDeclaration> methodsWithName = testClass.getMethodsByName("getMyField");
- assertEquals(1, methodsWithName.size());
- MethodDeclaration getter = methodsWithName.get(0);
- assertEquals("getMyField", getter.getNameAsString());
- assertEquals("int", getter.getType().toString());
- assertEquals(ReturnStmt.class, getter.getBody().get().getStatement(0).getClass());
- }
-
- @Test
- public void testCreateSetterInAClass() {
- testClass.addPrivateField(int.class, "myField").createSetter();
- assertEquals(2, testClass.getMembers().size());
- assertEquals(MethodDeclaration.class, testClass.getMember(1).getClass());
- List<MethodDeclaration> methodsWithName = testClass.getMethodsByName("setMyField");
- assertEquals(1, methodsWithName.size());
- MethodDeclaration setter = methodsWithName.get(0);
- assertEquals("setMyField", setter.getNameAsString());
- assertEquals("int", setter.getParameter(0).getType().toString());
- assertEquals(ExpressionStmt.class, setter.getBody().get().getStatement(0).getClass());
- assertEquals("this.myField = myField;", setter.getBody().get().getStatement(0).toString());
- }
-
- @Test
- public void testCreateGetterInEnum() {
- testEnum.addPrivateField(int.class, "myField").createGetter();
- assertEquals(2, testEnum.getMembers().size());
- assertEquals(MethodDeclaration.class, testEnum.getMember(1).getClass());
- List<MethodDeclaration> methodsWithName = testEnum.getMethodsByName("getMyField");
- assertEquals(1, methodsWithName.size());
- MethodDeclaration getter = methodsWithName.get(0);
- assertEquals("getMyField", getter.getNameAsString());
- assertEquals("int", getter.getType().toString());
- assertEquals(ReturnStmt.class, getter.getBody().get().getStatement(0).getClass());
- }
-
- @Test
- public void testCreateSetterInEnum() {
- testEnum.addPrivateField(int.class, "myField").createSetter();
- assertEquals(2, testEnum.getMembers().size());
- assertEquals(MethodDeclaration.class, testEnum.getMember(1).getClass());
- List<MethodDeclaration> methodsWithName = testEnum.getMethodsByName("setMyField");
- assertEquals(1, methodsWithName.size());
- MethodDeclaration setter = methodsWithName.get(0);
- assertEquals("setMyField", setter.getNameAsString());
- assertEquals("int", setter.getParameter(0).getType().toString());
- assertEquals(ExpressionStmt.class, setter.getBody().get().getStatement(0).getClass());
- assertEquals("this.myField = myField;", setter.getBody().get().getStatement(0).toString());
- }
+import java.util.List;
- @Test(expected = IllegalStateException.class)
- public void testCreateGetterWithANonValidField() {
- FieldDeclaration myPrivateField = testClass.addPrivateField(int.class, "myField");
- myPrivateField.getVariables().add(new VariableDeclarator(new VariableDeclaratorId("secondField")));
- myPrivateField.createGetter();
- }
+import static org.junit.Assert.assertEquals;
- @Test(expected = IllegalStateException.class)
- public void testCreateSetterWithANonValidField() {
- FieldDeclaration myPrivateField = testClass.addPrivateField(int.class, "myField");
- myPrivateField.getVariables().add(new VariableDeclarator(new VariableDeclaratorId("secondField")));
- myPrivateField.createSetter();
- }
+public class FieldDeclarationBuildersTest {
+ CompilationUnit cu;
+ private ClassOrInterfaceDeclaration testClass;
+ private EnumDeclaration testEnum;
+
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ testClass = cu.addClass("testClass");
+ testEnum = cu.addEnum("testEnum");
+ }
+
+ @After
+ public void teardown() {
+ cu = null;
+ testClass = null;
+ testEnum = null;
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testOrphanFieldGetter() {
+ new FieldDeclaration().createGetter();
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testOrphanFieldSetter() {
+ new FieldDeclaration().createSetter();
+ }
+
+ @Test
+ public void testCreateGetterInAClass() {
+ testClass.addPrivateField(int.class, "myField").createGetter();
+ assertEquals(2, testClass.getMembers().size());
+ assertEquals(MethodDeclaration.class, testClass.getMember(1).getClass());
+ List<MethodDeclaration> methodsWithName = testClass.getMethodsByName("getMyField");
+ assertEquals(1, methodsWithName.size());
+ MethodDeclaration getter = methodsWithName.get(0);
+ assertEquals("getMyField", getter.getNameAsString());
+ assertEquals("int", getter.getType().toString());
+ assertEquals(ReturnStmt.class, getter.getBody().get().getStatement(0).getClass());
+ }
+
+ @Test
+ public void testCreateSetterInAClass() {
+ testClass.addPrivateField(int.class, "myField").createSetter();
+ assertEquals(2, testClass.getMembers().size());
+ assertEquals(MethodDeclaration.class, testClass.getMember(1).getClass());
+ List<MethodDeclaration> methodsWithName = testClass.getMethodsByName("setMyField");
+ assertEquals(1, methodsWithName.size());
+ MethodDeclaration setter = methodsWithName.get(0);
+ assertEquals("setMyField", setter.getNameAsString());
+ assertEquals("int", setter.getParameter(0).getType().toString());
+ assertEquals(ExpressionStmt.class, setter.getBody().get().getStatement(0).getClass());
+ assertEquals("this.myField = myField;", setter.getBody().get().getStatement(0).toString());
+ }
+
+ @Test
+ public void testCreateGetterInEnum() {
+ testEnum.addPrivateField(int.class, "myField").createGetter();
+ assertEquals(2, testEnum.getMembers().size());
+ assertEquals(MethodDeclaration.class, testEnum.getMember(1).getClass());
+ List<MethodDeclaration> methodsWithName = testEnum.getMethodsByName("getMyField");
+ assertEquals(1, methodsWithName.size());
+ MethodDeclaration getter = methodsWithName.get(0);
+ assertEquals("getMyField", getter.getNameAsString());
+ assertEquals("int", getter.getType().toString());
+ assertEquals(ReturnStmt.class, getter.getBody().get().getStatement(0).getClass());
+ }
+
+ @Test
+ public void testCreateSetterInEnum() {
+ testEnum.addPrivateField(int.class, "myField").createSetter();
+ assertEquals(2, testEnum.getMembers().size());
+ assertEquals(MethodDeclaration.class, testEnum.getMember(1).getClass());
+ List<MethodDeclaration> methodsWithName = testEnum.getMethodsByName("setMyField");
+ assertEquals(1, methodsWithName.size());
+ MethodDeclaration setter = methodsWithName.get(0);
+ assertEquals("setMyField", setter.getNameAsString());
+ assertEquals("int", setter.getParameter(0).getType().toString());
+ assertEquals(ExpressionStmt.class, setter.getBody().get().getStatement(0).getClass());
+ assertEquals("this.myField = myField;", setter.getBody().get().getStatement(0).toString());
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testCreateGetterWithANonValidField() {
+ FieldDeclaration myPrivateField = testClass.addPrivateField(int.class, "myField");
+ myPrivateField.getVariables().add(new VariableDeclarator(new VariableDeclaratorId("secondField")));
+ myPrivateField.createGetter();
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testCreateSetterWithANonValidField() {
+ FieldDeclaration myPrivateField = testClass.addPrivateField(int.class, "myField");
+ myPrivateField.getVariables().add(new VariableDeclarator(new VariableDeclaratorId("secondField")));
+ myPrivateField.createSetter();
+ }
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithAnnotationsBuildersTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithAnnotationsBuildersTest.java
index f4174832e..7dab0f188 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithAnnotationsBuildersTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithAnnotationsBuildersTest.java
@@ -1,74 +1,73 @@
package com.github.javaparser.junit.builders;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.expr.NormalAnnotationExpr;
import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class NodeWithAnnotationsBuildersTest {
- CompilationUnit cu;
- private ClassOrInterfaceDeclaration testClass;
+ CompilationUnit cu;
+ private ClassOrInterfaceDeclaration testClass;
- @Before
- public void setup() {
- cu = new CompilationUnit();
- testClass = cu.addClass("testClass");
- }
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ testClass = cu.addClass("testClass");
+ }
- @interface hey {
+ @interface hey {
- }
+ }
- @After
- public void teardown() {
- cu = null;
- testClass = null;
- }
+ @After
+ public void teardown() {
+ cu = null;
+ testClass = null;
+ }
- @Test
- public void testAddAnnotation() {
- NormalAnnotationExpr annotation = testClass.addAnnotation(hey.class);
- assertEquals("import com.github.javaparser.junit.builders.NodeWithAnnotationsBuildersTest$hey;", cu.getImport(0).toString().trim());
- assertEquals(1, testClass.getAnnotations().size());
- assertEquals(annotation, testClass.getAnnotation(0));
- assertEquals(NormalAnnotationExpr.class, testClass.getAnnotation(0).getClass());
- }
+ @Test
+ public void testAddAnnotation() {
+ NormalAnnotationExpr annotation = testClass.addAnnotation(hey.class);
+ assertEquals("import com.github.javaparser.junit.builders.NodeWithAnnotationsBuildersTest$hey;", cu.getImport(0).toString().trim());
+ assertEquals(1, testClass.getAnnotations().size());
+ assertEquals(annotation, testClass.getAnnotation(0));
+ assertEquals(NormalAnnotationExpr.class, testClass.getAnnotation(0).getClass());
+ }
- @Test
- public void testAddMarkerAnnotation() {
- testClass.addMarkerAnnotation("test");
- assertEquals(1, testClass.getAnnotations().size());
- }
+ @Test
+ public void testAddMarkerAnnotation() {
+ testClass.addMarkerAnnotation("test");
+ assertEquals(1, testClass.getAnnotations().size());
+ }
- @Test
- public void testAddSingleMemberAnnotation() {
- testClass.addSingleMemberAnnotation("test", "value");
- assertEquals(1, testClass.getAnnotations().size());
- assertEquals("value", ((SingleMemberAnnotationExpr) testClass.getAnnotation(0)).getMemberValue().toString());
- }
+ @Test
+ public void testAddSingleMemberAnnotation() {
+ testClass.addSingleMemberAnnotation("test", "value");
+ assertEquals(1, testClass.getAnnotations().size());
+ assertEquals("value", ((SingleMemberAnnotationExpr) testClass.getAnnotation(0)).getMemberValue().toString());
+ }
- @Test
- public void testIsAnnotationPresent() {
- testClass.addMarkerAnnotation(hey.class);
- assertTrue(testClass.isAnnotationPresent(hey.class));
- }
+ @Test
+ public void testIsAnnotationPresent() {
+ testClass.addMarkerAnnotation(hey.class);
+ assertTrue(testClass.isAnnotationPresent(hey.class));
+ }
- @Test
- public void testGetAnnotationByName() {
- NormalAnnotationExpr annotation = testClass.addAnnotation(hey.class);
- assertEquals(annotation, testClass.getAnnotationByName("hey"));
- }
+ @Test
+ public void testGetAnnotationByName() {
+ NormalAnnotationExpr annotation = testClass.addAnnotation(hey.class);
+ assertEquals(annotation, testClass.getAnnotationByName("hey"));
+ }
- @Test
- public void testGetAnnotationByClass() {
- NormalAnnotationExpr annotation = testClass.addAnnotation(hey.class);
- assertEquals(annotation, testClass.getAnnotationByClass(hey.class));
- }
+ @Test
+ public void testGetAnnotationByClass() {
+ NormalAnnotationExpr annotation = testClass.addAnnotation(hey.class);
+ assertEquals(annotation, testClass.getAnnotationByClass(hey.class));
+ }
} \ No newline at end of file
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithMembersBuildersTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithMembersBuildersTest.java
index bb570687a..574193683 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithMembersBuildersTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithMembersBuildersTest.java
@@ -1,130 +1,125 @@
package com.github.javaparser.junit.builders;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
+import com.github.javaparser.ast.CompilationUnit;
+import com.github.javaparser.ast.Modifier;
+import com.github.javaparser.ast.body.*;
+import com.github.javaparser.ast.type.ClassOrInterfaceType;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import com.github.javaparser.ast.CompilationUnit;
-import com.github.javaparser.ast.Modifier;
-import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
-import com.github.javaparser.ast.body.ConstructorDeclaration;
-import com.github.javaparser.ast.body.FieldDeclaration;
-import com.github.javaparser.ast.body.InitializerDeclaration;
-import com.github.javaparser.ast.body.MethodDeclaration;
-import com.github.javaparser.ast.type.ClassOrInterfaceType;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class NodeWithMembersBuildersTest {
- CompilationUnit cu;
- private ClassOrInterfaceDeclaration classDeclaration;
-
- @Before
- public void setup() {
- cu = new CompilationUnit();
- classDeclaration = cu.addClass("test");
- }
-
- @After
- public void teardown() {
- cu = null;
- classDeclaration = null;
- }
-
- @Test
- public void testAddField() {
- FieldDeclaration addField = classDeclaration.addField(int.class, "fieldName", Modifier.PRIVATE);
- assertEquals(1, classDeclaration.getMembers().size());
- assertEquals(addField, classDeclaration.getMember(0));
- assertEquals("fieldName", addField.getVariable(0).getIdentifier().getNameAsString());
- }
-
- @Test
- public void testAddMethod() {
- MethodDeclaration addMethod = classDeclaration.addMethod("foo", Modifier.PUBLIC);
- assertEquals(1, classDeclaration.getMembers().size());
- assertEquals(addMethod, classDeclaration.getMember(0));
- assertEquals("foo", addMethod.getNameAsString());
- }
-
- @Test
- public void testAddCtor() {
- ConstructorDeclaration addCtor = classDeclaration.addCtor(Modifier.PUBLIC);
- assertEquals(1, classDeclaration.getMembers().size());
- assertEquals(addCtor, classDeclaration.getMember(0));
- assertEquals(classDeclaration.getName(), addCtor.getName());
- }
-
- @Test
- public void testAddInitializers() {
- classDeclaration.addInitializer();
- assertEquals(1, classDeclaration.getMembers().size());
- assertEquals(InitializerDeclaration.class, classDeclaration.getMember(0).getClass());
-
- classDeclaration.addStaticInitializer();
- assertEquals(2, classDeclaration.getMembers().size());
- assertEquals(InitializerDeclaration.class, classDeclaration.getMember(0).getClass());
- }
-
- @Test
- public void testGetMethodsWithName() {
- MethodDeclaration addMethod = classDeclaration.addMethod("foo", Modifier.PUBLIC);
- MethodDeclaration addMethod2 = classDeclaration.addMethod("foo", Modifier.PUBLIC).addParameter(int.class, "overload");
- List<MethodDeclaration> methodsByName = classDeclaration.getMethodsByName("foo");
- assertEquals(2, methodsByName.size());
- assertTrue(methodsByName.contains(addMethod));
- assertTrue(methodsByName.contains(addMethod2));
- }
-
- @Test
- public void testGetMethods() {
- MethodDeclaration addMethod = classDeclaration.addMethod("foo", Modifier.PUBLIC);
- MethodDeclaration addMethod2 = classDeclaration.addMethod("foo", Modifier.PUBLIC).addParameter(int.class, "overload");
-
- List<MethodDeclaration> methods = classDeclaration.getMethods();
-
- assertEquals(2, methods.size());
- assertTrue(methods.contains(addMethod));
- assertTrue(methods.contains(addMethod2));
- }
-
- @Test
- public void testGetMethodsWithParameterTypes() {
- classDeclaration.addMethod("foo", Modifier.PUBLIC);
- MethodDeclaration addMethod2 = classDeclaration.addMethod("foo", Modifier.PUBLIC).addParameter(int.class, "overload");
- ClassOrInterfaceType type = new ClassOrInterfaceType("List");
- type.setTypeArguments(new ClassOrInterfaceType("String"));
- MethodDeclaration methodWithListParam = classDeclaration.addMethod("fooList", Modifier.PUBLIC).addParameter(type, "overload");
- MethodDeclaration addMethod3 = classDeclaration.addMethod("foo2", Modifier.PUBLIC).addParameter(int.class, "overload");
-
- List<MethodDeclaration> methodsByParam = classDeclaration.getMethodsByParameterTypes(int.class);
- assertEquals(2, methodsByParam.size());
- assertTrue(methodsByParam.contains(addMethod2));
- assertTrue(methodsByParam.contains(addMethod3));
- List<MethodDeclaration> methodsByParam2 = classDeclaration.getMethodsByParameterTypes("List<String>");
- assertEquals(1, methodsByParam2.size());
- assertTrue(methodsByParam2.contains(methodWithListParam));
- }
-
- @Test
- public void testGetFieldWithName() {
- FieldDeclaration addField = classDeclaration.addField(int.class, "fieldName", Modifier.PRIVATE);
- classDeclaration.addField(float.class, "secondField", Modifier.PRIVATE);
- FieldDeclaration fieldByName = classDeclaration.getFieldByName("fieldName");
- assertEquals(addField, fieldByName);
- }
-
- @Test
- public void testGetFields() {
- FieldDeclaration firstField = classDeclaration.addField(int.class, "fieldName", Modifier.PRIVATE);
- FieldDeclaration secondField = classDeclaration.addField(float.class, "secondField", Modifier.PRIVATE);
-
- List<FieldDeclaration> fields = classDeclaration.getFields();
-
- assertTrue(fields.contains(firstField));
- assertTrue(fields.contains(secondField));
- }
+ CompilationUnit cu;
+ private ClassOrInterfaceDeclaration classDeclaration;
+
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ classDeclaration = cu.addClass("test");
+ }
+
+ @After
+ public void teardown() {
+ cu = null;
+ classDeclaration = null;
+ }
+
+ @Test
+ public void testAddField() {
+ FieldDeclaration addField = classDeclaration.addField(int.class, "fieldName", Modifier.PRIVATE);
+ assertEquals(1, classDeclaration.getMembers().size());
+ assertEquals(addField, classDeclaration.getMember(0));
+ assertEquals("fieldName", addField.getVariable(0).getIdentifier().getNameAsString());
+ }
+
+ @Test
+ public void testAddMethod() {
+ MethodDeclaration addMethod = classDeclaration.addMethod("foo", Modifier.PUBLIC);
+ assertEquals(1, classDeclaration.getMembers().size());
+ assertEquals(addMethod, classDeclaration.getMember(0));
+ assertEquals("foo", addMethod.getNameAsString());
+ }
+
+ @Test
+ public void testAddCtor() {
+ ConstructorDeclaration addCtor = classDeclaration.addCtor(Modifier.PUBLIC);
+ assertEquals(1, classDeclaration.getMembers().size());
+ assertEquals(addCtor, classDeclaration.getMember(0));
+ assertEquals(classDeclaration.getName(), addCtor.getName());
+ }
+
+ @Test
+ public void testAddInitializers() {
+ classDeclaration.addInitializer();
+ assertEquals(1, classDeclaration.getMembers().size());
+ assertEquals(InitializerDeclaration.class, classDeclaration.getMember(0).getClass());
+
+ classDeclaration.addStaticInitializer();
+ assertEquals(2, classDeclaration.getMembers().size());
+ assertEquals(InitializerDeclaration.class, classDeclaration.getMember(0).getClass());
+ }
+
+ @Test
+ public void testGetMethodsWithName() {
+ MethodDeclaration addMethod = classDeclaration.addMethod("foo", Modifier.PUBLIC);
+ MethodDeclaration addMethod2 = classDeclaration.addMethod("foo", Modifier.PUBLIC).addParameter(int.class, "overload");
+ List<MethodDeclaration> methodsByName = classDeclaration.getMethodsByName("foo");
+ assertEquals(2, methodsByName.size());
+ assertTrue(methodsByName.contains(addMethod));
+ assertTrue(methodsByName.contains(addMethod2));
+ }
+
+ @Test
+ public void testGetMethods() {
+ MethodDeclaration addMethod = classDeclaration.addMethod("foo", Modifier.PUBLIC);
+ MethodDeclaration addMethod2 = classDeclaration.addMethod("foo", Modifier.PUBLIC).addParameter(int.class, "overload");
+
+ List<MethodDeclaration> methods = classDeclaration.getMethods();
+
+ assertEquals(2, methods.size());
+ assertTrue(methods.contains(addMethod));
+ assertTrue(methods.contains(addMethod2));
+ }
+
+ @Test
+ public void testGetMethodsWithParameterTypes() {
+ classDeclaration.addMethod("foo", Modifier.PUBLIC);
+ MethodDeclaration addMethod2 = classDeclaration.addMethod("foo", Modifier.PUBLIC).addParameter(int.class, "overload");
+ ClassOrInterfaceType type = new ClassOrInterfaceType("List");
+ type.setTypeArguments(new ClassOrInterfaceType("String"));
+ MethodDeclaration methodWithListParam = classDeclaration.addMethod("fooList", Modifier.PUBLIC).addParameter(type, "overload");
+ MethodDeclaration addMethod3 = classDeclaration.addMethod("foo2", Modifier.PUBLIC).addParameter(int.class, "overload");
+
+ List<MethodDeclaration> methodsByParam = classDeclaration.getMethodsByParameterTypes(int.class);
+ assertEquals(2, methodsByParam.size());
+ assertTrue(methodsByParam.contains(addMethod2));
+ assertTrue(methodsByParam.contains(addMethod3));
+ List<MethodDeclaration> methodsByParam2 = classDeclaration.getMethodsByParameterTypes("List<String>");
+ assertEquals(1, methodsByParam2.size());
+ assertTrue(methodsByParam2.contains(methodWithListParam));
+ }
+
+ @Test
+ public void testGetFieldWithName() {
+ FieldDeclaration addField = classDeclaration.addField(int.class, "fieldName", Modifier.PRIVATE);
+ classDeclaration.addField(float.class, "secondField", Modifier.PRIVATE);
+ FieldDeclaration fieldByName = classDeclaration.getFieldByName("fieldName");
+ assertEquals(addField, fieldByName);
+ }
+
+ @Test
+ public void testGetFields() {
+ FieldDeclaration firstField = classDeclaration.addField(int.class, "fieldName", Modifier.PRIVATE);
+ FieldDeclaration secondField = classDeclaration.addField(float.class, "secondField", Modifier.PRIVATE);
+
+ List<FieldDeclaration> fields = classDeclaration.getFields();
+
+ assertTrue(fields.contains(firstField));
+ assertTrue(fields.contains(secondField));
+ }
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithParametersBuildersTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithParametersBuildersTest.java
index c5c5f4702..6d1d407e2 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithParametersBuildersTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithParametersBuildersTest.java
@@ -1,58 +1,57 @@
package com.github.javaparser.junit.builders;
-import static com.github.javaparser.utils.Utils.EOL;
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.Parameter;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.List;
+
+import static com.github.javaparser.utils.Utils.EOL;
+import static org.junit.Assert.assertEquals;
public class NodeWithParametersBuildersTest {
- CompilationUnit cu;
-
- @Before
- public void setup() {
- cu = new CompilationUnit();
- }
-
- @After
- public void teardown() {
- cu = null;
- }
-
- @Test
- public void testAddParameter() {
- MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", Modifier.PUBLIC);
- addMethod.addParameter(int.class, "yay");
- Parameter myNewParam = addMethod.addAndGetParameter(List.class, "myList");
- assertEquals(1, cu.getImports().size());
- assertEquals("import " + List.class.getName() + ";" + EOL, cu.getImport(0).toString());
- assertEquals(2, addMethod.getParameters().size());
- assertEquals("yay", addMethod.getParameter(0).getNameAsString());
- assertEquals("List", addMethod.getParameter(1).getType().toString());
- assertEquals(myNewParam, addMethod.getParameter(1));
- }
-
- @Test
- public void testGetParamByName() {
- MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", Modifier.PUBLIC);
- Parameter addAndGetParameter = addMethod.addAndGetParameter(int.class, "yay");
- assertEquals(addAndGetParameter, addMethod.getParamByName("yay"));
- }
-
- @Test
- public void testGetParamByType() {
- MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", Modifier.PUBLIC);
- Parameter addAndGetParameter = addMethod.addAndGetParameter(int.class, "yay");
- assertEquals(addAndGetParameter, addMethod.getParamByType("int"));
- assertEquals(addAndGetParameter, addMethod.getParamByType(int.class));
- }
+ CompilationUnit cu;
+
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ }
+
+ @After
+ public void teardown() {
+ cu = null;
+ }
+
+ @Test
+ public void testAddParameter() {
+ MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", Modifier.PUBLIC);
+ addMethod.addParameter(int.class, "yay");
+ Parameter myNewParam = addMethod.addAndGetParameter(List.class, "myList");
+ assertEquals(1, cu.getImports().size());
+ assertEquals("import " + List.class.getName() + ";" + EOL, cu.getImport(0).toString());
+ assertEquals(2, addMethod.getParameters().size());
+ assertEquals("yay", addMethod.getParameter(0).getNameAsString());
+ assertEquals("List", addMethod.getParameter(1).getType().toString());
+ assertEquals(myNewParam, addMethod.getParameter(1));
+ }
+
+ @Test
+ public void testGetParamByName() {
+ MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", Modifier.PUBLIC);
+ Parameter addAndGetParameter = addMethod.addAndGetParameter(int.class, "yay");
+ assertEquals(addAndGetParameter, addMethod.getParamByName("yay"));
+ }
+
+ @Test
+ public void testGetParamByType() {
+ MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", Modifier.PUBLIC);
+ Parameter addAndGetParameter = addMethod.addAndGetParameter(int.class, "yay");
+ assertEquals(addAndGetParameter, addMethod.getParamByType("int"));
+ assertEquals(addAndGetParameter, addMethod.getParamByType(int.class));
+ }
} \ No newline at end of file
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithThrownExceptionsBuildersTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithThrownExceptionsBuildersTest.java
index cfb6b762a..7c23087fe 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithThrownExceptionsBuildersTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/builders/NodeWithThrownExceptionsBuildersTest.java
@@ -1,37 +1,36 @@
package com.github.javaparser.junit.builders;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
public class NodeWithThrownExceptionsBuildersTest {
- CompilationUnit cu;
+ CompilationUnit cu;
- @Before
- public void setup() {
- cu = new CompilationUnit();
- }
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ }
- @After
- public void teardown() {
- cu = null;
- }
+ @After
+ public void teardown() {
+ cu = null;
+ }
- @Test
- public void testThrows() {
- MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", Modifier.PUBLIC);
- addMethod.addThrownException(IllegalStateException.class);
- assertEquals(1, addMethod.getThrownExceptions().size());
- assertEquals(true, addMethod.isThrown(IllegalStateException.class));
- addMethod.addThrownException(new ClassOrInterfaceType("Test"));
- assertEquals(2, addMethod.getThrownExceptions().size());
- assertEquals("Test", addMethod.getThrownException(1).toString());
- }
+ @Test
+ public void testThrows() {
+ MethodDeclaration addMethod = cu.addClass("test").addMethod("foo", Modifier.PUBLIC);
+ addMethod.addThrownException(IllegalStateException.class);
+ assertEquals(1, addMethod.getThrownExceptions().size());
+ assertEquals(true, addMethod.isThrown(IllegalStateException.class));
+ addMethod.addThrownException(new ClassOrInterfaceType("Test"));
+ assertEquals(2, addMethod.getThrownExceptions().size());
+ assertEquals("Test", addMethod.getThrownException(1).toString());
+ }
} \ No newline at end of file
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/remove/NodeRemovalTest.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/remove/NodeRemovalTest.java
index c6e21b19f..b4fe55337 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/remove/NodeRemovalTest.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/remove/NodeRemovalTest.java
@@ -1,61 +1,60 @@
package com.github.javaparser.junit.remove;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.ast.stmt.Statement;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
public class NodeRemovalTest {
- CompilationUnit cu;
-
- @Before
- public void setup() {
- cu = new CompilationUnit();
- }
-
- @After
- public void teardown() {
- cu = null;
- }
-
- @Test
- public void testRemoveClassFromCompilationUnit() {
- ClassOrInterfaceDeclaration testClass = cu.addClass("test");
- assertEquals(1, cu.getTypes().size());
- boolean remove = testClass.remove();
- assertEquals(true, remove);
- assertEquals(0, cu.getTypes().size());
- }
-
- @Test
- public void testRemoveFieldFromClass() {
- ClassOrInterfaceDeclaration testClass = cu.addClass("test");
-
- FieldDeclaration addField = testClass.addField(String.class, "test");
- assertEquals(1, testClass.getMembers().size());
- boolean remove = addField.remove();
- assertEquals(true, remove);
- assertEquals(0, testClass.getMembers().size());
- }
-
- @Test
- public void testRemoveStatementFromMethodBody() {
- ClassOrInterfaceDeclaration testClass = cu.addClass("testC");
-
- MethodDeclaration addMethod = testClass.addMethod("testM");
- BlockStmt methodBody = addMethod.createBody();
- Statement addStatement = methodBody.addAndGetStatement("test");
- assertEquals(1, methodBody.getStatements().size());
- boolean remove = addStatement.remove();
- assertEquals(true, remove);
- assertEquals(0, methodBody.getStatements().size());
- }
+ CompilationUnit cu;
+
+ @Before
+ public void setup() {
+ cu = new CompilationUnit();
+ }
+
+ @After
+ public void teardown() {
+ cu = null;
+ }
+
+ @Test
+ public void testRemoveClassFromCompilationUnit() {
+ ClassOrInterfaceDeclaration testClass = cu.addClass("test");
+ assertEquals(1, cu.getTypes().size());
+ boolean remove = testClass.remove();
+ assertEquals(true, remove);
+ assertEquals(0, cu.getTypes().size());
+ }
+
+ @Test
+ public void testRemoveFieldFromClass() {
+ ClassOrInterfaceDeclaration testClass = cu.addClass("test");
+
+ FieldDeclaration addField = testClass.addField(String.class, "test");
+ assertEquals(1, testClass.getMembers().size());
+ boolean remove = addField.remove();
+ assertEquals(true, remove);
+ assertEquals(0, testClass.getMembers().size());
+ }
+
+ @Test
+ public void testRemoveStatementFromMethodBody() {
+ ClassOrInterfaceDeclaration testClass = cu.addClass("testC");
+
+ MethodDeclaration addMethod = testClass.addMethod("testM");
+ BlockStmt methodBody = addMethod.createBody();
+ Statement addStatement = methodBody.addAndGetStatement("test");
+ assertEquals(1, methodBody.getStatements().size());
+ boolean remove = addStatement.remove();
+ assertEquals(true, remove);
+ assertEquals(0, methodBody.getStatements().size());
+ }
}
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/ClassCreator.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/ClassCreator.java
index 5e3e5e5a1..0d9d2f40b 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/ClassCreator.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/ClassCreator.java
@@ -35,10 +35,10 @@ public class ClassCreator {
// create the type declaration
ClassOrInterfaceDeclaration type = cu.addClass("GeneratedClass");
// create a method
- EnumSet<Modifier> modifiers = EnumSet.of(Modifier.PUBLIC);
- MethodDeclaration method = new MethodDeclaration(modifiers, VOID_TYPE, "main");
- modifiers.add(Modifier.STATIC);
- method.setModifiers(modifiers);
+ EnumSet<Modifier> modifiers = EnumSet.of(Modifier.PUBLIC);
+ MethodDeclaration method = new MethodDeclaration(modifiers, VOID_TYPE, "main");
+ modifiers.add(Modifier.STATIC);
+ method.setModifiers(modifiers);
type.addMember(method);
// add a parameter to the method
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_1.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_1.java
index 27b99439d..5713131e9 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_1.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_1.java
@@ -7,7 +7,7 @@ import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
import java.io.FileInputStream;
-import static com.github.javaparser.ast.type.PrimitiveType.*;
+import static com.github.javaparser.ast.type.PrimitiveType.INT_TYPE;
public class MethodChanger_1 {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_2.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_2.java
index 16df8e3bf..ccaf72ae1 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_2.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodChanger_2.java
@@ -1,8 +1,5 @@
package com.github.javaparser.junit.wiki_samples;
-import java.io.FileInputStream;
-import java.util.List;
-
import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.NodeList;
@@ -10,7 +7,9 @@ import com.github.javaparser.ast.body.BodyDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.TypeDeclaration;
-import static com.github.javaparser.ast.type.PrimitiveType.*;
+import java.io.FileInputStream;
+
+import static com.github.javaparser.ast.type.PrimitiveType.INT_TYPE;
public class MethodChanger_2 {
@@ -31,10 +30,10 @@ public class MethodChanger_2 {
}
private static void changeMethods(CompilationUnit cu) {
- NodeList<TypeDeclaration<?>> types = cu.getTypes();
- for (TypeDeclaration<?> type : types) {
- NodeList<BodyDeclaration<?>> members = type.getMembers();
- for (BodyDeclaration<?> member : members) {
+ NodeList<TypeDeclaration<?>> types = cu.getTypes();
+ for (TypeDeclaration<?> type : types) {
+ NodeList<BodyDeclaration<?>> members = type.getMembers();
+ for (BodyDeclaration<?> member : members) {
if (member instanceof MethodDeclaration) {
MethodDeclaration method = (MethodDeclaration) member;
changeMethod(method);
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodPrinter.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodPrinter.java
index d7408fbc9..3614475d5 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodPrinter.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/MethodPrinter.java
@@ -26,7 +26,7 @@ public class MethodPrinter {
}
/**
- * Simple visitor implementation for visiting MethodDeclaration nodes.
+ * Simple visitor implementation for visiting MethodDeclaration nodes.
*/
private static class MethodVisitor extends VoidVisitorAdapter {
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/TestFileToken.java b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/TestFileToken.java
index 23d09c338..93d529966 100644
--- a/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/TestFileToken.java
+++ b/javaparser-testing/src/test/java/com/github/javaparser/junit/wiki_samples/TestFileToken.java
@@ -6,11 +6,8 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
-import java.net.URL;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
/**
* Creates a temporary test file that a sample can use. This way we don't have to rewrite the samples to fit them into
diff --git a/javaparser-testing/src/test/resources/com/github/javaparser/bdd/samples/JavaConcepts.java b/javaparser-testing/src/test/resources/com/github/javaparser/bdd/samples/JavaConcepts.java
index e7dbd0ea7..14c1ce68a 100644
--- a/javaparser-testing/src/test/resources/com/github/javaparser/bdd/samples/JavaConcepts.java
+++ b/javaparser-testing/src/test/resources/com/github/javaparser/bdd/samples/JavaConcepts.java
@@ -1,9 +1,8 @@
package japa.bdd.samples;
import com.github.javaparser.JavaParser;
-
-import japa.parser.ParseException;
import com.github.javaparser.ast.CompilationUnit;
+import japa.parser.ParseException;
import org.junit.Ignore;
import java.io.*;
@@ -104,18 +103,18 @@ public class JavaConcepts<T extends List<int[]>, X> extends Base implements Seri
char cc = 'a';
- int[][] arr3 = { { 1, 2 }, { 3, 4 } };
+ int[][] arr3 = {{1, 2}, {3, 4}};
static int[] arr4[] = {};
public static JavaConcepts t;
static {
- arr4 = new int[][] { { 2 }, { 1 } };
+ arr4 = new int[][]{{2}, {1}};
}
{
- arr3 = new int[][] { { 2 }, { 1 } };
+ arr3 = new int[][]{{2}, {1}};
}
public enum Teste {
@@ -139,17 +138,13 @@ public class JavaConcepts<T extends List<int[]>, X> extends Base implements Seri
public enum Enum {
m(1) {
-
@Override
void mm() {
}
- }
- , f(2) {
-
+ }, f(2) {
void mm() {
}
- }
- ;
+ };
native void nnn();
@@ -225,7 +220,8 @@ public class JavaConcepts<T extends List<int[]>, X> extends Base implements Seri
int iii = 3;
iii += 3;
}
- label: {
+ label:
+ {
int iii = 1;
}
;
@@ -233,17 +229,17 @@ public class JavaConcepts<T extends List<int[]>, X> extends Base implements Seri
int min = -2147483648;
long sl = 123123123123l;
long minl = -9223372036854775808L;
- switch(i) {
+ switch (i) {
}
- ll: switch(i) {
+ ll:
+ switch (i) {
case 1:
System.out.println(1);
break ll;
- default:
- {
- System.out.println("default");
- break;
- }
+ default: {
+ System.out.println("default");
+ break;
+ }
case 2:
if (t instanceof Base) {
System.out.println(1);
@@ -255,7 +251,7 @@ public class JavaConcepts<T extends List<int[]>, X> extends Base implements Seri
private synchronized int doSomething()[] {
List<? extends Number> x = new ArrayList<Integer>();
- return new int[] { 1 };
+ return new int[]{1};
}
}
@@ -284,7 +280,8 @@ public class JavaConcepts<T extends List<int[]>, X> extends Base implements Seri
else
x = 2;
while (true) {
- xxx: while (x == 3) continue xxx;
+ xxx:
+ while (x == 3) continue xxx;
break;
}
do {
@@ -342,7 +339,7 @@ public class JavaConcepts<T extends List<int[]>, X> extends Base implements Seri
System.out.println("catch");
}
try (InputStream in = createInputStream();
- InputStream in2 = createInputStream()) {
+ InputStream in2 = createInputStream()) {
System.out.println(in);
} catch (IOException e) {
System.out.println("catch");
diff --git a/pom.xml b/pom.xml
index be1266f2f..6a0bd9bf1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,197 +1,198 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
<modules>
<module>javaparser-core</module>
<module>javaparser-testing</module>
</modules>
- <groupId>com.github.javaparser</groupId>
- <artifactId>javaparser-parent</artifactId>
- <packaging>pom</packaging>
- <version>3.0.1-RC.1-SNAPSHOT</version>
+ <groupId>com.github.javaparser</groupId>
+ <artifactId>javaparser-parent</artifactId>
+ <packaging>pom</packaging>
+ <version>3.0.1-RC.1-SNAPSHOT</version>
- <name>javaparser-parent</name>
- <url>https://github.com/javaparser</url>
- <inceptionYear>2007</inceptionYear>
- <description>Java 1.8 Parser Parser and Abstract Syntax Tree for Java</description>
+ <name>javaparser-parent</name>
+ <url>https://github.com/javaparser</url>
+ <inceptionYear>2007</inceptionYear>
+ <description>Java 1.8 Parser Parser and Abstract Syntax Tree for Java</description>
- <licenses>
- <license>
- <name>GNU Lesser General Public License</name>
- <url>http://www.gnu.org/licenses/lgpl-3.0.html</url>
- <distribution>repo</distribution>
- </license>
- <license>
- <name>Apache License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- <comments>A business-friendly OSS license</comments>
- </license>
- </licenses>
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License</name>
+ <url>http://www.gnu.org/licenses/lgpl-3.0.html</url>
+ <distribution>repo</distribution>
+ </license>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ <comments>A business-friendly OSS license</comments>
+ </license>
+ </licenses>
- <developers>
- <developer>
- <name>Danny van Bruggen</name>
- <email>hexagonaal@gmail.com</email>
- <url>https://github.com/matozoid</url>
- <id>matozoid</id>
- </developer>
- <developer>
- <name>Júlio Vilmar Gesser</name>
- <email>jgesser@gmail.com</email>
- </developer>
- <developer>
- <name>Sebastian Kirsch</name>
- <email>sebastian.kirsch@immobilienscout24.de</email>
- <url>https://github.com/sebastiankirsch</url>
- <id>sebastiankirsch</id>
- </developer>
- <developer>
- <name>André Rouél</name>
- <url>https://github.com/before</url>
- <id>before</id>
- </developer>
- <developer>
- <name>Nicholas Smith</name>
- <email>smiddypence@gmail.com</email>
- <url>https://github.com/SmiddyPence</url>
- <id>SmiddyPence</id>
- </developer>
- <developer>
- <name>Federico Tomassetti</name>
- <email>federico@tomassetti.me</email>
- <url>https://github.com/ftomassetti</url>
- <id>ftomassetti</id>
- </developer>
- <developer>
- <name>Didier Villevalois</name>
- <email>ptitjes@free.fr</email>
- <url>https://github.com/ptitjes</url>
- <id>ptitjes</id>
- </developer>
- </developers>
- <contributors>
- <contributor>
- <name>Sebastian Kürten</name>
- <email>sebastian@topobyte.de</email>
- <url>https://github.com/sebkur</url>
- </contributor>
- <contributor>
- <name>Junfei Liang</name>
- <email>fly2best@gmail.com</email>
- <url>https://github.com/fly2best</url>
- </contributor>
- <contributor>
- <name>Jarkko Miettinen</name>
- <url>https://github.com/jmiettinen</url>
- </contributor>
- <contributor>
- <name>Alexey Morozov</name>
- <email>morozov@altlinux.org</email>
- <url>https://github.com/amorozov</url>
- </contributor>
- <contributor>
- <name>Donny Nadolny</name>
- <email>donny.nadolny@gmail.com</email>
- <url>https://github.com/dnadolny</url>
- </contributor>
- <contributor>
- <name>Raquel Pau</name>
- <email>raquelpau@gmail.com</email>
- <url>https://github.com/rpau</url>
- </contributor>
- <contributor>
- <name>Chao Shi</name>
- <email>stepinto@live.com</email>
- <url>https://github.com/stepinto</url>
- </contributor>
- <contributor>
- <name>Michael Schieder</name>
- <email>michael.schieder@gmail.com</email>
- <url>https://github.com/mschieder</url>
- </contributor>
- <contributor>
- <name>CRUZ Maximilien</name>
- <email>maximilien.cruz@gmail.com</email>
- <url>https://github.com/DeepSnowNeeL</url>
- </contributor>
- </contributors>
+ <developers>
+ <developer>
+ <name>Danny van Bruggen</name>
+ <email>hexagonaal@gmail.com</email>
+ <url>https://github.com/matozoid</url>
+ <id>matozoid</id>
+ </developer>
+ <developer>
+ <name>Júlio Vilmar Gesser</name>
+ <email>jgesser@gmail.com</email>
+ </developer>
+ <developer>
+ <name>Sebastian Kirsch</name>
+ <email>sebastian.kirsch@immobilienscout24.de</email>
+ <url>https://github.com/sebastiankirsch</url>
+ <id>sebastiankirsch</id>
+ </developer>
+ <developer>
+ <name>André Rouél</name>
+ <url>https://github.com/before</url>
+ <id>before</id>
+ </developer>
+ <developer>
+ <name>Nicholas Smith</name>
+ <email>smiddypence@gmail.com</email>
+ <url>https://github.com/SmiddyPence</url>
+ <id>SmiddyPence</id>
+ </developer>
+ <developer>
+ <name>Federico Tomassetti</name>
+ <email>federico@tomassetti.me</email>
+ <url>https://github.com/ftomassetti</url>
+ <id>ftomassetti</id>
+ </developer>
+ <developer>
+ <name>Didier Villevalois</name>
+ <email>ptitjes@free.fr</email>
+ <url>https://github.com/ptitjes</url>
+ <id>ptitjes</id>
+ </developer>
+ </developers>
+ <contributors>
+ <contributor>
+ <name>Sebastian Kürten</name>
+ <email>sebastian@topobyte.de</email>
+ <url>https://github.com/sebkur</url>
+ </contributor>
+ <contributor>
+ <name>Junfei Liang</name>
+ <email>fly2best@gmail.com</email>
+ <url>https://github.com/fly2best</url>
+ </contributor>
+ <contributor>
+ <name>Jarkko Miettinen</name>
+ <url>https://github.com/jmiettinen</url>
+ </contributor>
+ <contributor>
+ <name>Alexey Morozov</name>
+ <email>morozov@altlinux.org</email>
+ <url>https://github.com/amorozov</url>
+ </contributor>
+ <contributor>
+ <name>Donny Nadolny</name>
+ <email>donny.nadolny@gmail.com</email>
+ <url>https://github.com/dnadolny</url>
+ </contributor>
+ <contributor>
+ <name>Raquel Pau</name>
+ <email>raquelpau@gmail.com</email>
+ <url>https://github.com/rpau</url>
+ </contributor>
+ <contributor>
+ <name>Chao Shi</name>
+ <email>stepinto@live.com</email>
+ <url>https://github.com/stepinto</url>
+ </contributor>
+ <contributor>
+ <name>Michael Schieder</name>
+ <email>michael.schieder@gmail.com</email>
+ <url>https://github.com/mschieder</url>
+ </contributor>
+ <contributor>
+ <name>CRUZ Maximilien</name>
+ <email>maximilien.cruz@gmail.com</email>
+ <url>https://github.com/DeepSnowNeeL</url>
+ </contributor>
+ </contributors>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <java.version>1.8</java.version>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <java.version>1.8</java.version>
- <!-- Maven Plugins -->
- <javacc-maven-plugin.version>2.6</javacc-maven-plugin.version>
- <maven-clean-plugin.version>3.0.0</maven-clean-plugin.version>
- <maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
- <maven-install-plugin.version>2.5.2</maven-install-plugin.version>
- <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
- <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
+ <!-- Maven Plugins -->
+ <javacc-maven-plugin.version>2.6</javacc-maven-plugin.version>
+ <maven-clean-plugin.version>3.0.0</maven-clean-plugin.version>
+ <maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
+ <maven-install-plugin.version>2.5.2</maven-install-plugin.version>
+ <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
+ <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
<maven-jacoco-plugin.version>0.7.7.201606060606</maven-jacoco-plugin.version>
<maven-coveralls-plugin.version>4.2.0</maven-coveralls-plugin.version>
<bnd-maven-plugin.version>3.2.0</bnd-maven-plugin.version>
- </properties>
+ </properties>
- <scm>
- <connection>scm:git:git://github.com/javaparser/javaparser.git</connection>
- <developerConnection>scm:git:git@github.com:javaparser/javaparser.git</developerConnection>
- <url>https://github.com/javaparser/javaparser.git</url>
- <tag>HEAD</tag>
- </scm>
+ <scm>
+ <connection>scm:git:git://github.com/javaparser/javaparser.git</connection>
+ <developerConnection>scm:git:git@github.com:javaparser/javaparser.git</developerConnection>
+ <url>https://github.com/javaparser/javaparser.git</url>
+ <tag>HEAD</tag>
+ </scm>
- <issueManagement>
- <system>GitHub Issue Tracker</system>
- <url>https://github.com/javaparser/javaparser/issues</url>
- </issueManagement>
+ <issueManagement>
+ <system>GitHub Issue Tracker</system>
+ <url>https://github.com/javaparser/javaparser/issues</url>
+ </issueManagement>
- <distributionManagement>
- <repository>
- <id>bintray-javaparser-JavaParser</id>
- <name>javaparser-JavaParser</name>
- <url>https://api.bintray.com/maven/javaparser/JavaParser/javaparser/</url>
- </repository>
- </distributionManagement>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>${java.version}</source>
- <target>${java.version}</target>
- </configuration>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>javacc-maven-plugin</artifactId>
- <version>${javacc-maven-plugin.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <version>${maven-clean-plugin.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>${maven-install-plugin.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>${maven-release-plugin.version}</version>
- </plugin>
+ <distributionManagement>
+ <repository>
+ <id>bintray-javaparser-JavaParser</id>
+ <name>javaparser-JavaParser</name>
+ <url>https://api.bintray.com/maven/javaparser/JavaParser/javaparser/</url>
+ </repository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>${javacc-maven-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>${maven-clean-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>${maven-install-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>${maven-release-plugin.version}</version>
+ </plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
@@ -202,18 +203,18 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>${maven-jacoco-plugin.version}</version>
</plugin>
- </plugins>
- </pluginManagement>
- </build>
- <profiles>
- <profile>
- <id>doclint-java8-disable</id>
- <activation>
- <jdk>[1.8,)</jdk>
- </activation>
- <properties>
- <additionalparam>-Xdoclint:none</additionalparam>
- </properties>
- </profile>
- </profiles>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <profiles>
+ <profile>
+ <id>doclint-java8-disable</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <properties>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </properties>
+ </profile>
+ </profiles>
</project>