Skip to content

Commit 698e389

Browse files
authored
Moving the baseline to Java 17 / Jakarta EE 10 (#739)
* Fixing Maven's `relativePath`s. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Switching to Java 17. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Dropping Jakarta EE 8 RESTEasy tests, there are already Jakarta EE 9+ versions available. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Bringing back Jakarta EE 9 Jersey integration test and deleting Jakarta EE 8 version. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading Spring integration test to Jakarta EE 9+. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading cloudevents-spring-boot-example to Jakarta EE 9+. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading cloudevents-restful-ws-quarkus-example to Jakarta EE 9+, upgrading Quarkus to the newest 3.x version. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Removing all Jakarta EE 8 code and examples. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Applied OpenRewrite recipe "Migrate to Java 17". Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading Spring Boot to the newest 3.x version. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading Jersey to the newest 3.1.x version. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading RESTEasy to the newest 6.2.x version. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading Vert.x to the newest 4.x version. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading Jetty to the newest 12.1.x version. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading to Jakarta EE 10. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Upgrading Apache Kafka to the newest version. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Random improvements. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Fixing rebase issue. Signed-off-by: Jacek Bilski <jacek@bilski.tech> * Fixing Jetty sample - also calling `callback.succeed()` when no body is provided. This was also found by a coding agent. Signed-off-by: Jacek Bilski <jacek@bilski.tech> --------- Signed-off-by: Jacek Bilski <jacek@bilski.tech>
1 parent 1df03b9 commit 698e389

102 files changed

Lines changed: 560 additions & 1982 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/branch.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
java: [ 8, 11, 17 ]
16+
java: [ 17, 21, 25 ]
1717
steps:
1818
- uses: actions/checkout@v2
1919
- name: Setup java
@@ -33,7 +33,7 @@ jobs:
3333
- name: Setup java
3434
uses: actions/setup-java@v1
3535
with:
36-
java-version: 8
36+
java-version: 17
3737
server-id: central # Value of the distributionManagement/repository/id field of the pom.xml
3838
server-username: MAVEN_USERNAME # env variable for username in deploy
3939
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
@@ -45,4 +45,3 @@ jobs:
4545
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
4646
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
4747
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
48-

.github/workflows/bump.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup java
2626
uses: actions/setup-java@v1
2727
with:
28-
java-version: 8
28+
java-version: 17
2929
- name: Bump version using Maven
3030
if: ${{ inputs.maven-modules == 'true' }}
3131
run: './mvnw versions:set -DnewVersion=$NEW_VERSION -DgenerateBackupPoms=false -B'
@@ -44,4 +44,3 @@ jobs:
4444
This PR performs the bump of the SDK to ${{ github.event.inputs.version }}.
4545
This PR is auto-generated by
4646
[create-pull-request](https://github.com/peter-evans/create-pull-request).
47-

.github/workflows/pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
java: [ 8, 11, 17 ]
15+
java: [ 17, 21, 25 ]
1616
name: Java ${{ matrix.java }} Test
1717
steps:
1818
- uses: actions/checkout@v2

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Supported features of the specification:
4040
| AVRO Event Format | :x: | :x: |
4141
| HTTP Protocol Binding | :heavy_check_mark: | :heavy_check_mark: |
4242
| - [Vert.x](http/vertx) | :heavy_check_mark: | :heavy_check_mark: |
43-
| - [Jakarta EE 8 Restful WS](http/restful-ws) | :heavy_check_mark: | :heavy_check_mark: |
4443
| - [Jakarta EE 9+ Restful WS](http/restful-ws-jakarta) | :heavy_check_mark: | :heavy_check_mark: |
4544
| - [Basic](http/basic) | :heavy_check_mark: | :heavy_check_mark: |
4645
| - [Spring](spring) | :heavy_check_mark: | :heavy_check_mark: |
@@ -69,7 +68,6 @@ Javadocs are available on [javadoc.io](https://www.javadoc.io):
6968
- [cloudevents-protobuf](https://www.javadoc.io/doc/io.cloudevents/cloudevents-protobuf)
7069
- [cloudevents-xml](https://www.javadoc.io/doc/io.cloudevents/cloudevents-xml)
7170
- [cloudevents-http-basic](https://www.javadoc.io/doc/io.cloudevents/cloudevents-http-basic)
72-
- [cloudevents-http-restful-ws](https://www.javadoc.io/doc/io.cloudevents/cloudevents-http-restful-ws)
7371
- [cloudevents-http-restful-ws-jakarta](https://www.javadoc.io/doc/io.cloudevents/cloudevents-http-restful-ws-jakarta)
7472
- [cloudevents-http-vertx](https://www.javadoc.io/doc/io.cloudevents/cloudevents-http-vertx)
7573
- [cloudevents-kafka](https://www.javadoc.io/doc/io.cloudevents/cloudevents-kafka)

amqp/src/main/java/io/cloudevents/amqp/impl/AmqpConstants.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ public static byte[] getPayloadAsByteArray(final Section payload) {
110110
return null;
111111
}
112112

113-
if (payload instanceof Data) {
114-
final Data body = (Data) payload;
113+
if (payload instanceof Data body) {
115114
return body.getValue().getArray();
116-
} else if (payload instanceof AmqpValue) {
117-
final AmqpValue body = (AmqpValue) payload;
115+
} else if (payload instanceof AmqpValue body) {
118116
if (body.getValue() instanceof byte[]) {
119117
return (byte[]) body.getValue();
120118
} else if (body.getValue() instanceof String &&

amqp/src/test/java/io/cloudevents/amqp/ProtonAmqpMessageFactoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private static Stream<Arguments> binaryTestArguments() {
228228
private static final SimpleEntry<String, Object> property(final String name, final Object value) {
229229
return name.equalsIgnoreCase("ignored") ?
230230
new SimpleEntry<>(name, value) :
231-
new SimpleEntry<>(String.format(PREFIX_TEMPLATE, name), value);
231+
new SimpleEntry<>(PREFIX_TEMPLATE.formatted(name), value);
232232
}
233233

234234
@SafeVarargs

amqp/src/test/java/io/cloudevents/amqp/ProtonAmqpMessageWriterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private Message translateStructured(final CloudEvent event, final EventFormat fo
116116
}
117117
private void addProperty(final Map<String, Object> map, final String name, final String value, final boolean prefix) {
118118
if (prefix) {
119-
map.put(String.format("cloudEvents:%s", name), value);
119+
map.put("cloudEvents:%s".formatted(name), value);
120120
} else {
121121
map.put(name, value);
122122
}

api/src/main/java/io/cloudevents/rw/CloudEventContextWriter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ default CloudEventContextWriter withContextAttribute(String name, OffsetDateTime
8585
* @throws IllegalArgumentException if you're trying to set the specversion attribute.
8686
*
8787
* @deprecated CloudEvent specification only permits {@link Integer} type as a
88-
* numeric value.
88+
* numeric value. Use {@link #withContextAttribute(String, Integer)} instead.
8989
*/
90+
@Deprecated
9091
default CloudEventContextWriter withContextAttribute(String name, Number value) throws CloudEventRWException {
9192
return withContextAttribute(name, value.toString());
9293
}
@@ -122,7 +123,7 @@ default CloudEventContextWriter withContextAttribute(String name, Boolean value)
122123
}
123124

124125
/**
125-
* Set attribute with a binary type.
126+
* Set the attribute with a binary type.
126127
* This setter should not be invoked for specversion, because the writer should
127128
* already know the specversion or because it doesn't need it to correctly write the value.
128129
*

benchmarks/pom.xml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<properties>
3232
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3333
<jmh.version>1.23</jmh.version>
34-
<javac.target>1.8</javac.target>
3534
<!-- Name of the benchmark Uber-JAR to generate. -->
3635
<uberjar.name>benchmarks</uberjar.name>
3736
<maven.javadoc.skip>true</maven.javadoc.skip>
@@ -80,16 +79,6 @@
8079

8180
<build>
8281
<plugins>
83-
<plugin>
84-
<groupId>org.apache.maven.plugins</groupId>
85-
<artifactId>maven-compiler-plugin</artifactId>
86-
<version>3.15.0</version>
87-
<configuration>
88-
<compilerVersion>${javac.target}</compilerVersion>
89-
<source>${javac.target}</source>
90-
<target>${javac.target}</target>
91-
</configuration>
92-
</plugin>
9382
<plugin>
9483
<groupId>org.apache.maven.plugins</groupId>
9584
<artifactId>maven-shade-plugin</artifactId>
@@ -135,6 +124,10 @@
135124
<artifactId>maven-clean-plugin</artifactId>
136125
<version>3.5.0</version>
137126
</plugin>
127+
<plugin>
128+
<artifactId>maven-compiler-plugin</artifactId>
129+
<version>3.15.0</version>
130+
</plugin>
138131
<plugin>
139132
<artifactId>maven-deploy-plugin</artifactId>
140133
<version>3.1.4</version>

benchmarks/src/main/java/io/cloudevents/bench/kafka/KafkaConsumerMessageToCloudEventBenchmark.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import org.openjdk.jmh.annotations.*;
2626
import org.openjdk.jmh.infra.Blackhole;
2727

28+
import java.util.Optional;
29+
2830
import static io.cloudevents.core.test.Data.V1_WITH_JSON_DATA_WITH_EXT;
2931

3032
public class KafkaConsumerMessageToCloudEventBenchmark {
@@ -45,12 +47,12 @@ public BinaryMessage() {
4547
0,
4648
0,
4749
TimestampType.NO_TIMESTAMP_TYPE,
48-
-1L,
4950
ConsumerRecord.NULL_SIZE,
5051
ConsumerRecord.NULL_SIZE,
5152
"aaa",
5253
inRecord.value(),
53-
inRecord.headers()
54+
inRecord.headers(),
55+
Optional.empty()
5456
);
5557
}
5658
}
@@ -81,12 +83,12 @@ public StructuredJsonMessage() {
8183
0,
8284
0,
8385
TimestampType.NO_TIMESTAMP_TYPE,
84-
-1L,
8586
ConsumerRecord.NULL_SIZE,
8687
ConsumerRecord.NULL_SIZE,
8788
"aaa",
8889
inRecord.value(),
89-
inRecord.headers()
90+
inRecord.headers(),
91+
Optional.empty()
9092
);
9193
}
9294
}

0 commit comments

Comments
 (0)