[nullsafe][annotation graph] Add test case for annotation graph

Summary:
We never tested params dependent on things (tested only things dependend
on params).

Reviewed By: artempyanykh

Differential Revision: D24726858

fbshipit-source-id: a0861cfc3
master
Mitya Lyubarskiy 4 years ago committed by Facebook GitHub Bot
parent ae52fb4787
commit 52ec2e5009

@ -47,6 +47,10 @@ public class AnnotationGraph {
private void methodD() {
// fieldB depends on fieldA
fieldB = fieldA;
// methodF(): param #0 and #2 depend on fieldB, but not param #2
// (fieldB was checked for null before)
methodF(fieldB, fieldB != null ? fieldB : "", fieldB);
}
private void methodE() {
@ -66,7 +70,7 @@ public class AnnotationGraph {
}
}
private void methodF() {
private void methodF(String param0, String param1, String param2) {
// violation for fieldA
fieldA.toString();

@ -5,7 +5,7 @@ AnnotationGraph:
kind: Field
field_name: fieldA
num_violations: 1
dependent_point_ids: [f1]
dependent_point_ids: [f1, p8, p10]
Annotation point:
id: f1
@ -51,6 +51,17 @@ AnnotationGraph:
num_violations: 1
dependent_point_ids: []
Annotation point:
id: p10
kind: Param
method_info:
method_name: methodF
params: java.lang.String, java.lang.String, java.lang.String
access_level: Private
param_num: 2
num_violations: 0
dependent_point_ids: []
Annotation point:
id: p3
kind: Param
@ -73,9 +84,31 @@ AnnotationGraph:
num_violations: 0
dependent_point_ids: [f0, m4]
Annotation point:
id: p8
kind: Param
method_info:
method_name: methodF
params: java.lang.String, java.lang.String, java.lang.String
access_level: Private
param_num: 0
num_violations: 0
dependent_point_ids: []
Annotation point:
id: p9
kind: Param
method_info:
method_name: methodF
params: java.lang.String, java.lang.String, java.lang.String
access_level: Private
param_num: 1
num_violations: 0
dependent_point_ids: []
codetoanalyze/java/nullsafe-annotation-graph/AnnotationGraph.java, Linters_dummy_method, 12, ERADICATE_META_CLASS_NEEDS_IMPROVEMENT, no_bucket, INFO, [], AnnotationGraph, codetoanalyze.java.nullsafe_annotation_graph, issues: 4, curr_mode: "Default"
codetoanalyze/java/nullsafe-annotation-graph/AnnotationGraph.java, Linters_dummy_method, 83, ERADICATE_ANNOTATION_GRAPH, no_bucket, INFO, [], SomeExternalClass, codetoanalyze.java.nullsafe_annotation_graph
codetoanalyze/java/nullsafe-annotation-graph/AnnotationGraph.java, Linters_dummy_method, 87, ERADICATE_ANNOTATION_GRAPH, no_bucket, INFO, [], SomeExternalClass, codetoanalyze.java.nullsafe_annotation_graph
AnnotationGraph:
Annotation point:
id: p0
@ -89,7 +122,7 @@ AnnotationGraph:
dependent_point_ids: []
codetoanalyze/java/nullsafe-annotation-graph/AnnotationGraph.java, Linters_dummy_method, 83, ERADICATE_META_CLASS_CAN_BE_NULLSAFE, no_bucket, ADVICE, [Congrats! `SomeExternalClass` is free of nullability issues. Mark it `@Nullsafe(Nullsafe.Mode.LOCAL)` to prevent regressions.], SomeExternalClass, codetoanalyze.java.nullsafe_annotation_graph, issues: 0, curr_mode: "Default", promote_mode: "Strict"
codetoanalyze/java/nullsafe-annotation-graph/AnnotationGraph.java, Linters_dummy_method, 87, ERADICATE_META_CLASS_CAN_BE_NULLSAFE, no_bucket, ADVICE, [Congrats! `SomeExternalClass` is free of nullability issues. Mark it `@Nullsafe(Nullsafe.Mode.LOCAL)` to prevent regressions.], SomeExternalClass, codetoanalyze.java.nullsafe_annotation_graph, issues: 0, curr_mode: "Default", promote_mode: "Strict"
codetoanalyze/java/nullsafe-annotation-graph/AnnotationGraph.java, codetoanalyze.java.nullsafe_annotation_graph.AnnotationGraph.<init>(), 0, ERADICATE_FIELD_NOT_INITIALIZED, no_bucket, WARNING, [Field `fieldD` is declared non-nullable, so it should be initialized in the constructor or in an `@Initializer` method], AnnotationGraph, codetoanalyze.java.nullsafe_annotation_graph
codetoanalyze/java/nullsafe-annotation-graph/AnnotationGraph.java, codetoanalyze.java.nullsafe_annotation_graph.AnnotationGraph.<init>(), 0, ERADICATE_FIELD_NOT_INITIALIZED, no_bucket, WARNING, [Field `fieldB` is declared non-nullable, so it should be initialized in the constructor or in an `@Initializer` method], AnnotationGraph, codetoanalyze.java.nullsafe_annotation_graph
codetoanalyze/java/nullsafe-annotation-graph/AnnotationGraph.java, codetoanalyze.java.nullsafe_annotation_graph.AnnotationGraph.<init>(), 0, ERADICATE_FIELD_NOT_INITIALIZED, no_bucket, WARNING, [Field `fieldA` is declared non-nullable, so it should be initialized in the constructor or in an `@Initializer` method], AnnotationGraph, codetoanalyze.java.nullsafe_annotation_graph

Loading…
Cancel
Save