| 1 | /* |
|---|---|
| 2 | * Copyright (C) 2007-2010 JĂșlio Vilmar Gesser. |
| 3 | * Copyright (C) 2011, 2013-2020 The JavaParser Team. |
| 4 | * |
| 5 | * This file is part of JavaParser. |
| 6 | * |
| 7 | * JavaParser can be used either under the terms of |
| 8 | * a) the GNU Lesser General Public License as published by |
| 9 | * the Free Software Foundation, either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * b) the terms of the Apache License |
| 12 | * |
| 13 | * You should have received a copy of both licenses in LICENCE.LGPL and |
| 14 | * LICENCE.APACHE. Please refer to those files for details. |
| 15 | * |
| 16 | * JavaParser is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU Lesser General Public License for more details. |
| 20 | */ |
| 21 | package com.github.javaparser.ast.visitor; |
| 22 | |
| 23 | import com.github.javaparser.ast.*; |
| 24 | import com.github.javaparser.ast.body.*; |
| 25 | import com.github.javaparser.ast.comments.BlockComment; |
| 26 | import com.github.javaparser.ast.comments.JavadocComment; |
| 27 | import com.github.javaparser.ast.comments.LineComment; |
| 28 | import com.github.javaparser.ast.expr.*; |
| 29 | import com.github.javaparser.ast.modules.*; |
| 30 | import com.github.javaparser.ast.stmt.*; |
| 31 | import com.github.javaparser.ast.type.*; |
| 32 | |
| 33 | public class NoCommentHashCodeVisitor implements GenericVisitor<Integer, Void> { |
| 34 | |
| 35 | private static final NoCommentHashCodeVisitor SINGLETON = new NoCommentHashCodeVisitor(); |
| 36 | |
| 37 | public static int hashCode(final Node node) { |
| 38 | return node.accept(SINGLETON, null); |
| 39 | } |
| 40 | |
| 41 | public Integer visit(final AnnotationDeclaration n, final Void arg) { |
| 42 | return (n.getMembers().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 43 | } |
| 44 | |
| 45 | public Integer visit(final AnnotationMemberDeclaration n, final Void arg) { |
| 46 | return (n.getDefaultValue().isPresent() ? n.getDefaultValue().get().accept(this, arg) : 0) * 31 + (n.getModifiers().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 47 | } |
| 48 | |
| 49 | public Integer visit(final ArrayAccessExpr n, final Void arg) { |
| 50 | return (n.getIndex().accept(this, arg)) * 31 + (n.getName().accept(this, arg)); |
| 51 | } |
| 52 | |
| 53 | public Integer visit(final ArrayCreationExpr n, final Void arg) { |
| 54 | return (n.getElementType().accept(this, arg)) * 31 + (n.getInitializer().isPresent() ? n.getInitializer().get().accept(this, arg) : 0) * 31 + (n.getLevels().accept(this, arg)); |
| 55 | } |
| 56 | |
| 57 | public Integer visit(final ArrayCreationLevel n, final Void arg) { |
| 58 | return (n.getAnnotations().accept(this, arg)) * 31 + (n.getDimension().isPresent() ? n.getDimension().get().accept(this, arg) : 0); |
| 59 | } |
| 60 | |
| 61 | public Integer visit(final ArrayInitializerExpr n, final Void arg) { |
| 62 | return (n.getValues().accept(this, arg)); |
| 63 | } |
| 64 | |
| 65 | public Integer visit(final ArrayType n, final Void arg) { |
| 66 | return (n.getComponentType().accept(this, arg)) * 31 + (n.getOrigin().hashCode()) * 31 + (n.getAnnotations().accept(this, arg)); |
| 67 | } |
| 68 | |
| 69 | public Integer visit(final AssertStmt n, final Void arg) { |
| 70 | return (n.getCheck().accept(this, arg)) * 31 + (n.getMessage().isPresent() ? n.getMessage().get().accept(this, arg) : 0); |
| 71 | } |
| 72 | |
| 73 | public Integer visit(final AssignExpr n, final Void arg) { |
| 74 | return (n.getOperator().hashCode()) * 31 + (n.getTarget().accept(this, arg)) * 31 + (n.getValue().accept(this, arg)); |
| 75 | } |
| 76 | |
| 77 | public Integer visit(final BinaryExpr n, final Void arg) { |
| 78 | return (n.getLeft().accept(this, arg)) * 31 + (n.getOperator().hashCode()) * 31 + (n.getRight().accept(this, arg)); |
| 79 | } |
| 80 | |
| 81 | public Integer visit(final BlockComment n, final Void arg) { |
| 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | public Integer visit(final BlockStmt n, final Void arg) { |
| 86 | return (n.getStatements().accept(this, arg)); |
| 87 | } |
| 88 | |
| 89 | public Integer visit(final BooleanLiteralExpr n, final Void arg) { |
| 90 | return (n.isValue() ? 1 : 0); |
| 91 | } |
| 92 | |
| 93 | public Integer visit(final BreakStmt n, final Void arg) { |
| 94 | return (n.getLabel().isPresent() ? n.getLabel().get().accept(this, arg) : 0); |
| 95 | } |
| 96 | |
| 97 | public Integer visit(final CastExpr n, final Void arg) { |
| 98 | return (n.getExpression().accept(this, arg)) * 31 + (n.getType().accept(this, arg)); |
| 99 | } |
| 100 | |
| 101 | public Integer visit(final CatchClause n, final Void arg) { |
| 102 | return (n.getBody().accept(this, arg)) * 31 + (n.getParameter().accept(this, arg)); |
| 103 | } |
| 104 | |
| 105 | public Integer visit(final CharLiteralExpr n, final Void arg) { |
| 106 | return (n.getValue().hashCode()); |
| 107 | } |
| 108 | |
| 109 | public Integer visit(final ClassExpr n, final Void arg) { |
| 110 | return (n.getType().accept(this, arg)); |
| 111 | } |
| 112 | |
| 113 | public Integer visit(final ClassOrInterfaceDeclaration n, final Void arg) { |
| 114 | return (n.getExtendedTypes().accept(this, arg)) * 31 + (n.getImplementedTypes().accept(this, arg)) * 31 + (n.isInterface() ? 1 : 0) * 31 + (n.getTypeParameters().accept(this, arg)) * 31 + (n.getMembers().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 115 | } |
| 116 | |
| 117 | public Integer visit(final ClassOrInterfaceType n, final Void arg) { |
| 118 | return (n.getName().accept(this, arg)) * 31 + (n.getScope().isPresent() ? n.getScope().get().accept(this, arg) : 0) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0) * 31 + (n.getAnnotations().accept(this, arg)); |
| 119 | } |
| 120 | |
| 121 | public Integer visit(final CompilationUnit n, final Void arg) { |
| 122 | return (n.getImports().accept(this, arg)) * 31 + (n.getModule().isPresent() ? n.getModule().get().accept(this, arg) : 0) * 31 + (n.getPackageDeclaration().isPresent() ? n.getPackageDeclaration().get().accept(this, arg) : 0) * 31 + (n.getTypes().accept(this, arg)); |
| 123 | } |
| 124 | |
| 125 | public Integer visit(final ConditionalExpr n, final Void arg) { |
| 126 | return (n.getCondition().accept(this, arg)) * 31 + (n.getElseExpr().accept(this, arg)) * 31 + (n.getThenExpr().accept(this, arg)); |
| 127 | } |
| 128 | |
| 129 | public Integer visit(final ConstructorDeclaration n, final Void arg) { |
| 130 | return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 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)); |
| 131 | } |
| 132 | |
| 133 | public Integer visit(final ContinueStmt n, final Void arg) { |
| 134 | return (n.getLabel().isPresent() ? n.getLabel().get().accept(this, arg) : 0); |
| 135 | } |
| 136 | |
| 137 | public Integer visit(final DoStmt n, final Void arg) { |
| 138 | return (n.getBody().accept(this, arg)) * 31 + (n.getCondition().accept(this, arg)); |
| 139 | } |
| 140 | |
| 141 | public Integer visit(final DoubleLiteralExpr n, final Void arg) { |
| 142 | return (n.getValue().hashCode()); |
| 143 | } |
| 144 | |
| 145 | public Integer visit(final EmptyStmt n, final Void arg) { |
| 146 | return 0; |
| 147 | } |
| 148 | |
| 149 | public Integer visit(final EnclosedExpr n, final Void arg) { |
| 150 | return (n.getInner().accept(this, arg)); |
| 151 | } |
| 152 | |
| 153 | public Integer visit(final EnumConstantDeclaration n, final Void arg) { |
| 154 | return (n.getArguments().accept(this, arg)) * 31 + (n.getClassBody().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 155 | } |
| 156 | |
| 157 | public Integer visit(final EnumDeclaration n, final Void arg) { |
| 158 | return (n.getEntries().accept(this, arg)) * 31 + (n.getImplementedTypes().accept(this, arg)) * 31 + (n.getMembers().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 159 | } |
| 160 | |
| 161 | public Integer visit(final ExplicitConstructorInvocationStmt n, final Void arg) { |
| 162 | return (n.getArguments().accept(this, arg)) * 31 + (n.getExpression().isPresent() ? n.getExpression().get().accept(this, arg) : 0) * 31 + (n.isThis() ? 1 : 0) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0); |
| 163 | } |
| 164 | |
| 165 | public Integer visit(final ExpressionStmt n, final Void arg) { |
| 166 | return (n.getExpression().accept(this, arg)); |
| 167 | } |
| 168 | |
| 169 | public Integer visit(final FieldAccessExpr n, final Void arg) { |
| 170 | return (n.getName().accept(this, arg)) * 31 + (n.getScope().accept(this, arg)) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0); |
| 171 | } |
| 172 | |
| 173 | public Integer visit(final FieldDeclaration n, final Void arg) { |
| 174 | return (n.getModifiers().accept(this, arg)) * 31 + (n.getVariables().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 175 | } |
| 176 | |
| 177 | public Integer visit(final ForStmt n, final Void arg) { |
| 178 | return (n.getBody().accept(this, arg)) * 31 + (n.getCompare().isPresent() ? n.getCompare().get().accept(this, arg) : 0) * 31 + (n.getInitialization().accept(this, arg)) * 31 + (n.getUpdate().accept(this, arg)); |
| 179 | } |
| 180 | |
| 181 | public Integer visit(final ForEachStmt n, final Void arg) { |
| 182 | return (n.getBody().accept(this, arg)) * 31 + (n.getIterable().accept(this, arg)) * 31 + (n.getVariable().accept(this, arg)); |
| 183 | } |
| 184 | |
| 185 | public Integer visit(final IfStmt n, final Void arg) { |
| 186 | return (n.getCondition().accept(this, arg)) * 31 + (n.getElseStmt().isPresent() ? n.getElseStmt().get().accept(this, arg) : 0) * 31 + (n.getThenStmt().accept(this, arg)); |
| 187 | } |
| 188 | |
| 189 | public Integer visit(final ImportDeclaration n, final Void arg) { |
| 190 | return (n.isAsterisk() ? 1 : 0) * 31 + (n.isStatic() ? 1 : 0) * 31 + (n.getName().accept(this, arg)); |
| 191 | } |
| 192 | |
| 193 | public Integer visit(final InitializerDeclaration n, final Void arg) { |
| 194 | return (n.getBody().accept(this, arg)) * 31 + (n.isStatic() ? 1 : 0) * 31 + (n.getAnnotations().accept(this, arg)); |
| 195 | } |
| 196 | |
| 197 | public Integer visit(final InstanceOfExpr n, final Void arg) { |
| 198 | return (n.getExpression().accept(this, arg)) * 31 + (n.getType().accept(this, arg)); |
| 199 | } |
| 200 | |
| 201 | public Integer visit(final IntegerLiteralExpr n, final Void arg) { |
| 202 | return (n.getValue().hashCode()); |
| 203 | } |
| 204 | |
| 205 | public Integer visit(final IntersectionType n, final Void arg) { |
| 206 | return (n.getElements().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 207 | } |
| 208 | |
| 209 | public Integer visit(final JavadocComment n, final Void arg) { |
| 210 | return 0; |
| 211 | } |
| 212 | |
| 213 | public Integer visit(final LabeledStmt n, final Void arg) { |
| 214 | return (n.getLabel().accept(this, arg)) * 31 + (n.getStatement().accept(this, arg)); |
| 215 | } |
| 216 | |
| 217 | public Integer visit(final LambdaExpr n, final Void arg) { |
| 218 | return (n.getBody().accept(this, arg)) * 31 + (n.isEnclosingParameters() ? 1 : 0) * 31 + (n.getParameters().accept(this, arg)); |
| 219 | } |
| 220 | |
| 221 | public Integer visit(final LineComment n, final Void arg) { |
| 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | public Integer visit(final LocalClassDeclarationStmt n, final Void arg) { |
| 226 | return (n.getClassDeclaration().accept(this, arg)); |
| 227 | } |
| 228 | |
| 229 | public Integer visit(final LongLiteralExpr n, final Void arg) { |
| 230 | return (n.getValue().hashCode()); |
| 231 | } |
| 232 | |
| 233 | public Integer visit(final MarkerAnnotationExpr n, final Void arg) { |
| 234 | return (n.getName().accept(this, arg)); |
| 235 | } |
| 236 | |
| 237 | public Integer visit(final MemberValuePair n, final Void arg) { |
| 238 | return (n.getName().accept(this, arg)) * 31 + (n.getValue().accept(this, arg)); |
| 239 | } |
| 240 | |
| 241 | public Integer visit(final MethodCallExpr n, final Void arg) { |
| 242 | return (n.getArguments().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getScope().isPresent() ? n.getScope().get().accept(this, arg) : 0) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0); |
| 243 | } |
| 244 | |
| 245 | public Integer visit(final MethodDeclaration n, final Void arg) { |
| 246 | return (n.getBody().isPresent() ? n.getBody().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 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)); |
| 247 | } |
| 248 | |
| 249 | public Integer visit(final MethodReferenceExpr n, final Void arg) { |
| 250 | return (n.getIdentifier().hashCode()) * 31 + (n.getScope().accept(this, arg)) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0); |
| 251 | } |
| 252 | |
| 253 | public Integer visit(final NameExpr n, final Void arg) { |
| 254 | return (n.getName().accept(this, arg)); |
| 255 | } |
| 256 | |
| 257 | public Integer visit(final Name n, final Void arg) { |
| 258 | return (n.getIdentifier().hashCode()) * 31 + (n.getQualifier().isPresent() ? n.getQualifier().get().accept(this, arg) : 0); |
| 259 | } |
| 260 | |
| 261 | public Integer visit(NodeList n, Void arg) { |
| 262 | int result = 0; |
| 263 | for (Object node : n) { |
| 264 | result += 31 * ((Visitable) node).accept(this, arg); |
| 265 | } |
| 266 | return result; |
| 267 | } |
| 268 | |
| 269 | public Integer visit(final NormalAnnotationExpr n, final Void arg) { |
| 270 | return (n.getPairs().accept(this, arg)) * 31 + (n.getName().accept(this, arg)); |
| 271 | } |
| 272 | |
| 273 | public Integer visit(final NullLiteralExpr n, final Void arg) { |
| 274 | return 0; |
| 275 | } |
| 276 | |
| 277 | public Integer visit(final ObjectCreationExpr n, final Void arg) { |
| 278 | return (n.getAnonymousClassBody().isPresent() ? n.getAnonymousClassBody().get().accept(this, arg) : 0) * 31 + (n.getArguments().accept(this, arg)) * 31 + (n.getScope().isPresent() ? n.getScope().get().accept(this, arg) : 0) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getTypeArguments().isPresent() ? n.getTypeArguments().get().accept(this, arg) : 0); |
| 279 | } |
| 280 | |
| 281 | public Integer visit(final PackageDeclaration n, final Void arg) { |
| 282 | return (n.getAnnotations().accept(this, arg)) * 31 + (n.getName().accept(this, arg)); |
| 283 | } |
| 284 | |
| 285 | public Integer visit(final Parameter n, final Void arg) { |
| 286 | return (n.getAnnotations().accept(this, arg)) * 31 + (n.isVarArgs() ? 1 : 0) * 31 + (n.getModifiers().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)) * 31 + (n.getVarArgsAnnotations().accept(this, arg)); |
| 287 | } |
| 288 | |
| 289 | public Integer visit(final PrimitiveType n, final Void arg) { |
| 290 | return (n.getType().hashCode()) * 31 + (n.getAnnotations().accept(this, arg)); |
| 291 | } |
| 292 | |
| 293 | public Integer visit(final ReturnStmt n, final Void arg) { |
| 294 | return (n.getExpression().isPresent() ? n.getExpression().get().accept(this, arg) : 0); |
| 295 | } |
| 296 | |
| 297 | public Integer visit(final SimpleName n, final Void arg) { |
| 298 | return (n.getIdentifier().hashCode()); |
| 299 | } |
| 300 | |
| 301 | public Integer visit(final SingleMemberAnnotationExpr n, final Void arg) { |
| 302 | return (n.getMemberValue().accept(this, arg)) * 31 + (n.getName().accept(this, arg)); |
| 303 | } |
| 304 | |
| 305 | public Integer visit(final StringLiteralExpr n, final Void arg) { |
| 306 | return (n.getValue().hashCode()); |
| 307 | } |
| 308 | |
| 309 | public Integer visit(final SuperExpr n, final Void arg) { |
| 310 | return (n.getTypeName().isPresent() ? n.getTypeName().get().accept(this, arg) : 0); |
| 311 | } |
| 312 | |
| 313 | public Integer visit(final SwitchEntry n, final Void arg) { |
| 314 | return (n.getLabels().accept(this, arg)) * 31 + (n.getStatements().accept(this, arg)) * 31 + (n.getType().hashCode()); |
| 315 | } |
| 316 | |
| 317 | public Integer visit(final SwitchStmt n, final Void arg) { |
| 318 | return (n.getEntries().accept(this, arg)) * 31 + (n.getSelector().accept(this, arg)); |
| 319 | } |
| 320 | |
| 321 | public Integer visit(final SynchronizedStmt n, final Void arg) { |
| 322 | return (n.getBody().accept(this, arg)) * 31 + (n.getExpression().accept(this, arg)); |
| 323 | } |
| 324 | |
| 325 | public Integer visit(final ThisExpr n, final Void arg) { |
| 326 | return (n.getTypeName().isPresent() ? n.getTypeName().get().accept(this, arg) : 0); |
| 327 | } |
| 328 | |
| 329 | public Integer visit(final ThrowStmt n, final Void arg) { |
| 330 | return (n.getExpression().accept(this, arg)); |
| 331 | } |
| 332 | |
| 333 | public Integer visit(final TryStmt n, final Void arg) { |
| 334 | return (n.getCatchClauses().accept(this, arg)) * 31 + (n.getFinallyBlock().isPresent() ? n.getFinallyBlock().get().accept(this, arg) : 0) * 31 + (n.getResources().accept(this, arg)) * 31 + (n.getTryBlock().accept(this, arg)); |
| 335 | } |
| 336 | |
| 337 | public Integer visit(final TypeExpr n, final Void arg) { |
| 338 | return (n.getType().accept(this, arg)); |
| 339 | } |
| 340 | |
| 341 | public Integer visit(final TypeParameter n, final Void arg) { |
| 342 | return (n.getName().accept(this, arg)) * 31 + (n.getTypeBound().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 343 | } |
| 344 | |
| 345 | public Integer visit(final UnaryExpr n, final Void arg) { |
| 346 | return (n.getExpression().accept(this, arg)) * 31 + (n.getOperator().hashCode()); |
| 347 | } |
| 348 | |
| 349 | public Integer visit(final UnionType n, final Void arg) { |
| 350 | return (n.getElements().accept(this, arg)) * 31 + (n.getAnnotations().accept(this, arg)); |
| 351 | } |
| 352 | |
| 353 | public Integer visit(final UnknownType n, final Void arg) { |
| 354 | return (n.getAnnotations().accept(this, arg)); |
| 355 | } |
| 356 | |
| 357 | public Integer visit(final VariableDeclarationExpr n, final Void arg) { |
| 358 | return (n.getAnnotations().accept(this, arg)) * 31 + (n.getModifiers().accept(this, arg)) * 31 + (n.getVariables().accept(this, arg)); |
| 359 | } |
| 360 | |
| 361 | public Integer visit(final VariableDeclarator n, final Void arg) { |
| 362 | return (n.getInitializer().isPresent() ? n.getInitializer().get().accept(this, arg) : 0) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)); |
| 363 | } |
| 364 | |
| 365 | public Integer visit(final VoidType n, final Void arg) { |
| 366 | return (n.getAnnotations().accept(this, arg)); |
| 367 | } |
| 368 | |
| 369 | public Integer visit(final WhileStmt n, final Void arg) { |
| 370 | return (n.getBody().accept(this, arg)) * 31 + (n.getCondition().accept(this, arg)); |
| 371 | } |
| 372 | |
| 373 | public Integer visit(final WildcardType n, final Void arg) { |
| 374 | return (n.getExtendedType().isPresent() ? n.getExtendedType().get().accept(this, arg) : 0) * 31 + (n.getSuperType().isPresent() ? n.getSuperType().get().accept(this, arg) : 0) * 31 + (n.getAnnotations().accept(this, arg)); |
| 375 | } |
| 376 | |
| 377 | public Integer visit(final ModuleDeclaration n, final Void arg) { |
| 378 | return (n.getAnnotations().accept(this, arg)) * 31 + (n.getDirectives().accept(this, arg)) * 31 + (n.isOpen() ? 1 : 0) * 31 + (n.getName().accept(this, arg)); |
| 379 | } |
| 380 | |
| 381 | public Integer visit(final ModuleRequiresDirective n, final Void arg) { |
| 382 | return (n.getModifiers().accept(this, arg)) * 31 + (n.getName().accept(this, arg)); |
| 383 | } |
| 384 | |
| 385 | @Override() |
| 386 | public Integer visit(final ModuleExportsDirective n, final Void arg) { |
| 387 | return (n.getModuleNames().accept(this, arg)) * 31 + (n.getName().accept(this, arg)); |
| 388 | } |
| 389 | |
| 390 | @Override() |
| 391 | public Integer visit(final ModuleProvidesDirective n, final Void arg) { |
| 392 | return (n.getName().accept(this, arg)) * 31 + (n.getWith().accept(this, arg)); |
| 393 | } |
| 394 | |
| 395 | @Override() |
| 396 | public Integer visit(final ModuleUsesDirective n, final Void arg) { |
| 397 | return (n.getName().accept(this, arg)); |
| 398 | } |
| 399 | |
| 400 | @Override |
| 401 | public Integer visit(final ModuleOpensDirective n, final Void arg) { |
| 402 | return (n.getModuleNames().accept(this, arg)) * 31 + (n.getName().accept(this, arg)); |
| 403 | } |
| 404 | |
| 405 | @Override |
| 406 | public Integer visit(final UnparsableStmt n, final Void arg) { |
| 407 | return 0; |
| 408 | } |
| 409 | |
| 410 | @Override |
| 411 | public Integer visit(final ReceiverParameter n, final Void arg) { |
| 412 | return (n.getAnnotations().accept(this, arg)) * 31 + (n.getName().accept(this, arg)) * 31 + (n.getType().accept(this, arg)); |
| 413 | } |
| 414 | |
| 415 | @Override |
| 416 | public Integer visit(final VarType n, final Void arg) { |
| 417 | return (n.getAnnotations().accept(this, arg)); |
| 418 | } |
| 419 | |
| 420 | @Override |
| 421 | public Integer visit(final Modifier n, final Void arg) { |
| 422 | return (n.getKeyword().hashCode()); |
| 423 | } |
| 424 | |
| 425 | @Override |
| 426 | public Integer visit(final SwitchExpr n, final Void arg) { |
| 427 | return (n.getEntries().accept(this, arg)) * 31 + (n.getSelector().accept(this, arg)); |
| 428 | } |
| 429 | |
| 430 | @Override |
| 431 | public Integer visit(final YieldStmt n, final Void arg) { |
| 432 | return (n.getExpression().accept(this, arg)); |
| 433 | } |
| 434 | |
| 435 | @Override |
| 436 | public Integer visit(final TextBlockLiteralExpr n, final Void arg) { |
| 437 | return (n.getValue().hashCode()); |
| 438 | } |
| 439 | } |
| 440 |
Members