Fix build-time Refaster template loading (#121)

When using the system classloader, `RefasterCheckTest` is able to
successfully load the Refaster templates from the classpath, causing the
tests to pass. However, when during a build the Java compiler loads
`RefasterCheck`, the templates on the annotation processor classpath are
_not_ exposed through the system classloader.
This commit is contained in:
Stephan Schroevers
2022-06-30 13:30:03 +02:00
committed by GitHub
parent c500516bb4
commit bf5199ea3d

View File

@@ -195,7 +195,7 @@ public final class RefasterCheck extends BugChecker implements CompilationUnitTr
private static ImmutableSet<ResourceInfo> getClassPathResources() {
try {
return ClassPath.from(ClassLoader.getSystemClassLoader()).getResources();
return ClassPath.from(RefasterCheck.class.getClassLoader()).getResources();
} catch (IOException e) {
throw new UncheckedIOException("Failed to scan classpath for resources", e);
}