Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api backwards compatibility #1350

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.lang.instrument.ClassFileTransformer;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -123,7 +124,10 @@ public static void main(final String[] args) {
private static void enableTransformations() {
ClientPluginServices plugins = ClientPluginServices.makeForContextLoader();
for (TransformationPlugin each : plugins.findTransformations()) {
HotSwapAgent.addTransformer(each.makeCoverageTransformer());
ClassFileTransformer transformer = each.makeCoverageTransformer();
if (transformer != null) {
HotSwapAgent.addTransformer(transformer);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@
import java.lang.instrument.ClassFileTransformer;

public interface TransformationPlugin extends ClientClasspathPlugin {
ClassFileTransformer makeCoverageTransformer();
ClassFileTransformer makeMutationTransformer();

@Deprecated
default ClassFileTransformer makeTransformer() {
return makeMutationTransformer();
}

default ClassFileTransformer makeCoverageTransformer() {
return null;
}

default ClassFileTransformer makeMutationTransformer() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import javax.management.NotificationListener;
import javax.management.openmbean.CompositeData;
import java.io.IOException;
import java.lang.instrument.ClassFileTransformer;
import java.lang.management.MemoryNotificationInfo;
import java.net.Socket;
import java.util.Collection;
Expand Down Expand Up @@ -169,7 +170,10 @@ private static List<TestUnit> findTestsForTestClasses(
private static void enableTransformations() {
ClientPluginServices plugins = ClientPluginServices.makeForContextLoader();
for (TransformationPlugin each : plugins.findTransformations()) {
HotSwapAgent.addTransformer(each.makeMutationTransformer());
ClassFileTransformer transformer = each.makeMutationTransformer();
if (transformer != null) {
HotSwapAgent.addTransformer(transformer);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ private static InputStream returnNormalBytes(final Object classPath,
// so the best we can do is exclude pitest itself and some common classes.
private static Predicate<String> excluded() {
return Prelude.or(
startsWith("org.objenesis."),
startsWith("net.bytebuddy."),
startsWith("javassist."),
startsWith("org.pitest."),
startsWith("com.groupcdg."),
startsWith("com.arcmutate."),
startsWith("java."),
startsWith("javax."),
startsWith("com.sun."),
Expand Down
Loading