From 3f2e73bf922b372fdda1cdc7e71af208fa7e00c7 Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 15 Jan 2026 14:46:32 -0500 Subject: [PATCH 1/8] add test matrix Signed-off-by: Jay DeLuca --- .github/workflows/multi-version-test.yml | 45 ++++++++++++++++++++++++ pom.xml | 7 ++-- 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/multi-version-test.yml diff --git a/.github/workflows/multi-version-test.yml b/.github/workflows/multi-version-test.yml new file mode 100644 index 000000000..1a2eac4c1 --- /dev/null +++ b/.github/workflows/multi-version-test.yml @@ -0,0 +1,45 @@ +--- +name: Multi-Version Compatibility Tests + +on: [pull_request] + +permissions: {} + +jobs: + compatibility-test: + name: Test on Java ${{ matrix.java }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + java: [11, 17, 21, 25] + steps: + - name: Check out + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + persist-credentials: false + + - name: Set up Java ${{ matrix.java }} + id: setup-java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + + - name: Cache local Maven repository + uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-java${{ matrix.java }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven-java${{ matrix.java }}- + ${{ runner.os }}-maven- + + - name: Build and test on Java ${{ matrix.java }} + run: | + if [ "${{ matrix.java }}" = "11" ]; then + echo "Building on Java 11 - excluding integration-tests module (GraalVM plugin requires Java 17+)" + ./mvnw clean install -Dtest.java.version=11 -pl '!integration-tests' + else + ./mvnw clean install -Dtest.java.version=${{ matrix.java }} + fi \ No newline at end of file diff --git a/pom.xml b/pom.xml index b00d02d4d..c67c256ab 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ 6.0.1 2.16.0-alpha 8 + 25 0.70 false false @@ -252,9 +253,9 @@ ${java.version} ${java.version} ${java.version} - 25 - 25 - 25 + ${test.java.version} + ${test.java.version} + ${test.java.version} true -Xlint:all,-serial,-processing,-options From c709cc72ed786e1670c001cc5643fdfbee8ffe09 Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 15 Jan 2026 15:08:52 -0500 Subject: [PATCH 2/8] make graal conditional for java 17+ Signed-off-by: Jay DeLuca --- .github/workflows/multi-version-test.yml | 8 +- .../it-spring-boot-smoke-test/pom.xml | 147 ++++++++++-------- .../exporter/httpserver/HTTPServerTest.java | 26 +++- 3 files changed, 106 insertions(+), 75 deletions(-) diff --git a/.github/workflows/multi-version-test.yml b/.github/workflows/multi-version-test.yml index 1a2eac4c1..897cbd79d 100644 --- a/.github/workflows/multi-version-test.yml +++ b/.github/workflows/multi-version-test.yml @@ -36,10 +36,4 @@ jobs: ${{ runner.os }}-maven- - name: Build and test on Java ${{ matrix.java }} - run: | - if [ "${{ matrix.java }}" = "11" ]; then - echo "Building on Java 11 - excluding integration-tests module (GraalVM plugin requires Java 17+)" - ./mvnw clean install -Dtest.java.version=11 -pl '!integration-tests' - else - ./mvnw clean install -Dtest.java.version=${{ matrix.java }} - fi \ No newline at end of file + run: ./mvnw clean install -Dtest.java.version=${{ matrix.java }} \ No newline at end of file diff --git a/integration-tests/it-spring-boot-smoke-test/pom.xml b/integration-tests/it-spring-boot-smoke-test/pom.xml index 2f0e18cb1..ee45922f5 100644 --- a/integration-tests/it-spring-boot-smoke-test/pom.xml +++ b/integration-tests/it-spring-boot-smoke-test/pom.xml @@ -21,7 +21,7 @@ Spring Smoke Tests - 25 + ${test.java.version} 6.0.1 @@ -89,72 +89,6 @@ - - org.graalvm.buildtools - native-maven-plugin - - - - - --initialize-at-build-time=org.junit.jupiter.api.DisplayNameGenerator$IndicativeSentences - - - --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor$ClassInfo - - - --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor$LifecycleMethods - - - --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ClassTemplateInvocationTestDescriptor - - - --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ClassTemplateTestDescriptor - - - --initialize-at-build-time=org.junit.jupiter.engine.descriptor.DynamicDescendantFilter$Mode - - - --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ExclusiveResourceCollector$1 - - - --initialize-at-build-time=org.junit.jupiter.engine.descriptor.MethodBasedTestDescriptor$MethodInfo - - - --initialize-at-build-time=org.junit.jupiter.engine.discovery.ClassSelectorResolver$DummyClassTemplateInvocationContext - - - --initialize-at-build-time=org.junit.platform.engine.support.store.NamespacedHierarchicalStore$EvaluatedValue - - --initialize-at-build-time=org.junit.platform.launcher.core.DiscoveryIssueNotifier - - - --initialize-at-build-time=org.junit.platform.launcher.core.HierarchicalOutputDirectoryProvider - - - --initialize-at-build-time=org.junit.platform.launcher.core.LauncherDiscoveryResult$EngineResultInfo - - - --initialize-at-build-time=org.junit.platform.suite.engine.SuiteTestDescriptor$LifecycleMethods - - - --initialize-at-build-time=org.junit.platform.commons.logging.LoggerFactory$DelegatingLogger - - - --initialize-at-build-time=org.junit.jupiter.engine.execution.ConditionEvaluator - - - --initialize-at-build-time=org.junit.jupiter.engine.execution.InterceptingExecutableInvoker - - - --initialize-at-build-time=org.junit.jupiter.api.extension.ConditionEvaluationResult - - - --initialize-at-build-time=org.junit.jupiter.engine.execution.InvocationInterceptorChain - - - - - org.springframework.boot spring-boot-maven-plugin @@ -180,4 +114,83 @@ + + + graalvm-native + + [17,) + + + + + org.graalvm.buildtools + native-maven-plugin + + + + + --initialize-at-build-time=org.junit.jupiter.api.DisplayNameGenerator$IndicativeSentences + + + --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor$ClassInfo + + + --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor$LifecycleMethods + + + --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ClassTemplateInvocationTestDescriptor + + + --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ClassTemplateTestDescriptor + + + --initialize-at-build-time=org.junit.jupiter.engine.descriptor.DynamicDescendantFilter$Mode + + + --initialize-at-build-time=org.junit.jupiter.engine.descriptor.ExclusiveResourceCollector$1 + + + --initialize-at-build-time=org.junit.jupiter.engine.descriptor.MethodBasedTestDescriptor$MethodInfo + + + --initialize-at-build-time=org.junit.jupiter.engine.discovery.ClassSelectorResolver$DummyClassTemplateInvocationContext + + + --initialize-at-build-time=org.junit.platform.engine.support.store.NamespacedHierarchicalStore$EvaluatedValue + + --initialize-at-build-time=org.junit.platform.launcher.core.DiscoveryIssueNotifier + + + --initialize-at-build-time=org.junit.platform.launcher.core.HierarchicalOutputDirectoryProvider + + + --initialize-at-build-time=org.junit.platform.launcher.core.LauncherDiscoveryResult$EngineResultInfo + + + --initialize-at-build-time=org.junit.platform.suite.engine.SuiteTestDescriptor$LifecycleMethods + + + --initialize-at-build-time=org.junit.platform.commons.logging.LoggerFactory$DelegatingLogger + + + --initialize-at-build-time=org.junit.jupiter.engine.execution.ConditionEvaluator + + + --initialize-at-build-time=org.junit.jupiter.engine.execution.InterceptingExecutableInvoker + + + --initialize-at-build-time=org.junit.jupiter.api.extension.ConditionEvaluationResult + + + --initialize-at-build-time=org.junit.jupiter.engine.execution.InvocationInterceptorChain + + + + + + + + + + diff --git a/prometheus-metrics-exporter-httpserver/src/test/java/io/prometheus/metrics/exporter/httpserver/HTTPServerTest.java b/prometheus-metrics-exporter-httpserver/src/test/java/io/prometheus/metrics/exporter/httpserver/HTTPServerTest.java index 9b7f658de..5959c5c91 100644 --- a/prometheus-metrics-exporter-httpserver/src/test/java/io/prometheus/metrics/exporter/httpserver/HTTPServerTest.java +++ b/prometheus-metrics-exporter-httpserver/src/test/java/io/prometheus/metrics/exporter/httpserver/HTTPServerTest.java @@ -12,6 +12,7 @@ import io.prometheus.metrics.model.registry.PrometheusScrapeRequest; import io.prometheus.metrics.model.snapshots.MetricSnapshots; import java.io.IOException; +import java.lang.reflect.Method; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; @@ -45,7 +46,7 @@ public Result authenticate(HttpExchange exchange) { HttpHandler handler = exchange -> { boolean found = false; - Subject current = Subject.current(); + Subject current = getCurrentSubject(); for (Principal p : current.getPrincipals()) { if (user.equals(p.getName())) { found = true; @@ -186,4 +187,27 @@ void healthDisabled() throws IOException { "204", "/-/healthy"); } + + /** + * Get current Subject using reflection to support both Java 17 and Java 18+. + * + *

Java 18+ has Subject.current(), but Java 17 and earlier require + * Subject.getSubject(AccessController.getContext()). + */ + @SuppressWarnings({"removal"}) + private static Subject getCurrentSubject() { + try { + Method currentMethod = Subject.class.getMethod("current"); + return (Subject) currentMethod.invoke(null); + } catch (NoSuchMethodException e) { + // Fall back to pre-Java 18 API + try { + return Subject.getSubject(java.security.AccessController.getContext()); + } catch (Exception ex) { + throw new RuntimeException("Failed to get current Subject", ex); + } + } catch (Exception e) { + throw new RuntimeException("Failed to invoke Subject.current()", e); + } + } } From 8472199034a2908923d0582bb75916dbe84d1859 Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 15 Jan 2026 15:27:25 -0500 Subject: [PATCH 3/8] errorprone too Signed-off-by: Jay DeLuca --- .github/workflows/multi-version-test.yml | 4 +- .../it-spring-boot-smoke-test/pom.xml | 38 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/multi-version-test.yml b/.github/workflows/multi-version-test.yml index 897cbd79d..86bd9b57e 100644 --- a/.github/workflows/multi-version-test.yml +++ b/.github/workflows/multi-version-test.yml @@ -1,5 +1,5 @@ --- -name: Multi-Version Compatibility Tests +name: Java-Version Compatibility Tests on: [pull_request] @@ -36,4 +36,4 @@ jobs: ${{ runner.os }}-maven- - name: Build and test on Java ${{ matrix.java }} - run: ./mvnw clean install -Dtest.java.version=${{ matrix.java }} \ No newline at end of file + run: ./mvnw clean install -Dtest.java.version=${{ matrix.java }} -Dspotless.check.skip=true -Dcheckstyle.skip=true -Dmaven.compiler.proc=none -Dwarnings=-nowarn \ No newline at end of file diff --git a/integration-tests/it-spring-boot-smoke-test/pom.xml b/integration-tests/it-spring-boot-smoke-test/pom.xml index 5bd82a5cd..eb0d1c5d8 100644 --- a/integration-tests/it-spring-boot-smoke-test/pom.xml +++ b/integration-tests/it-spring-boot-smoke-test/pom.xml @@ -93,30 +93,12 @@ org.springframework.boot spring-boot-maven-plugin - - com.diffplug.spotless - spotless-maven-plugin - 3.1.0 - - - - - - - - verify - - check - - - - - graalvm-native + java17-plus [17,) @@ -188,6 +170,24 @@ + + com.diffplug.spotless + spotless-maven-plugin + 3.1.0 + + + + + + + + verify + + check + + + + From 4d19fd7405363bb57805042fea55e0b896ee559e Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 15 Jan 2026 15:29:59 -0500 Subject: [PATCH 4/8] fix spotless disable Signed-off-by: Jay DeLuca --- .github/workflows/multi-version-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/multi-version-test.yml b/.github/workflows/multi-version-test.yml index 86bd9b57e..ad73904d3 100644 --- a/.github/workflows/multi-version-test.yml +++ b/.github/workflows/multi-version-test.yml @@ -36,4 +36,4 @@ jobs: ${{ runner.os }}-maven- - name: Build and test on Java ${{ matrix.java }} - run: ./mvnw clean install -Dtest.java.version=${{ matrix.java }} -Dspotless.check.skip=true -Dcheckstyle.skip=true -Dmaven.compiler.proc=none -Dwarnings=-nowarn \ No newline at end of file + run: ./mvnw clean install -Dtest.java.version=${{ matrix.java }} -Dspotless.skip=true -Dcheckstyle.skip=true -Dmaven.compiler.proc=none -Dwarnings=-nowarn \ No newline at end of file From 18763cb5eec2decb2fe3fc9eef10efcb84806797 Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 15 Jan 2026 15:31:16 -0500 Subject: [PATCH 5/8] disable cache Signed-off-by: Jay DeLuca --- .github/workflows/multi-version-test.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/multi-version-test.yml b/.github/workflows/multi-version-test.yml index ad73904d3..026749c1d 100644 --- a/.github/workflows/multi-version-test.yml +++ b/.github/workflows/multi-version-test.yml @@ -26,14 +26,14 @@ jobs: distribution: 'temurin' java-version: ${{ matrix.java }} - - name: Cache local Maven repository - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-java${{ matrix.java }}-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-java${{ matrix.java }}- - ${{ runner.os }}-maven- +# - name: Cache local Maven repository +# uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5 +# with: +# path: ~/.m2/repository +# key: ${{ runner.os }}-maven-java${{ matrix.java }}-${{ hashFiles('**/pom.xml') }} +# restore-keys: | +# ${{ runner.os }}-maven-java${{ matrix.java }}- +# ${{ runner.os }}-maven- - name: Build and test on Java ${{ matrix.java }} run: ./mvnw clean install -Dtest.java.version=${{ matrix.java }} -Dspotless.skip=true -Dcheckstyle.skip=true -Dmaven.compiler.proc=none -Dwarnings=-nowarn \ No newline at end of file From 4bcc776ced1f8350c510f79168f342a1f91388bf Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 15 Jan 2026 15:34:16 -0500 Subject: [PATCH 6/8] try again Signed-off-by: Jay DeLuca --- prometheus-metrics-parent/pom.xml | 48 +++++++++++++++++++------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/prometheus-metrics-parent/pom.xml b/prometheus-metrics-parent/pom.xml index 075eaf782..c5b521b1a 100644 --- a/prometheus-metrics-parent/pom.xml +++ b/prometheus-metrics-parent/pom.xml @@ -68,29 +68,39 @@ - - com.diffplug.spotless - spotless-maven-plugin - 3.1.0 - - - - - ${spotless.skip} - - - - verify - - check - - - - + + java17-plus + + [17,) + + + + + com.diffplug.spotless + spotless-maven-plugin + 3.1.0 + + + + + ${spotless.skip} + + + + verify + + check + + + + + + + release From 58e0b20a9ce94de179c2bd2f08dbabebb492621e Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 15 Jan 2026 15:39:14 -0500 Subject: [PATCH 7/8] move errorprone into diff profile Signed-off-by: Jay DeLuca --- .github/workflows/multi-version-test.yml | 18 +++---- pom.xml | 64 ++++++++++++++---------- 2 files changed, 47 insertions(+), 35 deletions(-) diff --git a/.github/workflows/multi-version-test.yml b/.github/workflows/multi-version-test.yml index 026749c1d..2736e7229 100644 --- a/.github/workflows/multi-version-test.yml +++ b/.github/workflows/multi-version-test.yml @@ -26,14 +26,14 @@ jobs: distribution: 'temurin' java-version: ${{ matrix.java }} -# - name: Cache local Maven repository -# uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5 -# with: -# path: ~/.m2/repository -# key: ${{ runner.os }}-maven-java${{ matrix.java }}-${{ hashFiles('**/pom.xml') }} -# restore-keys: | -# ${{ runner.os }}-maven-java${{ matrix.java }}- -# ${{ runner.os }}-maven- + - name: Cache local Maven repository + uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-java${{ matrix.java }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven-java${{ matrix.java }}- + ${{ runner.os }}-maven- - name: Build and test on Java ${{ matrix.java }} - run: ./mvnw clean install -Dtest.java.version=${{ matrix.java }} -Dspotless.skip=true -Dcheckstyle.skip=true -Dmaven.compiler.proc=none -Dwarnings=-nowarn \ No newline at end of file + run: ./mvnw clean install -Dtest.java.version=${{ matrix.java }} -Dspotless.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn -Dcoverage.skip=true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 685d9a27e..fedd9571e 100644 --- a/pom.xml +++ b/pom.xml @@ -262,33 +262,7 @@ ${warnings} --should-stop=ifError=FLOW -XDcompilePolicy=simple - - -Xplugin:ErrorProne - -Xep:AlmostJavadoc:OFF - -Xep:MissingSummary:OFF - -Xep:LongDoubleConversion:OFF - -Xep:StringSplitter:OFF - -XepExcludedPaths:(.*/generated/.*|.*/src/test/java/.*|.*/examples/.*|.*/integration-tests/.*) - -XepOpt:NullAway:AnnotatedPackages=io.prometheus.metrics - - - - com.google.errorprone - error_prone_core - 2.46.0 - - - com.uber.nullaway - nullaway - 0.12.15 - - - @@ -449,6 +423,44 @@ + + errorprone + + [21,) + + + + + maven-compiler-plugin + + + + -Xplugin:ErrorProne + -Xep:AlmostJavadoc:OFF + -Xep:MissingSummary:OFF + -Xep:LongDoubleConversion:OFF + -Xep:StringSplitter:OFF + -XepExcludedPaths:(.*/generated/.*|.*/src/test/java/.*|.*/examples/.*|.*/integration-tests/.*) + -XepOpt:NullAway:AnnotatedPackages=io.prometheus.metrics + + + + + com.google.errorprone + error_prone_core + 2.46.0 + + + com.uber.nullaway + nullaway + 0.12.15 + + + + + + + release From 69f79012c1f7bbf2118e7a4107c5f0ad5cb65d1f Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 15 Jan 2026 15:44:03 -0500 Subject: [PATCH 8/8] another try Signed-off-by: Jay DeLuca --- .github/workflows/multi-version-test.yml | 2 +- pom.xml | 49 ++++++++++++------------ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/multi-version-test.yml b/.github/workflows/multi-version-test.yml index 2736e7229..4fc7e07a7 100644 --- a/.github/workflows/multi-version-test.yml +++ b/.github/workflows/multi-version-test.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - java: [11, 17, 21, 25] + java: [17, 21, 25] steps: - name: Check out uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 diff --git a/pom.xml b/pom.xml index fedd9571e..f9b261c33 100644 --- a/pom.xml +++ b/pom.xml @@ -276,6 +276,31 @@ + + + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + + + io.opentelemetry.instrumentation + opentelemetry-instrumentation-bom-alpha + ${otel.instrumentation.version} + pom + import + + + io.opentelemetry + opentelemetry-proto + 1.7.1-alpha + test + + + + @@ -315,30 +340,6 @@ benchmarks integration-tests - - - - org.junit - junit-bom - ${junit-jupiter.version} - pom - import - - - io.opentelemetry.instrumentation - opentelemetry-instrumentation-bom-alpha - ${otel.instrumentation.version} - pom - import - - - io.opentelemetry - opentelemetry-proto - 1.7.1-alpha - test - - -