Skip to content
Merged
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
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [push]
on: [push, pull_request]

jobs:
build:
Expand All @@ -15,10 +15,16 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v5
with:
distribution: 'oracle'
distribution: 'temurin'
java-version: ${{ matrix.java }}
architecture: ${{ matrix.architecture }}
cache: 'maven'

- name: Build with Maven
run: mvn package
run: mvn -B --no-transfer-progress package

- name: Verify jar compatibility
uses: pivovarit/verify-jar-action@v1.2.0
with:
directory: 'java-jpms-jdk8/target'
java-version: '8'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.claude
.idea/
target/

*.iml
.DS_Store

1 change: 1 addition & 0 deletions java-jpms-jdk8/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://4comprehension.com/jdk8-with-jpms-support/
66 changes: 66 additions & 0 deletions java-jpms-jdk8/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<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.pivovarit</groupId>
<artifactId>articles</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>java-jpms-jdk8</artifactId>

<name>java-jpms-jdk8</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>1.2.2.Final</version>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<jvmVersion>9</jvmVersion>
<module>
<moduleInfoSource>
module com.pivovarit.utils {
exports com.pivovarit.jpms;
}
</moduleInfoSource>
</module>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.pivovarit.utils;

public final class StringUtils {

private StringUtils() {
}

public static String reverse(String input) {
return input == null ? null : new StringBuilder(input).reverse().toString();
}

public static boolean isPalindrome(String input) {
if (input == null) {
return false;
}
String reversed = reverse(input);
return input.equalsIgnoreCase(reversed);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.pivovarit.utils;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

class StringUtilsTest {

@Test
void shouldReverseString() {
assertThat(StringUtils.reverse("hello")).isEqualTo("olleh");
}

@Test
void shouldReturnNullForNullReverse() {
assertThat(StringUtils.reverse(null)).isNull();
}

@Test
void shouldDetectPalindrome() {
assertThat(StringUtils.isPalindrome("racecar")).isTrue();
}

@Test
void shouldDetectNonPalindrome() {
assertThat(StringUtils.isPalindrome("hello")).isFalse();
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<module>java-immutable-collectors</module>
<module>java-11-string-api-updates</module>
<module>java-jdk8-on-spin-wait</module>
<module>java-jpms-jdk8</module>
<module>java-design-patterns</module>
<module>java-random-stream</module>
<module>java-last-gatherer</module>
Expand Down