Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ jobs:
strategy:
matrix:
java:
- '8'
- '11'
#- '17'
# Java LTS versions
- '8' # 2030/12
- '11' # 2032/01
- '17' # 2029/09
- '21' # 2031/09
name: Java ${{ matrix.Java }} sample
steps:
- uses: actions/checkout@v2
Expand Down
55 changes: 42 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jmh.version>1.35</jmh.version>
<jmh.version>1.37</jmh.version>
</properties>

<build>
Expand Down Expand Up @@ -61,8 +61,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<!-- <parallel>all</parallel> &lt;!&ndash; Run tests in parallel&ndash;&gt;-->
<!-- <useUnlimitedThreads>true</useUnlimitedThreads>-->
<rerunFailingTestsCount>10</rerunFailingTestsCount>
<argLine>-Xms1g -Xmx1g</argLine>
</configuration>
Expand Down Expand Up @@ -107,6 +105,43 @@
</plugins>
</reporting>

<profiles>
<profile>
<id>java-12-plus-reflection</id>
<activation>
<jdk>[12,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine> --add-opens java.base/java.nio=ALL-UNNAMED </argLine>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>run-benchmarks</id>
<configuration>
<arguments>
<argument>--add-opens=java.base/java.nio=ALL-UNNAMED</argument>
<argument>-classpath</argument>
<classpath/>
<argument>org.openjdk.jmh.Main</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>no.fiken.oss.junixsocket</groupId>
Expand All @@ -119,45 +154,39 @@
<version>1.0.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.12.1</version>
<version>5.18.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.12.1</version>
<version>5.18.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.12.4</version>
<version>4.11.0</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.23.1</version>
<version>3.27.6</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.openjdk.jmh -->
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/bwapi/UnsafeTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ private static Object getOrCrash(final Class<?> className, final Object object,
return result;

} catch (final Exception e) { // or crash...
e.printStackTrace();
System.exit(-1);
return null;
throw new RuntimeException(e);
}
}

Expand Down
11 changes: 7 additions & 4 deletions src/test/java/bwapi/ClientDataBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ public static class EmptyState {

@Setup(Level.Invocation)
public void setup() {
WrappedBuffer wrappedBuffer = new WrappedBuffer(ClientData.GameData.SIZE);
game = new Game();
game.botClientData().setBuffer(new WrappedBuffer(ClientData.GameData.SIZE));
game.botClientData().setBuffer(wrappedBuffer);
client = new Client(wrappedBuffer);
strings = buildStrings();
}

}

@State(Scope.Thread)
Expand All @@ -33,9 +34,11 @@ public static class FilledWithStrings {

@Setup(Level.Invocation)
public void setup() {
data = client.liveClientData().gameData();
WrappedBuffer wrappedBuffer = new WrappedBuffer(ClientData.GameData.SIZE);
game = new Game();
game.botClientData().setBuffer(new WrappedBuffer(ClientData.GameData.SIZE));
game.botClientData().setBuffer(wrappedBuffer);
client = new Client(wrappedBuffer);
data = game.botClientData().gameData();
String[] strings = buildStrings();
for (String s : strings) {
GameDataUtils.addString(client.liveClientData().gameData(), s);
Expand Down
Loading