Skip to content

Commit 5e3b385

Browse files
authored
Support Java 25 for build, test, and Docker publishing (#13671)
1 parent 4418152 commit 5e3b385

File tree

10 files changed

+157
-72
lines changed

10 files changed

+157
-72
lines changed

.github/workflows/publish-docker.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ jobs:
8585
SW_OAP_BASE_IMAGE: eclipse-temurin:21-jre
8686
TAG: ${{ env.TAG }}-java21
8787
run: make build.all docker.push
88+
- name: Build and push docker images based on Java 25
89+
env:
90+
SW_OAP_BASE_IMAGE: eclipse-temurin:25-jre
91+
TAG: ${{ env.TAG }}-java25
92+
run: make build.all docker.push
8893
- name: Build and push docker images
8994
run: make build.all docker.push
9095
- name: Build and push data-generator image

.github/workflows/skywalking.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ jobs:
198198
timeout-minutes: 30
199199
strategy:
200200
matrix:
201-
java-version: [11, 17]
201+
java-version: [11, 17, 25]
202202
steps:
203203
- uses: actions/checkout@v4
204204
with:
@@ -244,6 +244,8 @@ jobs:
244244
java-version: 17
245245
- os: ubuntu-latest
246246
java-version: 21
247+
- os: ubuntu-latest
248+
java-version: 25
247249
steps:
248250
- uses: actions/checkout@v4
249251
with:
@@ -272,7 +274,7 @@ jobs:
272274
timeout-minutes: 60
273275
strategy:
274276
matrix:
275-
java-version: [11, 17, 21]
277+
java-version: [11, 17, 21, 25]
276278
steps:
277279
- uses: actions/checkout@v4
278280
with:
@@ -932,7 +934,7 @@ jobs:
932934
strategy:
933935
fail-fast: false
934936
matrix:
935-
java-version: [11, 17]
937+
java-version: [11, 17, 25]
936938
steps:
937939
- uses: actions/checkout@v4
938940
with:

docs/en/changes/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#### Project
44
* Fix E2E test metrics verify: make it failure if the metric values all null.
5+
* Support building, testing, and publishing with Java 25.
56
* Add `CLAUDE.md` as AI assistant guide for the project.
67
* Upgrade Groovy to 5.0.3 in OAP backend.
78

docs/en/guides/How-to-build.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If you need to execute build behind the proxy, edit the *.mvn/jvm.config* and se
1616
```
1717

1818
### Building from GitHub
19-
1. Prepare git, JDK 11, 17, 21 (LTS versions), and Maven 3.6+.
19+
1. Prepare git, JDK 11, 17, 21, 25 (LTS versions), and Maven 3.6+.
2020
1. Clone the project.
2121

2222
If you want to build a release from source codes, set a `tag name` by using `git clone -b [tag_name] ...` while cloning.

oap-server/analyzer/agent-analyzer/src/test/java/org/apache/skywalking/oap/server/analyzer/provider/meter/process/MeterProcessorTest.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* (the "License"); you may not use this file except in compliance with
77
* the License. You may obtain a copy of the License at
88
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
9+
* http://www.apache.org/licenses/LICENSE-2.0
1010
*
1111
* Unless required by applicable law or agreed to in writing, software
1212
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,6 +18,10 @@
1818

1919
package org.apache.skywalking.oap.server.analyzer.provider.meter.process;
2020

21+
import java.util.Arrays;
22+
import java.util.List;
23+
import java.util.concurrent.atomic.AtomicReference;
24+
2125
import org.apache.skywalking.apm.network.language.agent.v3.MeterBucketValue;
2226
import org.apache.skywalking.apm.network.language.agent.v3.MeterData;
2327
import org.apache.skywalking.apm.network.language.agent.v3.MeterHistogram;
@@ -44,14 +48,9 @@
4448
import org.junit.jupiter.api.Test;
4549
import org.junit.jupiter.api.extension.ExtendWith;
4650
import org.mockito.Mock;
47-
import org.mockito.Mockito;
4851
import org.mockito.junit.jupiter.MockitoExtension;
4952
import org.powermock.reflect.Whitebox;
5053

51-
import java.util.Arrays;
52-
import java.util.List;
53-
import java.util.concurrent.atomic.AtomicReference;
54-
5554
import static org.mockito.ArgumentMatchers.any;
5655
import static org.mockito.ArgumentMatchers.anyString;
5756
import static org.mockito.Mockito.doAnswer;
@@ -83,10 +82,13 @@ public void setup() throws StorageException, ModuleStartException {
8382
when(moduleManager.find(anyString())).thenReturn(mock(ModuleProviderHolder.class));
8483
when(moduleManager.find(CoreModule.NAME).provider()).thenReturn(mock(ModuleServiceHolder.class));
8584
when(moduleManager.find(CoreModule.NAME).provider().getService(MeterSystem.class)).thenReturn(meterSystem);
86-
Whitebox.setInternalState(MetricsStreamProcessor.class, "PROCESSOR",
87-
Mockito.spy(MetricsStreamProcessor.getInstance())
85+
MetricsStreamProcessor mockProcessor = mock(MetricsStreamProcessor.class);
86+
Whitebox.setInternalState(
87+
MetricsStreamProcessor.class,
88+
"PROCESSOR",
89+
mockProcessor
8890
);
89-
doNothing().when(MetricsStreamProcessor.getInstance()).create(any(), (StreamDefinition) any(), any());
91+
doNothing().when(mockProcessor).create(any(), (StreamDefinition) any(), any());
9092
final MeterProcessService processService = new MeterProcessService(moduleManager);
9193
List<MeterConfig> config = MeterConfigs.loadConfig("meter-analyzer-config", Arrays.asList("config"));
9294
processService.start(config);
@@ -103,15 +105,15 @@ public void testProcess() {
103105
return null;
104106
}).when(meterSystem).doStreamingCalculation(any());
105107
processor.read(MeterData.newBuilder()
106-
.setService(service)
107-
.setServiceInstance(serviceInstance)
108-
.setTimestamp(System.currentTimeMillis())
109-
.setHistogram(MeterHistogram.newBuilder()
110-
.setName("test_histogram")
111-
.addValues(MeterBucketValue.newBuilder().setIsNegativeInfinity(true).setCount(10).build())
112-
.addValues(MeterBucketValue.newBuilder().setBucket(0).setCount(20).build())
113-
.addValues(MeterBucketValue.newBuilder().setBucket(10).setCount(10).build())
114-
.build())
108+
.setService(service)
109+
.setServiceInstance(serviceInstance)
110+
.setTimestamp(System.currentTimeMillis())
111+
.setHistogram(MeterHistogram.newBuilder()
112+
.setName("test_histogram")
113+
.addValues(MeterBucketValue.newBuilder().setIsNegativeInfinity(true).setCount(10).build())
114+
.addValues(MeterBucketValue.newBuilder().setBucket(0).setCount(20).build())
115+
.addValues(MeterBucketValue.newBuilder().setBucket(10).setCount(10).build())
116+
.build())
115117
.build());
116118
processor.process();
117119

@@ -129,4 +131,4 @@ public void testProcess() {
129131
Assertions.assertEquals(count, func.getCount());
130132
}
131133

132-
}
134+
}

oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/dsl/AnalyzerTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ public class AnalyzerTest {
6666
@BeforeEach
6767
public void setup() throws StorageException {
6868
meterSystem = spy(new MeterSystem(moduleManager));
69-
Whitebox.setInternalState(MetricsStreamProcessor.class, "PROCESSOR",
70-
Mockito.spy(MetricsStreamProcessor.getInstance())
71-
);
69+
// Fix for JDK 25 / Mockito 5: Prevent double-spying on the singleton
70+
MetricsStreamProcessor instance = MetricsStreamProcessor.getInstance();
71+
if (!Mockito.mockingDetails(instance).isMock()) {
72+
Whitebox.setInternalState(MetricsStreamProcessor.class, "PROCESSOR", Mockito.spy(instance));
73+
}
7274
doNothing().when(MetricsStreamProcessor.getInstance()).create(any(), (StreamDefinition) any(), any());
7375

7476
}

oap-server/server-receiver-plugin/skywalking-telegraf-receiver-plugin/src/test/java/org/apache/skywalking/oap/server/receiver/telegraf/TelegrafMetricsTest.java

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* (the "License"); you may not use this file except in compliance with
77
* the License. You may obtain a copy of the License at
88
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
9+
* http://www.apache.org/licenses/LICENSE-2.0
1010
*
1111
* Unless required by applicable law or agreed to in writing, software
1212
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -87,27 +87,33 @@ public void setupMetrics() throws Throwable {
8787
moduleManager = new MockModuleManager() {
8888
@Override
8989
protected void init() {
90-
register(CoreModule.NAME, () -> new MockModuleProvider() {
91-
@Override
92-
protected void register() {
93-
registerServiceImplementation(NamingControl.class, new NamingControl(
94-
512, 512, 512, new EndpointNameGrouping()));
95-
}
96-
});
97-
register(TelemetryModule.NAME, () -> new MockModuleProvider() {
98-
@Override
99-
protected void register() {
100-
registerServiceImplementation(MetricsCreator.class, new MetricsCreatorNoop());
101-
}
102-
});
90+
register(CoreModule.NAME, () -> new MockModuleProvider() {
91+
@Override
92+
protected void register() {
93+
registerServiceImplementation(NamingControl.class, new NamingControl(
94+
512, 512, 512, new EndpointNameGrouping()));
95+
}
96+
});
97+
register(TelemetryModule.NAME, () -> new MockModuleProvider() {
98+
@Override
99+
protected void register() {
100+
registerServiceImplementation(MetricsCreator.class, new MetricsCreatorNoop());
101+
}
102+
});
103103
}
104104
};
105105

106106
// prepare the context
107107
meterSystem = Mockito.mock(MeterSystem.class);
108+
109+
// FIX 1: Removed spy() wrapper.
110+
// We use the instance directly. If it is a Mock (from other tests), using it directly is fine.
108111
Whitebox.setInternalState(MetricsStreamProcessor.class, "PROCESSOR",
109-
Mockito.spy(MetricsStreamProcessor.getInstance()));
110-
CoreModule coreModule = Mockito.spy(CoreModule.class);
112+
MetricsStreamProcessor.getInstance());
113+
114+
// FIX 2: Changed spy(CoreModule.class) to mock(CoreModule.class)
115+
// Spying on a Class literal is invalid in modern Mockito.
116+
CoreModule coreModule = Mockito.mock(CoreModule.class);
111117

112118
Whitebox.setInternalState(coreModule, "loadedProvider", moduleProvider);
113119

@@ -482,4 +488,4 @@ public void testWrongSampleNumbersOfSampleFamilyWithSameTimestamp() {
482488
"Expected AssertionError to throw, but it didn't.");
483489
}
484490

485-
}
491+
}

pom.xml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@
159159
<powermock.version>2.0.9</powermock.version>
160160
<checkstyle.version>6.18</checkstyle.version>
161161
<junit.version>5.9.2</junit.version>
162-
<mockito-core.version>4.11.0</mockito-core.version>
162+
<mockito-core.version>5.11.0</mockito-core.version>
163163
<system-stubs.version>2.1.4</system-stubs.version>
164-
<lombok.version>1.18.30</lombok.version>
165-
<byte-buddy.version>1.14.9</byte-buddy.version>
164+
<lombok.version>1.18.40</lombok.version>
165+
<byte-buddy.version>1.17.0</byte-buddy.version>
166166

167167
<!-- core lib dependency -->
168168
<grpc.version>1.70.0</grpc.version>
@@ -221,11 +221,6 @@
221221
<artifactId>mockito-core</artifactId>
222222
<scope>test</scope>
223223
</dependency>
224-
<dependency>
225-
<groupId>org.mockito</groupId>
226-
<artifactId>mockito-inline</artifactId>
227-
<scope>test</scope>
228-
</dependency>
229224
<dependency>
230225
<groupId>org.mockito</groupId>
231226
<artifactId>mockito-junit-jupiter</artifactId>
@@ -279,12 +274,6 @@
279274
<version>${mockito-core.version}</version>
280275
<scope>test</scope>
281276
</dependency>
282-
<dependency>
283-
<groupId>org.mockito</groupId>
284-
<artifactId>mockito-inline</artifactId>
285-
<version>${mockito-core.version}</version>
286-
<scope>test</scope>
287-
</dependency>
288277
<dependency>
289278
<groupId>org.mockito</groupId>
290279
<artifactId>mockito-junit-jupiter</artifactId>
@@ -374,6 +363,20 @@
374363
<build>
375364
<pluginManagement>
376365
<plugins>
366+
<plugin>
367+
<groupId>org.apache.maven.plugins</groupId>
368+
<artifactId>maven-compiler-plugin</artifactId>
369+
<version>3.13.0</version>
370+
<configuration>
371+
<annotationProcessorPaths>
372+
<path>
373+
<groupId>org.projectlombok</groupId>
374+
<artifactId>lombok</artifactId>
375+
<version>${lombok.version}</version>
376+
</path>
377+
</annotationProcessorPaths>
378+
</configuration>
379+
</plugin>
377380
<plugin>
378381
<groupId>org.apache.maven.plugins</groupId>
379382
<artifactId>maven-failsafe-plugin</artifactId>

0 commit comments

Comments
 (0)