Skip to content

Commit

Permalink
Merge branch 'master' into issue-1059
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar authored Oct 28, 2024
2 parents e089b06 + 8f4b928 commit 2842318
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,16 @@ private static class DefaultLibraryModels implements LibraryModels {
.put(methodRef("spark.utils.StringUtils", "isNotBlank(java.lang.CharSequence)"), 0)
.put(methodRef("spark.utils.StringUtils", "hasLength(java.lang.String)"), 0)
.put(methodRef("spark.utils.StringUtils", "hasLength(java.lang.CharSequence)"), 0)
.put(
methodRef(
"org.apache.commons.collections.CollectionUtils",
"isNotEmpty(java.util.Collection)"),
0)
.put(
methodRef(
"org.apache.commons.collections4.CollectionUtils",
"isNotEmpty(java.util.Collection<?>)"),
0)
.put(
methodRef("org.apache.commons.lang.StringUtils", "isNotEmpty(java.lang.String)"), 0)
.put(
Expand Down
36 changes: 36 additions & 0 deletions nullaway/src/test/java/com/uber/nullaway/FrameworkTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,42 @@ public void apacheValidateStringValidIndex() {
.doTest();
}

@Test
public void apacheCollectionsCollectionUtilsIsNotEmpty() {
defaultCompilationHelper
.addSourceLines(
"Foo.java",
"package com.uber;",
"import org.apache.commons.collections.CollectionUtils;",
"import org.jetbrains.annotations.Nullable;",
"import java.util.List;",
"public class Foo {",
" public void bar(@Nullable List<String> s) {",
" if(CollectionUtils.isNotEmpty(s))",
" s.get(0);",
" }",
"}")
.doTest();
}

@Test
public void apacheCollections4CollectionUtilsIsNotEmpty() {
defaultCompilationHelper
.addSourceLines(
"Foo.java",
"package com.uber;",
"import org.apache.commons.collections4.CollectionUtils;",
"import org.jetbrains.annotations.Nullable;",
"import java.util.List;",
"public class Foo {",
" public void bar(@Nullable List<String> s) {",
" if(CollectionUtils.isNotEmpty(s))",
" s.get(0);",
" }",
"}")
.doTest();
}

@Test
public void filesIsDirectory() {
defaultCompilationHelper
Expand Down

0 comments on commit 2842318

Please sign in to comment.