Summary: This diff converts the Eradicate and Checkers tests to the new direct test format, which does not rely on buck or junit. A self-contained Makefile is used to compile and analyze the test files, including all the dependencies, and a special option in InferPrint is used to produce a file of expected results `issues.exp`, which is checked into the repository. Having an explicit Makefile makes it easy to edit and compile one set of test files in isolation, to investigate test failures, do debugging, etc. A bunch of boilerplate code is removed. For example, the single file of expected results `issues.exp` replaces the 1.5K LOC in `endtoend/java/eradicate`. Reviewed By: jvillard Differential Revision: D3764632 fbshipit-source-id: 6c68ab8master
parent
4cd9470586
commit
2cb595b8c9
@ -0,0 +1,32 @@
|
||||
# Copyright (c) 2016 - present Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD style license found in the
|
||||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
ROOT_DIR = ../../../../..
|
||||
include $(ROOT_DIR)/Makefile.config
|
||||
|
||||
ANDROID19 = $(JAVA_LIB_DIR)/android/android-19.jar
|
||||
ANDROIDSUPPORT = $(DEPENDENCIES_DIR)/java/android/support/v4/android-support-v4.jar
|
||||
ANNOTATIONS = $(ANNOTATIONS_DIR)/annotations.jar
|
||||
BUTTERKNIFE = $(DEPENDENCIES_DIR)/java/butterknife/butterknife-7.0.1.jar
|
||||
JSR305 = $(DEPENDENCIES_DIR)/java/jsr-305/jsr305.jar
|
||||
INJECT = $(DEPENDENCIES_DIR)/java/jsr-330/javax.inject.jar
|
||||
|
||||
CLASSPATH=$(ANDROID19):$(ANDROIDSUPPORT):$(ANNOTATIONS):$(BUTTERKNIFE):$(JSR305):$(INJECT):.
|
||||
|
||||
default: compile
|
||||
|
||||
print: analyze
|
||||
$(INFERPRINT_BIN) -q --issues-tests issues.exp.test
|
||||
LC_ALL=C sort -o issues.exp.test issues.exp.test
|
||||
|
||||
test: analyze print
|
||||
make clean
|
||||
diff -u issues.exp issues.exp.test
|
||||
rm issues.exp.test
|
||||
|
||||
clean:
|
||||
rm -rf codetoanalyze infer-out *.class
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"modeled_expensive": [
|
||||
{
|
||||
"language": "Java",
|
||||
"class": "android.app.Activity",
|
||||
"method": "findViewById"
|
||||
},
|
||||
{
|
||||
"language": "Java",
|
||||
"class": "android.view.View",
|
||||
"method": "findViewById"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
sources = glob(['**/*.java'])
|
||||
|
||||
dependencies = [
|
||||
'//dependencies/java/android/support/v4:android-support-v4',
|
||||
'//infer/annotations:annotations',
|
||||
'//infer/lib/java/android:android',
|
||||
]
|
||||
|
||||
java_library(
|
||||
name = 'checkers',
|
||||
srcs = sources,
|
||||
deps = dependencies,
|
||||
visibility = [
|
||||
'PUBLIC'
|
||||
]
|
||||
)
|
||||
|
||||
out = 'out'
|
||||
inferconfig_file = '$(location //infer/tests/codetoanalyze/java:inferconfig)'
|
||||
copy_inferconfig = ' '.join(['cp', inferconfig_file, '$SRCDIR'])
|
||||
clean_cmd = ' '.join(['rm', '-rf', out])
|
||||
classpath = ':'.join([('$(classpath ' + path + ')') for path in dependencies])
|
||||
infer_cmd = ' '.join([
|
||||
'infer',
|
||||
'--no-progress-bar',
|
||||
'--absolute-paths',
|
||||
'-o', out,
|
||||
'-a', 'checkers',
|
||||
'--',
|
||||
'javac',
|
||||
'-cp', classpath,
|
||||
'$SRCS',
|
||||
])
|
||||
copy_cmd = ' '.join(['cp', out + '/report.csv', '$OUT'])
|
||||
command = ' && '.join([clean_cmd, copy_inferconfig, infer_cmd, copy_cmd])
|
||||
|
||||
genrule(
|
||||
name = 'analyze',
|
||||
srcs = sources,
|
||||
out = 'report.csv',
|
||||
cmd = command,
|
||||
deps = dependencies + [':checkers'],
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
]
|
||||
)
|
@ -0,0 +1,28 @@
|
||||
# Copyright (c) 2016 - present Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD style license found in the
|
||||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
include ../Makefile
|
||||
|
||||
FILES = \
|
||||
Branch.java \
|
||||
FragmentRetainsViewExample.java \
|
||||
ExpensiveCallExample.java \
|
||||
ImmutableCast.java \
|
||||
ExpensiveInheritanceExample.java \
|
||||
NoAllocationExample.java \
|
||||
ExpensiveInterfaceExample.java \
|
||||
PrintfArgsChecker.java \
|
||||
ExpensiveSubtypingExample.java \
|
||||
TraceCallSequence.java \
|
||||
FragmentDoesNotRetainViewExample.java \
|
||||
TwoCheckersExample.java
|
||||
|
||||
compile:
|
||||
javac -cp $(CLASSPATH) $(FILES)
|
||||
|
||||
analyze:
|
||||
$(INFER_BIN) -a checkers -- javac -cp $(CLASSPATH) $(FILES) >/dev/null 2>/dev/null
|
@ -0,0 +1,36 @@
|
||||
ExpensiveCallExample.java, View ExpensiveCallExample.callsFindViewByIdFromActivity(FragmentActivity,int), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, View ExpensiveCallExample.callsFindViewByIdFromView(ImageView,int), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.annotatedPerformanceCriticalInInterface(), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.callMethodOnExpensiveClass(ExpensiveClass), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.callingExpensiveMethodFromInterface(ExpensiveInterfaceExample), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.callsExpensiveInConditionalBranch(), 2, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.callsExpensiveInTheUnlikelyElseBranch(), 4, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.callsExpensiveWithDisjunctionAfterUnlikely(), 2, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.callsExpensiveWithOverriddenUnlikelyCondition(), 4, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.directlyCallingExpensiveMethod(), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.indirectlyCallingExpensiveMethod(), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.longerCallStackToExpensive(), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void ExpensiveCallExample.onlyOneExpensiveCallUsingUnlikely(), 4, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void PerformanceCriticalClass.performanceCriticalMethod1(ExpensiveClass), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void PerformanceCriticalClass.performanceCriticalMethod2(Other), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void PerformanceCriticalClass.performanceCriticalMethod3(Other), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void PerformanceCriticalSubclass.subclassPerformanceCriticalMethod1(ExpensiveClass), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void PerformanceCriticalSubclass.subclassPerformanceCriticalMethod2(ExpensiveSubclass), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveCallExample.java, void PerformanceCriticalSubclass.subclassPerformanceCriticalMethod3(Other), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveInheritanceExample.java, void ExpensiveInheritanceExample.doesReportBecauseTypeFlowInsensitive(A), 2, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveInheritanceExample.java, void ExpensiveInheritanceExample.reportsAssumingObjectOfTypeA(), 2, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveInheritanceExample.java, void ExpensiveInheritanceExample.reportsBecauseFooIsExpensiveInA(A), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
||||
ExpensiveSubtypingExample.java, void ExpensiveSubtypingExample.m3(), 0, CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED
|
||||
FragmentRetainsViewExample.java, void FragmentRetainsViewExample.onDestroyView(), 0, CHECKERS_FRAGMENT_RETAINS_VIEW
|
||||
FragmentRetainsViewExample.java, void FragmentRetainsViewExample.onDestroyView(), 0, CHECKERS_FRAGMENT_RETAINS_VIEW
|
||||
FragmentRetainsViewExample.java, void FragmentRetainsViewExample.onDestroyView(), 0, CHECKERS_FRAGMENT_RETAINS_VIEW
|
||||
ImmutableCast.java, List ImmutableCast.badCast(ImmutableList), 0, CHECKERS_IMMUTABLE_CAST
|
||||
ImmutableCast.java, List ImmutableCast.badCastFromField(), 0, CHECKERS_IMMUTABLE_CAST
|
||||
NoAllocationExample.java, void NoAllocationExample.directlyAllocatingMethod(), 1, CHECKERS_ALLOCATES_MEMORY
|
||||
NoAllocationExample.java, void NoAllocationExample.indirectlyAllocatingMethod(), 1, CHECKERS_ALLOCATES_MEMORY
|
||||
PrintfArgsChecker.java, void PrintfArgsChecker.formatStringIsNotLiteral(PrintStream), 2, CHECKERS_PRINTF_ARGS
|
||||
PrintfArgsChecker.java, void PrintfArgsChecker.notSuppressed(PrintStream), 1, CHECKERS_PRINTF_ARGS
|
||||
PrintfArgsChecker.java, void PrintfArgsChecker.stringInsteadOfInteger(PrintStream), 1, CHECKERS_PRINTF_ARGS
|
||||
PrintfArgsChecker.java, void PrintfArgsChecker.wrongNumberOfArguments(PrintStream), 1, CHECKERS_PRINTF_ARGS
|
||||
TwoCheckersExample.java, List TwoCheckersExample.shouldRaiseImmutableCastError(), 0, CHECKERS_IMMUTABLE_CAST
|
||||
TwoCheckersExample.java, List TwoCheckersExample.shouldRaisePerformanceCriticalError(), 1, CHECKERS_CALLS_EXPENSIVE_METHOD
|
@ -1,48 +0,0 @@
|
||||
sources = glob(['**/*.java'])
|
||||
|
||||
dependencies = [
|
||||
'//infer/annotations:annotations',
|
||||
'//infer/lib/java/android:android',
|
||||
'//dependencies/java/jsr-305:jsr-305',
|
||||
'//dependencies/java/jsr-330:jsr-330',
|
||||
'//dependencies/java/android/support/v4:android-support-v4',
|
||||
'//dependencies/java/butterknife:butterknife',
|
||||
]
|
||||
|
||||
java_library(
|
||||
name = 'eradicate',
|
||||
srcs = sources,
|
||||
deps = dependencies,
|
||||
visibility = [
|
||||
'PUBLIC'
|
||||
]
|
||||
)
|
||||
|
||||
out = 'out'
|
||||
clean_cmd = ' '.join(['rm', '-rf', out])
|
||||
classpath = ':'.join([('$(classpath ' + path + ')') for path in dependencies])
|
||||
env_cmd = ' '.join(['export', 'ERADICATE_RETURN_OVER_ANNOTATED=1'])
|
||||
infer_cmd = ' '.join([
|
||||
'infer',
|
||||
'--no-progress-bar',
|
||||
'--absolute-paths',
|
||||
'-o', out,
|
||||
'-a', 'eradicate',
|
||||
'--',
|
||||
'javac',
|
||||
'-cp', classpath,
|
||||
'$SRCS',
|
||||
])
|
||||
copy_cmd = ' '.join(['cp', out + '/report.csv', '$OUT'])
|
||||
command = ' && '.join([clean_cmd, env_cmd, infer_cmd, copy_cmd])
|
||||
|
||||
genrule(
|
||||
name = 'analyze',
|
||||
srcs = sources,
|
||||
out = 'report.csv',
|
||||
cmd = command,
|
||||
deps = dependencies + [':eradicate'],
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
]
|
||||
)
|
@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2016 - present Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD style license found in the
|
||||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
include ../Makefile
|
||||
|
||||
FILES = \
|
||||
ActivityFieldNotInitialized.java \
|
||||
FieldNotInitialized.java \
|
||||
FieldNotNullable.java \
|
||||
InconsistentSubclassAnnotationInterface.java \
|
||||
InconsistentSubclassAnnotation.java \
|
||||
LibraryCalls.java \
|
||||
NoReuseUndefFunctionValues.java \
|
||||
NullFieldAccess.java \
|
||||
NullMethodCall.java \
|
||||
ParameterNotNullable.java \
|
||||
ReturnNotNullable.java \
|
||||
SuppressWarningsExample.java \
|
||||
SuppressedFieldNotInitializedExample.java
|
||||
|
||||
compile:
|
||||
javac -cp $(CLASSPATH) $(FILES)
|
||||
|
||||
analyze:
|
||||
ERADICATE_RETURN_OVER_ANNOTATED=1 \
|
||||
$(INFER_BIN) -a eradicate -- javac -cp $(CLASSPATH) $(FILES) >/dev/null 2>/dev/null
|
@ -0,0 +1,51 @@
|
||||
ActivityFieldNotInitialized.java, ActivityFieldNotInitialized$BadActivityWithOnCreate.<init>(ActivityFieldNotInitialized), 0, ERADICATE_FIELD_NOT_INITIALIZED
|
||||
FieldNotInitialized.java, FieldNotInitialized.<init>(), 0, ERADICATE_FIELD_NOT_INITIALIZED
|
||||
FieldNotNullable.java, FieldNotNullable.<init>(Integer), -25, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, FieldNotNullable.<init>(String), -2, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, void FieldNotNullable.setYNull(), 1, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, void FieldNotNullable.setYNullable(String), 1, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, void NestedFieldAccess$TestFunctionsIdempotent.FlatBAD1(NestedFieldAccess$TestFunctionsIdempotent), 2, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, void NestedFieldAccess$TestFunctionsIdempotent.FlatBAD2(NestedFieldAccess$TestFunctionsIdempotent), 2, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, void NestedFieldAccess$TestFunctionsIdempotent.NestedBAD1(), 2, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, void NestedFieldAccess$TestFunctionsIdempotent.NestedBAD2(), 2, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, void NestedFieldAccess$TestFunctionsIdempotent.NestedBAD3(), 2, ERADICATE_FIELD_NOT_NULLABLE
|
||||
FieldNotNullable.java, void NestedFieldAccess$TestPut.putNull(Map,String), 3, ERADICATE_FIELD_NOT_NULLABLE
|
||||
InconsistentSubclassAnnotation.java, String InconsistentSubclassAnnotation.implementInAnotherFile(String), 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION
|
||||
InconsistentSubclassAnnotation.java, SubclassExample$T SubclassExample$B.foo(), 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION
|
||||
InconsistentSubclassAnnotation.java, SubclassExample$T SubclassExample$C.baz(), 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION
|
||||
InconsistentSubclassAnnotation.java, void SubclassExample$D.deref(SubclassExample$T), 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION
|
||||
LibraryCalls.java, String LibraryCalls.badAtomicReferenceDereference(AtomicReference), 1, ERADICATE_NULL_METHOD_CALL
|
||||
LibraryCalls.java, String LibraryCalls.badPhantomReferenceDereference(PhantomReference), 1, ERADICATE_NULL_METHOD_CALL
|
||||
LibraryCalls.java, String LibraryCalls.badReferenceDereference(Reference), 1, ERADICATE_NULL_METHOD_CALL
|
||||
LibraryCalls.java, String LibraryCalls.badSoftReferenceDereference(SoftReference), 1, ERADICATE_NULL_METHOD_CALL
|
||||
LibraryCalls.java, String LibraryCalls.badWeakReferenceDereference(WeakReference), 1, ERADICATE_NULL_METHOD_CALL
|
||||
NullFieldAccess.java, Object NullFieldAccess.arrayAccess(), 1, ERADICATE_NULL_FIELD_ACCESS
|
||||
NullFieldAccess.java, int NullFieldAccess.arrayLength(), 1, ERADICATE_NULL_FIELD_ACCESS
|
||||
NullFieldAccess.java, int NullFieldAccess.useInterface(NullFieldAccess$I), 2, ERADICATE_NULL_FIELD_ACCESS
|
||||
NullFieldAccess.java, int NullFieldAccess.useX(), 2, ERADICATE_NULL_FIELD_ACCESS
|
||||
NullFieldAccess.java, int NullFieldAccess.useZ(), 2, ERADICATE_NULL_FIELD_ACCESS
|
||||
NullMethodCall.java, int NullMethodCall$Inner.outerField(), 2, ERADICATE_NULL_METHOD_CALL
|
||||
NullMethodCall.java, int NullMethodCall$Inner.outerPrivateField(), 2, ERADICATE_NULL_METHOD_CALL
|
||||
NullMethodCall.java, void NullMethodCall$TestTextUtilsIsEmpty.myTextUtilsIsEmpty(CharSequence), 2, ERADICATE_NULL_METHOD_CALL
|
||||
NullMethodCall.java, void NullMethodCall$TestTextUtilsIsEmpty.myTextUtilsNotIsNotEmpty(CharSequence), 2, ERADICATE_NULL_METHOD_CALL
|
||||
NullMethodCall.java, void NullMethodCall$TestTextUtilsIsEmpty.textUtilsIsEmpty(CharSequence), 2, ERADICATE_NULL_METHOD_CALL
|
||||
NullMethodCall.java, void NullMethodCall.callOnNull(), 2, ERADICATE_NULL_METHOD_CALL
|
||||
NullMethodCall.java, void NullMethodCall.testExceptionPerInstruction(int), 6, ERADICATE_NULL_METHOD_CALL
|
||||
NullMethodCall.java, void NullMethodCall.testFieldAssignmentIfThenElse(String), 2, ERADICATE_NULL_METHOD_CALL
|
||||
NullMethodCall.java, void NullMethodCall.testSystemGetPropertyReturn(), 2, ERADICATE_NULL_METHOD_CALL
|
||||
ParameterNotNullable.java, String ParameterNotNullable.testSystemGetPropertyArgument(), 1, ERADICATE_PARAMETER_NOT_NULLABLE
|
||||
ParameterNotNullable.java, URL ParameterNotNullable.testClassGetResourceArgument(Class), 1, ERADICATE_PARAMETER_NOT_NULLABLE
|
||||
ParameterNotNullable.java, void ParameterNotNullable.callNull(), 2, ERADICATE_PARAMETER_NOT_NULLABLE
|
||||
ParameterNotNullable.java, void ParameterNotNullable.callNullable(String), 1, ERADICATE_PARAMETER_NOT_NULLABLE
|
||||
ReturnNotNullable.java, Object ReturnNotNullable.tryWithResourcesReturnNullable(String), 0, ERADICATE_RETURN_NOT_NULLABLE
|
||||
ReturnNotNullable.java, String ReturnNotNullable.redundantEq(), 0, ERADICATE_RETURN_OVER_ANNOTATED
|
||||
ReturnNotNullable.java, String ReturnNotNullable.redundantEq(), 2, ERADICATE_CONDITION_REDUNDANT_NONNULL
|
||||
ReturnNotNullable.java, String ReturnNotNullable.redundantNeq(), 0, ERADICATE_RETURN_OVER_ANNOTATED
|
||||
ReturnNotNullable.java, String ReturnNotNullable.redundantNeq(), 2, ERADICATE_CONDITION_REDUNDANT_NONNULL
|
||||
ReturnNotNullable.java, String ReturnNotNullable.returnNull(), 0, ERADICATE_RETURN_NOT_NULLABLE
|
||||
ReturnNotNullable.java, String ReturnNotNullable.returnNullable(String), 0, ERADICATE_RETURN_NOT_NULLABLE
|
||||
ReturnNotNullable.java, String ReturnNotNullable.return_null_in_catch(), 0, ERADICATE_RETURN_NOT_NULLABLE
|
||||
ReturnNotNullable.java, String ReturnNotNullable.return_null_in_catch_after_throw(), 0, ERADICATE_RETURN_NOT_NULLABLE
|
||||
ReturnNotNullable.java, URL ReturnNotNullable.getResourceNullable(Class,String), 0, ERADICATE_RETURN_NOT_NULLABLE
|
||||
SuppressWarningsExample.java, void SuppressWarningsExample.doNotSuppressNoAnnot(Object), 1, ERADICATE_NULL_METHOD_CALL
|
||||
SuppressWarningsExample.java, void SuppressWarningsExample.doNotSuppressWrongAnnot(Object), 1, ERADICATE_NULL_METHOD_CALL
|
@ -1,16 +0,0 @@
|
||||
java_test(
|
||||
name='checkers',
|
||||
srcs=glob(['*.java']),
|
||||
deps=[
|
||||
'//dependencies/java/guava:guava',
|
||||
'//dependencies/java/junit:hamcrest',
|
||||
'//dependencies/java/junit:junit',
|
||||
'//infer/tests/utils:utils',
|
||||
],
|
||||
resources=[
|
||||
'//infer/tests/codetoanalyze/java/checkers:analyze',
|
||||
],
|
||||
visibility=[
|
||||
'PUBLIC',
|
||||
],
|
||||
)
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class ExpensiveCallTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/ExpensiveCallExample.java";
|
||||
|
||||
public static final String CALLS_EXPENSIVE_METHOD =
|
||||
"CHECKERS_CALLS_EXPENSIVE_METHOD";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadCheckersResults(ExpensiveCallTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"directlyCallingExpensiveMethod",
|
||||
"indirectlyCallingExpensiveMethod",
|
||||
"callingExpensiveMethodFromInterface",
|
||||
"longerCallStackToExpensive",
|
||||
"callsFindViewByIdFromView",
|
||||
"callsFindViewByIdFromActivity",
|
||||
"annotatedPerformanceCriticalInInterface",
|
||||
"performanceCriticalMethod1",
|
||||
"performanceCriticalMethod2",
|
||||
"performanceCriticalMethod3",
|
||||
"subclassPerformanceCriticalMethod1",
|
||||
"subclassPerformanceCriticalMethod2",
|
||||
"subclassPerformanceCriticalMethod3",
|
||||
"callMethodOnExpensiveClass",
|
||||
"onlyOneExpensiveCallUsingUnlikely",
|
||||
"callsExpensiveInTheUnlikelyElseBranch",
|
||||
"callsExpensiveWithDisjunctionAfterUnlikely",
|
||||
"callsExpensiveWithOverriddenUnlikelyCondition",
|
||||
"callsExpensiveInConditionalBranch",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + CALLS_EXPENSIVE_METHOD,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
CALLS_EXPENSIVE_METHOD,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class ExpensiveInheritanceTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/ExpensiveInheritanceExample.java";
|
||||
|
||||
public static final String CALLS_EXPENSIVE_METHOD =
|
||||
"CHECKERS_CALLS_EXPENSIVE_METHOD";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadCheckersResults(ExpensiveInheritanceTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"reportsBecauseFooIsExpensiveInA",
|
||||
"reportsAssumingObjectOfTypeA",
|
||||
"doesReportBecauseTypeFlowInsensitive",
|
||||
};
|
||||
assertThat("Results should contain " + CALLS_EXPENSIVE_METHOD,
|
||||
inferResults,
|
||||
containsExactly(CALLS_EXPENSIVE_METHOD,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class ExpensiveSubtypingTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/ExpensiveSubtypingExample.java";
|
||||
|
||||
public static final String EXPENSIVE_OVERRIDES_UNANNOTATED =
|
||||
"CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadCheckersResults(ExpensiveSubtypingTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"m3",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + EXPENSIVE_OVERRIDES_UNANNOTATED,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
EXPENSIVE_OVERRIDES_UNANNOTATED,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsNoErrorInMethod.doesNotContain;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class FragmentDoesNotRetainViewTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java";
|
||||
|
||||
public static final String FRAGMENT_RETAINS_VIEW =
|
||||
"CHECKERS_FRAGMENT_RETAINS_VIEW";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadCheckersResults(FragmentDoesNotRetainViewTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchNumberOfErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"Results should contain 0 retained View errors",
|
||||
inferResults,
|
||||
doesNotContain(
|
||||
FRAGMENT_RETAINS_VIEW,
|
||||
SOURCE_FILE,
|
||||
"onDestroyView"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsNumberOfErrorsInMethod.containsNumberOfErrors;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class FragmentRetainsViewTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/FragmentRetainsViewExample.java";
|
||||
|
||||
public static final String FRAGMENT_RETAINS_VIEW =
|
||||
"CHECKERS_FRAGMENT_RETAINS_VIEW";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadCheckersResults(FragmentRetainsViewTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchNumberOfErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"Results should contain 3 retained View errors",
|
||||
inferResults,
|
||||
containsNumberOfErrors(
|
||||
FRAGMENT_RETAINS_VIEW,
|
||||
SOURCE_FILE,
|
||||
"onDestroyView",
|
||||
3
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class ImmutableCastTest {
|
||||
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/ImmutableCast.java";
|
||||
|
||||
public static final String IMMUTABLE_CAST = "CHECKERS_IMMUTABLE_CAST";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadCheckersResults(ImmutableCastTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"badCast",
|
||||
"badCastFromField",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + IMMUTABLE_CAST,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
IMMUTABLE_CAST,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
public class NoAllocationTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/NoAllocationExample.java";
|
||||
|
||||
public static final String ALLOCATES_MEMORY =
|
||||
"CHECKERS_ALLOCATES_MEMORY";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults = InferResults.loadCheckersResults(NoAllocationTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"directlyAllocatingMethod",
|
||||
"indirectlyAllocatingMethod",
|
||||
};
|
||||
assertThat("Results should contain " + ALLOCATES_MEMORY,
|
||||
inferResults,
|
||||
containsExactly(ALLOCATES_MEMORY,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class PrintfArgsCheckerTest {
|
||||
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/PrintfArgsChecker.java";
|
||||
|
||||
public static final String CHECKERS_PRINTF_ARGS = "CHECKERS_PRINTF_ARGS";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadCheckersResults(PrintfArgsCheckerTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"notSuppressed",
|
||||
"stringInsteadOfInteger",
|
||||
"wrongNumberOfArguments",
|
||||
"formatStringIsNotLiteral",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + CHECKERS_PRINTF_ARGS,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
CHECKERS_PRINTF_ARGS,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.checkers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsErrorInMethod.contains;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class TwoCheckersTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/checkers/TwoCheckersExample.java";
|
||||
|
||||
public static final String CALLS_EXPENSIVE_METHOD =
|
||||
"CHECKERS_CALLS_EXPENSIVE_METHOD";
|
||||
|
||||
public static final String IMMUTABLE_CAST =
|
||||
"CHECKERS_IMMUTABLE_CAST";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadCheckersResults(TwoCheckersTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void immutableCastErrorIsFound ()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat("Results should contain " + IMMUTABLE_CAST,
|
||||
inferResults,
|
||||
contains(IMMUTABLE_CAST,
|
||||
SOURCE_FILE,
|
||||
"shouldRaiseImmutableCastError"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PerformanceCriticalErrorIsFound ()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat("Results should contain " + CALLS_EXPENSIVE_METHOD,
|
||||
inferResults,
|
||||
contains(CALLS_EXPENSIVE_METHOD,
|
||||
SOURCE_FILE,
|
||||
"shouldRaisePerformanceCriticalError"));
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class ActivityFieldNotInitializedTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/ActivityFieldNotInitialized.java";
|
||||
|
||||
public static final String FIELD_NOT_INITIALIZED =
|
||||
"ERADICATE_FIELD_NOT_INITIALIZED";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults = InferResults.loadEradicateResults(
|
||||
ActivityFieldNotInitializedTest.class,
|
||||
SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"<init>",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + FIELD_NOT_INITIALIZED,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
FIELD_NOT_INITIALIZED,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
java_test(
|
||||
name='eradicate',
|
||||
srcs=glob(['*.java']),
|
||||
deps=[
|
||||
'//dependencies/java/guava:guava',
|
||||
'//dependencies/java/junit:hamcrest',
|
||||
'//dependencies/java/junit:junit',
|
||||
'//infer/tests/utils:utils',
|
||||
],
|
||||
resources=[
|
||||
'//infer/tests/codetoanalyze/java/eradicate:analyze',
|
||||
],
|
||||
visibility=[
|
||||
'PUBLIC',
|
||||
],
|
||||
)
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
import static utils.matchers.ResultContainsNumberOfErrorsInMethod.containsNumberOfErrors;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class FieldNotInitializedTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/FieldNotInitialized.java";
|
||||
|
||||
public static final String FIELD_NOT_INITIALIZED =
|
||||
"ERADICATE_FIELD_NOT_INITIALIZED";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadEradicateResults(FieldNotInitializedTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"Results should contain " + FIELD_NOT_INITIALIZED,
|
||||
inferResults,
|
||||
containsNumberOfErrors(
|
||||
FIELD_NOT_INITIALIZED,
|
||||
SOURCE_FILE,
|
||||
"<init>",
|
||||
1
|
||||
)
|
||||
);
|
||||
|
||||
String[] procedures = {"<init>"};
|
||||
assertThat(
|
||||
"Results should contain " + FIELD_NOT_INITIALIZED,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
FIELD_NOT_INITIALIZED,
|
||||
SOURCE_FILE,
|
||||
procedures
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class FieldNotNullableTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/FieldNotNullable.java";
|
||||
|
||||
public static final String FIELD_NOT_NULLABLE =
|
||||
"ERADICATE_FIELD_NOT_NULLABLE";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadEradicateResults(FieldNotNullableTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"setYNull",
|
||||
"setYNullable",
|
||||
"<init>",
|
||||
"FlatBAD1",
|
||||
"FlatBAD2",
|
||||
"NestedBAD1",
|
||||
"NestedBAD2",
|
||||
"NestedBAD3",
|
||||
"putNull",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + FIELD_NOT_NULLABLE,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
FIELD_NOT_NULLABLE,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ErrorPattern.createPatterns;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
import utils.matchers.ErrorPattern;
|
||||
|
||||
public class InconsistentSubclassAnnotationTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/InconsistentSubclassAnnotation.java";
|
||||
|
||||
public static final String ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION =
|
||||
"ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION";
|
||||
|
||||
public static final String ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION =
|
||||
"ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults = InferResults.loadEradicateResults(
|
||||
InconsistentSubclassAnnotationTest.class,
|
||||
SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
|
||||
|
||||
String[] returnMethods = {"foo", "baz"};
|
||||
List<ErrorPattern> errorPatterns = createPatterns(
|
||||
ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION,
|
||||
SOURCE_FILE,
|
||||
returnMethods);
|
||||
|
||||
String[] parameterMethods = {"deref", "implementInAnotherFile"};
|
||||
errorPatterns.addAll(
|
||||
createPatterns(
|
||||
ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION,
|
||||
SOURCE_FILE,
|
||||
parameterMethods
|
||||
)
|
||||
);
|
||||
|
||||
assertThat(
|
||||
"Results should contain ",
|
||||
inferResults,
|
||||
containsExactly(errorPatterns)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class LibraryCallsTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/LibraryCalls.java";
|
||||
|
||||
public static final String NULL_METHOD_CALL =
|
||||
"ERADICATE_NULL_METHOD_CALL";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadEradicateResults(LibraryCallsTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"badReferenceDereference",
|
||||
"badWeakReferenceDereference",
|
||||
"badPhantomReferenceDereference",
|
||||
"badSoftReferenceDereference",
|
||||
"badAtomicReferenceDereference",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + NULL_METHOD_CALL,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
NULL_METHOD_CALL,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsNoErrorInMethod.doesNotContain;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class NoReuseUndefFunctionValuesTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/NoReuseUndefFunctionValues.java";
|
||||
|
||||
public static final String FIELD_NOT_INITIALIZED =
|
||||
"ERADICATE_FIELD_NOT_INITIALIZED";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadEradicateResults(NoReuseUndefFunctionValuesTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors() throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"Results should not contain " + FIELD_NOT_INITIALIZED,
|
||||
inferResults,
|
||||
doesNotContain(
|
||||
FIELD_NOT_INITIALIZED,
|
||||
SOURCE_FILE,
|
||||
"<init>"));
|
||||
}
|
||||
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class NullFieldAccessTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/NullFieldAccess.java";
|
||||
|
||||
public static final String NULL_FIELD_ACCESS =
|
||||
"ERADICATE_NULL_FIELD_ACCESS";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadEradicateResults(NullFieldAccessTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"useX",
|
||||
"useZ",
|
||||
"useInterface",
|
||||
"arrayLength",
|
||||
"arrayAccess",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + NULL_FIELD_ACCESS,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
NULL_FIELD_ACCESS,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class NullMethodCallTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/NullMethodCall.java";
|
||||
|
||||
public static final String NULL_METHOD_CALL = "ERADICATE_NULL_METHOD_CALL";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadEradicateResults(NullMethodCallTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"callOnNull",
|
||||
"outerField",
|
||||
"outerPrivateField",
|
||||
"testFieldAssignmentIfThenElse",
|
||||
"testExceptionPerInstruction",
|
||||
"testSystemGetPropertyReturn",
|
||||
"textUtilsIsEmpty",
|
||||
"myTextUtilsIsEmpty",
|
||||
"myTextUtilsNotIsNotEmpty",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + NULL_METHOD_CALL,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
NULL_METHOD_CALL,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class ParameterNotNullableTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/ParameterNotNullable.java";
|
||||
|
||||
public static final String PARAMETER_NOT_NULLABLE =
|
||||
"ERADICATE_PARAMETER_NOT_NULLABLE";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadEradicateResults(ParameterNotNullableTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"callNull",
|
||||
"callNullable",
|
||||
"testSystemGetPropertyArgument",
|
||||
"testClassGetResourceArgument",
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + PARAMETER_NOT_NULLABLE,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
PARAMETER_NOT_NULLABLE,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ErrorPattern.createPatterns;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
import utils.matchers.ErrorPattern;
|
||||
|
||||
public class ReturnNotNullableTest {
|
||||
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/ReturnNotNullable.java";
|
||||
|
||||
public static final String RETURN_NOT_NULLABLE =
|
||||
"ERADICATE_RETURN_NOT_NULLABLE";
|
||||
public static final String CONDITION_REDUNDANT_NONNULL =
|
||||
"ERADICATE_CONDITION_REDUNDANT_NONNULL";
|
||||
public static final String RETURN_OVER_ANNOTATED =
|
||||
"ERADICATE_RETURN_OVER_ANNOTATED";
|
||||
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults =
|
||||
InferResults.loadEradicateResults(ReturnNotNullableTest.class, SOURCE_FILE);
|
||||
}
|
||||
|
||||
boolean returnOverAnnotatedEnabled = true;
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
|
||||
|
||||
String[] nullableMethods = {
|
||||
"returnNull",
|
||||
"returnNullable",
|
||||
"return_null_in_catch",
|
||||
"return_null_in_catch_after_throw",
|
||||
"getResourceNullable",
|
||||
"tryWithResourcesReturnNullable",
|
||||
};
|
||||
List<ErrorPattern> errorPatterns = createPatterns(
|
||||
RETURN_NOT_NULLABLE,
|
||||
SOURCE_FILE,
|
||||
nullableMethods);
|
||||
|
||||
String[] redundantMethods = {
|
||||
"redundantEq",
|
||||
"redundantNeq",
|
||||
};
|
||||
errorPatterns.addAll(
|
||||
createPatterns(
|
||||
CONDITION_REDUNDANT_NONNULL,
|
||||
SOURCE_FILE,
|
||||
redundantMethods
|
||||
)
|
||||
);
|
||||
|
||||
if (returnOverAnnotatedEnabled) {
|
||||
errorPatterns.addAll(
|
||||
createPatterns(
|
||||
RETURN_OVER_ANNOTATED,
|
||||
SOURCE_FILE,
|
||||
redundantMethods
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
assertThat(
|
||||
"Results should contain ",
|
||||
inferResults,
|
||||
containsExactly(errorPatterns)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsNoErrorInMethod.doesNotContain;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class SuppressWarningsTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/SuppressWarningsExample.java";
|
||||
|
||||
public static final String NULL_METHOD_CALL = "ERADICATE_NULL_METHOD_CALL";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults = InferResults.loadEradicateResults(
|
||||
SuppressWarningsTest.class,
|
||||
SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
"doNotSuppressWrongAnnot",
|
||||
"doNotSuppressNoAnnot"
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + NULL_METHOD_CALL,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
NULL_METHOD_CALL,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package endtoend.java.eradicate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.ResultContainsNoErrorInMethod.doesNotContain;
|
||||
import static utils.matchers.ResultContainsExactly.containsExactly;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferResults;
|
||||
|
||||
public class SuppressedFieldNotInitializedTest {
|
||||
|
||||
public static final String SOURCE_FILE =
|
||||
"infer/tests/codetoanalyze/java/eradicate/SuppressedFieldNotInitializedExample.java";
|
||||
|
||||
public static final String FIELD_NOT_INITIALIZED =
|
||||
"ERADICATE_FIELD_NOT_INITIALIZED";
|
||||
|
||||
private static InferResults inferResults;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferResults = InferResults.loadEradicateResults(
|
||||
SuppressedFieldNotInitializedTest.class,
|
||||
SOURCE_FILE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchErrors()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
String[] methods = {
|
||||
};
|
||||
assertThat(
|
||||
"Results should contain " + FIELD_NOT_INITIALIZED,
|
||||
inferResults,
|
||||
containsExactly(
|
||||
FIELD_NOT_INITIALIZED,
|
||||
SOURCE_FILE,
|
||||
methods));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue