Skip to content

Commit

Permalink
exclude gwt classloader from transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Coles committed Aug 1, 2022
1 parent 7f07da7 commit 2909dcc
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public byte[] transform(final ClassLoader loader, final String className,
final Class<?> classBeingRedefined,
final ProtectionDomain protectionDomain, final byte[] classfileBuffer) {


if (className.equals(targetClass)) {
if (className.equals(targetClass) && shouldTransform(loader)) {
CLASS_LOADERS.put(loader, null);
// we might be mid-mutation so return the mutated bytes
return currentMutant;
Expand All @@ -78,4 +77,10 @@ private static Class<?> checkClassForLoader(ClassLoader loader, String className

}

private boolean shouldTransform(ClassLoader loader) {
// Only gwtmockito has been identified so far as a loader not to transform
// but there will be others
return !loader.getClass().getName().startsWith("com.google.gwtmockito.");
}

}

0 comments on commit 2909dcc

Please sign in to comment.