-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Index flow of nullable back to upstream through a field write (#211)
This PR is built on (~#210~ landed) Resolves #209 by indexing flow of nullable back to upstream through field writes. Previously we only indexed flow of nullable back to upstream via parameter passing, e.g. code below: ```java class Target{ Object getFoo() void bar(Object param); } class Dependency { Target t; void baz(){ t.bar(t.getFoo()); } } ``` We know that making `getFoo()` will trigger a fix on `bar()` parameter. This PR updates Annotator to index all flows back to upstream including field writes. Hence, in the code below: ```java class Target{ Object bar; Object getFoo(); } class Dependency { Target t; void baz(){ t.bar = t.getFoo(); } } ``` Annotator now indexes the flow of nullable back to target through write to a field and includes the corresponding fix in the processing fix tree. Please note this PR only updates indexing flow of nullable back to upstream. Annotator still does **not** index the impact of making public fields `@Nullable` on downstream dependencies.
- Loading branch information
1 parent
d0979c3
commit f0574a1
Showing
7 changed files
with
81 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...r-core/src/test/resources/nullableflowfieldwrite/expected/Dep/src/main/java/test/Dep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package test.dep; | ||
import test.Bar; | ||
public class Dep { | ||
public Bar bar = new Bar(); | ||
public void exec() { | ||
bar.foo2 = bar.getFoo(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...ore/src/test/resources/nullableflowfieldwrite/expected/Target/src/main/java/test/Bar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package test; | ||
import javax.annotation.Nullable; | ||
public class Bar { | ||
@Nullable public String foo; | ||
@Nullable public String foo2 = ""; | ||
@Nullable public String getFoo() { | ||
return foo; | ||
} | ||
} |