Skip to content

Commit

Permalink
Migrate to jakarta
Browse files Browse the repository at this point in the history
Follow up of #9253, migrate all annotations to jakarta
  • Loading branch information
snazy committed Aug 21, 2024
1 parent f079491 commit c0722ec
Show file tree
Hide file tree
Showing 251 changed files with 766 additions and 1,800 deletions.
1 change: 0 additions & 1 deletion api/client-testextension/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ dependencies {

// javax/jakarta
compileOnly(libs.jakarta.annotation.api)
compileOnly(libs.findbugs.jsr305)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.projectnessie.client.ext;

import javax.annotation.Nonnull;
import jakarta.annotation.Nonnull;
import org.projectnessie.client.api.NessieApiV1;

/**
Expand All @@ -30,12 +30,10 @@ public interface NessieClientFactory {
NessieApiVersion apiVersion();

@Nonnull
@jakarta.annotation.Nonnull
default NessieApiV1 make() {
return make((builder, version) -> builder);
}

@Nonnull
@jakarta.annotation.Nonnull
NessieApiV1 make(NessieClientCustomizer customizer);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import static org.projectnessie.client.NessieClientBuilder.createClientBuilderFromSystemSettings;
import static org.projectnessie.client.ext.MultiVersionApiTest.apiVersion;

import jakarta.annotation.Nonnull;
import java.io.Serializable;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.api.extension.ParameterResolutionException;
Expand Down Expand Up @@ -132,7 +132,6 @@ private NessieClientFactory clientFactoryForContext(ExtensionContext extensionCo

return new ClientFactory(uri, mainConfigSource, apiVersion, responseFactoryClass) {
@Nonnull
@jakarta.annotation.Nonnull
@Override // Note: this object is not serializable
public NessieApiV1 make(NessieClientCustomizer customizer) {
return super.make(
Expand Down Expand Up @@ -171,7 +170,6 @@ public NessieApiVersion apiVersion() {
}

@Nonnull
@jakarta.annotation.Nonnull
@Override
public NessieApiV1 make(NessieClientCustomizer customizer) {
NessieClientBuilder clientBuilder =
Expand Down
15 changes: 5 additions & 10 deletions api/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ dependencies {

// javax/jakarta
compileOnly(libs.jakarta.annotation.api)
compileOnly(libs.findbugs.jsr305)
compileOnly(libs.jakarta.validation.api)
compileOnly(libs.javax.validation.api)
compileOnly(libs.jakarta.ws.rs.api)
compileOnly(libs.javax.ws.rs)

compileOnly(libs.httpclient5)

Expand All @@ -47,9 +44,8 @@ dependencies {

compileOnly(project(":nessie-doc-generator-annotations"))

compileOnly(libs.immutables.builder)
compileOnly(libs.immutables.value.annotations)
annotationProcessor(libs.immutables.value.processor)
compileOnly(project(":nessie-immutables-std"))
annotationProcessor(project(":nessie-immutables-std", configuration = "processor"))

testFixturesApi(libs.guava)
testFixturesApi(libs.bouncycastle.bcprov)
Expand Down Expand Up @@ -87,9 +83,8 @@ dependencies {

testRuntimeOnly(libs.logback.classic)

testCompileOnly(libs.immutables.builder)
testCompileOnly(libs.immutables.value.annotations)
testAnnotationProcessor(libs.immutables.value.processor)
testCompileOnly(project(":nessie-immutables-std"))
testAnnotationProcessor(project(":nessie-immutables-std", configuration = "processor"))

intTestImplementation(platform(libs.testcontainers.bom))
intTestImplementation("org.testcontainers:testcontainers")
Expand All @@ -99,7 +94,7 @@ dependencies {
exclude(group = "org.slf4j") // uses SLF4J 2.x, we are not ready yet
}
intTestImplementation(project(":nessie-container-spec-helper"))
intTestCompileOnly(libs.immutables.value.annotations)
intTestCompileOnly(project(":nessie-immutables-std"))
}

jandex { skipDefaultProcessing() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import static org.projectnessie.client.config.NessieClientConfigSources.systemPropertiesConfigSource;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import jakarta.annotation.Nonnull;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -47,7 +48,6 @@
import java.util.concurrent.CompletionStage;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.net.ssl.SNIHostName;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;
Expand Down Expand Up @@ -265,7 +265,6 @@ static NessieClientBuilder createClientBuilderFromSystemSettings(
* implementation class could be found
*/
@Nonnull
@jakarta.annotation.Nonnull
static NessieClientBuilder createClientBuilder(String clientName, String clientBuilderImpl) {
ServiceLoader<NessieClientBuilder> implementations =
ServiceLoader.load(NessieClientBuilder.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.projectnessie.client.api;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.projectnessie.error.NessieConflictException;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.Branch;
Expand All @@ -28,9 +28,7 @@
* @since {@link NessieApiV1}
*/
public interface AssignBranchBuilder extends OnBranchBuilder<AssignBranchBuilder> {
AssignBranchBuilder assignTo(
@Valid @jakarta.validation.Valid @NotNull @jakarta.validation.constraints.NotNull
Reference assignTo);
AssignBranchBuilder assignTo(@Valid @NotNull Reference assignTo);

void assign() throws NessieNotFoundException, NessieConflictException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.projectnessie.client.api;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.projectnessie.error.NessieConflictException;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.Branch;
Expand Down Expand Up @@ -49,9 +49,7 @@ default <R extends Reference> AssignReferenceBuilder<R> reference(R reference) {
return (AssignReferenceBuilder<R>) ChangeReferenceBuilder.super.reference(reference);
}

AssignReferenceBuilder<T> assignTo(
@Valid @jakarta.validation.Valid @NotNull @jakarta.validation.constraints.NotNull
Reference assignTo);
AssignReferenceBuilder<T> assignTo(@Valid @NotNull Reference assignTo);

void assign() throws NessieNotFoundException, NessieConflictException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.projectnessie.client.api;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.projectnessie.error.NessieConflictException;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.Reference;
Expand All @@ -28,9 +28,7 @@
* @since {@link NessieApiV1}
*/
public interface AssignTagBuilder extends OnTagBuilder<AssignTagBuilder> {
AssignTagBuilder assignTo(
@Valid @jakarta.validation.Valid @NotNull @jakarta.validation.constraints.NotNull
Reference assignTo);
AssignTagBuilder assignTo(@Valid @NotNull Reference assignTo);

void assign() throws NessieNotFoundException, NessieConflictException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package org.projectnessie.client.api;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import org.projectnessie.error.NessieConflictException;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.Branch;
Expand Down Expand Up @@ -88,9 +88,6 @@ public interface CreateReferenceBuilder {
*/
CreateReferenceBuilder sourceRefName(
@Pattern(regexp = Validation.REF_NAME_REGEX, message = Validation.REF_NAME_MESSAGE)
@jakarta.validation.constraints.Pattern(
regexp = Validation.REF_NAME_REGEX,
message = Validation.REF_NAME_MESSAGE)
String sourceRefName);

/**
Expand All @@ -106,9 +103,7 @@ CreateReferenceBuilder sourceRefName(
* @param reference is {@link Branch} or {@link Tag} defining the name and hash for the new
* reference-to-be-created.
*/
CreateReferenceBuilder reference(
@Valid @jakarta.validation.Valid @NotNull @jakarta.validation.constraints.NotNull
Reference reference);
CreateReferenceBuilder reference(@Valid @NotNull Reference reference);

Reference create() throws NessieNotFoundException, NessieConflictException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.projectnessie.client.api;

import javax.annotation.Nullable;
import javax.validation.constraints.Pattern;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.Pattern;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.FetchOption;
import org.projectnessie.model.LogResponse;
Expand Down Expand Up @@ -47,12 +47,7 @@ default GetCommitLogBuilder fetch(org.projectnessie.api.params.FetchOption fetch
}

GetCommitLogBuilder untilHash(
@Nullable
@jakarta.annotation.Nullable
@Pattern(regexp = Validation.HASH_REGEX, message = Validation.HASH_MESSAGE)
@jakarta.validation.constraints.Pattern(
regexp = Validation.HASH_REGEX,
message = Validation.HASH_MESSAGE)
@Nullable @Pattern(regexp = Validation.HASH_REGEX, message = Validation.HASH_MESSAGE)
String untilHash);

@Override // kept for byte-code compatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package org.projectnessie.client.api;

import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
import javax.validation.Valid;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.Content;
import org.projectnessie.model.ContentKey;
Expand All @@ -30,7 +30,7 @@
* @since {@link NessieApiV1}
*/
public interface GetContentBuilder extends OnReferenceBuilder<GetContentBuilder> {
GetContentBuilder key(@Valid @jakarta.validation.Valid ContentKey key);
GetContentBuilder key(@Valid ContentKey key);

GetContentBuilder keys(List<ContentKey> keys);

Expand All @@ -46,8 +46,7 @@ default GetContentBuilder forWrite(boolean forWrite) {
return this;
}

ContentResponse getSingle(@Valid @jakarta.validation.Valid ContentKey key)
throws NessieNotFoundException;
ContentResponse getSingle(@Valid ContentKey key) throws NessieNotFoundException;

Map<ContentKey, Content> get() throws NessieNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@
*/
package org.projectnessie.client.api;

import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import org.immutables.value.Value;
import org.projectnessie.model.Namespace;
import org.projectnessie.model.Reference;

@Value.Immutable
public interface GetNamespaceResult {
@NotNull
@jakarta.validation.constraints.NotNull
@Value.Parameter(order = 1)
Namespace getNamespace();

@Nullable
@jakarta.annotation.Nullable
@Value.Parameter(order = 2)
Reference getEffectiveReference();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.projectnessie.client.api;

import javax.annotation.Nullable;
import javax.validation.constraints.Pattern;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.Pattern;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.RefLogResponse;
import org.projectnessie.model.Validation;
Expand All @@ -38,25 +38,15 @@ public interface GetRefLogBuilder
* reflog.
*/
GetRefLogBuilder untilHash(
@Nullable
@jakarta.annotation.Nullable
@Pattern(regexp = Validation.HASH_REGEX, message = Validation.HASH_MESSAGE)
@jakarta.validation.constraints.Pattern(
regexp = Validation.HASH_REGEX,
message = Validation.HASH_MESSAGE)
@Nullable @Pattern(regexp = Validation.HASH_REGEX, message = Validation.HASH_MESSAGE)
String untilHash);

/**
* Hash of the reflog (inclusive) to end at (in chronological sense), the 'near' end of the
* reflog.
*/
GetRefLogBuilder fromHash(
@Nullable
@jakarta.annotation.Nullable
@Pattern(regexp = Validation.HASH_REGEX, message = Validation.HASH_MESSAGE)
@jakarta.validation.constraints.Pattern(
regexp = Validation.HASH_REGEX,
message = Validation.HASH_MESSAGE)
@Nullable @Pattern(regexp = Validation.HASH_REGEX, message = Validation.HASH_MESSAGE)
String fromHash);

@Override // kept for byte-code compatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.projectnessie.client.api;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.FetchOption;
import org.projectnessie.model.Reference;
Expand All @@ -29,12 +29,7 @@
*/
public interface GetReferenceBuilder {
GetReferenceBuilder refName(
@NotNull
@jakarta.validation.constraints.NotNull
@Pattern(regexp = Validation.REF_NAME_REGEX, message = Validation.REF_NAME_MESSAGE)
@jakarta.validation.constraints.Pattern(
regexp = Validation.REF_NAME_REGEX,
message = Validation.REF_NAME_MESSAGE)
@NotNull @Pattern(regexp = Validation.REF_NAME_REGEX, message = Validation.REF_NAME_MESSAGE)
String refName);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.projectnessie.client.api;

import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;
import org.projectnessie.error.NessieConflictException;
import org.projectnessie.error.NessieNotFoundException;
import org.projectnessie.model.CommitMeta;
Expand Down Expand Up @@ -51,8 +51,7 @@ public interface MergeReferenceBuilder extends MergeTransplantBuilder<MergeRefer
*/
MergeReferenceBuilder commitMeta(CommitMeta commitMeta);

MergeReferenceBuilder fromHash(
@NotBlank @jakarta.validation.constraints.NotBlank String fromHash);
MergeReferenceBuilder fromHash(@NotBlank String fromHash);

/**
* Convenience for {@link #fromRefName(String) fromRefName(fromRef.getName())}{@code .}{@link
Expand Down
Loading

0 comments on commit c0722ec

Please sign in to comment.