diff options
author | Danny van Bruggen <hexagonaal@gmail.com> | 2017-10-17 00:54:49 +0200 |
---|---|---|
committer | Danny van Bruggen <hexagonaal@gmail.com> | 2017-10-17 00:54:49 +0200 |
commit | 255d26470311d9624b12bac2301d589fa2eefb99 (patch) | |
tree | a803dffb31cf40edab692d6c386fb58b0fb0cab8 /javaparser-core/src/main/java/com/github/javaparser/ast/visitor | |
parent | 2e435be05d9200097a6edf9f89d83b9330fd5135 (diff) | |
download | javaparser-255d26470311d9624b12bac2301d589fa2eefb99.tar.gz |
Regenerate code
Diffstat (limited to 'javaparser-core/src/main/java/com/github/javaparser/ast/visitor')
15 files changed, 257 insertions, 223 deletions
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 66ba934cf..e5b88e1a1 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 @@ -185,11 +185,12 @@ public class CloneVisitor implements GenericVisitor<Visitable, Object> { BlockStmt body = cloneNode(n.getBody(), arg); SimpleName name = cloneNode(n.getName(), arg); NodeList<Parameter> parameters = cloneList(n.getParameters(), arg); + ReceiverParameter receiverParameter = cloneNode(n.getReceiverParameter(), arg); NodeList<ReferenceType> thrownExceptions = cloneList(n.getThrownExceptions(), arg); NodeList<TypeParameter> typeParameters = cloneList(n.getTypeParameters(), arg); NodeList<AnnotationExpr> annotations = cloneList(n.getAnnotations(), arg); Comment comment = cloneNode(n.getComment(), arg); - ConstructorDeclaration r = new ConstructorDeclaration(n.getTokenRange().orElse(null), n.getModifiers(), annotations, typeParameters, name, parameters, thrownExceptions, body, null); + ConstructorDeclaration r = new ConstructorDeclaration(n.getTokenRange().orElse(null), n.getModifiers(), annotations, typeParameters, name, parameters, thrownExceptions, body, receiverParameter); r.setComment(comment); return r; } @@ -201,11 +202,12 @@ public class CloneVisitor implements GenericVisitor<Visitable, Object> { Type type = cloneNode(n.getType(), arg); SimpleName name = cloneNode(n.getName(), arg); NodeList<Parameter> parameters = cloneList(n.getParameters(), arg); + ReceiverParameter receiverParameter = cloneNode(n.getReceiverParameter(), arg); NodeList<ReferenceType> thrownExceptions = cloneList(n.getThrownExceptions(), arg); NodeList<TypeParameter> typeParameters = cloneList(n.getTypeParameters(), arg); NodeList<AnnotationExpr> annotations = cloneList(n.getAnnotations(), arg); Comment comment = cloneNode(n.getComment(), arg); - MethodDeclaration r = new MethodDeclaration(n.getTokenRange().orElse(null), n.getModifiers(), annotations, typeParameters, type, name, parameters, thrownExceptions, body, null); + MethodDeclaration r = new MethodDeclaration(n.getTokenRange().orElse(null), n.getModifiers(), annotations, typeParameters, type, name, parameters, thrownExceptions, body, receiverParameter); r.setComment(comment); return r; } @@ -1054,4 +1056,16 @@ public class CloneVisitor implements GenericVisitor<Visitable, Object> { r.setComment(comment); return r; } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.CloneVisitorGenerator") + public Visitable visit(final ReceiverParameter n, final Object arg) { + NodeList<AnnotationExpr> annotations = cloneList(n.getAnnotations(), arg); + Name name = cloneNode(n.getName(), arg); + Type type = cloneNode(n.getType(), arg); + Comment comment = cloneNode(n.getComment(), arg); + ReceiverParameter r = new ReceiverParameter(n.getTokenRange().orElse(null), annotations, type, name); + r.setComment(comment); + return r; + } } 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 bbb694c1f..49a2ee278 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 @@ -338,6 +338,8 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> { return false; if (!nodesEquals(n.getParameters(), n2.getParameters())) return false; + if (!nodeEquals(n.getReceiverParameter(), n2.getReceiverParameter())) + return false; if (!nodesEquals(n.getThrownExceptions(), n2.getThrownExceptions())) return false; if (!nodesEquals(n.getTypeParameters(), n2.getTypeParameters())) @@ -363,6 +365,8 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> { return false; if (!nodesEquals(n.getParameters(), n2.getParameters())) return false; + if (!nodeEquals(n.getReceiverParameter(), n2.getReceiverParameter())) + return false; if (!nodesEquals(n.getThrownExceptions(), n2.getThrownExceptions())) return false; if (!nodesEquals(n.getTypeParameters(), n2.getTypeParameters())) @@ -1357,4 +1361,19 @@ public class EqualsVisitor implements GenericVisitor<Boolean, Visitable> { return false; return true; } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.EqualsVisitorGenerator") + public Boolean visit(final ReceiverParameter n, final Visitable arg) { + final ReceiverParameter n2 = (ReceiverParameter) arg; + if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) + return false; + if (!nodeEquals(n.getName(), n2.getName())) + return false; + if (!nodeEquals(n.getType(), n2.getType())) + return false; + if (!nodeEquals(n.getComment(), n2.getComment())) + return false; + return true; + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapter.java index 83634ed6c..14ae6c5b5 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapter.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericListVisitorAdapter.java @@ -562,6 +562,11 @@ public abstract class GenericListVisitorAdapter<R, A> implements GenericVisitor< if (tmp != null) result.addAll(tmp); } + if (n.getReceiverParameter().isPresent()) { + tmp = n.getReceiverParameter().get().accept(this, arg); + if (tmp != null) + result.addAll(tmp); + } { tmp = n.getThrownExceptions().accept(this, arg); if (tmp != null) @@ -1200,6 +1205,11 @@ public abstract class GenericListVisitorAdapter<R, A> implements GenericVisitor< if (tmp != null) result.addAll(tmp); } + if (n.getReceiverParameter().isPresent()) { + tmp = n.getReceiverParameter().get().accept(this, arg); + if (tmp != null) + result.addAll(tmp); + } { tmp = n.getThrownExceptions().accept(this, arg); if (tmp != null) @@ -2003,4 +2013,32 @@ public abstract class GenericListVisitorAdapter<R, A> implements GenericVisitor< } return result; } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.GenericListVisitorAdapterGenerator") + public List<R> visit(final ReceiverParameter n, final A arg) { + List<R> result = new ArrayList<>(); + List<R> tmp; + { + tmp = n.getAnnotations().accept(this, arg); + if (tmp != null) + result.addAll(tmp); + } + { + tmp = n.getName().accept(this, arg); + if (tmp != null) + result.addAll(tmp); + } + { + tmp = n.getType().accept(this, arg); + if (tmp != null) + result.addAll(tmp); + } + if (n.getComment().isPresent()) { + tmp = n.getComment().get().accept(this, arg); + if (tmp != null) + result.addAll(tmp); + } + return result; + } } 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 3f2199f8a..693789a4d 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 @@ -311,4 +311,7 @@ public interface GenericVisitor<R, A> { @Generated("com.github.javaparser.generator.core.visitor.GenericVisitorGenerator") R visit(UnparsableStmt n, A arg); + + @Generated("com.github.javaparser.generator.core.visitor.GenericVisitorGenerator") + R visit(ReceiverParameter n, A arg); } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java index 0bc8ad6bd..5b4bf55c0 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorAdapter.java @@ -502,6 +502,11 @@ public abstract class GenericVisitorAdapter<R, A> implements GenericVisitor<R, A if (result != null) return result; } + if (n.getReceiverParameter().isPresent()) { + result = n.getReceiverParameter().get().accept(this, arg); + if (result != null) + return result; + } { result = n.getThrownExceptions().accept(this, arg); if (result != null) @@ -1050,6 +1055,11 @@ public abstract class GenericVisitorAdapter<R, A> implements GenericVisitor<R, A if (result != null) return result; } + if (n.getReceiverParameter().isPresent()) { + result = n.getReceiverParameter().get().accept(this, arg); + if (result != null) + return result; + } { result = n.getThrownExceptions().accept(this, arg); if (result != null) @@ -1998,4 +2008,31 @@ public abstract class GenericVisitorAdapter<R, A> implements GenericVisitor<R, A } return null; } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.GenericVisitorAdapterGenerator") + public R visit(final ReceiverParameter n, final A arg) { + R result; + { + result = n.getAnnotations().accept(this, arg); + if (result != null) + return result; + } + { + result = n.getName().accept(this, arg); + if (result != null) + return result; + } + { + result = n.getType().accept(this, arg); + if (result != null) + return result; + } + if (n.getComment().isPresent()) { + result = n.getComment().get().accept(this, arg); + if (result != null) + return result; + } + return null; + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorWithDefaults.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorWithDefaults.java index 5fe2411ad..1f9362860 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorWithDefaults.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/GenericVisitorWithDefaults.java @@ -589,4 +589,10 @@ public abstract class GenericVisitorWithDefaults<R, A> implements GenericVisitor public R visit(final UnparsableStmt n, final A arg) { return defaultAction(n, arg); } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.GenericVisitorWithDefaultsGenerator") + public R visit(final ReceiverParameter n, final A arg) { + return defaultAction(n, arg); + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java index eb172138f..2a12b7f69 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java @@ -159,7 +159,7 @@ public class HashCodeVisitor implements GenericVisitor<Integer, Void> { @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator") public Integer visit(final ConstructorDeclaration n, final Void arg) { - return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); + return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getReceiverParameter().isPresent() ? n.getReceiverParameter().get().accept(this, arg) : 0) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); } @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator") @@ -304,7 +304,7 @@ public class HashCodeVisitor implements GenericVisitor<Integer, Void> { @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator") public Integer visit(final MethodDeclaration n, final Void arg) { - return (n.getBody().isPresent() ? n.getBody().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); + return (n.getBody().isPresent() ? n.getBody().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getReceiverParameter().isPresent() ? n.getReceiverParameter().get().accept(this, arg) : 0) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); } @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator") @@ -504,4 +504,10 @@ public class HashCodeVisitor implements GenericVisitor<Integer, Void> { public Integer visit(final UnparsableStmt n, final Void arg) { return (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator") + public Integer visit(final ReceiverParameter n, final Void arg) { + return (n.getAnnotations().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0); + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitor.java index 834da0bc8..0a8619055 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ModifierVisitor.java @@ -321,6 +321,7 @@ public class ModifierVisitor<A> implements GenericVisitor<Visitable, A> { BlockStmt body = (BlockStmt) n.getBody().accept(this, arg); SimpleName name = (SimpleName) n.getName().accept(this, arg); NodeList<Parameter> parameters = modifyList(n.getParameters(), arg); + ReceiverParameter receiverParameter = n.getReceiverParameter().map(s -> (ReceiverParameter) s.accept(this, arg)).orElse(null); NodeList<ReferenceType> thrownExceptions = modifyList(n.getThrownExceptions(), arg); NodeList<TypeParameter> typeParameters = modifyList(n.getTypeParameters(), arg); NodeList<AnnotationExpr> annotations = modifyList(n.getAnnotations(), arg); @@ -330,6 +331,7 @@ public class ModifierVisitor<A> implements GenericVisitor<Visitable, A> { n.setBody(body); n.setName(name); n.setParameters(parameters); + n.setReceiverParameter(receiverParameter); n.setThrownExceptions(thrownExceptions); n.setTypeParameters(typeParameters); n.setAnnotations(annotations); @@ -650,6 +652,7 @@ public class ModifierVisitor<A> implements GenericVisitor<Visitable, A> { Type type = (Type) n.getType().accept(this, arg); SimpleName name = (SimpleName) n.getName().accept(this, arg); NodeList<Parameter> parameters = modifyList(n.getParameters(), arg); + ReceiverParameter receiverParameter = n.getReceiverParameter().map(s -> (ReceiverParameter) s.accept(this, arg)).orElse(null); NodeList<ReferenceType> thrownExceptions = modifyList(n.getThrownExceptions(), arg); NodeList<TypeParameter> typeParameters = modifyList(n.getTypeParameters(), arg); NodeList<AnnotationExpr> annotations = modifyList(n.getAnnotations(), arg); @@ -660,6 +663,7 @@ public class ModifierVisitor<A> implements GenericVisitor<Visitable, A> { n.setType(type); n.setName(name); n.setParameters(parameters); + n.setReceiverParameter(receiverParameter); n.setThrownExceptions(thrownExceptions); n.setTypeParameters(typeParameters); n.setAnnotations(annotations); @@ -1265,4 +1269,20 @@ public class ModifierVisitor<A> implements GenericVisitor<Visitable, A> { n.setComment(comment); return n; } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.ModifierVisitorGenerator") + public Visitable visit(final ReceiverParameter n, final A arg) { + NodeList<AnnotationExpr> annotations = modifyList(n.getAnnotations(), arg); + Name name = (Name) n.getName().accept(this, arg); + Type type = (Type) n.getType().accept(this, arg); + Comment comment = n.getComment().map(s -> (Comment) s.accept(this, arg)).orElse(null); + if (name == null || type == null) + return null; + n.setAnnotations(annotations); + n.setName(name); + n.setType(type); + n.setComment(comment); + return n; + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitor.java index 16c183256..8e6862995 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentEqualsVisitor.java @@ -1,118 +1,36 @@ -/*
- * Copyright (C) 2007-2010 Júlio Vilmar Gesser.
- * Copyright (C) 2011, 2013-2016 The JavaParser Team.
- *
- * This file is part of JavaParser.
- *
- * JavaParser can be used either under the terms of
- * a) the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * b) the terms of the Apache License
- *
- * You should have received a copy of both licenses in LICENCE.LGPL and
- * LICENCE.APACHE. Please refer to those files for details.
- *
- * JavaParser is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2016 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. */ package com.github.javaparser.ast.visitor; -import java.util.Optional; -import javax.annotation.Generated; -import com.github.javaparser.ast.ArrayCreationLevel; -import com.github.javaparser.ast.CompilationUnit; -import com.github.javaparser.ast.ImportDeclaration; -import com.github.javaparser.ast.Node; -import com.github.javaparser.ast.NodeList; -import com.github.javaparser.ast.PackageDeclaration; -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.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.body.MethodDeclaration; -import com.github.javaparser.ast.body.Parameter; -import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; import com.github.javaparser.ast.comments.BlockComment; import com.github.javaparser.ast.comments.JavadocComment; import com.github.javaparser.ast.comments.LineComment; -import com.github.javaparser.ast.expr.ArrayAccessExpr; -import com.github.javaparser.ast.expr.ArrayCreationExpr; -import com.github.javaparser.ast.expr.ArrayInitializerExpr; -import com.github.javaparser.ast.expr.AssignExpr; -import com.github.javaparser.ast.expr.BinaryExpr; -import com.github.javaparser.ast.expr.BooleanLiteralExpr; -import com.github.javaparser.ast.expr.CastExpr; -import com.github.javaparser.ast.expr.CharLiteralExpr; -import com.github.javaparser.ast.expr.ClassExpr; -import com.github.javaparser.ast.expr.ConditionalExpr; -import com.github.javaparser.ast.expr.DoubleLiteralExpr; -import com.github.javaparser.ast.expr.EnclosedExpr; -import com.github.javaparser.ast.expr.FieldAccessExpr; -import com.github.javaparser.ast.expr.InstanceOfExpr; -import com.github.javaparser.ast.expr.IntegerLiteralExpr; -import com.github.javaparser.ast.expr.LambdaExpr; -import com.github.javaparser.ast.expr.LongLiteralExpr; -import com.github.javaparser.ast.expr.MarkerAnnotationExpr; -import com.github.javaparser.ast.expr.MemberValuePair; -import com.github.javaparser.ast.expr.MethodCallExpr; -import com.github.javaparser.ast.expr.MethodReferenceExpr; -import com.github.javaparser.ast.expr.Name; -import com.github.javaparser.ast.expr.NameExpr; -import com.github.javaparser.ast.expr.NormalAnnotationExpr; -import com.github.javaparser.ast.expr.NullLiteralExpr; -import com.github.javaparser.ast.expr.ObjectCreationExpr; -import com.github.javaparser.ast.expr.SimpleName; -import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr; -import com.github.javaparser.ast.expr.StringLiteralExpr; -import com.github.javaparser.ast.expr.SuperExpr; -import com.github.javaparser.ast.expr.ThisExpr; -import com.github.javaparser.ast.expr.TypeExpr; -import com.github.javaparser.ast.expr.UnaryExpr; -import com.github.javaparser.ast.expr.VariableDeclarationExpr; -import com.github.javaparser.ast.modules.ModuleDeclaration; -import com.github.javaparser.ast.modules.ModuleExportsStmt; -import com.github.javaparser.ast.modules.ModuleOpensStmt; -import com.github.javaparser.ast.modules.ModuleProvidesStmt; -import com.github.javaparser.ast.modules.ModuleRequiresStmt; -import com.github.javaparser.ast.modules.ModuleUsesStmt; -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.LocalClassDeclarationStmt; -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.UnparsableStmt; -import com.github.javaparser.ast.stmt.WhileStmt; -import com.github.javaparser.ast.type.ArrayType; -import com.github.javaparser.ast.type.ClassOrInterfaceType; -import com.github.javaparser.ast.type.IntersectionType; -import com.github.javaparser.ast.type.PrimitiveType; -import com.github.javaparser.ast.type.TypeParameter; -import com.github.javaparser.ast.type.UnionType; -import com.github.javaparser.ast.type.UnknownType; -import com.github.javaparser.ast.type.VoidType; -import com.github.javaparser.ast.type.WildcardType; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import javax.annotation.Generated; +import java.util.Optional; public class NoCommentEqualsVisitor implements GenericVisitor<Boolean, Visitable> { @@ -349,6 +267,8 @@ public class NoCommentEqualsVisitor implements GenericVisitor<Boolean, Visitable return false; if (!nodesEquals(n.getParameters(), n2.getParameters())) return false; + if (!nodeEquals(n.getReceiverParameter(), n2.getReceiverParameter())) + return false; if (!nodesEquals(n.getThrownExceptions(), n2.getThrownExceptions())) return false; if (!nodesEquals(n.getTypeParameters(), n2.getTypeParameters())) @@ -372,6 +292,8 @@ public class NoCommentEqualsVisitor implements GenericVisitor<Boolean, Visitable return false; if (!nodesEquals(n.getParameters(), n2.getParameters())) return false; + if (!nodeEquals(n.getReceiverParameter(), n2.getReceiverParameter())) + return false; if (!nodesEquals(n.getThrownExceptions(), n2.getThrownExceptions())) return false; if (!nodesEquals(n.getTypeParameters(), n2.getTypeParameters())) @@ -1208,4 +1130,17 @@ public class NoCommentEqualsVisitor implements GenericVisitor<Boolean, Visitable public Boolean visit(final UnparsableStmt n, final Visitable arg) { return true; } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.NoCommentEqualsVisitorGenerator") + public Boolean visit(final ReceiverParameter n, final Visitable arg) { + final ReceiverParameter n2 = (ReceiverParameter) arg; + if (!nodesEquals(n.getAnnotations(), n2.getAnnotations())) + return false; + if (!nodeEquals(n.getName(), n2.getName())) + return false; + if (!nodeEquals(n.getType(), n2.getType())) + return false; + return true; + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitor.java index 024a221f1..914391c90 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/NoCommentHashCodeVisitor.java @@ -1,117 +1,35 @@ -/*
- * Copyright (C) 2007-2010 Júlio Vilmar Gesser.
- * Copyright (C) 2011, 2013-2016 The JavaParser Team.
- *
- * This file is part of JavaParser.
- *
- * JavaParser can be used either under the terms of
- * a) the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * b) the terms of the Apache License
- *
- * You should have received a copy of both licenses in LICENCE.LGPL and
- * LICENCE.APACHE. Please refer to those files for details.
- *
- * JavaParser is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+/* + * Copyright (C) 2007-2010 Júlio Vilmar Gesser. + * Copyright (C) 2011, 2013-2016 The JavaParser Team. + * + * This file is part of JavaParser. + * + * JavaParser can be used either under the terms of + * a) the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * b) the terms of the Apache License + * + * You should have received a copy of both licenses in LICENCE.LGPL and + * LICENCE.APACHE. Please refer to those files for details. + * + * JavaParser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. */ package com.github.javaparser.ast.visitor; -import javax.annotation.Generated; -import com.github.javaparser.ast.ArrayCreationLevel; -import com.github.javaparser.ast.CompilationUnit; -import com.github.javaparser.ast.ImportDeclaration; -import com.github.javaparser.ast.Node; -import com.github.javaparser.ast.NodeList; -import com.github.javaparser.ast.PackageDeclaration; -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.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.body.MethodDeclaration; -import com.github.javaparser.ast.body.Parameter; -import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.*; +import com.github.javaparser.ast.body.*; import com.github.javaparser.ast.comments.BlockComment; import com.github.javaparser.ast.comments.JavadocComment; import com.github.javaparser.ast.comments.LineComment; -import com.github.javaparser.ast.expr.ArrayAccessExpr; -import com.github.javaparser.ast.expr.ArrayCreationExpr; -import com.github.javaparser.ast.expr.ArrayInitializerExpr; -import com.github.javaparser.ast.expr.AssignExpr; -import com.github.javaparser.ast.expr.BinaryExpr; -import com.github.javaparser.ast.expr.BooleanLiteralExpr; -import com.github.javaparser.ast.expr.CastExpr; -import com.github.javaparser.ast.expr.CharLiteralExpr; -import com.github.javaparser.ast.expr.ClassExpr; -import com.github.javaparser.ast.expr.ConditionalExpr; -import com.github.javaparser.ast.expr.DoubleLiteralExpr; -import com.github.javaparser.ast.expr.EnclosedExpr; -import com.github.javaparser.ast.expr.FieldAccessExpr; -import com.github.javaparser.ast.expr.InstanceOfExpr; -import com.github.javaparser.ast.expr.IntegerLiteralExpr; -import com.github.javaparser.ast.expr.LambdaExpr; -import com.github.javaparser.ast.expr.LongLiteralExpr; -import com.github.javaparser.ast.expr.MarkerAnnotationExpr; -import com.github.javaparser.ast.expr.MemberValuePair; -import com.github.javaparser.ast.expr.MethodCallExpr; -import com.github.javaparser.ast.expr.MethodReferenceExpr; -import com.github.javaparser.ast.expr.Name; -import com.github.javaparser.ast.expr.NameExpr; -import com.github.javaparser.ast.expr.NormalAnnotationExpr; -import com.github.javaparser.ast.expr.NullLiteralExpr; -import com.github.javaparser.ast.expr.ObjectCreationExpr; -import com.github.javaparser.ast.expr.SimpleName; -import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr; -import com.github.javaparser.ast.expr.StringLiteralExpr; -import com.github.javaparser.ast.expr.SuperExpr; -import com.github.javaparser.ast.expr.ThisExpr; -import com.github.javaparser.ast.expr.TypeExpr; -import com.github.javaparser.ast.expr.UnaryExpr; -import com.github.javaparser.ast.expr.VariableDeclarationExpr; -import com.github.javaparser.ast.modules.ModuleDeclaration; -import com.github.javaparser.ast.modules.ModuleExportsStmt; -import com.github.javaparser.ast.modules.ModuleOpensStmt; -import com.github.javaparser.ast.modules.ModuleProvidesStmt; -import com.github.javaparser.ast.modules.ModuleRequiresStmt; -import com.github.javaparser.ast.modules.ModuleUsesStmt; -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.LocalClassDeclarationStmt; -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.UnparsableStmt; -import com.github.javaparser.ast.stmt.WhileStmt; -import com.github.javaparser.ast.type.ArrayType; -import com.github.javaparser.ast.type.ClassOrInterfaceType; -import com.github.javaparser.ast.type.IntersectionType; -import com.github.javaparser.ast.type.PrimitiveType; -import com.github.javaparser.ast.type.TypeParameter; -import com.github.javaparser.ast.type.UnionType; -import com.github.javaparser.ast.type.UnknownType; -import com.github.javaparser.ast.type.VoidType; -import com.github.javaparser.ast.type.WildcardType; +import com.github.javaparser.ast.expr.*; +import com.github.javaparser.ast.modules.*; +import com.github.javaparser.ast.stmt.*; +import com.github.javaparser.ast.type.*; +import javax.annotation.Generated; public class NoCommentHashCodeVisitor implements GenericVisitor<Integer, Void> { @@ -233,7 +151,7 @@ public class NoCommentHashCodeVisitor implements GenericVisitor<Integer, Void> { @Generated("com.github.javaparser.generator.core.visitor.NoCommentHashCodeVisitorGenerator") public Integer visit(final ConstructorDeclaration n, final Void arg) { - return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); + return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getReceiverParameter().isPresent() ? n.getReceiverParameter().get().accept(this, arg) : 0) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); } @Generated("com.github.javaparser.generator.core.visitor.NoCommentHashCodeVisitorGenerator") @@ -378,7 +296,7 @@ public class NoCommentHashCodeVisitor implements GenericVisitor<Integer, Void> { @Generated("com.github.javaparser.generator.core.visitor.NoCommentHashCodeVisitorGenerator") public Integer visit(final MethodDeclaration n, final Void arg) { - return (n.getBody().isPresent() ? n.getBody().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); + return (n.getBody().isPresent() ? n.getBody().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getParameters().accept(this, arg)) * 31 + (n.getReceiverParameter().isPresent() ? n.getReceiverParameter().get().accept(this, arg) : 0) * 31 + (n.getThrownExceptions().accept(this, arg)) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); } @Generated("com.github.javaparser.generator.core.visitor.NoCommentHashCodeVisitorGenerator") @@ -578,4 +496,10 @@ public class NoCommentHashCodeVisitor implements GenericVisitor<Integer, Void> { public Integer visit(final UnparsableStmt n, final Void arg) { return 0; } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.NoCommentHashCodeVisitorGenerator") + public Integer visit(final ReceiverParameter n, final Void arg) { + return (n.getAnnotations().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)); + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ObjectIdentityEqualsVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ObjectIdentityEqualsVisitor.java index efbfcec08..dceeabba3 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ObjectIdentityEqualsVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ObjectIdentityEqualsVisitor.java @@ -582,4 +582,10 @@ public class ObjectIdentityEqualsVisitor implements GenericVisitor<Boolean, Visi public Boolean visit(final UnparsableStmt n, final Visitable arg) { return n == arg; } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.ObjectIdentityEqualsVisitorGenerator") + public Boolean visit(final ReceiverParameter n, final Visitable arg) { + return n == arg; + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ObjectIdentityHashCodeVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ObjectIdentityHashCodeVisitor.java index a81914311..8f7a5e386 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ObjectIdentityHashCodeVisitor.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/ObjectIdentityHashCodeVisitor.java @@ -496,4 +496,10 @@ public class ObjectIdentityHashCodeVisitor implements GenericVisitor<Integer, Vo public Integer visit(final UnparsableStmt n, final Void arg) { return n.hashCode(); } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.ObjectIdentityHashCodeVisitorGenerator") + public Integer visit(final ReceiverParameter n, final Void arg) { + return n.hashCode(); + } } 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 9be4d3a76..e797d8ef4 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 @@ -306,4 +306,7 @@ public interface VoidVisitor<A> { @Generated("com.github.javaparser.generator.core.visitor.VoidVisitorGenerator") void visit(UnparsableStmt n, A arg); + + @Generated("com.github.javaparser.generator.core.visitor.VoidVisitorGenerator") + void visit(ReceiverParameter n, A arg); } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java index db35866ce..6ece2a302 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorAdapter.java @@ -208,6 +208,7 @@ public abstract class VoidVisitorAdapter<A> implements VoidVisitor<A> { n.getBody().accept(this, arg); n.getName().accept(this, arg); n.getParameters().forEach(p -> p.accept(this, arg)); + n.getReceiverParameter().ifPresent(l -> l.accept(this, arg)); n.getThrownExceptions().forEach(p -> p.accept(this, arg)); n.getTypeParameters().forEach(p -> p.accept(this, arg)); n.getAnnotations().forEach(p -> p.accept(this, arg)); @@ -410,6 +411,7 @@ public abstract class VoidVisitorAdapter<A> implements VoidVisitor<A> { n.getType().accept(this, arg); n.getName().accept(this, arg); n.getParameters().forEach(p -> p.accept(this, arg)); + n.getReceiverParameter().ifPresent(l -> l.accept(this, arg)); n.getThrownExceptions().forEach(p -> p.accept(this, arg)); n.getTypeParameters().forEach(p -> p.accept(this, arg)); n.getAnnotations().forEach(p -> p.accept(this, arg)); @@ -753,4 +755,13 @@ public abstract class VoidVisitorAdapter<A> implements VoidVisitor<A> { public void visit(final UnparsableStmt n, final A arg) { n.getComment().ifPresent(l -> l.accept(this, arg)); } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.VoidVisitorAdapterGenerator") + public void visit(final ReceiverParameter n, final A arg) { + n.getAnnotations().forEach(p -> p.accept(this, arg)); + n.getName().accept(this, arg); + n.getType().accept(this, arg); + n.getComment().ifPresent(l -> l.accept(this, arg)); + } } diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorWithDefaults.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorWithDefaults.java index b2dcb853d..ba5a93db2 100644 --- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorWithDefaults.java +++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/VoidVisitorWithDefaults.java @@ -585,4 +585,10 @@ public abstract class VoidVisitorWithDefaults<A> implements VoidVisitor<A> { public void visit(final UnparsableStmt n, final A arg) { defaultAction(n, arg); } + + @Override + @Generated("com.github.javaparser.generator.core.visitor.VoidVisitorWithDefaultsGenerator") + public void visit(final ReceiverParameter n, final A arg) { + defaultAction(n, arg); + } } |