File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
java/ql/test/library-tests/dataflow/flowfeature Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -46,4 +46,50 @@ static void test6() {
4646 Object x = source ("6" );
4747 test6sink (x );
4848 }
49+
50+ Object getSrc () {
51+ return source ("get" );
52+ }
53+
54+ void srcField () {
55+ foo = source ("field" );
56+ }
57+
58+ static Object foo = null ;
59+
60+ void srcCall (int i ) {
61+ test7 (source ("call" ), i );
62+ }
63+
64+ Object test7 (Object x , int i ) {
65+ Object src = null ;
66+ if (i == 0 ) {
67+ src = getSrc ();
68+ } else if (i == 1 ) {
69+ src = foo ;
70+ } else if (i == 2 ) {
71+ src = x ;
72+ } else if (i == 3 ) {
73+ src = source ("direct" );
74+ }
75+
76+ sinkPut (src );
77+ foo2 = src ;
78+ sink (src ); // $ EqCc="direct" SrcCc="field" SrcCc="call" SrcCc="direct" SinkCc="get" SinkCc="field" SinkCc="direct"
79+ return src ;
80+ }
81+
82+ static Object foo2 = null ;
83+
84+ void sinkPut (Object x ) {
85+ sink (x ); // $ SrcCc="field" SrcCc="call" SrcCc="direct"
86+ }
87+
88+ void sinkField () {
89+ sink (foo2 ); // $ SrcCc="field" SrcCc="call" SrcCc="direct" SinkCc="get" SinkCc="field" SinkCc="call" SinkCc="direct"
90+ }
91+
92+ void sinkReturn (int i ) {
93+ sink (test7 (null , i )); // $ SrcCc="field" SinkCc="get" SinkCc="field" SinkCc="direct"
94+ }
4995}
Original file line number Diff line number Diff line change 11testFailures
2+ | A.java:78:10:78:12 | src | Unexpected result: SinkCc="call" |
23failures
You can’t perform that action at this time.
0 commit comments