Skip to content

Commit ac0ac34

Browse files
Apply MR jmockit#665
1 parent 5c6a2df commit ac0ac34

File tree

4 files changed

+135
-41
lines changed

4 files changed

+135
-41
lines changed

main/pom.xml

+119-39
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project
3-
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
54
<modelVersion>4.0.0</modelVersion>
65

7-
<groupId>org.jmockit</groupId><artifactId>jmockit</artifactId><version>1.49</version>
6+
<groupId>org.jmockit</groupId>
7+
<artifactId>jmockit.ts</artifactId>
8+
<version>1.49.1</version>
89
<packaging>jar</packaging>
910

11+
<parent>
12+
<groupId>orchestra</groupId>
13+
<artifactId>maven-distribution-management</artifactId>
14+
<version>0.7</version>
15+
</parent>
16+
1017
<name>JMockit</name>
1118
<description>
1219
JMockit is a Java toolkit for automated developer testing.
@@ -22,7 +29,9 @@
2229
</license>
2330
</licenses>
2431
<developers>
25-
<developer><name>Rogério Liesenfeld</name></developer>
32+
<developer>
33+
<name>Rogério Liesenfeld</name>
34+
</developer>
2635
</developers>
2736
<inceptionYear>2006</inceptionYear>
2837
<scm>
@@ -66,16 +75,21 @@
6675
</resources>
6776
<plugins>
6877
<plugin>
69-
<artifactId>maven-compiler-plugin</artifactId><version>3.8.0</version>
78+
<artifactId>maven-compiler-plugin</artifactId>
79+
<version>3.8.0</version>
7080
<configuration>
7181
<encoding>UTF-8</encoding>
72-
<source>1.7</source><target>1.7</target>
73-
<compilerArgs><arg>-Xlint:none</arg></compilerArgs>
82+
<source>1.7</source>
83+
<target>1.7</target>
84+
<compilerArgs>
85+
<arg>-Xlint:none</arg>
86+
</compilerArgs>
7487
<useIncrementalCompilation>false</useIncrementalCompilation>
7588
</configuration>
7689
</plugin>
7790
<plugin>
78-
<artifactId>maven-jar-plugin</artifactId><version>3.1.0</version>
91+
<artifactId>maven-jar-plugin</artifactId>
92+
<version>3.1.0</version>
7993
<configuration>
8094
<archive>
8195
<addMavenDescriptor>false</addMavenDescriptor>
@@ -91,7 +105,8 @@
91105
</configuration>
92106
</plugin>
93107
<plugin>
94-
<artifactId>maven-source-plugin</artifactId><version>3.0.1</version>
108+
<artifactId>maven-source-plugin</artifactId>
109+
<version>3.0.1</version>
95110
<configuration>
96111
<archive>
97112
<addMavenDescriptor>false</addMavenDescriptor>
@@ -107,12 +122,15 @@
107122
<executions>
108123
<execution>
109124
<id>attach-sources</id>
110-
<goals><goal>jar-no-fork</goal></goals>
125+
<goals>
126+
<goal>jar-no-fork</goal>
127+
</goals>
111128
</execution>
112129
</executions>
113130
</plugin>
114131
<plugin>
115-
<artifactId>maven-javadoc-plugin</artifactId><version>3.0.1</version>
132+
<artifactId>maven-javadoc-plugin</artifactId>
133+
<version>3.0.1</version>
116134
<configuration>
117135
<encoding>UTF-8</encoding>
118136
<nodeprecated>true</nodeprecated>
@@ -139,38 +157,65 @@
139157
<executions>
140158
<execution>
141159
<id>attach-javadocs</id>
142-
<goals><goal>jar</goal></goals>
160+
<goals>
161+
<goal>jar</goal>
162+
</goals>
143163
</execution>
144164
</executions>
145165
</plugin>
146166
<plugin>
147-
<artifactId>maven-surefire-plugin</artifactId><version>2.22.2</version>
167+
<artifactId>maven-surefire-plugin</artifactId>
168+
<version>2.22.2</version>
148169
<configuration>
149170
<disableXmlReport>true</disableXmlReport>
150171
<runOrder>alphabetical</runOrder>
151172
<argLine>@{argLine} -javaagent:../agent.jar</argLine>
152-
<properties><property><name>junit</name><value>false</value></property></properties>
153-
<excludes><exclude>**/TestNGViolatedExpectationsTest.class</exclude></excludes>
173+
<properties>
174+
<property>
175+
<name>junit</name>
176+
<value>false</value>
177+
</property>
178+
</properties>
179+
<excludes>
180+
<exclude>**/TestNGViolatedExpectationsTest.class</exclude>
181+
</excludes>
154182
<threadCount>1</threadCount>
155183
<forkCount>1C</forkCount>
156184
</configuration>
157185
<dependencies>
158186
<dependency>
159-
<groupId>org.apache.maven.surefire</groupId><artifactId>surefire-junit47</artifactId><version>2.22.2</version>
187+
<groupId>org.apache.maven.surefire</groupId>
188+
<artifactId>surefire-junit47</artifactId>
189+
<version>2.22.2</version>
160190
</dependency>
161191
<dependency>
162-
<groupId>org.apache.maven.surefire</groupId><artifactId>surefire-testng</artifactId><version>2.22.2</version>
192+
<groupId>org.apache.maven.surefire</groupId>
193+
<artifactId>surefire-testng</artifactId>
194+
<version>2.22.2</version>
163195
</dependency>
164196
</dependencies>
165197
</plugin>
166198
<plugin>
167-
<groupId>org.jacoco</groupId><artifactId>jacoco-maven-plugin</artifactId><version>0.8.4</version>
199+
<groupId>org.jacoco</groupId>
200+
<artifactId>jacoco-maven-plugin</artifactId>
201+
<version>0.8.4</version>
168202
<executions>
169-
<execution><id>default-prepare-agent</id><goals><goal>prepare-agent</goal></goals></execution>
170-
<execution><id>default-report</id><goals><goal>report</goal></goals><phase>test</phase></execution>
203+
<execution>
204+
<id>default-prepare-agent</id>
205+
<goals>
206+
<goal>prepare-agent</goal>
207+
</goals>
208+
</execution>
209+
<execution>
210+
<id>default-report</id>
211+
<goals>
212+
<goal>report</goal>
213+
</goals>
214+
<phase>test</phase>
215+
</execution>
171216
</executions>
172217
</plugin>
173-
<plugin>
218+
<!--<plugin>
174219
<artifactId>maven-gpg-plugin</artifactId><version>1.6</version>
175220
<executions>
176221
<execution>
@@ -179,58 +224,93 @@
179224
<goals><goal>sign</goal></goals>
180225
</execution>
181226
</executions>
182-
</plugin>
183-
<plugin>
227+
</plugin>-->
228+
<!--<plugin>
184229
<groupId>org.sonatype.plugins</groupId><artifactId>nexus-staging-maven-plugin</artifactId><version>1.6.8</version>
185230
<extensions>true</extensions>
186231
<configuration>
187232
<serverId>sonatype-nexus-staging</serverId>
188233
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
189234
<autoReleaseAfterClose>true</autoReleaseAfterClose>
190235
</configuration>
191-
</plugin>
236+
</plugin>-->
192237
</plugins>
193238
</build>
194239

195240
<dependencies>
196241
<dependency>
197-
<groupId>com.github.spotbugs</groupId><artifactId>spotbugs-annotations</artifactId><version>4.0.0</version>
242+
<groupId>com.github.spotbugs</groupId>
243+
<artifactId>spotbugs-annotations</artifactId>
244+
<version>4.0.0</version>
198245
</dependency>
199246
<dependency>
200-
<groupId>junit</groupId><artifactId>junit</artifactId><version>4.13</version>
247+
<groupId>junit</groupId>
248+
<artifactId>junit</artifactId>
249+
<version>4.13</version>
201250
<optional>true</optional>
202251
</dependency>
203252
<dependency>
204-
<groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter-engine</artifactId><version>5.6.0</version>
253+
<groupId>org.junit.jupiter</groupId>
254+
<artifactId>junit-jupiter-engine</artifactId>
255+
<version>5.6.0</version>
205256
<optional>true</optional>
206257
<exclusions>
207-
<exclusion><groupId>org.apiguardian</groupId><artifactId>apiguardian-api</artifactId></exclusion>
208-
<exclusion><groupId>org.opentest4j</groupId><artifactId>opentest4j</artifactId></exclusion>
209-
<exclusion><groupId>org.junit.platform</groupId><artifactId>junit-platform-engine</artifactId></exclusion>
210-
<exclusion><groupId>org.junit.platform</groupId><artifactId>junit-platform-commons</artifactId></exclusion>
258+
<exclusion>
259+
<groupId>org.apiguardian</groupId>
260+
<artifactId>apiguardian-api</artifactId>
261+
</exclusion>
262+
<exclusion>
263+
<groupId>org.opentest4j</groupId>
264+
<artifactId>opentest4j</artifactId>
265+
</exclusion>
266+
<exclusion>
267+
<groupId>org.junit.platform</groupId>
268+
<artifactId>junit-platform-engine</artifactId>
269+
</exclusion>
270+
<exclusion>
271+
<groupId>org.junit.platform</groupId>
272+
<artifactId>junit-platform-commons</artifactId>
273+
</exclusion>
211274
</exclusions>
212275
</dependency>
213276
<dependency>
214-
<groupId>org.testng</groupId><artifactId>testng</artifactId><version>7.1.0</version>
277+
<groupId>org.testng</groupId>
278+
<artifactId>testng</artifactId>
279+
<version>7.1.0</version>
215280
<optional>true</optional>
216281
</dependency>
217282
<dependency>
218-
<groupId>javax</groupId><artifactId>javaee-api</artifactId><version>7.0</version>
283+
<groupId>javax</groupId>
284+
<artifactId>javaee-api</artifactId>
285+
<version>7.0</version>
219286
<optional>true</optional>
220287
<exclusions>
221-
<exclusion><groupId>com.sun.mail</groupId><artifactId>javax.mail</artifactId></exclusion>
288+
<exclusion>
289+
<groupId>com.sun.mail</groupId>
290+
<artifactId>javax.mail</artifactId>
291+
</exclusion>
222292
</exclusions>
223293
</dependency>
224294
<dependency>
225-
<groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>5.2.4.RELEASE</version>
295+
<groupId>org.springframework</groupId>
296+
<artifactId>spring-web</artifactId>
297+
<version>5.2.4.RELEASE</version>
226298
<optional>true</optional>
227299
</dependency>
228300
<dependency>
229-
<groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>5.2.4.RELEASE</version>
301+
<groupId>org.springframework</groupId>
302+
<artifactId>spring-context</artifactId>
303+
<version>5.2.4.RELEASE</version>
230304
<optional>true</optional>
231305
<exclusions>
232-
<exclusion><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId></exclusion>
233-
<exclusion><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId></exclusion>
306+
<exclusion>
307+
<groupId>org.springframework</groupId>
308+
<artifactId>spring-aop</artifactId>
309+
</exclusion>
310+
<exclusion>
311+
<groupId>org.springframework</groupId>
312+
<artifactId>spring-expression</artifactId>
313+
</exclusion>
234314
</exclusions>
235315
</dependency>
236316
</dependencies>

main/src/mockit/asm/constantPool/ConstantPoolGeneration.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,10 @@ public Item newConstItem(@Nonnull Object cst) {
390390
if (cst instanceof MethodHandle) {
391391
return newMethodHandleItem((MethodHandle) cst);
392392
}
393-
393+
if(cst instanceof DynamicItem) {
394+
DynamicItem dI = (DynamicItem)cst;
395+
return createDynamicItem(dI.type, dI.name, dI.desc, dI.bsmIndex);
396+
}
394397
throw new IllegalArgumentException("value " + cst);
395398
}
396399

main/src/mockit/asm/constantPool/DynamicItem.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public final class DynamicItem extends TypeOrMemberItem
88
{
9-
@Nonnegative private int bsmIndex;
9+
@Nonnegative int bsmIndex;
1010

1111
public DynamicItem(@Nonnegative int index) { super(index); }
1212

main/src/mockit/asm/util/BytecodeReader.java

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import javax.annotation.*;
44

5+
import mockit.asm.constantPool.DynamicItem;
6+
import mockit.asm.jvmConstants.ConstantPoolTypes;
57
import mockit.asm.types.*;
68
import static mockit.asm.jvmConstants.ConstantPoolTypes.*;
79

@@ -394,6 +396,15 @@ protected final Object readConst(@Nonnegative int itemIndex) {
394396
case MTYPE:
395397
String methodDesc = readNonnullUTF8(constCodeIndex);
396398
return MethodType.create(methodDesc);
399+
case CONDY: {
400+
int bsmStartIndex = readUnsignedShort(constCodeIndex);
401+
int nameIndex = readItem(constCodeIndex + 2);
402+
String name = readNonnullUTF8(nameIndex);
403+
String desc = readNonnullUTF8(nameIndex + 2);
404+
DynamicItem dynamicItem = new DynamicItem(itemIndex);
405+
dynamicItem.set(ConstantPoolTypes.CONDY, name, desc, bsmStartIndex);
406+
return dynamicItem;
407+
}
397408
// case HANDLE_BASE + [1..9]:
398409
default:
399410
return readMethodHandle(constCodeIndex);

0 commit comments

Comments
 (0)