Skip to content

Commit 5ca35af

Browse files
committed
Java: Improve joinorder in getErasedRepr.
1 parent e3021f4 commit 5ca35af

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,16 @@ predicate expectsContent(Node n, ContentSet c) {
348348
FlowSummaryImpl::Private::Steps::summaryExpectsContent(n.(FlowSummaryNode).getSummaryNode(), c)
349349
}
350350

351+
pragma[nomagic]
352+
private predicate numericRepresentative(RefType t) {
353+
t.(BoxedType).getPrimitiveType().getName() = "double"
354+
}
355+
356+
pragma[nomagic]
357+
private predicate booleanRepresentative(RefType t) {
358+
t.(BoxedType).getPrimitiveType().getName() = "boolean"
359+
}
360+
351361
/**
352362
* Gets a representative (boxed) type for `t` for the purpose of pruning
353363
* possible flow. A single type is used for all numeric types to account for
@@ -356,10 +366,10 @@ predicate expectsContent(Node n, ContentSet c) {
356366
RefType getErasedRepr(Type t) {
357367
exists(Type e | e = t.getErasure() |
358368
if e instanceof NumericOrCharType
359-
then result.(BoxedType).getPrimitiveType().getName() = "double"
369+
then numericRepresentative(result)
360370
else
361371
if e instanceof BooleanType
362-
then result.(BoxedType).getPrimitiveType().getName() = "boolean"
372+
then booleanRepresentative(result)
363373
else result = e
364374
)
365375
or

0 commit comments

Comments
 (0)