Skip to content

Commit 348a186

Browse files
committed
Java: Make JumpStmt a concrete class again
Public abstract classes can be error-prone, when users unintentionally implement a new subclass instead of refining the set of existing subclasses.
1 parent a93b4ed commit 348a186

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

java/ql/lib/semmle/code/java/Statement.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,11 @@ class ThrowStmt extends Stmt, @throwstmt {
556556
override string getAPrimaryQlClass() { result = "ThrowStmt" }
557557
}
558558

559+
// Workaround to avoid having to make JumpStmt abstract
560+
private class JumpStmt_ = @breakstmt or @yieldstmt or @continuestmt;
561+
559562
/** A `break`, `yield` or `continue` statement. */
560-
abstract class JumpStmt extends Stmt {
563+
class JumpStmt extends Stmt, JumpStmt_ {
561564
/**
562565
* Gets the labeled statement that this `break` or
563566
* `continue` statement refers to, if any.

0 commit comments

Comments
 (0)