Skip to content

Commit

Permalink
Create minimal reproducer for Quarkus 32298
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Apr 5, 2023
1 parent 08f0006 commit 7faf606
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 171 deletions.
7 changes: 3 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

```
cd /tmp
git clone --branch serialization-registration https://github.com/zakkak/issue-reproducers reproducers
git clone --branch 2023-04-05-delayed-error-reporting-causing-issues https://github.com/zakkak/issue-reproducers reproducers
cd reproducers
mvn package
export JAVA_HOME=/opt/jvms/graalvm-ce-java11-21.2.0
$JAVA_HOME/bin/native-image --initialize-at-build-time \
export JAVA_HOME=/opt/jvms/graalvm-ce-java17-22.3.1
$JAVA_HOME/bin/native-image --initialize-at-build-time=. \
--no-fallback -H:+ReportExceptionStackTraces \
-jar target/reproducer-1.0-SNAPSHOT.jar
./reproducer-1.0-SNAPSHOT
```
48 changes: 10 additions & 38 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,14 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>Main</Main-Class>
<Build-Number>1.0</Build-Number>
</manifestEntries>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<artifactSet>
<excludes>
<exclude>org.graalvm.nativeimage:*</exclude>
<exclude>*:*:tar.gz:</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Expand All @@ -61,12 +33,12 @@
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>21.3.0-SNAPSHOT</version>
<version>22.3.1</version>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</artifactId>
<version>21.3.0-SNAPSHOT</version>
<version>22.3.1</version>
</dependency>
</dependencies>

Expand Down
14 changes: 0 additions & 14 deletions src/main/java/AbstractParent.java

This file was deleted.

32 changes: 0 additions & 32 deletions src/main/java/ExternalizablePerson.java

This file was deleted.

42 changes: 8 additions & 34 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,14 @@
import org.graalvm.home.Version;
public class Main {

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
static {
dontCallMe();
}

public class Main {
private static void dontCallMe() {
throw new IllegalArgumentException("Don't call me!");
}

public static void main(String[] args) {
// we don't test serialization for GraalVM < 21.3
if (Version.getCurrent().compareTo(21, 3) < 0) {
System.out.println("Please use GraalVM >21.3");
return;
}

try {
SomeSerializationObject instance = new SomeSerializationObject();
instance.setPerson(new Person("Sheldon"));
ExternalizablePerson ep = new ExternalizablePerson();
ep.setName("Sheldon 2.0");
instance.setExternalizablePerson(ep);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(out);
os.writeObject(instance);
ByteArrayInputStream bais = new ByteArrayInputStream(out.toByteArray());
ObjectInputStream is = new ObjectInputStream(bais);
SomeSerializationObject result = (SomeSerializationObject) is.readObject();
if (result.getPerson().getName().equals("Sheldon")
&& result.getExternalizablePerson().getName().equals("Sheldon 2.0")) {
System.out.println("OK");
} else {
System.out.println("Ooops");
}
} catch (Exception e) {
System.out.println("Ooops2");
e.printStackTrace();
}
System.out.println("Hello World!");
}
}
8 changes: 0 additions & 8 deletions src/main/java/Person.java

This file was deleted.

18 changes: 0 additions & 18 deletions src/main/java/SerializationFeature.java

This file was deleted.

23 changes: 0 additions & 23 deletions src/main/java/SomeSerializationObject.java

This file was deleted.

12 changes: 12 additions & 0 deletions src/main/java/Target_Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(Main.class)
public final class Target_Main {

@Delete
private static void dontCallMe() {
// Do nothing;
}

}

0 comments on commit 7faf606

Please sign in to comment.