File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
java/ql/lib/semmle/code/java/dataflow/internal Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff 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) {
356366RefType 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
You can’t perform that action at this time.
0 commit comments