diff --git a/java/ql/src/Language Abuse/EmptyStatement.java b/java/ql/src/Language Abuse/EmptyStatement.java deleted file mode 100644 index 4f9b462a38fa..000000000000 --- a/java/ql/src/Language Abuse/EmptyStatement.java +++ /dev/null @@ -1,8 +0,0 @@ -public class Cart { - // AVOID: Empty statement - List items = new ArrayList();; - public void applyDiscount(float discount) { - // AVOID: Empty statement as loop body - for (int i = 0; i < items.size(); items.get(i++).applyDiscount(discount)); - } -} \ No newline at end of file diff --git a/java/ql/src/Language Abuse/EmptyStatement.qhelp b/java/ql/src/Language Abuse/EmptyStatement.qhelp deleted file mode 100644 index 700bd488dfce..000000000000 --- a/java/ql/src/Language Abuse/EmptyStatement.qhelp +++ /dev/null @@ -1,39 +0,0 @@ - - - - - -

An empty statement is a single semicolon ; that does not -terminate another statement. Such a statement hinders readability and has no effect on its own.

- -
- - -

Avoid empty statements. If a loop is intended to have an empty body, it is better -to mark that fact explicitly by using a pair of braces {} containing an explanatory comment -for the body, rather than a single semicolon.

- -
- - -

In the following example, there is an empty statement on line 3, where an additional semicolon is -used. On line 6, the for statement has an empty body because the condition is -immediately followed by a semicolon. In this case, it is better to include a pair of braces {} containing -an explanatory comment for the body instead. - -

- -
- - - -
  • -Help - Eclipse Platform: -Java Compiler Errors/Warnings Preferences. -
  • - - -
    -
    diff --git a/java/ql/src/Language Abuse/EmptyStatement.ql b/java/ql/src/Language Abuse/EmptyStatement.ql deleted file mode 100644 index 36f61b862ac9..000000000000 --- a/java/ql/src/Language Abuse/EmptyStatement.ql +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @name Empty statement - * @description An empty statement hinders readability. - * @kind problem - * @problem.severity recommendation - * @precision low - * @id java/empty-statement - * @tags maintainability - * useless-code - */ - -import java - -from EmptyStmt empty, string action -where - if exists(LoopStmt l | l.getBody() = empty) - then action = "turned into '{}'" - else action = "deleted" -select empty, "This empty statement should be " + action + "." diff --git a/java/ql/src/change-notes/2024-10-03-remove-java-query.md b/java/ql/src/change-notes/2024-10-03-remove-java-query.md new file mode 100644 index 000000000000..e9f3e4910cb5 --- /dev/null +++ b/java/ql/src/change-notes/2024-10-03-remove-java-query.md @@ -0,0 +1,4 @@ +--- +category: minorAnalysis +--- +* Removed the `java/empty-statement` query that was subsumed by the `java/empty-block` query. \ No newline at end of file