AnnaStudy

We conduct the first comprehensive study of annotation-induced faults on static analyzers. In this work, we collect 246 issues from five popular and analyze their root causes, symptoms, and fix strategies. We also implemented a metamorphic testing framework, AnnaTester, to detect usual annotation-induced faults based on our findings. AnnaTester identified 43 faults, 20 of which have been fixed.

Defects found

Annotation Link Status Rule
NoArgsConstructor Link Fixed ClassWithOnlyPrivateConstructorsShouldBeFinal
Cleanup Link Fixed RSPEC-2095
NoArgsConstructor Link Fixed RSPEC-2974
AllArgsConstructor Link Fixed RSPEC-2974
DummyAnnotation Link Confirmed Indentation
AllArgsConstructor Link Fixed AbstractClassWithoutAnyMethod
Value Link Fixed ClassWithOnlyPrivateConstructorsShouldBeFinal
NonNull Link Fixed NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT
Value Link Fixed CommentDefaultAccessModifier
Get Link Fixed DoNotUseThreads
UtilityClass Link Fixed MissingStaticMethodInNonInstantiatableClass
Nullable Link Pending NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION
EqualsAndHashcode Link Confirmed OnlyOneReturn
UtilityClass Link Fixed FieldNamingConventions
DummyAnnotation Link Fixed Parser(Crash)
Inject Link Confirmed RSPEC-3306
DummyAnnotation Link Fixed Parser(Crash)
UtilityClass Link Fixed FinalFieldCouldBeStatic
Nullable Link Pending NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION
Setter Link Fixed ImmutableField
UtilityClass Link Confirmed ImmutableField
Value Link Fixed RSPEC-2974
Data Link Fixed RSPEC-2974
DummyAnnotation Link Fixed UseArrayListInsteadOfVector
NoArgsConstructor Link Fixed MissingStaticMethodInNonInstantiatableClass
DummyAnnotation Link Pending Parser(Wrong middle result)
DummyAnnotation Link Pending UnusedLocalVariable
Test Link Fixed CommentDefaultAccessModifier
VisibleForTesting Link Pending THREAD_SAFETY_VIOLATION
DummyAnnotation Link Fixed Parser(Crash)
DummyAnnotation Link Pending Parser(Wrong middle result)
AfterClass Link Fixed SignatureDeclareThrowsException
NonNull Link Fixed NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT
Inject Link Fixed UnnecessaryConstructor
Inject Link Fixed MissingStaticMethodInNonInstantiatableClass
DummyAnnotation Link Pending OneStatementPerLine
Nullable Link Pending NULL_DEREFERENCE
Value Link Fixed RedundantFieldInitializer
DummyAnnotation Link Pending UnsynchronizedStaticFormatter
NonNull Link Pending NP_STORE_INTO_NONNULL_FIELD
Value Link Fixed ConstructorCallsOverridableMethod
Nullable Link Pending NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
Test Link Fixed JUnitTestsShouldIncludeAssert

Analyzed Issues

We have analyzed 246 issues from five static analyzers: PMD, SpotBugs, SonarQube, Infer, CheckStyle, and Soot. The issue data can be available via the following line: [Link]

Paper

    Please refer to the author's homepage to check the camera-ready paper: [Link]

Open Source