diff --git a/java/java-impl/src/com/intellij/codeInspection/DuplicateBranchesInSwitchInspection.java b/java/java-impl/src/com/intellij/codeInspection/DuplicateBranchesInSwitchInspection.java index 838e8d3b5128..f6f3b1a39d69 100644 --- a/java/java-impl/src/com/intellij/codeInspection/DuplicateBranchesInSwitchInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/DuplicateBranchesInSwitchInspection.java @@ -638,11 +638,8 @@ public class DuplicateBranchesInSwitchInspection extends LocalInspectionTool { private final boolean myIsSimpleExit; private final boolean myCanFallThrough; - Branch(@NotNull PsiSwitchLabelStatement[] labels, @NotNull List statementList, - boolean hasImplicitBreak, @NotNull String[] commentTexts) { - super(labels, - statementsWithoutTrailingBreak(statementList), - commentTexts); + Branch(@NotNull PsiSwitchLabelStatement[] labels, @NotNull List statementList, boolean hasImplicitBreak, @NotNull String[] comments) { + super(labels, statementsWithoutTrailingBreak(statementList), comments); int lastIndex = statementList.size() - 1; PsiStatement lastStatement = statementList.get(lastIndex); @@ -677,9 +674,7 @@ public class DuplicateBranchesInSwitchInspection extends LocalInspectionTool { return new DeleteRedundantBranchFix(); } - /** - * switch labels with comments and spaces - */ + // 'switch' labels with comments and spaces @NotNull List getBranchPrefix() { List result = new ArrayList<>(); @@ -785,10 +780,7 @@ public class DuplicateBranchesInSwitchInspection extends LocalInspectionTool { private final boolean myIsSimpleExit; Rule(@NotNull PsiSwitchLabeledRuleStatement rule, @NotNull PsiStatement body, @NotNull String[] commentTexts) { - super(new PsiSwitchLabeledRuleStatement[]{rule}, - new PsiStatement[]{body}, - commentTexts); - + super(new PsiSwitchLabeledRuleStatement[]{rule}, new PsiStatement[]{body}, commentTexts); myIsSimpleExit = body instanceof PsiExpressionStatement || body instanceof PsiThrowStatement; } diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowAnalyzer.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowAnalyzer.java index b78a4623e25b..b1c31aa90c7f 100644 --- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowAnalyzer.java +++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowAnalyzer.java @@ -27,7 +27,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor { private final ControlFlowPolicy myPolicy; private ControlFlowImpl myCurrentFlow; - private final Stack myCatchParameters = new Stack<>();// stack of PsiParameter for catch + private final Stack myCatchParameters = new Stack<>();// stack of PsiParameter for 'catch' private final Stack myCatchBlocks = new Stack<>(); private final Stack myFinallyBlocks = new Stack<>(); @@ -239,7 +239,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor { for (int i = myUnhandledExceptionCatchBlocks.size() - 1; i >= 0; i--) { ProgressManager.checkCanceled(); PsiElement block = myUnhandledExceptionCatchBlocks.get(i); - // cannot jump to outer catch blocks (belonging to outer try stmt) if current try{} has finally block + // cannot jump to outer catch blocks (belonging to outer try stmt) if current try{} has 'finally' block if (block == null) { if (!myFinallyBlocks.isEmpty()) { break; @@ -255,7 +255,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor { } } - // generate jump to the top finally block + // generate a jump to the top 'finally' block if (!myFinallyBlocks.isEmpty()) { final PsiElement finallyBlock = myFinallyBlocks.peek().getElement(); ConditionalThrowToInstruction throwToInstruction = new ConditionalThrowToInstruction(-2); @@ -852,8 +852,8 @@ class ControlFlowAnalyzer extends JavaElementVisitor { @Override public void visitSwitchLabeledRuleStatement(PsiSwitchLabeledRuleStatement statement) { startElement(statement); - PsiExpressionList caseValues = statement.getCaseValues(); + PsiExpressionList caseValues = statement.getCaseValues(); if (caseValues != null) { for (PsiExpression caseValue : caseValues.getExpressions()) { ProgressManager.checkCanceled(); @@ -983,7 +983,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor { } /** - * find offsets of catch(es) corresponding to this throw statement + * Find offsets of catch(es) corresponding to this throw statement * myCatchParameters and myCatchBlocks arrays should be sorted in ascending scope order (from outermost to innermost) * * @return list of targets or list of single null element if no appropriate targets found @@ -1066,7 +1066,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor { if (description != null) { description.accept(this); } - // if description is evaluated, the assert statement cannot complete normally + // if description is evaluated, the 'assert' statement cannot complete normally // though non-necessarily AssertionError will be thrown (description may throw something, or AssertionError ctor, etc.) PsiClassType exceptionClass = JavaPsiFacade.getElementFactory(statement.getProject()).createTypeByFQClassName( CommonClassNames.JAVA_LANG_THROWABLE, statement.getResolveScope()); @@ -1217,7 +1217,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor { // unchecked exception throwing completion myCurrentFlow.addInstruction(new ReturnInstruction(procStart - 1, throwExceptionCompletion)); - // checked exception throwing completion. need to dispatch to the correct catch clause + // checked exception throwing completion; need to dispatch to the correct catch clause final List unhandledExceptionCatchBlocks = finallyBlockToUnhandledExceptions.remove(finallyBlock); for (int i = 0; unhandledExceptionCatchBlocks != null && i < unhandledExceptionCatchBlocks.size(); i++) { ProgressManager.checkCanceled(); @@ -1476,18 +1476,16 @@ class ControlFlowAnalyzer extends JavaElementVisitor { switch (shortcut) { case NO_SHORTCUT: - assert lOperand != null; myCurrentFlow.addInstruction(new ConditionalGoToInstruction(0, role, lOperand)); addElementOffsetLater(gotoElement, gotoIsAtStart); + break; - break; case STOP_EXPRESSION: - if (lOperand != null) { - myCurrentFlow.addInstruction(new GoToInstruction(0, role)); - addElementOffsetLater(gotoElement, gotoIsAtStart); - rValue = null; - } + myCurrentFlow.addInstruction(new GoToInstruction(0, role)); + addElementOffsetLater(gotoElement, gotoIsAtStart); + rValue = null; break; + case SKIP_CURRENT_OPERAND: break; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiLabelReference.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiLabelReference.java index 691ced04d882..1f049dcae9f3 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiLabelReference.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiLabelReference.java @@ -4,7 +4,7 @@ package com.intellij.psi.impl.source; import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.impl.PsiImplUtil; -import com.intellij.util.ArrayUtilRt; +import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; @@ -67,7 +67,7 @@ public class PsiLabelReference implements PsiReference { @NotNull @Override public String[] getVariants() { - return ArrayUtilRt.toStringArray(PsiImplUtil.findAllEnclosingLabels(myStatement)); + return ArrayUtil.toStringArray(PsiImplUtil.findAllEnclosingLabels(myStatement)); } @Override diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspection.java index 2a3c27627faf..0f0ef4b3975e 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspection.java @@ -37,17 +37,12 @@ import javax.swing.*; import static com.intellij.util.ObjectUtils.tryCast; public class UnnecessaryLocalVariableInspection extends BaseInspection { - /** - * @noinspection PublicField, WeakerAccess - */ public boolean m_ignoreImmediatelyReturnedVariables; - /** - * @deprecated unused, left for compatibility - * @noinspection PublicField - */ + + /** @deprecated unused, left for compatibility */ @Deprecated public boolean m_ignoreAnnotatedVariables; - @SuppressWarnings("WeakerAccess") + public boolean m_ignoreAnnotatedVariablesNew = true; @Override diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java index 03dcf57446d3..0757ec3e0c8a 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java @@ -9,7 +9,6 @@ import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase; import com.intellij.util.ArrayUtilRt; import org.intellij.lang.annotations.Language; -import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; /** @@ -35,14 +34,9 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas protected BaseInspection[] getInspections() { final BaseInspection inspection = getInspection(); - if (inspection != null) { - return new BaseInspection[] {inspection}; - } - return new BaseInspection[0]; + return inspection != null ? new BaseInspection[]{inspection} : new BaseInspection[0]; } - @SuppressWarnings("LanguageMismatch") - @NonNls @Language("JAVA") protected String[] getEnvironmentClasses() { return ArrayUtilRt.EMPTY_STRING_ARRAY; @@ -69,7 +63,7 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas myFixture.filterAvailableIntentions(quickfixName)); } - protected void assertQuickfixNotAvailable(String quickfixName, @Language("JAVA") @NotNull @NonNls String text) { + protected void assertQuickfixNotAvailable(String quickfixName, @Language("JAVA") @NotNull String text) { text = text.replace("/**/", ""); myFixture.configureByText(JavaFileType.INSTANCE, text); assertEmpty("Quickfix \'" + quickfixName + "\' is available but should not", @@ -89,35 +83,34 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas protected void doTest(final String testName, final String hint) { myFixture.configureByFile(getRelativePath() + "/" + testName + ".java"); - final IntentionAction action = myFixture.getAvailableIntention(hint); - assertNotNull(action); + IntentionAction action = myFixture.findSingleIntention(hint); myFixture.launchAction(action); myFixture.checkResultByFile(getRelativePath() + "/" + testName + ".after.java"); } protected void doExpressionTest( @NotNull String hint, - @Language(value = "JAVA", prefix = "/** @noinspection ALL*/class $X$ {static {System.out.print(", suffix = ");}}") @NotNull @NonNls String before, - @Language(value = "JAVA", prefix = "class $X$ {static {System.out.print(", suffix = ");}}") @NotNull @NonNls String after) { + @Language(value = "JAVA", prefix = "/** @noinspection ALL*/class $X$ {static {System.out.print(", suffix = ");}}") @NotNull String before, + @Language(value = "JAVA", prefix = "class $X$ {static {System.out.print(", suffix = ");}}") @NotNull String after + ) { doTest(hint, "class $X$ {static {System.out.print(" + before + ");}}", "class $X$ {static {System.out.print(" + after + ");}}"); } protected void doMemberTest( @NotNull String hint, - @Language(value = "JAVA", prefix = "/** @noinspection ALL*/class $X$ {", suffix = "}") @NotNull @NonNls String before, - @Language(value = "JAVA", prefix = "class $X$ {", suffix = "}") @NotNull @NonNls String after) { + @Language(value = "JAVA", prefix = "/** @noinspection ALL*/class $X$ {", suffix = "}") @NotNull String before, + @Language(value = "JAVA", prefix = "class $X$ {", suffix = "}") @NotNull String after + ) { doTest(hint, "class $X$ {" + before + "}", "class $X$ {" + after + "}"); } - protected void doTest(@NotNull String hint, - @Language("JAVA") @NotNull @NonNls String before, - @Language("JAVA") @NotNull @NonNls String after) { + protected void doTest(@NotNull String hint, @Language("JAVA") @NotNull String before, @Language("JAVA") @NotNull String after) { doTest(hint, before, after, "aaa.java"); } protected void doTest(@NotNull String hint, - @Language("JAVA") @NotNull @NonNls String before, - @Language("JAVA") @NotNull @NonNls String after, + @Language("JAVA") @NotNull String before, + @Language("JAVA") @NotNull String after, @NotNull String fileName) { before = before.replace("/**/", ""); myFixture.configureByText(fileName, before); @@ -131,5 +124,4 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas assertNotNull(myRelativePath); return myRelativePath; } - -} +} \ No newline at end of file diff --git a/uast/uast-common/src/org/jetbrains/uast/evaluation/DepthLimitingEvaluatorVisitor.kt b/uast/uast-common/src/org/jetbrains/uast/evaluation/DepthLimitingEvaluatorVisitor.kt index c3be74df3cad..6190c29019e8 100644 --- a/uast/uast-common/src/org/jetbrains/uast/evaluation/DepthLimitingEvaluatorVisitor.kt +++ b/uast/uast-common/src/org/jetbrains/uast/evaluation/DepthLimitingEvaluatorVisitor.kt @@ -6,8 +6,10 @@ import org.jetbrains.uast.* import org.jetbrains.uast.values.UUndeterminedValue import org.jetbrains.uast.visitor.UastTypedVisitor -internal class DepthLimitingEvaluatorVisitor(val depthLimit: kotlin.Int, - delegator: (org.jetbrains.uast.evaluation.DepthLimitingEvaluatorVisitor) -> org.jetbrains.uast.visitor.UastTypedVisitor) : UastTypedVisitor { +internal class DepthLimitingEvaluatorVisitor( + private val depthLimit: Int, + delegator: (DepthLimitingEvaluatorVisitor) -> UastTypedVisitor +) : UastTypedVisitor { private val delegate = delegator(this) diff --git a/uast/uast-common/src/org/jetbrains/uast/evaluation/TreeBasedEvaluator.kt b/uast/uast-common/src/org/jetbrains/uast/evaluation/TreeBasedEvaluator.kt index 7ae07e61d5bf..abd38302c98b 100644 --- a/uast/uast-common/src/org/jetbrains/uast/evaluation/TreeBasedEvaluator.kt +++ b/uast/uast-common/src/org/jetbrains/uast/evaluation/TreeBasedEvaluator.kt @@ -128,8 +128,7 @@ class TreeBasedEvaluator( data: UEvaluationState ): UEvaluationInfo { storeState(node, data) - val resolvedElement = node.resolveToUElement() - return when (resolvedElement) { + return when (val resolvedElement = node.resolveToUElement()) { is UEnumConstant -> UEnumEntryValueConstant(resolvedElement, node) is UField -> if (resolvedElement.hasModifierProperty(PsiModifier.FINAL)) { data[resolvedElement].ifUndetermined { diff --git a/uast/uast-common/src/org/jetbrains/uast/visitor/UastVisitor.kt b/uast/uast-common/src/org/jetbrains/uast/visitor/UastVisitor.kt index d1ff614dc9c3..3040b27c3795 100644 --- a/uast/uast-common/src/org/jetbrains/uast/visitor/UastVisitor.kt +++ b/uast/uast-common/src/org/jetbrains/uast/visitor/UastVisitor.kt @@ -17,12 +17,9 @@ interface UastVisitor { fun visitField(node: UField): Boolean = visitVariable(node) fun visitLocalVariable(node: ULocalVariable): Boolean = visitVariable(node) fun visitEnumConstant(node: UEnumConstant): Boolean = visitField(node) - fun visitAnnotation(node: UAnnotation): Boolean = visitElement(node) - // Expressions fun visitExpression(node: UExpression): Boolean = visitElement(node) - fun visitLabeledExpression(node: ULabeledExpression): Boolean = visitExpression(node) fun visitDeclarationsExpression(node: UDeclarationsExpression): Boolean = visitExpression(node) fun visitBlockExpression(node: UBlockExpression): Boolean = visitExpression(node) @@ -52,8 +49,7 @@ interface UastVisitor { fun visitSuperExpression(node: USuperExpression): Boolean = visitExpression(node) fun visitReturnExpression(node: UReturnExpression): Boolean = visitExpression(node) fun visitBreakExpression(node: UBreakExpression): Boolean = visitExpression(node) - @JvmDefault - fun visitYieldExpression(node: UYieldExpression): Boolean = visitExpression(node) + @JvmDefault fun visitYieldExpression(node: UYieldExpression): Boolean = visitExpression(node) fun visitContinueExpression(node: UContinueExpression): Boolean = visitExpression(node) fun visitThrowExpression(node: UThrowExpression): Boolean = visitExpression(node) fun visitArrayAccessExpression(node: UArrayAccessExpression): Boolean = visitExpression(node) @@ -64,209 +60,59 @@ interface UastVisitor { // After - fun afterVisitElement(node: UElement) {} - - fun afterVisitFile(node: UFile) { - afterVisitElement(node) - } - - fun afterVisitImportStatement(node: UImportStatement) { - afterVisitElement(node) - } - - fun afterVisitDeclaration(node: UDeclaration) { - afterVisitElement(node) - } - - fun afterVisitClass(node: UClass) { - afterVisitDeclaration(node) - } - - fun afterVisitInitializer(node: UClassInitializer) { - afterVisitDeclaration(node) - } - - fun afterVisitMethod(node: UMethod) { - afterVisitDeclaration(node) - } - - fun afterVisitVariable(node: UVariable) { - afterVisitElement(node) - } - - fun afterVisitParameter(node: UParameter) { - afterVisitVariable(node) - } - - fun afterVisitField(node: UField) { - afterVisitVariable(node) - } - - fun afterVisitLocalVariable(node: ULocalVariable) { - afterVisitVariable(node) - } - - fun afterVisitEnumConstant(node: UEnumConstant) { - afterVisitField(node) - } - - fun afterVisitAnnotation(node: UAnnotation) { - afterVisitElement(node) - } + fun afterVisitElement(node: UElement) { } + fun afterVisitFile(node: UFile) = afterVisitElement(node) + fun afterVisitImportStatement(node: UImportStatement) = afterVisitElement(node) + fun afterVisitDeclaration(node: UDeclaration) = afterVisitElement(node) + fun afterVisitClass(node: UClass) = afterVisitDeclaration(node) + fun afterVisitInitializer(node: UClassInitializer) = afterVisitDeclaration(node) + fun afterVisitMethod(node: UMethod) = afterVisitDeclaration(node) + fun afterVisitVariable(node: UVariable) = afterVisitElement(node) + fun afterVisitParameter(node: UParameter) = afterVisitVariable(node) + fun afterVisitField(node: UField) = afterVisitVariable(node) + fun afterVisitLocalVariable(node: ULocalVariable) = afterVisitVariable(node) + fun afterVisitEnumConstant(node: UEnumConstant) = afterVisitField(node) + fun afterVisitAnnotation(node: UAnnotation) = afterVisitElement(node) // Expressions - fun afterVisitExpression(node: UExpression) { - afterVisitElement(node) - } - - fun afterVisitLabeledExpression(node: ULabeledExpression) { - afterVisitExpression(node) - } - - fun afterVisitDeclarationsExpression(node: UDeclarationsExpression) { - afterVisitExpression(node) - } - - fun afterVisitBlockExpression(node: UBlockExpression) { - afterVisitExpression(node) - } - - fun afterVisitQualifiedReferenceExpression(node: UQualifiedReferenceExpression) { - afterVisitExpression(node) - } - - fun afterVisitSimpleNameReferenceExpression(node: USimpleNameReferenceExpression) { - afterVisitExpression(node) - } - - fun afterVisitTypeReferenceExpression(node: UTypeReferenceExpression) { - afterVisitExpression(node) - } - - fun afterVisitCallExpression(node: UCallExpression) { - afterVisitExpression(node) - } - - fun afterVisitBinaryExpression(node: UBinaryExpression) { - afterVisitExpression(node) - } - - fun afterVisitBinaryExpressionWithType(node: UBinaryExpressionWithType) { - afterVisitExpression(node) - } - - fun afterVisitParenthesizedExpression(node: UParenthesizedExpression) { - afterVisitExpression(node) - } - - fun afterVisitUnaryExpression(node: UUnaryExpression) { - afterVisitExpression(node) - } - - fun afterVisitPrefixExpression(node: UPrefixExpression) { - afterVisitExpression(node) - } - - fun afterVisitPostfixExpression(node: UPostfixExpression) { - afterVisitExpression(node) - } - - fun afterVisitExpressionList(node: UExpressionList) { - afterVisitExpression(node) - } - - fun afterVisitIfExpression(node: UIfExpression) { - afterVisitExpression(node) - } - - fun afterVisitSwitchExpression(node: USwitchExpression) { - afterVisitExpression(node) - } - - fun afterVisitSwitchClauseExpression(node: USwitchClauseExpression) { - afterVisitExpression(node) - } - - fun afterVisitWhileExpression(node: UWhileExpression) { - afterVisitExpression(node) - } - - fun afterVisitDoWhileExpression(node: UDoWhileExpression) { - afterVisitExpression(node) - } - - fun afterVisitForExpression(node: UForExpression) { - afterVisitExpression(node) - } - - fun afterVisitForEachExpression(node: UForEachExpression) { - afterVisitExpression(node) - } - - fun afterVisitTryExpression(node: UTryExpression) { - afterVisitExpression(node) - } - - fun afterVisitCatchClause(node: UCatchClause) { - afterVisitElement(node) - } - - fun afterVisitLiteralExpression(node: ULiteralExpression) { - afterVisitExpression(node) - } - - fun afterVisitThisExpression(node: UThisExpression) { - afterVisitExpression(node) - } - - fun afterVisitSuperExpression(node: USuperExpression) { - afterVisitExpression(node) - } - - fun afterVisitReturnExpression(node: UReturnExpression) { - afterVisitExpression(node) - } - - fun afterVisitBreakExpression(node: UBreakExpression) { - afterVisitExpression(node) - } - - @JvmDefault - fun afterVisitYieldExpression(node: UYieldExpression) { - afterVisitExpression(node) - } - - fun afterVisitContinueExpression(node: UContinueExpression) { - afterVisitExpression(node) - } - - fun afterVisitThrowExpression(node: UThrowExpression) { - afterVisitExpression(node) - } - - fun afterVisitArrayAccessExpression(node: UArrayAccessExpression) { - afterVisitExpression(node) - } - - fun afterVisitCallableReferenceExpression(node: UCallableReferenceExpression) { - afterVisitExpression(node) - } - - fun afterVisitClassLiteralExpression(node: UClassLiteralExpression) { - afterVisitExpression(node) - } - - fun afterVisitLambdaExpression(node: ULambdaExpression) { - afterVisitExpression(node) - } - - fun afterVisitObjectLiteralExpression(node: UObjectLiteralExpression) { - afterVisitExpression(node) - } - - fun afterVisitPolyadicExpression(node: UPolyadicExpression) { - afterVisitExpression(node) - } + fun afterVisitExpression(node: UExpression) = afterVisitElement(node) + fun afterVisitLabeledExpression(node: ULabeledExpression) = afterVisitExpression(node) + fun afterVisitDeclarationsExpression(node: UDeclarationsExpression) = afterVisitExpression(node) + fun afterVisitBlockExpression(node: UBlockExpression) = afterVisitExpression(node) + fun afterVisitQualifiedReferenceExpression(node: UQualifiedReferenceExpression) = afterVisitExpression(node) + fun afterVisitSimpleNameReferenceExpression(node: USimpleNameReferenceExpression) = afterVisitExpression(node) + fun afterVisitTypeReferenceExpression(node: UTypeReferenceExpression) = afterVisitExpression(node) + fun afterVisitCallExpression(node: UCallExpression) = afterVisitExpression(node) + fun afterVisitBinaryExpression(node: UBinaryExpression) = afterVisitExpression(node) + fun afterVisitBinaryExpressionWithType(node: UBinaryExpressionWithType) = afterVisitExpression(node) + fun afterVisitParenthesizedExpression(node: UParenthesizedExpression) = afterVisitExpression(node) + fun afterVisitUnaryExpression(node: UUnaryExpression) = afterVisitExpression(node) + fun afterVisitPrefixExpression(node: UPrefixExpression) = afterVisitExpression(node) + fun afterVisitPostfixExpression(node: UPostfixExpression) = afterVisitExpression(node) + fun afterVisitExpressionList(node: UExpressionList) = afterVisitExpression(node) + fun afterVisitIfExpression(node: UIfExpression) = afterVisitExpression(node) + fun afterVisitSwitchExpression(node: USwitchExpression) = afterVisitExpression(node) + fun afterVisitSwitchClauseExpression(node: USwitchClauseExpression) = afterVisitExpression(node) + fun afterVisitWhileExpression(node: UWhileExpression) = afterVisitExpression(node) + fun afterVisitDoWhileExpression(node: UDoWhileExpression) = afterVisitExpression(node) + fun afterVisitForExpression(node: UForExpression) = afterVisitExpression(node) + fun afterVisitForEachExpression(node: UForEachExpression) = afterVisitExpression(node) + fun afterVisitTryExpression(node: UTryExpression) = afterVisitExpression(node) + fun afterVisitCatchClause(node: UCatchClause) = afterVisitElement(node) + fun afterVisitLiteralExpression(node: ULiteralExpression) = afterVisitExpression(node) + fun afterVisitThisExpression(node: UThisExpression) = afterVisitExpression(node) + fun afterVisitSuperExpression(node: USuperExpression) = afterVisitExpression(node) + fun afterVisitReturnExpression(node: UReturnExpression) = afterVisitExpression(node) + fun afterVisitBreakExpression(node: UBreakExpression) = afterVisitExpression(node) + @JvmDefault fun afterVisitYieldExpression(node: UYieldExpression) = afterVisitExpression(node) + fun afterVisitContinueExpression(node: UContinueExpression) = afterVisitExpression(node) + fun afterVisitThrowExpression(node: UThrowExpression) = afterVisitExpression(node) + fun afterVisitArrayAccessExpression(node: UArrayAccessExpression) = afterVisitExpression(node) + fun afterVisitCallableReferenceExpression(node: UCallableReferenceExpression) = afterVisitExpression(node) + fun afterVisitClassLiteralExpression(node: UClassLiteralExpression) = afterVisitExpression(node) + fun afterVisitLambdaExpression(node: ULambdaExpression) = afterVisitExpression(node) + fun afterVisitObjectLiteralExpression(node: UObjectLiteralExpression) = afterVisitExpression(node) + fun afterVisitPolyadicExpression(node: UPolyadicExpression) = afterVisitExpression(node) } abstract class AbstractUastVisitor : UastVisitor { @@ -274,12 +120,14 @@ abstract class AbstractUastVisitor : UastVisitor { } /** - * There is a convention in UAST-visitors that visitor will not be passed to children if `visit*` will return true. + * There is a convention in UAST-visitors that a visitor will not be passed to children if `visit*` will return `true`. * So make sure that overridden methods returns `true` and please think twice before returning `false` if you are passing implementation to * [com.intellij.uast.UastVisitorAdapter]. */ +@Suppress("KDocUnresolvedReference") abstract class AbstractUastNonRecursiveVisitor : UastVisitor { override fun visitElement(node: UElement): Boolean = true } +@Suppress("unused") object EmptyUastVisitor : AbstractUastVisitor() \ No newline at end of file