--- powermock-powermock-1.6.5/core/src/main/java/org/powermock/core/ClassReplicaCreator.java 2016-04-30 07:22:01.000000000 +0200 +++ powermock-powermock-1.6.5/core/src/main/java/org/powermock/core/ClassReplicaCreator.java 2018-11-19 15:25:16.875884583 +0100 @@ -96,7 +95,7 @@ CtConstructor copy = CtNewConstructor.copy(ctConstructor, newClass, null); newClass.addConstructor(copy); } - return newClass.toClass(this.getClass().getClassLoader(), this.getClass().getProtectionDomain()); + return (Class)newClass.toClass(this.getClass().getClassLoader(), this.getClass().getProtectionDomain()); } catch (Exception e) { throw new RuntimeException(e); } --- powermock-powermock-1.6.5/modules/module-impl/junit4/src/main/java/org/powermock/modules/junit4/internal/impl/DelegatingPowerMockRunner.java 2022-03-23 10:33:03.950752843 +0100 +++ powermock-powermock-1.6.5/modules/module-impl/junit4/src/main/java/org/powermock/modules/junit4/internal/impl/DelegatingPowerMockRunner.java 2022-03-23 21:58:42.906207848 +0100 @@ -97,12 +98,16 @@ @Override public Runner call() throws Exception { try { + if (testClass.isAnnotationPresent(PowerMockRunnerDelegate.class)) { + return Whitebox.invokeConstructor(testClass.getAnnotation(PowerMockRunnerDelegate.class).value(), + new Class[] {Class.class}, + new Object[] {testClass}); + } else { return Whitebox.invokeConstructor( - testClass.isAnnotationPresent(PowerMockRunnerDelegate.class) - ? testClass.getAnnotation(PowerMockRunnerDelegate.class).value() - : PowerMockRunnerDelegate.DefaultJUnitRunner.class, + PowerMockRunnerDelegate.DefaultJUnitRunner.class, new Class[] {Class.class}, new Object[] {testClass}); + } } catch (ConstructorNotFoundException rootProblem) { if (testClass.isAnnotationPresent(PowerMockRunnerDelegate.class) && JUnitVersion.isGreaterThanOrEqualTo("4.5")) {