Skip to content

Commit

Permalink
Change formal parameter name (typetools#6913)
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst authored Dec 9, 2024
1 parent 5accb14 commit 3613e47
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public InitializationVisitor(BaseTypeChecker checker) {
}

@Override
public void setRoot(CompilationUnitTree root) {
public void setRoot(CompilationUnitTree newRoot) {
// Clean up the cache of initialized fields once per compilation unit.
// Alternatively, but harder to determine, this could be done once per top-level class.
initializedFields.clear();
super.setRoot(root);
super.setRoot(newRoot);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public MustCallAnnotatedTypeFactory(BaseTypeChecker checker) {
}

@Override
public void setRoot(@Nullable CompilationUnitTree root) {
super.setRoot(root);
public void setRoot(@Nullable CompilationUnitTree newRoot) {
super.setRoot(newRoot);
// TODO: This should probably be guarded by isSafeToClearSharedCFG from
// GenericAnnotatedTypeFactory, but this works here because we know the Must Call Checker is
// always the first subchecker that's sharing tempvars.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ public Factory createTypeFactoryPublic() {
// **********************************************************************

@Override
public void setRoot(CompilationUnitTree root) {
atypeFactory.setRoot(root);
super.setRoot(root);
public void setRoot(CompilationUnitTree newRoot) {
atypeFactory.setRoot(newRoot);
super.setRoot(newRoot);
testJointJavacJavaParserVisitor();
testAnnotationInsertion();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ protected SourceVisitor(SourceChecker checker) {
* Set the CompilationUnitTree to be used during any visits. For any later calls of {@code
* com.sun.source.util.TreePathScanner.scan(TreePath, P)}, the CompilationUnitTree of the TreePath
* has to be equal to {@code root}.
*
* @param newRoot the new compilation unit
*/
public void setRoot(CompilationUnitTree root) {
this.root = root;
public void setRoot(CompilationUnitTree newRoot) {
this.root = newRoot;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,19 +899,19 @@ protected void initializeReflectionResolution() {
/**
* Set the CompilationUnitTree that should be used.
*
* @param root the new compilation unit to use
* @param newRoot the new compilation unit to use
*/
public void setRoot(@Nullable CompilationUnitTree root) {
if (root != null && wholeProgramInference != null) {
for (Tree typeDecl : root.getTypeDecls()) {
public void setRoot(@Nullable CompilationUnitTree newRoot) {
if (newRoot != null && wholeProgramInference != null) {
for (Tree typeDecl : newRoot.getTypeDecls()) {
if (typeDecl.getKind() == Tree.Kind.CLASS) {
ClassTree classTree = (ClassTree) typeDecl;
wholeProgramInference.preprocessClassTree(classTree);
}
}
}

this.root = root;
this.root = newRoot;
// Do not clear here. Only the primary checker should clear this cache.
// treePathCache.clear();

Expand Down

0 comments on commit 3613e47

Please sign in to comment.