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

[MRESOLVER-542] Reduce usage of final classes #479

Merged
merged 1 commit into from
Apr 26, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* Internal utility methods.
*/
public final class Utils {
private Utils() {}

private static PrioritizedComponents<ArtifactDecoratorFactory> sortArtifactDecoratorFactories(
RepositorySystemSession session, Map<String, ArtifactDecoratorFactory> factories) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
/**
* A simple artifact type registry.
*/
public final class DefaultArtifactTypeRegistry extends SimpleArtifactTypeRegistry {
public class DefaultArtifactTypeRegistry extends SimpleArtifactTypeRegistry {

/**
* Creates a new artifact type registry with initally no registered artifact types. Use {@link #add(ArtifactType)}
* Creates a new artifact type registry with initially no registered artifact types. Use {@link #add(ArtifactType)}
* to populate the registry.
*/
public DefaultArtifactTypeRegistry() {}
Expand All @@ -37,6 +37,7 @@ public DefaultArtifactTypeRegistry() {}
* @param type The artifact type to add, must not be {@code null}.
* @return This registry for chaining, never {@code null}.
*/
@Override
public DefaultArtifactTypeRegistry add(ArtifactType type) {
super.add(type);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,17 @@ public Artifact setPath(Path path) {
return this;
}

@Override
public String getProperty(String key, String defaultValue) {
return delegate.getProperty(key, defaultValue);
}

@Override
public Map<String, String> getProperties() {
return delegate.getProperties();
}

@Override
public Artifact setProperties(Map<String, String> properties) {
Artifact artifact = delegate.setProperties(properties);
if (artifact != delegate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* An artifact type registry which first consults its own mappings and in case of an unknown type falls back to another
* type registry.
*/
public final class OverlayArtifactTypeRegistry extends SimpleArtifactTypeRegistry {
public class OverlayArtifactTypeRegistry extends SimpleArtifactTypeRegistry {

private final ArtifactTypeRegistry delegate;

Expand All @@ -45,11 +45,13 @@ public OverlayArtifactTypeRegistry(ArtifactTypeRegistry delegate) {
* @param type The artifact type to add, must not be {@code null}.
* @return This registry for chaining, never {@code null}.
*/
@Override
public OverlayArtifactTypeRegistry add(ArtifactType type) {
super.add(type);
return this;
}

@Override
public ArtifactType get(String typeId) {
ArtifactType type = super.get(typeId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public SimpleArtifactTypeRegistry add(ArtifactType type) {
return this;
}

@Override
public ArtifactType get(String typeId) {
return types.get(typeId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public static DependencyGraphTransformer newInstance(
return new ChainedDependencyGraphTransformer(transformer1, transformer2);
}

@Override
public DependencyNode transformGraph(DependencyNode node, DependencyGraphTransformationContext context)
throws RepositoryException {
requireNonNull(node, "node cannot be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
*/
public final class ConflictIdSorter implements DependencyGraphTransformer {

@Override
public DependencyNode transformGraph(DependencyNode node, DependencyGraphTransformationContext context)
throws RepositoryException {
requireNonNull(node, "node cannot be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public final class NoopDependencyGraphTransformer implements DependencyGraphTran
*/
public NoopDependencyGraphTransformer() {}

@Override
public DependencyNode transformGraph(DependencyNode node, DependencyGraphTransformationContext context)
throws RepositoryException {
requireNonNull(node, "node cannot be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public static DependencyTraverser newInstance(DependencyTraverser traverser1, De
return new AndDependencyTraverser(traverser1, traverser2);
}

@Override
public boolean traverseDependency(Dependency dependency) {
requireNonNull(dependency, "dependency cannot be null");
for (DependencyTraverser traverser : traversers) {
Expand All @@ -102,6 +103,7 @@ public boolean traverseDependency(Dependency dependency) {
return true;
}

@Override
public DependencyTraverser deriveChildTraverser(DependencyCollectionContext context) {
requireNonNull(context, "context cannot be null");
int seen = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ public StaticDependencyTraverser(boolean traverse) {
this.traverse = traverse;
}

@Override
public boolean traverseDependency(Dependency dependency) {
requireNonNull(dependency, "dependency cannot be null");
return traverse;
}

@Override
public DependencyTraverser deriveChildTraverser(DependencyCollectionContext context) {
requireNonNull(context, "context cannot be null");
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* respectively, until the kind mismatch is resolved, e.g. "1-alpha" = "1.0.0-alpha" &lt; "1.0.1-ga" = "1.0.1".
* </p>
*/
public final class GenericVersionScheme extends VersionSchemeSupport {
public class GenericVersionScheme extends VersionSchemeSupport {
@Override
public GenericVersion parseVersion(final String version) throws InvalidVersionSpecificationException {
return new GenericVersion(version);
Expand Down