Runnable jcstress + JUnit companion for the ankurm.com post on the Java Memory Model, double-checked locking, and the volatile fix.
89 lines
3.2 KiB
XML
89 lines
3.2 KiB
XML
<?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/xsd/maven-4.0.0.xsd">
|
|
<modelVersion>4.0.0</modelVersion>
|
|
|
|
<parent>
|
|
<groupId>com.ankurm</groupId>
|
|
<artifactId>java-core-examples</artifactId>
|
|
<version>1.0</version>
|
|
</parent>
|
|
|
|
<artifactId>jmm</artifactId>
|
|
<name>jmm</name>
|
|
<description>The Java Memory Model: volatile, happens-before, safe publication, and the double-checked-locking bug, reproduced with jcstress.</description>
|
|
|
|
<properties>
|
|
<jcstress.version>0.16</jcstress.version>
|
|
</properties>
|
|
|
|
<dependencies>
|
|
<dependency>
|
|
<groupId>org.openjdk.jcstress</groupId>
|
|
<artifactId>jcstress-core</artifactId>
|
|
<version>${jcstress.version}</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.junit.jupiter</groupId>
|
|
<artifactId>junit-jupiter</artifactId>
|
|
<version>5.11.0</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
</dependencies>
|
|
|
|
<build>
|
|
<finalName>jcstress</finalName>
|
|
<plugins>
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-compiler-plugin</artifactId>
|
|
<version>3.13.0</version>
|
|
<configuration>
|
|
<release>25</release>
|
|
<!--
|
|
jcstress-core ships its own annotation processor (JCStressTestProcessor) that
|
|
generates the *_jcstress.java harness classes from @JCStressTest/@State/@Actor.
|
|
On JDK 21 javac still finds it implicitly via the classpath (with a warning that
|
|
this is going away). On JDK 25 that implicit discovery is gone: no warning, no
|
|
error, the processor is just silently never invoked and target/generated-test-sources
|
|
stays empty. Verified with plain javac on both JDKs while building this repo -
|
|
see the versions callout in the post. annotationProcessorPaths is what makes it
|
|
work on both.
|
|
-->
|
|
<annotationProcessorPaths>
|
|
<path>
|
|
<groupId>org.openjdk.jcstress</groupId>
|
|
<artifactId>jcstress-core</artifactId>
|
|
<version>${jcstress.version}</version>
|
|
</path>
|
|
</annotationProcessorPaths>
|
|
</configuration>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-surefire-plugin</artifactId>
|
|
<version>3.2.5</version>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-shade-plugin</artifactId>
|
|
<version>3.5.1</version>
|
|
<executions>
|
|
<execution>
|
|
<phase>package</phase>
|
|
<goals><goal>shade</goal></goals>
|
|
<configuration>
|
|
<transformers>
|
|
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
|
<mainClass>org.openjdk.jcstress.Main</mainClass>
|
|
</transformer>
|
|
</transformers>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</project>
|