Skip to content

Instantly share code, notes, and snippets.

@XakepSDK
Last active January 23, 2018 16:19
Show Gist options
  • Save XakepSDK/436534bc52916894a065bf184e79e4b7 to your computer and use it in GitHub Desktop.
Save XakepSDK/436534bc52916894a065bf184e79e4b7 to your computer and use it in GitHub Desktop.
try {
ClassLoader classLoader = getClass().getClassLoader();
Field invalidClasses = classLoader.getClass().getDeclaredField("invalidClasses");
invalidClasses.setAccessible(true);
Field negativeResourceCache = classLoader.getClass().getDeclaredField("negativeResourceCache");
negativeResourceCache.setAccessible(true);
Method clear = Set.class.getDeclaredMethod("clear");
Object o = invalidClasses.get(classLoader);
clear.invoke(o);
Object o1 = negativeResourceCache.get(classLoader);
clear.invoke(o1);
} catch (NoSuchFieldException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment