File tree Expand file tree Collapse file tree 4 files changed +19
-1
lines changed
src/semmle/code/java/frameworks/guava
library-tests/frameworks/guava
stubs/guava-30.0/com/google/common/base Expand file tree Collapse file tree 4 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1+ lgtm,codescanning
2+ * Increase coverage of the Guava framework by adding support for ` com.google.common.base.MoreObjects#firstNonNull ` .
Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ private class GuavaBaseCsv extends SummaryModelCsv {
3535 "com.google.common.base;Splitter;false;splitToList;(CharSequence);;Argument[0];ReturnValue;taint" ,
3636 "com.google.common.base;Splitter;false;splitToStream;(CharSequence);;Argument[0];ReturnValue;taint" ,
3737 "com.google.common.base;Splitter$MapSplitter;false;split;(CharSequence);;Argument[0];ReturnValue;taint" ,
38- "com.google.common.base;Preconditions;false;checkNotNull;;;Argument[0];ReturnValue;value"
38+ "com.google.common.base;Preconditions;false;checkNotNull;;;Argument[0];ReturnValue;value" ,
39+ "com.google.common.base;MoreObjects;false;firstNonNull;;;Argument[0..1];ReturnValue;value"
3940 ]
4041 }
4142}
Original file line number Diff line number Diff line change @@ -60,4 +60,10 @@ void test3() {
6060 void test4 () {
6161 sink (Preconditions .checkNotNull (taint ())); // $numTaintFlow=1
6262 }
63+
64+ void test5 () {
65+ sink (MoreObjects .firstNonNull (taint (), taint ())); // $numTaintFlow=2
66+ sink (MoreObjects .firstNonNull (null , taint ())); // $numTaintFlow=1
67+ sink (MoreObjects .firstNonNull (taint (), null )); // $numTaintFlow=1
68+ }
6369}
Original file line number Diff line number Diff line change 1+ package com .google .common .base ;
2+
3+ import org .checkerframework .checker .nullness .qual .Nullable ;
4+
5+ public final class MoreObjects {
6+ public static <T > T firstNonNull (@ Nullable T first , @ Nullable T second ) {
7+ return null ;
8+ }
9+ }
You can’t perform that action at this time.
0 commit comments