Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
zcai1 committed Feb 24, 2022
1 parent 1827620 commit 5826a00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
8 changes: 5 additions & 3 deletions src/checkers/inference/DefaultSlotManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,14 @@ public class DefaultSlotManager implements SlotManager {

private final Set<Class<? extends Annotation>> realQualifiers;
private final ProcessingEnvironment processingEnvironment;
private final InferenceChecker inferenceChecker;

public DefaultSlotManager( final ProcessingEnvironment processingEnvironment,
public DefaultSlotManager( final InferenceChecker inferenceChecker,
final AnnotationMirror realTop,
final Set<Class<? extends Annotation>> realQualifiers,
boolean storeConstants) {
this.processingEnvironment = processingEnvironment;
this.inferenceChecker = inferenceChecker;
this.processingEnvironment = inferenceChecker.getProcessingEnvironment();
this.realTop = realTop;
// sort the qualifiers so that they are always assigned the same varId
this.realQualifiers = sortAnnotationClasses(realQualifiers);
Expand Down Expand Up @@ -405,7 +407,7 @@ public SourceVariableSlot createSourceVariableSlot(AnnotationLocation location,

if (!defaultAnnotationsCache.containsKey(tree)) {
// If cache misses, we check if the top level class has changed.
ClassTree topLevelClass = InferenceMain.getInstance().getVisitor().getCurrentTopLevelClass();
ClassTree topLevelClass = inferenceChecker.getCurrentTopLevelClass();

if (!defaultAnnotationsCache.containsKey(topLevelClass)) {
// If the top level has changed, we refresh our cache with the new scope.
Expand Down
9 changes: 0 additions & 9 deletions src/checkers/inference/InferenceChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ protected BaseTypeVisitor<?> createSourceVisitor() {
return null;
}

@Override
public Properties getMessagesProperties() {
// Add the messages.properties file defined in the same location as
// InferenceChecker
Properties messages = super.getMessagesProperties();
messages.putAll(getProperties(this.getClass(), MSGS_FILE, true));
return messages;
}

@Override
public void typeProcess(TypeElement element, TreePath treePath) {
// As the entry point for type processing, each time we will receive
Expand Down
2 changes: 1 addition & 1 deletion src/checkers/inference/InferenceMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public SlotManager getSlotManager() {
}

slotManager = new DefaultSlotManager(
inferenceChecker.getProcessingEnvironment(),
inferenceChecker,
tops.iterator().next(),
realTypeFactory.getSupportedTypeQualifiers(),
true
Expand Down

0 comments on commit 5826a00

Please sign in to comment.