diff --git a/main/src/mockit/internal/mockups/MockClassSetup.java b/main/src/mockit/internal/mockups/MockClassSetup.java index b9e518ee3..f9fe9cf51 100644 --- a/main/src/mockit/internal/mockups/MockClassSetup.java +++ b/main/src/mockit/internal/mockups/MockClassSetup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2014 Rogério Liesenfeld + * Copyright (c) 2006-2015 Rogério Liesenfeld * This file is subject to the terms of the MIT license (see LICENSE.txt). */ package mockit.internal.mockups; @@ -15,7 +15,6 @@ import mockit.internal.state.*; import mockit.internal.util.*; import static mockit.external.asm.ClassReader.*; -import static mockit.internal.util.Utilities.*; import org.jetbrains.annotations.*; @@ -106,10 +105,6 @@ private Set> redefineMethodsInClassHierarchy() private byte[] modifyRealClass(@NotNull Class classToModify) { if (rcReader == null) { - if (!HOTSPOT_VM && classToModify == System.class) { - return null; - } - rcReader = createClassReaderForRealClass(classToModify); } diff --git a/main/test/mockit/ReentrantMockTest.java b/main/test/mockit/ReentrantMockTest.java index a672f5c9e..e0087366a 100644 --- a/main/test/mockit/ReentrantMockTest.java +++ b/main/test/mockit/ReentrantMockTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2014 Rogério Liesenfeld + * Copyright (c) 2006-2015 Rogério Liesenfeld * This file is subject to the terms of the MIT license (see LICENSE.txt). */ package mockit; @@ -9,6 +9,8 @@ import org.junit.*; import static org.junit.Assert.*; +import static mockit.internal.util.Utilities.*; + public final class ReentrantMockTest { public static class RealClass @@ -228,24 +230,28 @@ public void reentrantMockForJREClassWhichCallsAnotherFromADifferentThread() System.setProperty("a", "1"); System.setProperty("b", "2"); - new MockUp() { - String property; + if (HOTSPOT_VM) { // causes main thread to hang up on IBM JRE + new MockUp() + { + String property; - @Mock - String getProperty(Invocation inv, String key) { return inv.proceed(); } + @Mock + String getProperty(Invocation inv, String key) { return inv.proceed(); } - @Mock - String clearProperty(final String key) throws InterruptedException - { - Thread t = new Thread() { - @Override - public void run() { property = System.getProperty(key); } - }; - t.start(); - t.join(); - return property; - } - }; + @Mock + String clearProperty(final String key) throws InterruptedException + { + Thread t = new Thread() + { + @Override + public void run() { property = System.getProperty(key); } + }; + t.start(); + t.join(); + return property; + } + }; + } assertEquals("1", System.getProperty("a")); assertEquals("2", System.clearProperty("b"));