Skip to content

Commit

Permalink
Apply MR jmockit#665
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrefischerorx committed Nov 6, 2024
1 parent 5c6a2df commit ac0ac34
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 41 deletions.
158 changes: 119 additions & 39 deletions main/pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0" 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">
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jmockit</groupId><artifactId>jmockit</artifactId><version>1.49</version>
<groupId>org.jmockit</groupId>
<artifactId>jmockit.ts</artifactId>
<version>1.49.1</version>
<packaging>jar</packaging>

<parent>
<groupId>orchestra</groupId>
<artifactId>maven-distribution-management</artifactId>
<version>0.7</version>
</parent>

<name>JMockit</name>
<description>
JMockit is a Java toolkit for automated developer testing.
Expand All @@ -22,7 +29,9 @@
</license>
</licenses>
<developers>
<developer><name>Rogério Liesenfeld</name></developer>
<developer>
<name>Rogério Liesenfeld</name>
</developer>
</developers>
<inceptionYear>2006</inceptionYear>
<scm>
Expand Down Expand Up @@ -66,16 +75,21 @@
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId><version>3.8.0</version>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.7</source><target>1.7</target>
<compilerArgs><arg>-Xlint:none</arg></compilerArgs>
<source>1.7</source>
<target>1.7</target>
<compilerArgs>
<arg>-Xlint:none</arg>
</compilerArgs>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId><version>3.1.0</version>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
Expand All @@ -91,7 +105,8 @@
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId><version>3.0.1</version>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
Expand All @@ -107,12 +122,15 @@
<executions>
<execution>
<id>attach-sources</id>
<goals><goal>jar-no-fork</goal></goals>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId><version>3.0.1</version>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<encoding>UTF-8</encoding>
<nodeprecated>true</nodeprecated>
Expand All @@ -139,38 +157,65 @@
<executions>
<execution>
<id>attach-javadocs</id>
<goals><goal>jar</goal></goals>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId><version>2.22.2</version>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<disableXmlReport>true</disableXmlReport>
<runOrder>alphabetical</runOrder>
<argLine>@{argLine} -javaagent:../agent.jar</argLine>
<properties><property><name>junit</name><value>false</value></property></properties>
<excludes><exclude>**/TestNGViolatedExpectationsTest.class</exclude></excludes>
<properties>
<property>
<name>junit</name>
<value>false</value>
</property>
</properties>
<excludes>
<exclude>**/TestNGViolatedExpectationsTest.class</exclude>
</excludes>
<threadCount>1</threadCount>
<forkCount>1C</forkCount>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId><artifactId>surefire-junit47</artifactId><version>2.22.2</version>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId><artifactId>surefire-testng</artifactId><version>2.22.2</version>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.22.2</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId><artifactId>jacoco-maven-plugin</artifactId><version>0.8.4</version>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<executions>
<execution><id>default-prepare-agent</id><goals><goal>prepare-agent</goal></goals></execution>
<execution><id>default-report</id><goals><goal>report</goal></goals><phase>test</phase></execution>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<!--<plugin>
<artifactId>maven-gpg-plugin</artifactId><version>1.6</version>
<executions>
<execution>
Expand All @@ -179,58 +224,93 @@
<goals><goal>sign</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
</plugin>-->
<!--<plugin>
<groupId>org.sonatype.plugins</groupId><artifactId>nexus-staging-maven-plugin</artifactId><version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugin>-->
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId><artifactId>spotbugs-annotations</artifactId><version>4.0.0</version>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId><artifactId>junit</artifactId><version>4.13</version>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter-engine</artifactId><version>5.6.0</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.0</version>
<optional>true</optional>
<exclusions>
<exclusion><groupId>org.apiguardian</groupId><artifactId>apiguardian-api</artifactId></exclusion>
<exclusion><groupId>org.opentest4j</groupId><artifactId>opentest4j</artifactId></exclusion>
<exclusion><groupId>org.junit.platform</groupId><artifactId>junit-platform-engine</artifactId></exclusion>
<exclusion><groupId>org.junit.platform</groupId><artifactId>junit-platform-commons</artifactId></exclusion>
<exclusion>
<groupId>org.apiguardian</groupId>
<artifactId>apiguardian-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.opentest4j</groupId>
<artifactId>opentest4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
</exclusion>
<exclusion>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testng</groupId><artifactId>testng</artifactId><version>7.1.0</version>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax</groupId><artifactId>javaee-api</artifactId><version>7.0</version>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<optional>true</optional>
<exclusions>
<exclusion><groupId>com.sun.mail</groupId><artifactId>javax.mail</artifactId></exclusion>
<exclusion>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>5.2.4.RELEASE</version>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.4.RELEASE</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>5.2.4.RELEASE</version>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.4.RELEASE</version>
<optional>true</optional>
<exclusions>
<exclusion><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId></exclusion>
<exclusion><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId></exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
Expand Down
5 changes: 4 additions & 1 deletion main/src/mockit/asm/constantPool/ConstantPoolGeneration.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ public Item newConstItem(@Nonnull Object cst) {
if (cst instanceof MethodHandle) {
return newMethodHandleItem((MethodHandle) cst);
}

if(cst instanceof DynamicItem) {
DynamicItem dI = (DynamicItem)cst;
return createDynamicItem(dI.type, dI.name, dI.desc, dI.bsmIndex);
}
throw new IllegalArgumentException("value " + cst);
}

Expand Down
2 changes: 1 addition & 1 deletion main/src/mockit/asm/constantPool/DynamicItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public final class DynamicItem extends TypeOrMemberItem
{
@Nonnegative private int bsmIndex;
@Nonnegative int bsmIndex;

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

Expand Down
11 changes: 11 additions & 0 deletions main/src/mockit/asm/util/BytecodeReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import javax.annotation.*;

import mockit.asm.constantPool.DynamicItem;
import mockit.asm.jvmConstants.ConstantPoolTypes;
import mockit.asm.types.*;
import static mockit.asm.jvmConstants.ConstantPoolTypes.*;

Expand Down Expand Up @@ -394,6 +396,15 @@ protected final Object readConst(@Nonnegative int itemIndex) {
case MTYPE:
String methodDesc = readNonnullUTF8(constCodeIndex);
return MethodType.create(methodDesc);
case CONDY: {
int bsmStartIndex = readUnsignedShort(constCodeIndex);
int nameIndex = readItem(constCodeIndex + 2);
String name = readNonnullUTF8(nameIndex);
String desc = readNonnullUTF8(nameIndex + 2);
DynamicItem dynamicItem = new DynamicItem(itemIndex);
dynamicItem.set(ConstantPoolTypes.CONDY, name, desc, bsmStartIndex);
return dynamicItem;
}
// case HANDLE_BASE + [1..9]:
default:
return readMethodHandle(constCodeIndex);
Expand Down

0 comments on commit ac0ac34

Please sign in to comment.