Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update InternalApiBoundaryTest to skip flagging the use of protected APIs that are in internal package #5774

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@

import java.util.List;
import java.util.Map;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.annotations.SdkProtectedApi;
import software.amazon.awssdk.protocols.jsoncore.JsonNode;
import software.amazon.awssdk.protocols.jsoncore.JsonNodeVisitor;

/**
* A null {@link JsonNode}.
*
* <p>
* Implementation notes: this class should've been outside internal package,
* but we can't fix it due to backwards compatibility reasons.
*/
@SdkInternalApi
@SdkProtectedApi
public final class NullJsonNode implements JsonNode {
private static final NullJsonNode INSTANCE = new NullJsonNode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Class <software.amazon.awssdk.core.internal.util.MetricUtils> does not reside ou
Class <software.amazon.awssdk.core.internal.waiters.ResponseOrException> does not reside outside of package '..internal..' in (ResponseOrException.java:0)
Class <software.amazon.awssdk.core.internal.waiters.WaiterAttribute> does not reside outside of package '..internal..' in (WaiterAttribute.java:0)
Class <software.amazon.awssdk.http.nio.netty.internal.DnsResolverLoader> does not reside outside of package '..internal..' in (DnsResolverLoader.java:0)
Class <software.amazon.awssdk.protocols.jsoncore.internal.NullJsonNode> does not reside outside of package '..internal..' in (NullJsonNode.java:0)
Class <software.amazon.awssdk.retries.api.internal.backoff.ExponentialDelayWithHalfJitter> does not reside outside of package '..internal..' in (ExponentialDelayWithHalfJitter.java:0)
Class <software.amazon.awssdk.retries.internal.DefaultAwareRetryStrategy> does not reside outside of package '..internal..' in (DefaultAwareRetryStrategy.java:0)
Class <software.amazon.awssdk.retries.internal.RetryStrategyDefaults> does not reside outside of package '..internal..' in (RetryStrategyDefaults.java:0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import java.util.Set;
import java.util.stream.Collectors;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.annotations.SdkProtectedApi;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.core.internal.interceptor.trait.RequestCompression;
Expand Down Expand Up @@ -92,7 +94,9 @@ public void check(JavaClass item, ConditionEvents events) {
}

if (JavaClass.Predicates.resideInAPackage("software.amazon.awssdk..internal..").test(dependencyTargetClass)) {
if (!ArchUtils.resideInSameRootPackage(packageName, dependencyPackageName)) {
if (!ArchUtils.resideInSameRootPackage(packageName, dependencyPackageName) &&
// Ignore if the dependency class is not annotated with SdkInternalApi since it's an exception case
dependencyTargetClass.isAnnotatedWith(SdkInternalApi.class)) {
String errorMessage = String.format("%s depends on an internal API from a different module (%s)",
item.getDescription(),
dependencyTargetClass.getDescription());
Expand Down
Loading