Skip to content

Java: Fix some join-orders. #10904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/ControlFlowGraph.qll
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ private module ControlFlowGraphImpl {
/**
* Gets a statement that always throws an exception or calls `exit`.
*/
pragma[assume_small_delta]
private Stmt nonReturningStmt() {
result instanceof ThrowStmt
or
Expand All @@ -421,6 +422,7 @@ private module ControlFlowGraphImpl {
/**
* Gets an expression that always throws an exception or calls `exit`.
*/
pragma[assume_small_delta]
private Expr nonReturningExpr() {
result = nonReturningMethodAccess()
or
Expand Down
1 change: 1 addition & 0 deletions java/ql/lib/semmle/code/java/Expr.qll
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,7 @@ class TypeAccess extends Expr, Annotatable, @typeaccess {
override CompilationUnit getCompilationUnit() { result = Expr.super.getCompilationUnit() }

/** Gets a printable representation of this expression. */
pragma[assume_small_delta]
override string toString() {
result = this.getQualifier().toString() + "." + this.getType().toString()
or
Expand Down
1 change: 1 addition & 0 deletions java/ql/lib/semmle/code/java/Member.qll
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ class FieldDeclaration extends ExprParent, @fielddecl, Annotatable {
/** Gets the number of fields declared in this declaration. */
int getNumField() { result = max(int idx | fieldDeclaredIn(_, this, idx) | idx) + 1 }

pragma[assume_small_delta]
override string toString() {
if this.getNumField() = 1
then result = this.getTypeAccess() + " " + this.getField(0) + ";"
Expand Down
1 change: 1 addition & 0 deletions java/ql/lib/semmle/code/java/Type.qll
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ private predicate hasSubtypeStar1(RefType t, RefType sub) {
/**
* Holds if `hasSubtype*(t, sub)`, but manual-magic'ed with `getAWildcardLowerBound(sub)`.
*/
pragma[assume_small_delta]
pragma[nomagic]
private predicate hasSubtypeStar2(RefType t, RefType sub) {
sub = t and getAWildcardLowerBound(sub)
Expand Down
2 changes: 2 additions & 0 deletions java/ql/lib/semmle/code/java/dataflow/NullGuards.qll
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ EqualityTest varEqualityTestExpr(SsaVariable v1, SsaVariable v2, boolean isEqual
}

/** Gets an expression that is provably not `null`. */
pragma[assume_small_delta]
Expr clearlyNotNullExpr(Expr reason) {
result instanceof ClassInstanceExpr and reason = result
or
Expand Down Expand Up @@ -236,6 +237,7 @@ Expr directNullGuard(SsaVariable v, boolean branch, boolean isnull) {
* If `result` evaluates to `branch`, then `v` is guaranteed to be null if `isnull`
* is true, and non-null if `isnull` is false.
*/
pragma[assume_small_delta]
Guard nullGuard(SsaVariable v, boolean branch, boolean isnull) {
result = directNullGuard(v, branch, isnull) or
exists(boolean branch0 | implies_v3(result, branch, nullGuard(v, branch0, isnull), branch0))
Expand Down
1 change: 1 addition & 0 deletions java/ql/lib/semmle/code/java/dataflow/SSA.qll
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class SsaSourceVariable extends TSsaSourceVariable {
* accessed from nested callables are therefore associated with several
* `SsaSourceVariable`s.
*/
pragma[assume_small_delta]
cached
VarAccess getAnAccess() {
exists(LocalScopeVariable v, Callable c |
Expand Down
1 change: 1 addition & 0 deletions java/ql/lib/semmle/code/java/dataflow/TypeFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ private module ForAll<RankedEdge Edge, TypePropagation T> {
* Holds if `t` is a candidate bound for `n` that is also valid for data coming
* through the edges into `n` ranked from `1` to `r`.
*/
pragma[assume_small_delta]
private predicate flowJoin(int r, TypeFlowNode n, T::Typ t) {
(
r = 1 and candJoinType(n, t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ private MethodAccess callReturningSameType(Expr ref) {
result.getMethod().getReturnType() = ref.getType()
}

pragma[assume_small_delta]
private SrcRefType entrypointType() {
exists(RemoteFlowSource s, RefType t |
s instanceof DataFlow::ExplicitParameterNode and
Expand Down
1 change: 1 addition & 0 deletions java/ql/lib/semmle/code/java/dispatch/DispatchFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ private Callable dispatchCand(Call c) {
/**
* Holds if `t` and all its enclosing types are public.
*/
pragma[assume_small_delta]
private predicate veryPublic(RefType t) {
t.isPublic() and
(
Expand Down
1 change: 1 addition & 0 deletions java/ql/lib/semmle/code/java/dispatch/ObjFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ private predicate relevantNodeBack(ObjNode n) {
exists(ObjNode mid | objStep(n, mid) and relevantNodeBack(mid))
}

pragma[assume_small_delta]
private predicate relevantNode(ObjNode n) {
source(_, n) and relevantNodeBack(n)
or
Expand Down
1 change: 1 addition & 0 deletions java/ql/lib/semmle/code/java/frameworks/Rmi.qll
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class RemoteCallableMethod extends Method {
RemoteCallableMethod() { remoteCallableMethod(this) }
}

pragma[assume_small_delta]
private predicate remoteCallableMethod(Method method) {
method.getDeclaringType().getASupertype() instanceof TypeRemote
or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class JacksonSerializableField extends SerializableField {

/** A field that may be deserialized using the Jackson JSON framework. */
class JacksonDeserializableField extends DeserializableField {
pragma[assume_small_delta]
JacksonDeserializableField() {
exists(JacksonDeserializableType superType |
superType = this.getDeclaringType().getAnAncestor() and
Expand Down