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) {
348
348
FlowSummaryImpl:: Private:: Steps:: summaryExpectsContent ( n .( FlowSummaryNode ) .getSummaryNode ( ) , c )
349
349
}
350
350
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
+
351
361
/**
352
362
* Gets a representative (boxed) type for `t` for the purpose of pruning
353
363
* possible flow. A single type is used for all numeric types to account for
@@ -356,10 +366,10 @@ predicate expectsContent(Node n, ContentSet c) {
356
366
RefType getErasedRepr ( Type t ) {
357
367
exists ( Type e | e = t .getErasure ( ) |
358
368
if e instanceof NumericOrCharType
359
- then result . ( BoxedType ) . getPrimitiveType ( ) . getName ( ) = "double"
369
+ then numericRepresentative ( result )
360
370
else
361
371
if e instanceof BooleanType
362
- then result . ( BoxedType ) . getPrimitiveType ( ) . getName ( ) = "boolean"
372
+ then booleanRepresentative ( result )
363
373
else result = e
364
374
)
365
375
or
You can’t perform that action at this time.
0 commit comments