From b21ebf4a80919e5dc4aadd4243d00d1441d0f859 Mon Sep 17 00:00:00 2001 From: mmalaeb Date: Fri, 26 Oct 2018 21:34:08 +0300 Subject: [PATCH] Support for Java 9 and above - Default class loader loads "jdk.internal.reflect" packages - Upgrade "javassist" to 3.23.1-GA --- README.MD | 2 +- pom.xml | 2 +- .../testing/instrumentation/InstrumentedClassLoader.java | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.MD b/README.MD index 1bb5b41..1e3e565 100644 --- a/README.MD +++ b/README.MD @@ -4,7 +4,7 @@ It inserts breakpoints into code, and tests all execution combinations for possi It is well explained in this talk: https://vimeo.com/105758363 and slides: http://www.slideshare.net/RafaelWinterhalter/unit-testing-concurrent-code Weaver is originally developed by Google Developers here: https://github.com/google/thread-weaver -This forks updates libraries for Java 8 compatibility and adds mavenization needed for MapDB project. +This forks updates libraries for Java 11 compatibility and adds mavenization needed for MapDB project. Examples are here: https://github.com/jankotek/thread-weaver/tree/master/src/test/java/examples diff --git a/pom.xml b/pom.xml index ce05c67..99d4496 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ org.javassist javassist - 3.20.0-GA + 3.23.1-GA diff --git a/src/main/java/com/google/testing/instrumentation/InstrumentedClassLoader.java b/src/main/java/com/google/testing/instrumentation/InstrumentedClassLoader.java index 611eda6..7bf071f 100644 --- a/src/main/java/com/google/testing/instrumentation/InstrumentedClassLoader.java +++ b/src/main/java/com/google/testing/instrumentation/InstrumentedClassLoader.java @@ -44,7 +44,8 @@ public final class InstrumentedClassLoader extends ClassLoader { /* Note - we run into various obscure errors with on-the-fly classes if we try * to load sun packages, so delegate these to the parent class loader. Also * delegate java and javax packages, on the assumption that we don't want to - * instrument these. + * instrument these. After JDK9 we also need to delegate jdk.internal.reflect + * to the parent class loader. * * We also exclude classes from the JUnit and EasyMock test frameworks, from * Objenesis, and from org.w3c.dom, on the grounds that we are not likely to @@ -55,7 +56,7 @@ public final class InstrumentedClassLoader extends ClassLoader { * callers specify this. */ private static final List excludedClassPrefixes = - Arrays.asList("java.", "javax.", "sun.", "net.sf.cglib", "junit.", + Arrays.asList("java.", "javax.", "sun.", "jdk.internal.reflect", "net.sf.cglib", "junit.", "org.junit.", "org.objenesis.", "org.easymock.", "org.w3c.dom", "org.jdom"); /**