Merge pull request #21317 from aschackmull/java/deprecate-unreachableblocks

Java: Deprecate UnreachableBlocks.
This commit is contained in:
Anders Schack-Mulligen
2026-02-12 11:43:37 +01:00
committed by GitHub
6 changed files with 11 additions and 54 deletions

View File

@@ -0,0 +1,4 @@
---
category: deprecated
---
* The `UnreachableBlocks.qll` library has been deprecated.

View File

@@ -1,8 +1,10 @@
/**
* DEPRECATED: This module is no longer maintained, and will be removed in a future release.
*
* Provides classes and predicates for identifying unreachable blocks under a "closed-world" assumption.
*/
overlay[local?]
module;
deprecated module;
import java
import semmle.code.java.controlflow.Guards

View File

@@ -1,5 +1,8 @@
/**
* DEPRECATED: This module is no longer maintained, and will be removed in a future release.
*/
overlay[local?]
module;
deprecated module;
import java
import semmle.code.java.controlflow.UnreachableBlocks

View File

@@ -1,12 +0,0 @@
| unreachableblocks/Unreachable.java:3:14:3:24 | Exceptional Exit |
| unreachableblocks/Unreachable.java:3:14:3:24 | Exceptional Exit |
| unreachableblocks/Unreachable.java:5:14:5:19 | Exceptional Exit |
| unreachableblocks/Unreachable.java:6:14:8:3 | { ... } |
| unreachableblocks/Unreachable.java:9:21:11:3 | { ... } |
| unreachableblocks/Unreachable.java:12:22:14:3 | { ... } |
| unreachableblocks/Unreachable.java:17:3:17:9 | case ... |
| unreachableblocks/Unreachable.java:19:3:19:9 | case ... |
| unreachableblocks/Unreachable.java:24:3:24:9 | case ... |
| unreachableblocks/Unreachable.java:26:3:26:10 | case ... |
| unreachableblocks/Unreachable.java:27:3:27:10 | default |
| unreachableblocks/Unreachable.java:32:18:32:28 | Exceptional Exit |

View File

@@ -1,5 +0,0 @@
import default
import semmle.code.java.controlflow.UnreachableBlocks
from UnreachableBasicBlock unreachableBasicBlock
select unreachableBasicBlock

View File

@@ -1,35 +0,0 @@
package unreachableblocks;
public class Unreachable {
private boolean privateFalse = false;
public void method() {
if (false) {
// unreachable
}
if (privateFalse) {
// unreachable
}
if (methodFalse()) {
// unreachable
}
switch (7) {
case 5: // unreachable
break;
case 6: // unreachable
System.out.println("dead"); // unreachable
case 7:
case 8: // reachable from 7
break; // reachable
case 9: //unreachable
break;
case 10: // unreachable
default:
break; //unreachable
}
}
private boolean methodFalse() {
return privateFalse;
}
}