mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 22:08:16 -05:00
92af4ea17f
* gnu/packages/java.scm (java-powermock-reflect): Update to 2.0.9. [source]: Use git source. (java-powermock-reflect, java-powermock-core, java-powermock-api-support) (java-powermock-junit4-common, java-powermock-junit4) (java-powermock-api-easymock): Update inputs and use new style. * gnu/packages/patches/java-powermock-fix-java-files.patch: Update patch. Change-Id: I856e5f923b094b9fcfa78f5f1d6ca2e4c2af41a7
298 lines
16 KiB
Diff
298 lines
16 KiB
Diff
This patch fixes build issues caused by the java compiler not finding the
|
|
correct types on some statements.
|
|
|
|
From 10ce6e0e30bbaf22212abc77f5d644c074df6068 Mon Sep 17 00:00:00 2001
|
|
From: Julien Lepiller <julien@lepiller.eu>
|
|
Date: Sat, 25 Feb 2023 18:00:13 +0100
|
|
Subject: [PATCH] Fix java files.
|
|
|
|
---
|
|
.../ConditionalStateStackManipulation.java | 6 ++--
|
|
.../org/powermock/core/bytebuddy/Frame.java | 2 +-
|
|
.../core/bytebuddy/MaxLocalsExtractor.java | 6 ++--
|
|
.../core/bytebuddy/MockGetawayCall.java | 2 +-
|
|
.../core/bytebuddy/PrimitiveBoxing.java | 4 +--
|
|
.../agent/DefinalizingClassTransformer.java | 4 +--
|
|
.../agent/DefinalizingClassVisitor.java | 6 ++--
|
|
.../impl/DelegatingPowerMockRunner.java | 13 +++++---
|
|
.../org/powermock/reflect/WhiteBoxTest.java | 32 +++++++++----------
|
|
.../reflect/internal/proxy/ClassFactory.java | 6 ++--
|
|
10 files changed, 43 insertions(+), 38 deletions(-)
|
|
|
|
diff --git a/powermock-core/src/main/java/org/powermock/core/bytebuddy/ConditionalStateStackManipulation.java b/powermock-core/src/main/java/org/powermock/core/bytebuddy/ConditionalStateStackManipulation.java
|
|
index fa23a3f..1fa4b94 100644
|
|
--- a/powermock-core/src/main/java/org/powermock/core/bytebuddy/ConditionalStateStackManipulation.java
|
|
+++ b/powermock-core/src/main/java/org/powermock/core/bytebuddy/ConditionalStateStackManipulation.java
|
|
@@ -20,9 +20,9 @@ package org.powermock.core.bytebuddy;
|
|
|
|
import net.bytebuddy.implementation.Implementation.Context;
|
|
import net.bytebuddy.implementation.bytecode.StackManipulation;
|
|
-import net.bytebuddy.jar.asm.Label;
|
|
-import net.bytebuddy.jar.asm.MethodVisitor;
|
|
-import net.bytebuddy.jar.asm.Opcodes;
|
|
+import org.objectweb.asm.Label;
|
|
+import org.objectweb.asm.MethodVisitor;
|
|
+import org.objectweb.asm.Opcodes;
|
|
|
|
public class ConditionalStateStackManipulation implements StackManipulation {
|
|
|
|
diff --git a/powermock-core/src/main/java/org/powermock/core/bytebuddy/Frame.java b/powermock-core/src/main/java/org/powermock/core/bytebuddy/Frame.java
|
|
index 8ada262..adfc218 100644
|
|
--- a/powermock-core/src/main/java/org/powermock/core/bytebuddy/Frame.java
|
|
+++ b/powermock-core/src/main/java/org/powermock/core/bytebuddy/Frame.java
|
|
@@ -24,7 +24,7 @@ import net.bytebuddy.description.method.ParameterDescription.InDefinedShape;
|
|
import net.bytebuddy.description.method.ParameterList;
|
|
import net.bytebuddy.description.type.TypeDescription.Generic;
|
|
import net.bytebuddy.implementation.bytecode.StackSize;
|
|
-import net.bytebuddy.jar.asm.Opcodes;
|
|
+import org.objectweb.asm.Opcodes;
|
|
import net.bytebuddy.utility.CompoundList;
|
|
|
|
import java.util.ArrayList;
|
|
diff --git a/powermock-core/src/main/java/org/powermock/core/bytebuddy/MaxLocalsExtractor.java b/powermock-core/src/main/java/org/powermock/core/bytebuddy/MaxLocalsExtractor.java
|
|
index 6b5cddd..8fe1936 100644
|
|
--- a/powermock-core/src/main/java/org/powermock/core/bytebuddy/MaxLocalsExtractor.java
|
|
+++ b/powermock-core/src/main/java/org/powermock/core/bytebuddy/MaxLocalsExtractor.java
|
|
@@ -19,9 +19,9 @@
|
|
package org.powermock.core.bytebuddy;
|
|
|
|
import net.bytebuddy.description.method.MethodDescription;
|
|
-import net.bytebuddy.jar.asm.ClassVisitor;
|
|
-import net.bytebuddy.jar.asm.MethodVisitor;
|
|
-import net.bytebuddy.jar.asm.Opcodes;
|
|
+import org.objectweb.asm.ClassVisitor;
|
|
+import org.objectweb.asm.MethodVisitor;
|
|
+import org.objectweb.asm.Opcodes;
|
|
|
|
public class MaxLocalsExtractor extends ClassVisitor {
|
|
|
|
diff --git a/powermock-core/src/main/java/org/powermock/core/bytebuddy/MockGetawayCall.java b/powermock-core/src/main/java/org/powermock/core/bytebuddy/MockGetawayCall.java
|
|
index db84196..84942f8 100644
|
|
--- a/powermock-core/src/main/java/org/powermock/core/bytebuddy/MockGetawayCall.java
|
|
+++ b/powermock-core/src/main/java/org/powermock/core/bytebuddy/MockGetawayCall.java
|
|
@@ -27,7 +27,7 @@ import net.bytebuddy.implementation.bytecode.StackManipulation;
|
|
import net.bytebuddy.implementation.bytecode.collection.ArrayFactory;
|
|
import net.bytebuddy.implementation.bytecode.constant.ClassConstant;
|
|
import net.bytebuddy.implementation.bytecode.member.MethodInvocation;
|
|
-import net.bytebuddy.jar.asm.MethodVisitor;
|
|
+import org.objectweb.asm.MethodVisitor;
|
|
import org.powermock.core.bytebuddy.Variable.VariableAccess;
|
|
import org.powermock.reflect.internal.WhiteboxImpl;
|
|
|
|
diff --git a/powermock-core/src/main/java/org/powermock/core/bytebuddy/PrimitiveBoxing.java b/powermock-core/src/main/java/org/powermock/core/bytebuddy/PrimitiveBoxing.java
|
|
index e200b22..ae1036b 100644
|
|
--- a/powermock-core/src/main/java/org/powermock/core/bytebuddy/PrimitiveBoxing.java
|
|
+++ b/powermock-core/src/main/java/org/powermock/core/bytebuddy/PrimitiveBoxing.java
|
|
@@ -24,8 +24,8 @@ import net.bytebuddy.description.type.TypeDescription.ForLoadedType;
|
|
import net.bytebuddy.implementation.Implementation;
|
|
import net.bytebuddy.implementation.bytecode.StackManipulation;
|
|
import net.bytebuddy.implementation.bytecode.StackSize;
|
|
-import net.bytebuddy.jar.asm.MethodVisitor;
|
|
-import net.bytebuddy.jar.asm.Opcodes;
|
|
+import org.objectweb.asm.MethodVisitor;
|
|
+import org.objectweb.asm.Opcodes;
|
|
|
|
public enum PrimitiveBoxing implements StackManipulation{
|
|
|
|
diff --git a/powermock-modules/powermock-module-javaagent/src/main/java/org/powermock/modules/agent/DefinalizingClassTransformer.java b/powermock-modules/powermock-module-javaagent/src/main/java/org/powermock/modules/agent/DefinalizingClassTransformer.java
|
|
index e8eef7a..01d0bcb 100644
|
|
--- a/powermock-modules/powermock-module-javaagent/src/main/java/org/powermock/modules/agent/DefinalizingClassTransformer.java
|
|
+++ b/powermock-modules/powermock-module-javaagent/src/main/java/org/powermock/modules/agent/DefinalizingClassTransformer.java
|
|
@@ -16,8 +16,8 @@
|
|
|
|
package org.powermock.modules.agent;
|
|
|
|
-import net.bytebuddy.jar.asm.ClassReader;
|
|
-import net.bytebuddy.jar.asm.ClassWriter;
|
|
+import org.objectweb.asm.ClassReader;
|
|
+import org.objectweb.asm.ClassWriter;
|
|
|
|
import java.lang.instrument.ClassFileTransformer;
|
|
import java.security.ProtectionDomain;
|
|
diff --git a/powermock-modules/powermock-module-javaagent/src/main/java/org/powermock/modules/agent/DefinalizingClassVisitor.java b/powermock-modules/powermock-module-javaagent/src/main/java/org/powermock/modules/agent/DefinalizingClassVisitor.java
|
|
index 3bb80c3..9aada60 100644
|
|
--- a/powermock-modules/powermock-module-javaagent/src/main/java/org/powermock/modules/agent/DefinalizingClassVisitor.java
|
|
+++ b/powermock-modules/powermock-module-javaagent/src/main/java/org/powermock/modules/agent/DefinalizingClassVisitor.java
|
|
@@ -1,8 +1,8 @@
|
|
package org.powermock.modules.agent;
|
|
|
|
-import net.bytebuddy.jar.asm.ClassVisitor;
|
|
-import net.bytebuddy.jar.asm.MethodVisitor;
|
|
-import net.bytebuddy.jar.asm.Opcodes;
|
|
+import org.objectweb.asm.ClassVisitor;
|
|
+import org.objectweb.asm.MethodVisitor;
|
|
+import org.objectweb.asm.Opcodes;
|
|
|
|
class DefinalizingClassVisitor extends ClassVisitor {
|
|
|
|
diff --git a/powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/internal/impl/DelegatingPowerMockRunner.java b/powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/internal/impl/DelegatingPowerMockRunner.java
|
|
index 301f854..caecbbd 100644
|
|
--- a/powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/internal/impl/DelegatingPowerMockRunner.java
|
|
+++ b/powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/internal/impl/DelegatingPowerMockRunner.java
|
|
@@ -98,12 +98,17 @@ implements PowerMockJUnitRunnerDelegate, Filterable {
|
|
@Override
|
|
public Runner call() throws Exception {
|
|
try {
|
|
- return Whitebox.invokeConstructor(
|
|
- testClass.isAnnotationPresent(PowerMockRunnerDelegate.class)
|
|
- ? testClass.getAnnotation(PowerMockRunnerDelegate.class).value()
|
|
- : PowerMockRunnerDelegate.DefaultJUnitRunner.class,
|
|
+ if(testClass.isAnnotationPresent(PowerMockRunnerDelegate.class)) {
|
|
+ return Whitebox.invokeConstructor(
|
|
+ testClass.getAnnotation(PowerMockRunnerDelegate.class).value(),
|
|
new Class[] {Class.class},
|
|
new Object[] {testClass});
|
|
+ } else {
|
|
+ return Whitebox.invokeConstructor(
|
|
+ PowerMockRunnerDelegate.DefaultJUnitRunner.class,
|
|
+ new Class[] {Class.class},
|
|
+ new Object[] {testClass});
|
|
+ }
|
|
} catch (ConstructorNotFoundException rootProblem) {
|
|
if (testClass.isAnnotationPresent(PowerMockRunnerDelegate.class)
|
|
&& JUnitVersion.isGreaterThanOrEqualTo("4.5")) {
|
|
diff --git a/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java b/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java
|
|
index acb3154..8c24fbc 100644
|
|
--- a/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java
|
|
+++ b/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java
|
|
@@ -248,7 +248,7 @@ public class WhiteBoxTest {
|
|
|
|
@Test
|
|
public void testMethodWithPrimitiveAndWrappedInt_primtive_wrapped() throws Exception {
|
|
- assertEquals(17, Whitebox.invokeMethod(new ClassWithPrivateMethods(), "methodWithPrimitiveAndWrappedInt",
|
|
+ assertEquals(17, (int) Whitebox.invokeMethod(new ClassWithPrivateMethods(), "methodWithPrimitiveAndWrappedInt",
|
|
new Class[]{int.class, Integer.class}, 9, Integer.valueOf(8)));
|
|
}
|
|
|
|
@@ -257,13 +257,13 @@ public class WhiteBoxTest {
|
|
int expected = 123;
|
|
Whitebox.setInternalState(ClassWithInternalState.class, "staticState", expected);
|
|
assertEquals(expected, ClassWithInternalState.getStaticState());
|
|
- assertEquals(expected, Whitebox.getInternalState(ClassWithInternalState.class, "staticState"));
|
|
+ assertEquals(expected, (int) Whitebox.getInternalState(ClassWithInternalState.class, "staticState"));
|
|
}
|
|
|
|
@Test
|
|
public void testStaticFinalPrimitiveState() {
|
|
Whitebox.setInternalState(ClassWithInternalState.class, "staticFinalIntState", 123);
|
|
- assertEquals(123, Whitebox.getInternalState(ClassWithInternalState.class, "staticFinalIntState"));
|
|
+ assertEquals(123, (int) Whitebox.getInternalState(ClassWithInternalState.class, "staticFinalIntState"));
|
|
}
|
|
|
|
@Test
|
|
@@ -330,25 +330,25 @@ public class WhiteBoxTest {
|
|
@Test
|
|
public void testInvokeVarArgsMethod_multipleValues() throws Exception {
|
|
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
|
|
- assertEquals(6, Whitebox.invokeMethod(tested, "varArgsMethod", 1, 2, 3));
|
|
+ assertEquals(6, (int) Whitebox.invokeMethod(tested, "varArgsMethod", 1, 2, 3));
|
|
}
|
|
|
|
@Test
|
|
public void testInvokeVarArgsMethod_noArguments() throws Exception {
|
|
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
|
|
- assertEquals(0, Whitebox.invokeMethod(tested, "varArgsMethod"));
|
|
+ assertEquals(0, (int) Whitebox.invokeMethod(tested, "varArgsMethod"));
|
|
}
|
|
|
|
@Test
|
|
public void testInvokeVarArgsMethod_oneArgument() throws Exception {
|
|
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
|
|
- assertEquals(4, Whitebox.invokeMethod(tested, "varArgsMethod", 2));
|
|
+ assertEquals(4, (int) Whitebox.invokeMethod(tested, "varArgsMethod", 2));
|
|
}
|
|
|
|
@Test
|
|
public void testInvokeVarArgsMethod_invokeVarArgsWithOneArgument() throws Exception {
|
|
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
|
|
- assertEquals(1, Whitebox.invokeMethod(tested, "varArgsMethod", new Class<?>[]{int[].class}, 1));
|
|
+ assertEquals(1, (int) Whitebox.invokeMethod(tested, "varArgsMethod", new Class<?>[]{int[].class}, 1));
|
|
}
|
|
|
|
@Test
|
|
@@ -372,7 +372,7 @@ public class WhiteBoxTest {
|
|
ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
|
|
};
|
|
Whitebox.setInternalState(tested, fieldName, value);
|
|
- assertEquals(value, Whitebox.getInternalState(tested, fieldName));
|
|
+ assertEquals(value, (int) Whitebox.getInternalState(tested, fieldName));
|
|
}
|
|
|
|
@Test
|
|
@@ -383,8 +383,8 @@ public class WhiteBoxTest {
|
|
ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
|
|
};
|
|
Whitebox.setInternalState(tested, fieldName, value);
|
|
- assertEquals(value, Whitebox.getInternalState(tested, fieldName));
|
|
- assertEquals(-1, Whitebox.getInternalState(tested, fieldName, ClassWithInternalState.class));
|
|
+ assertEquals(value, (int) Whitebox.getInternalState(tested, fieldName));
|
|
+ assertEquals(-1, (int) Whitebox.getInternalState(tested, fieldName, ClassWithInternalState.class));
|
|
}
|
|
|
|
@Test(expected = IllegalArgumentException.class)
|
|
@@ -394,7 +394,7 @@ public class WhiteBoxTest {
|
|
ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
|
|
};
|
|
Whitebox.setInternalState(tested, fieldName, new Object());
|
|
- assertEquals(value, Whitebox.getInternalState(tested, fieldName));
|
|
+ assertEquals(value, (int) Whitebox.getInternalState(tested, fieldName));
|
|
}
|
|
|
|
@Test(expected = IllegalArgumentException.class)
|
|
@@ -404,7 +404,7 @@ public class WhiteBoxTest {
|
|
ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
|
|
};
|
|
Whitebox.setInternalState(tested, fieldName, (Object) null);
|
|
- assertEquals(value, Whitebox.getInternalState(tested, fieldName));
|
|
+ assertEquals(value, (int) Whitebox.getInternalState(tested, fieldName));
|
|
}
|
|
|
|
@Test
|
|
@@ -413,8 +413,8 @@ public class WhiteBoxTest {
|
|
ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState();
|
|
Whitebox.setInternalState(tested, int.class, value);
|
|
assertEquals(value, (int) Whitebox.getInternalState(tested, int.class));
|
|
- assertEquals(value, Whitebox.getInternalState(tested, "anotherInternalState"));
|
|
- assertEquals(value, Whitebox.getInternalState(tested, "anotherInternalState",
|
|
+ assertEquals(value, (int) Whitebox.getInternalState(tested, "anotherInternalState"));
|
|
+ assertEquals(value, (int) Whitebox.getInternalState(tested, "anotherInternalState",
|
|
ClassWithChildThatHasInternalState.class));
|
|
}
|
|
|
|
@@ -425,7 +425,7 @@ public class WhiteBoxTest {
|
|
Whitebox.setInternalState(tested, int.class, value, ClassWithInternalState.class);
|
|
assertEquals(42, (int) Whitebox.getInternalState(tested, int.class));
|
|
assertEquals(value, (int) Whitebox.getInternalState(tested, int.class, ClassWithInternalState.class));
|
|
- assertEquals(value, Whitebox.getInternalState(tested, "staticState", ClassWithInternalState.class));
|
|
+ assertEquals(value, (int) Whitebox.getInternalState(tested, "staticState", ClassWithInternalState.class));
|
|
}
|
|
|
|
@Test
|
|
@@ -621,7 +621,7 @@ public class WhiteBoxTest {
|
|
@Test
|
|
public void testInvokeMethodWithBothNormalAndVarArgsParameter() throws Exception {
|
|
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
|
|
- assertEquals(4, Whitebox.invokeMethod(tested, "varArgsMethod2", 1, 2, 3));
|
|
+ assertEquals(4, (int) Whitebox.invokeMethod(tested, "varArgsMethod2", 1, 2, 3));
|
|
}
|
|
|
|
@Test
|
|
diff --git a/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java b/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java
|
|
index 03db992..828bfe0 100644
|
|
--- a/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java
|
|
+++ b/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java
|
|
@@ -1,8 +1,8 @@
|
|
package org.powermock.reflect.internal.proxy;
|
|
|
|
-import net.bytebuddy.jar.asm.ClassWriter;
|
|
-import net.bytebuddy.jar.asm.MethodVisitor;
|
|
-import net.bytebuddy.jar.asm.Opcodes;
|
|
+import org.objectweb.asm.ClassWriter;
|
|
+import org.objectweb.asm.MethodVisitor;
|
|
+import org.objectweb.asm.Opcodes;
|
|
|
|
class ClassFactory implements Opcodes {
|
|
|
|
--
|
|
2.38.1
|
|
|