gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / java-powermock-fix-java-files.patch
CommitLineData
8d6a4815
JL
1This patch fixes build issues caused by the java compiler not finding the
2correct types on some statements.
3
4From 1ac84b58b4383fa118d98c35956d722d11cf449e Mon Sep 17 00:00:00 2001
5From: Julien Lepiller <julien@lepiller.eu>
6Date: Tue, 22 Aug 2017 20:40:27 +0200
7Subject: [PATCH] Fix java files.
8
9---
10 .../internal/impl/DelegatingPowerMockRunner.java | 13 +++++++---
11 .../java/org/powermock/reflect/WhiteBoxTest.java | 30 +++++++++++-----------
12 .../reflect/internal/proxy/ClassFactory.java | 6 ++---
13 3 files changed, 27 insertions(+), 22 deletions(-)
14
15diff --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
16index 301f854..caecbbd 100644
17--- a/powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/internal/impl/DelegatingPowerMockRunner.java
18+++ b/powermock-modules/powermock-module-junit4/src/main/java/org/powermock/modules/junit4/internal/impl/DelegatingPowerMockRunner.java
19@@ -98,12 +98,17 @@ implements PowerMockJUnitRunnerDelegate, Filterable {
20 @Override
21 public Runner call() throws Exception {
22 try {
23- return Whitebox.invokeConstructor(
24- testClass.isAnnotationPresent(PowerMockRunnerDelegate.class)
25- ? testClass.getAnnotation(PowerMockRunnerDelegate.class).value()
26- : PowerMockRunnerDelegate.DefaultJUnitRunner.class,
27+ if(testClass.isAnnotationPresent(PowerMockRunnerDelegate.class)) {
28+ return Whitebox.invokeConstructor(
29+ testClass.getAnnotation(PowerMockRunnerDelegate.class).value(),
30 new Class[] {Class.class},
31 new Object[] {testClass});
32+ } else {
33+ return Whitebox.invokeConstructor(
34+ PowerMockRunnerDelegate.DefaultJUnitRunner.class,
35+ new Class[] {Class.class},
36+ new Object[] {testClass});
37+ }
38 } catch (ConstructorNotFoundException rootProblem) {
39 if (testClass.isAnnotationPresent(PowerMockRunnerDelegate.class)
40 && JUnitVersion.isGreaterThanOrEqualTo("4.5")) {
41diff --git a/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java b/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java
42index bf1e2e3..0d60487 100644
43--- a/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java
44+++ b/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java
45@@ -248,7 +248,7 @@ public class WhiteBoxTest {
46
47 @Test
48 public void testMethodWithPrimitiveAndWrappedInt_primtive_wrapped() throws Exception {
49- assertEquals(17, Whitebox.invokeMethod(new ClassWithPrivateMethods(), "methodWithPrimitiveAndWrappedInt",
50+ assertEquals((Integer)17, Whitebox.invokeMethod(new ClassWithPrivateMethods(), "methodWithPrimitiveAndWrappedInt",
51 new Class[]{int.class, Integer.class}, 9, Integer.valueOf(8)));
52 }
53
54@@ -257,7 +257,7 @@ public class WhiteBoxTest {
55 int expected = 123;
56 Whitebox.setInternalState(ClassWithInternalState.class, "staticState", expected);
57 assertEquals(expected, ClassWithInternalState.getStaticState());
58- assertEquals(expected, Whitebox.getInternalState(ClassWithInternalState.class, "staticState"));
59+ assertEquals(expected, (int)Whitebox.getInternalState(ClassWithInternalState.class, "staticState"));
60 }
61
62 @Test
63@@ -334,25 +334,25 @@ public class WhiteBoxTest {
64 @Test
65 public void testInvokeVarArgsMethod_multipleValues() throws Exception {
66 ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
67- assertEquals(6, Whitebox.invokeMethod(tested, "varArgsMethod", 1, 2, 3));
68+ assertEquals(6, (int)Whitebox.invokeMethod(tested, "varArgsMethod", 1, 2, 3));
69 }
70
71 @Test
72 public void testInvokeVarArgsMethod_noArguments() throws Exception {
73 ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
74- assertEquals(0, Whitebox.invokeMethod(tested, "varArgsMethod"));
75+ assertEquals(0, (int)Whitebox.invokeMethod(tested, "varArgsMethod"));
76 }
77
78 @Test
79 public void testInvokeVarArgsMethod_oneArgument() throws Exception {
80 ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
81- assertEquals(4, Whitebox.invokeMethod(tested, "varArgsMethod", 2));
82+ assertEquals(4, (int)Whitebox.invokeMethod(tested, "varArgsMethod", 2));
83 }
84
85 @Test
86 public void testInvokeVarArgsMethod_invokeVarArgsWithOneArgument() throws Exception {
87 ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
88- assertEquals(1, Whitebox.invokeMethod(tested, "varArgsMethod", new Class<?>[]{int[].class}, 1));
89+ assertEquals(1, (int)Whitebox.invokeMethod(tested, "varArgsMethod", new Class<?>[]{int[].class}, 1));
90 }
91
92 @Test
93@@ -376,7 +376,7 @@ public class WhiteBoxTest {
94 ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
95 };
96 Whitebox.setInternalState(tested, fieldName, value);
97- assertEquals(value, Whitebox.getInternalState(tested, fieldName));
98+ assertEquals(value, (int)Whitebox.getInternalState(tested, fieldName));
99 }
100
101 @Test
102@@ -387,8 +387,8 @@ public class WhiteBoxTest {
103 ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
104 };
105 Whitebox.setInternalState(tested, fieldName, value);
106- assertEquals(value, Whitebox.getInternalState(tested, fieldName));
107- assertEquals(-1, Whitebox.getInternalState(tested, fieldName, ClassWithInternalState.class));
108+ assertEquals(value, (int)Whitebox.getInternalState(tested, fieldName));
109+ assertEquals(-1, (int)Whitebox.getInternalState(tested, fieldName, ClassWithInternalState.class));
110 }
111
112 @Test(expected = IllegalArgumentException.class)
113@@ -398,7 +398,7 @@ public class WhiteBoxTest {
114 ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
115 };
116 Whitebox.setInternalState(tested, fieldName, new Object());
117- assertEquals(value, Whitebox.getInternalState(tested, fieldName));
118+ assertEquals(value, (int)Whitebox.getInternalState(tested, fieldName));
119 }
120
121 @Test(expected = IllegalArgumentException.class)
122@@ -408,7 +408,7 @@ public class WhiteBoxTest {
123 ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
124 };
125 Whitebox.setInternalState(tested, fieldName, (Object) null);
126- assertEquals(value, Whitebox.getInternalState(tested, fieldName));
127+ assertEquals(value, (int)Whitebox.getInternalState(tested, fieldName));
128 }
129
130 @Test
131@@ -417,8 +417,8 @@ public class WhiteBoxTest {
132 ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState();
133 Whitebox.setInternalState(tested, int.class, value);
134 assertEquals(value, (int) Whitebox.getInternalState(tested, int.class));
135- assertEquals(value, Whitebox.getInternalState(tested, "anotherInternalState"));
136- assertEquals(value, Whitebox.getInternalState(tested, "anotherInternalState",
137+ assertEquals(value, (int)Whitebox.getInternalState(tested, "anotherInternalState"));
138+ assertEquals(value, (int)Whitebox.getInternalState(tested, "anotherInternalState",
139 ClassWithChildThatHasInternalState.class));
140 }
141
142@@ -429,7 +429,7 @@ public class WhiteBoxTest {
143 Whitebox.setInternalState(tested, int.class, value, ClassWithInternalState.class);
144 assertEquals(42, (int) Whitebox.getInternalState(tested, int.class));
145 assertEquals(value, (int) Whitebox.getInternalState(tested, int.class, ClassWithInternalState.class));
146- assertEquals(value, Whitebox.getInternalState(tested, "staticState", ClassWithInternalState.class));
147+ assertEquals(value, (int)Whitebox.getInternalState(tested, "staticState", ClassWithInternalState.class));
148 }
149
150 @Test
151@@ -619,7 +619,7 @@ public class WhiteBoxTest {
152 @Test
153 public void testInvokeMethodWithBothNormalAndVarArgsParameter() throws Exception {
154 ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
155- assertEquals(4, Whitebox.invokeMethod(tested, "varArgsMethod2", 1, 2, 3));
156+ assertEquals(4, (int)Whitebox.invokeMethod(tested, "varArgsMethod2", 1, 2, 3));
157 }
158
159 @Test
160diff --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
161index a5e5fda..14b8bbe 100644
162--- a/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java
163+++ b/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java
164@@ -1,8 +1,8 @@
165 package org.powermock.reflect.internal.proxy;
166
167-import net.sf.cglib.asm.ClassWriter;
168-import net.sf.cglib.asm.MethodVisitor;
169-import net.sf.cglib.asm.Opcodes;
170+import org.objectweb.asm.ClassWriter;
171+import org.objectweb.asm.MethodVisitor;
172+import org.objectweb.asm.Opcodes;
173
174 class ClassFactory implements Opcodes {
175
176--
1772.14.1
178