diff --git a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EnumTrailingCommaCheck.java b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EnumTrailingCommaCheck.java index 83e1b4b90..f05372aa7 100644 --- a/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EnumTrailingCommaCheck.java +++ b/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/EnumTrailingCommaCheck.java @@ -140,21 +140,11 @@ public void visitToken(DetailAST enumDef) { * {@code false otherwise} */ private boolean isIllegalTokenAfterComma(DetailAST lastComma, DetailAST nextAst) { - boolean illegalToken = false; - final int nextAstType = nextAst.getType(); - if (nextAstType == TokenTypes.SEMI) { - if (nextAst.getLineNo() == lastComma.getLineNo()) { - // semi on the same line as last comma - illegalToken = true; - } - } - else if (nextAstType == TokenTypes.ENUM_CONSTANT_DEF) { - // next enum constant on the same line after comma - illegalToken = true; - } - return illegalToken; + // semi on the same line as last comma, or followed by enum constant + return (nextAstType == TokenTypes.SEMI && nextAst.getLineNo() == lastComma.getLineNo()) + || nextAstType == TokenTypes.ENUM_CONSTANT_DEF; } /**