Skip to content

Commit

Permalink
Fix log spam due to dropCache warning
Browse files Browse the repository at this point in the history
  • Loading branch information
LunNova committed Jan 20, 2017
1 parent 503eaf0 commit b0d0783
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/javassist/ClassLoaderPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void writeClassfile(String className, OutputStream out) throws NotFoundException
}
}

public void dropCache(String name) {
if (classes.remove(name) == null) {
public void dropCache(String name, boolean allowFailure) {
if (classes.remove(name) == null && !allowFailure) {
// TODO: Should be behind a system property? Could be very spammy
PatcherLog.warn("Failed to drop " + name + " from cache. Currently cached: " + classes.keySet().toString());
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/nallar/modpatcher/LaunchClassLoaderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public static void cacheSrgBytes(String transformedName, byte[] bytes) {

byte[] old = cachedSrgClasses.put(transformedName, bytes);
if (old != null && !Arrays.equals(bytes, old)) {
ModPatcherTransformer.pool.dropCache(transformedName);
ModPatcherTransformer.pool.dropCache(transformedName, false);
if (shouldWarnInconsistentTransformation())
PatcherLog.warn(null, new Error("Inconsistent transformation results. Tried to cache different bytes for class " + transformedName + " to previous result after transformation."));
}
Expand Down Expand Up @@ -317,6 +317,6 @@ static void removeRedundantExclusions(Set<String> transformerExceptions) {

public static void releaseSrgBytes(String transformedName) {
cachedSrgClasses.remove(transformedName);
ModPatcherTransformer.pool.dropCache(transformedName);
ModPatcherTransformer.pool.dropCache(transformedName, true);
}
}

0 comments on commit b0d0783

Please sign in to comment.