@@ -8,6 +8,7 @@ private import semmle.code.java.dataflow.SSA
88private import semmle.code.java.dataflow.TypeFlow
99private import semmle.code.java.controlflow.Guards
1010private import semmle.code.java.dataflow.ExternalFlow
11+ private import semmle.code.java.dataflow.FlowSteps
1112import semmle.code.java.dataflow.InstanceAccess
1213
1314cached
@@ -368,60 +369,6 @@ predicate hasNonlocalValue(FieldRead fr) {
368369 */
369370predicate localFlowStep ( Node node1 , Node node2 ) { simpleLocalFlowStep ( node1 , node2 ) }
370371
371- /**
372- * A method or constructor that returns the exact value of one of its parameters or the qualifier.
373- *
374- * Extend this class and override `returnsValue` to add additional value-preserving steps through a
375- * method that should be added to the basic local flow step relation.
376- *
377- * These steps will be visible for all global data-flow purposes, as well as via
378- * `DataFlow::Node.getASuccessor` and other related functions exposing intraprocedural dataflow.
379- */
380- abstract class ValuePreservingCallable extends Callable {
381- /**
382- * Holds if this callable returns precisely the value passed into argument `arg`.
383- * `arg` is a parameter index, or is -1 to indicate the qualifier.
384- */
385- abstract predicate returnsValue ( int arg ) ;
386- }
387-
388- /**
389- * A method or constructor that returns the exact value of its qualifier (e.g., `return this;`)
390- *
391- * Extend this class and override `returnsValue` to add additional value-preserving steps through a
392- * method that should be added to the basic local flow step relation.
393- *
394- * These steps will be visible for all global data-flow purposes, as well as via
395- * `DataFlow::Node.getASuccessor` and other related functions exposing intraprocedural dataflow.
396- */
397- abstract class FluentMethod extends ValuePreservingCallable {
398- override predicate returnsValue ( int arg ) { arg = - 1 }
399- }
400-
401- private class StandardLibraryValuePreservingCallable extends ValuePreservingCallable {
402- int returnsArgNo ;
403-
404- StandardLibraryValuePreservingCallable ( ) {
405- this .getDeclaringType ( ) .hasQualifiedName ( "java.util" , "Objects" ) and
406- (
407- this .hasName ( [ "requireNonNull" , "requireNonNullElseGet" ] ) and returnsArgNo = 0
408- or
409- this .hasName ( "requireNonNullElse" ) and returnsArgNo = [ 0 .. this .getNumberOfParameters ( ) - 1 ]
410- or
411- this .hasName ( "toString" ) and returnsArgNo = 1
412- )
413- or
414- this .getDeclaringType ( )
415- .getSourceDeclaration ( )
416- .getASourceSupertype * ( )
417- .hasQualifiedName ( "java.util" , "Stack" ) and
418- this .hasName ( "push" ) and
419- returnsArgNo = 0
420- }
421-
422- override predicate returnsValue ( int argNo ) { argNo = returnsArgNo }
423- }
424-
425372/**
426373 * INTERNAL: do not use.
427374 *
0 commit comments