Skip to content

Commit

Permalink
Fix error on checking the initTree2PrevFieldInit cache. (#252)
Browse files Browse the repository at this point in the history
We were saving a `ClassSymbol` but testing for the `ClassTree`. 
This didn't cause a functional problem, but it means the cache wasn't being hit.
  • Loading branch information
lazaroclapp committed Nov 6, 2018
1 parent d1684d9 commit d0bddbc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion nullaway/src/main/java/com/uber/nullaway/NullAway.java
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,8 @@ private boolean fieldInitializedByPreviousInitializer(
Symbol fieldSymbol, TreePath initTreePath, VisitorState state) {
TreePath enclosingClassPath = initTreePath.getParentPath();
ClassTree enclosingClass = (ClassTree) enclosingClassPath.getLeaf();
Multimap<Tree, Element> tree2Init = initTree2PrevFieldInit.get(enclosingClass);
Multimap<Tree, Element> tree2Init =
initTree2PrevFieldInit.get(ASTHelpers.getSymbol(enclosingClass));
if (tree2Init == null) {
tree2Init = computeTree2Init(enclosingClassPath, state);
initTree2PrevFieldInit.put(ASTHelpers.getSymbol(enclosingClass), tree2Init);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ private boolean lookupAndBuildCache(Symbol.ClassSymbol klass) {
// Load model jars
for (String modelJarPath : mapModelJarLocations.get(jarName)) {
JarFile jar = new JarFile(modelJarPath);
if (jar == null) {
throw new Error("Cannot open jar: " + modelJarPath);
}
LOG(DEBUG, "DEBUG", "Found model jar at: " + modelJarPath);
JarEntry astubxJE = jar.getJarEntry(DEFAULT_ASTUBX_LOCATION);
if (astubxJE == null) {
Expand Down

0 comments on commit d0bddbc

Please sign in to comment.