Skip to content

Commit

Permalink
Invalidate caches after processing
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed May 16, 2018
1 parent 600d144 commit b0c97b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ class FunctionTransform implements ASTTransformation {

}
}
AstAnnotationUtils.invalidateCache()
new InjectTransform().visit(nodes, source)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ class InjectTransform implements ASTTransformation, CompilationUnitAware {
}
}
}

AstAnnotationUtils.invalidateCache()
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.github.benmanes.caffeine.cache.Caffeine;
import io.micronaut.core.annotation.AnnotationMetadata;
import io.micronaut.core.annotation.AnnotationUtil;
import io.micronaut.core.annotation.Internal;
import io.micronaut.inject.annotation.JavaAnnotationMetadataBuilder;

import javax.lang.model.element.AnnotationMirror;
Expand Down Expand Up @@ -133,4 +134,13 @@ public boolean isAnnotated(ExecutableElement method) {
}
return false;
}

/**
* Invalidates any cached metadata.
*/
@Internal
static void invalidateCache() {
annotationMetadataCache.invalidateAll();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ public final boolean process(Set<? extends TypeElement> annotations, RoundEnviro
error("Error finalizing type visitor [%s]: %s", loadedVisitor.getVisitor(), e.getMessage());
}
}
AnnotationUtils.invalidateCache();
return true;
}
}
AnnotationUtils.invalidateCache();
return false;
}

Expand Down

0 comments on commit b0c97b4

Please sign in to comment.