From 5849d85f1f5263ceb5445dc08309a298a1a67f0e Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Fri, 7 Nov 2025 11:24:20 +0100 Subject: [PATCH] Java: Deprecate two more SSA classes. --- java/ql/lib/semmle/code/java/dataflow/SSA.qll | 12 +++++++++--- .../semmle/code/java/dataflow/internal/SsaImpl.qll | 10 +++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/java/ql/lib/semmle/code/java/dataflow/SSA.qll b/java/ql/lib/semmle/code/java/dataflow/SSA.qll index 68887cc2b80..233b083a4eb 100644 --- a/java/ql/lib/semmle/code/java/dataflow/SSA.qll +++ b/java/ql/lib/semmle/code/java/dataflow/SSA.qll @@ -293,12 +293,14 @@ class SsaExplicitUpdate extends SsaUpdate { } /** + * DEPRECATED: Use `SsaImplicitWrite` instead. + * * An SSA variable that represents any sort of implicit update. This can be a * `Call` that might reach a non-local update of the field, an explicit or * implicit update of the qualifier of the field, or the implicit update that * occurs just prior to a `FieldRead` of an untracked field. */ -class SsaImplicitUpdate extends SsaUpdate { +deprecated class SsaImplicitUpdate extends SsaUpdate { SsaImplicitUpdate() { not this instanceof SsaExplicitUpdate } override string toString() { @@ -383,18 +385,22 @@ private predicate isNonLocalImpl(SsaImplicitWrite calldef) { exists(getANonLocal private predicate isNonLocal(SsaImplicitWrite calldef) = forceLocal(isNonLocalImpl/1)(calldef) /** + * DEPRECATED: Use `SsaUncertainWrite` instead. + * * An SSA variable that represents an uncertain implicit update of the value. * This is a `Call` that might reach a non-local update of the field or one of * its qualifiers. */ -class SsaUncertainImplicitUpdate extends SsaImplicitUpdate { +deprecated class SsaUncertainImplicitUpdate extends SsaImplicitUpdate { SsaUncertainImplicitUpdate() { ssaUncertainImplicitUpdate(this) } /** + * DEPRECATED: Use `getPriorDefinition()` instead. + * * Gets the immediately preceding definition. Since this update is uncertain * the value from the preceding definition might still be valid. */ - SsaVariable getPriorDef() { ssaDefReachesUncertainDef(result, this) } + deprecated SsaVariable getPriorDef() { ssaDefReachesUncertainDef(result, this) } } /** diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/SsaImpl.qll b/java/ql/lib/semmle/code/java/dataflow/internal/SsaImpl.qll index 1a60b1c7966..34bb39a8509 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/SsaImpl.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/SsaImpl.qll @@ -486,13 +486,13 @@ private module Cached { overlay[global] cached - predicate defUpdatesNamedField(SsaImplicitUpdate def, TrackedField f, Callable setter) { + predicate defUpdatesNamedField(SsaImplicitWrite def, TrackedField f, Callable setter) { f = def.getSourceVariable() and - updatesNamedField0(def.getCfgNode().asCall(), f, setter) + updatesNamedField0(def.getControlFlowNode().asCall(), f, setter) } cached - predicate ssaUncertainImplicitUpdate(SsaImplicitUpdate def) { + deprecated predicate ssaUncertainImplicitUpdate(SsaImplicitUpdate def) { exists(SsaSourceVariable v, BasicBlock bb, int i | def.definesAt(v, bb, i) and uncertainVariableUpdate(v, _, bb, i) @@ -522,7 +522,7 @@ private module Cached { * SSA definition of `v`. */ cached - predicate ssaDefReachesUncertainDef(TrackedSsaDef def, SsaUncertainImplicitUpdate redef) { + deprecated predicate ssaDefReachesUncertainDef(TrackedSsaDef def, SsaUncertainImplicitUpdate redef) { Impl::uncertainWriteDefinitionInput(redef, def) } @@ -671,7 +671,7 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu predicate ssaDefHasSource(WriteDefinition def) { def instanceof SsaExplicitWrite } predicate allowFlowIntoUncertainDef(UncertainWriteDefinition def) { - def instanceof SsaUncertainImplicitUpdate + def instanceof SsaUncertainWrite } class GuardValue = Guards::GuardValue;