Skip to content

Commit e1ff647

Browse files
committed
Fix "Illegal prefix" error in log when custom class/resource locators are in use
1 parent 31cc0a0 commit e1ff647

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

forge/src/main/java/org/embeddedt/modernfix/platform/forge/ModernFixPlatformHooksImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import java.util.Enumeration;
5656
import java.util.Map;
5757
import java.util.Optional;
58+
import java.util.Set;
5859
import java.util.function.Consumer;
5960
import java.util.function.Function;
6061

@@ -214,6 +215,12 @@ private static Function<String, Enumeration<URL>> constructResourceFinder() thro
214215
Field serviceLookupField = servicesHandler.getClass().getDeclaredField("serviceLookup");
215216
serviceLookupField.setAccessible(true);
216217
Map<String, TransformationServiceDecorator> serviceLookup = (Map<String, TransformationServiceDecorator>)serviceLookupField.get(servicesHandler);
218+
for(String s : new String[] { "classPrefixes", "resourceNames" }) {
219+
// Reset cache fields to avoid class prefixes, etc. being falsely flagged
220+
Field cacheField = TransformationServiceDecorator.class.getDeclaredField(s);
221+
cacheField.setAccessible(true);
222+
((Set<String>)cacheField.get(null)).clear();
223+
}
217224
Method getClassLoaderMethod = TransformationServiceDecorator.class.getDeclaredMethod("getClassLoader");
218225
getClassLoaderMethod.setAccessible(true);
219226
Function<String, Enumeration<URL>> resourceEnumeratorLocator = ModernFixResourceFinder::findAllURLsForResource;

0 commit comments

Comments
 (0)