Skip to content

Commit 75dfacb

Browse files
authored
refactor: remove lombok and replace all annotations with plain java implementations (#377)
* refactor: remove Lombok and replace with explicit Java code This change removes all Lombok annotations from the codebase and manually implements the equivalent constructors, builders, getters, equals/hashCode, and toString methods where required. The goal is to eliminate the Lombok dependency, improve Java version compatibility, and make the generated behavior explicit and maintainable. No functional changes were made. Signed-off-by: Max Lambrecht <[email protected]> * Remove 'final' in parameters and variables Signed-off-by: Max Lambrecht <[email protected]> * Remove 'final' in parameters and variables Signed-off-by: Max Lambrecht <[email protected]> * Add require non null Signed-off-by: Max Lambrecht <[email protected]> * Revert change Signed-off-by: Max Lambrecht <[email protected]> * Add java 25 to the build matrix Signed-off-by: Max Lambrecht <[email protected]> * Address PR comments Signed-off-by: Max Lambrecht <[email protected]> --------- Signed-off-by: Max Lambrecht <[email protected]>
1 parent 23268ac commit 75dfacb

File tree

81 files changed

+2125
-1042
lines changed

Some content is hidden

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

81 files changed

+2125
-1042
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
java-version: [ 17, 21 ]
20+
java-version: [ 17, 21, 25 ]
2121

2222
steps:
2323
- uses: actions/checkout@v6
@@ -51,7 +51,7 @@ jobs:
5151
runs-on: macos-latest
5252
strategy:
5353
matrix:
54-
java-version: [ 17, 21 ]
54+
java-version: [ 17, 21, 25 ]
5555

5656
steps:
5757
- uses: actions/checkout@v6

build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ subprojects {
2020
grpcVersion = '1.77.0'
2121
jupiterVersion = '5.13.4'
2222
mockitoVersion = '4.11.0'
23-
lombokVersion = '1.18.42'
2423
nimbusVersion = '10.6'
2524
shadowVersion = '9.0.0'
2625

@@ -107,12 +106,6 @@ subprojects {
107106
} else {
108107
testImplementation group: 'uk.org.webcompere', name: 'system-stubs-core', version: '2.1.8'
109108
}
110-
111-
// Project Lombok dependency
112-
compileOnly group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
113-
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
114-
testCompileOnly group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
115-
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
116109
}
117110

118111
testing {

java-spiffe-core/grpc-netty-linux/src/main/java/io/spiffe/workloadapi/internal/GrpcManagedChannelFactory.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
import io.grpc.netty.shaded.io.netty.channel.epoll.EpollDomainSocketChannel;
99
import io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup;
1010
import io.grpc.netty.shaded.io.netty.channel.unix.DomainSocketAddress;
11-
import lombok.NonNull;
12-
import lombok.val;
1311
import org.apache.commons.lang3.SystemUtils;
1412

1513
import java.net.URI;
14+
import java.util.Objects;
1615
import java.util.concurrent.ExecutorService;
1716

1817
/**
@@ -33,8 +32,10 @@ private GrpcManagedChannelFactory() {
3332
* @param executorService the executor to configure the event loop group
3433
* @return a instance of a {@link ManagedChannelWrapper}
3534
*/
36-
public static ManagedChannelWrapper newChannel(@NonNull URI address, ExecutorService executorService) {
37-
val scheme = address.getScheme();
35+
public static ManagedChannelWrapper newChannel(URI address, ExecutorService executorService) {
36+
Objects.requireNonNull(address, "address must not be null");
37+
38+
String scheme = address.getScheme();
3839
ManagedChannelWrapper result;
3940
switch (scheme) {
4041
case UNIX_SCHEME:
@@ -50,22 +51,22 @@ public static ManagedChannelWrapper newChannel(@NonNull URI address, ExecutorSer
5051
}
5152

5253
// Create a Native Socket Channel pointing to the spiffeSocketPath
53-
private static ManagedChannelWrapper createNativeSocketChannel(@NonNull URI address, ExecutorService executorService) {
54+
private static ManagedChannelWrapper createNativeSocketChannel(URI address, ExecutorService executorService) {
5455
NettyChannelBuilder channelBuilder = NettyChannelBuilder.
5556
forAddress(new DomainSocketAddress(address.getPath()));
5657
EventLoopGroup eventLoopGroup = configureNativeSocketChannel(channelBuilder, executorService);
5758
ManagedChannel managedChannel = channelBuilder.usePlaintext().build();
5859
return new ManagedChannelWrapper(managedChannel, eventLoopGroup);
5960
}
6061

61-
private static ManagedChannelWrapper createTcpChannel(@NonNull URI address) {
62+
private static ManagedChannelWrapper createTcpChannel(URI address) {
6263
ManagedChannel managedChannel = NettyChannelBuilder.forAddress(address.getHost(), address.getPort())
6364
.negotiationType(NegotiationType.PLAINTEXT)
6465
.build();
6566
return new ManagedChannelWrapper(managedChannel);
6667
}
6768

68-
private static EventLoopGroup configureNativeSocketChannel(@NonNull NettyChannelBuilder channelBuilder, ExecutorService executorService) {
69+
private static EventLoopGroup configureNativeSocketChannel(NettyChannelBuilder channelBuilder, ExecutorService executorService) {
6970
if (SystemUtils.IS_OS_LINUX) {
7071
// nThreads = 0 -> use Netty default
7172
EpollEventLoopGroup epollEventLoopGroup = new EpollEventLoopGroup(0, executorService);

java-spiffe-core/grpc-netty-macos-aarch64/src/main/java/io/spiffe/workloadapi/internal/GrpcManagedChannelFactory.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
import io.netty.channel.kqueue.KQueueDomainSocketChannel;
99
import io.netty.channel.kqueue.KQueueEventLoopGroup;
1010
import io.netty.channel.unix.DomainSocketAddress;
11-
import lombok.NonNull;
12-
import lombok.val;
1311
import org.apache.commons.lang3.SystemUtils;
1412

1513
import java.net.URI;
14+
import java.util.Objects;
1615
import java.util.concurrent.ExecutorService;
1716

1817
/**
@@ -33,8 +32,10 @@ private GrpcManagedChannelFactory() {
3332
* @param executorService the executor to configure the event loop group
3433
* @return a instance of a {@link ManagedChannelWrapper}
3534
*/
36-
public static ManagedChannelWrapper newChannel(@NonNull URI address, ExecutorService executorService) {
37-
val scheme = address.getScheme();
35+
public static ManagedChannelWrapper newChannel(URI address, ExecutorService executorService) {
36+
Objects.requireNonNull(address, "address must not be null");
37+
38+
String scheme = address.getScheme();
3839
ManagedChannelWrapper result;
3940
switch (scheme) {
4041
case UNIX_SCHEME:
@@ -50,22 +51,22 @@ public static ManagedChannelWrapper newChannel(@NonNull URI address, ExecutorSer
5051
}
5152

5253
// Create a Native Socket Channel pointing to the spiffeSocketPath
53-
private static ManagedChannelWrapper createNativeSocketChannel(@NonNull URI address, ExecutorService executorService) {
54+
private static ManagedChannelWrapper createNativeSocketChannel(URI address, ExecutorService executorService) {
5455
NettyChannelBuilder channelBuilder = NettyChannelBuilder.
5556
forAddress(new DomainSocketAddress(address.getPath()));
5657
EventLoopGroup eventLoopGroup = configureNativeSocketChannel(channelBuilder, executorService);
5758
ManagedChannel managedChannel = channelBuilder.usePlaintext().build();
5859
return new ManagedChannelWrapper(managedChannel, eventLoopGroup);
5960
}
6061

61-
private static ManagedChannelWrapper createTcpChannel(@NonNull URI address) {
62+
private static ManagedChannelWrapper createTcpChannel(URI address) {
6263
ManagedChannel managedChannel = NettyChannelBuilder.forAddress(address.getHost(), address.getPort())
6364
.negotiationType(NegotiationType.PLAINTEXT)
6465
.build();
6566
return new ManagedChannelWrapper(managedChannel);
6667
}
6768

68-
private static EventLoopGroup configureNativeSocketChannel(@NonNull NettyChannelBuilder channelBuilder, ExecutorService executorService) {
69+
private static EventLoopGroup configureNativeSocketChannel(NettyChannelBuilder channelBuilder, ExecutorService executorService) {
6970
if (SystemUtils.IS_OS_MAC) {
7071
// nThreads = 0 -> use Netty default
7172
KQueueEventLoopGroup eventLoopGroup = new KQueueEventLoopGroup(0, executorService);

java-spiffe-core/grpc-netty-macos/src/main/java/io/spiffe/workloadapi/internal/GrpcManagedChannelFactory.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
import io.netty.channel.kqueue.KQueueDomainSocketChannel;
99
import io.netty.channel.kqueue.KQueueEventLoopGroup;
1010
import io.netty.channel.unix.DomainSocketAddress;
11-
import lombok.NonNull;
12-
import lombok.val;
1311
import org.apache.commons.lang3.SystemUtils;
1412

1513
import java.net.URI;
14+
import java.util.Objects;
1615
import java.util.concurrent.ExecutorService;
1716

1817
/**
@@ -33,8 +32,10 @@ private GrpcManagedChannelFactory() {
3332
* @param executorService the executor to configure the event loop group
3433
* @return a instance of a {@link ManagedChannelWrapper}
3534
*/
36-
public static ManagedChannelWrapper newChannel(@NonNull URI address, ExecutorService executorService) {
37-
val scheme = address.getScheme();
35+
public static ManagedChannelWrapper newChannel(URI address, ExecutorService executorService) {
36+
Objects.requireNonNull(address, "address must not be null");
37+
38+
String scheme = address.getScheme();
3839
ManagedChannelWrapper result;
3940
switch (scheme) {
4041
case UNIX_SCHEME:
@@ -50,22 +51,22 @@ public static ManagedChannelWrapper newChannel(@NonNull URI address, ExecutorSer
5051
}
5152

5253
// Create a Native Socket Channel pointing to the spiffeSocketPath
53-
private static ManagedChannelWrapper createNativeSocketChannel(@NonNull URI address, ExecutorService executorService) {
54+
private static ManagedChannelWrapper createNativeSocketChannel(URI address, ExecutorService executorService) {
5455
NettyChannelBuilder channelBuilder = NettyChannelBuilder.
5556
forAddress(new DomainSocketAddress(address.getPath()));
5657
EventLoopGroup eventLoopGroup = configureNativeSocketChannel(channelBuilder, executorService);
5758
ManagedChannel managedChannel = channelBuilder.usePlaintext().build();
5859
return new ManagedChannelWrapper(managedChannel, eventLoopGroup);
5960
}
6061

61-
private static ManagedChannelWrapper createTcpChannel(@NonNull URI address) {
62+
private static ManagedChannelWrapper createTcpChannel(URI address) {
6263
ManagedChannel managedChannel = NettyChannelBuilder.forAddress(address.getHost(), address.getPort())
6364
.negotiationType(NegotiationType.PLAINTEXT)
6465
.build();
6566
return new ManagedChannelWrapper(managedChannel);
6667
}
6768

68-
private static EventLoopGroup configureNativeSocketChannel(@NonNull NettyChannelBuilder channelBuilder, ExecutorService executorService) {
69+
private static EventLoopGroup configureNativeSocketChannel(NettyChannelBuilder channelBuilder, ExecutorService executorService) {
6970
if (SystemUtils.IS_OS_MAC) {
7071
// nThreads = 0 -> use Netty default
7172
KQueueEventLoopGroup eventLoopGroup = new KQueueEventLoopGroup(0, executorService);

java-spiffe-core/src/main/java/io/spiffe/bundle/BundleSource.java

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

44
import io.spiffe.exception.BundleNotFoundException;
55
import io.spiffe.spiffeid.TrustDomain;
6-
import lombok.NonNull;
76

87
/**
98
* Represents a source of bundles of type T keyed by trust domain.
@@ -17,5 +16,5 @@ public interface BundleSource<T> {
1716
* @return the a bundle of type T for the given trust domain
1817
* @throws BundleNotFoundException if no bundle is found for the given trust domain
1918
*/
20-
T getBundleForTrustDomain(@NonNull final TrustDomain trustDomain) throws BundleNotFoundException;
19+
T getBundleForTrustDomain(TrustDomain trustDomain) throws BundleNotFoundException;
2120
}

0 commit comments

Comments
 (0)