mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (formatting)
This commit is contained in:
+8
-20
@@ -33,7 +33,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class UnnecessarySemicolonInspection extends BaseInspection implements CleanupLocalInspectionTool {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
@@ -159,25 +158,18 @@ public class UnnecessarySemicolonInspection extends BaseInspection implements Cl
|
||||
registerError(element, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
}
|
||||
|
||||
private void findUnnecessarySemicolonsAfterEnumConstants(
|
||||
@NotNull PsiClass aClass) {
|
||||
private void findUnnecessarySemicolonsAfterEnumConstants(@NotNull PsiClass aClass) {
|
||||
PsiElement child = aClass.getFirstChild();
|
||||
while (child != null) {
|
||||
if (child instanceof PsiJavaToken) {
|
||||
final PsiJavaToken token = (PsiJavaToken)child;
|
||||
final IElementType tokenType = token.getTokenType();
|
||||
if (tokenType.equals(JavaTokenType.SEMICOLON)) {
|
||||
final PsiElement prevSibling =
|
||||
skipBackwardWhiteSpacesAndComments(child);
|
||||
final PsiElement prevSibling = skipBackwardWhiteSpacesAndComments(child);
|
||||
if (!(prevSibling instanceof PsiEnumConstant)) {
|
||||
if (prevSibling instanceof PsiJavaToken) {
|
||||
final PsiJavaToken javaToken =
|
||||
(PsiJavaToken)prevSibling;
|
||||
final IElementType prevTokenType =
|
||||
javaToken.getTokenType();
|
||||
if (!JavaTokenType.COMMA.equals(prevTokenType)
|
||||
&& !JavaTokenType.LBRACE.equals(
|
||||
prevTokenType)) {
|
||||
final IElementType prevTokenType = ((PsiJavaToken)prevSibling).getTokenType();
|
||||
if (!JavaTokenType.COMMA.equals(prevTokenType) && !JavaTokenType.LBRACE.equals(prevTokenType)) {
|
||||
registerError(child, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
}
|
||||
}
|
||||
@@ -192,17 +184,13 @@ public class UnnecessarySemicolonInspection extends BaseInspection implements Cl
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiElement skipForwardWhiteSpacesAndComments(
|
||||
PsiElement element) {
|
||||
return PsiTreeUtil.skipSiblingsForward(element,
|
||||
PsiWhiteSpace.class, PsiComment.class);
|
||||
private static PsiElement skipForwardWhiteSpacesAndComments(PsiElement element) {
|
||||
return PsiTreeUtil.skipSiblingsForward(element, PsiWhiteSpace.class, PsiComment.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiElement skipBackwardWhiteSpacesAndComments(
|
||||
PsiElement element) {
|
||||
return PsiTreeUtil.skipSiblingsBackward(element,
|
||||
PsiWhiteSpace.class, PsiComment.class);
|
||||
private static PsiElement skipBackwardWhiteSpacesAndComments(PsiElement element) {
|
||||
return PsiTreeUtil.skipSiblingsBackward(element, PsiWhiteSpace.class, PsiComment.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user