Skip to content

Commit

Permalink
Add missing @OverRide annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Feb 9, 2024
1 parent fd825f9 commit fc9a7d8
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ public interface Dependency extends Artifact {
* @return a {@link DependencyCoordinate}
*/
@Nonnull
@Override
DependencyCoordinate toCoordinate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,52 +181,64 @@ private boolean empty(String value) {
return (value == null) || (value.trim().length() < 1);
}

@Override
public String getClassifier() {
return classifier;
}

@Override
public boolean hasClassifier() {
return classifier != null && !classifier.isEmpty();
}

@Override
public String getScope() {
return scope;
}

@Override
public String getGroupId() {
return groupId;
}

@Override
public String getArtifactId() {
return artifactId;
}

@Override
public String getVersion() {
return version;
}

@Override
public void setVersion(String version) {
this.version = version;
setBaseVersionInternal(version);
versionRange = null;
}

@Override
public String getType() {
return type;
}

@Override
public void setFile(File file) {
this.file = file;
}

@Override
public File getFile() {
return file;
}

@Override
public ArtifactRepository getRepository() {
return repository;
}

@Override
public void setRepository(ArtifactRepository repository) {
this.repository = repository;
}
Expand All @@ -235,10 +247,12 @@ public void setRepository(ArtifactRepository repository) {
//
// ----------------------------------------------------------------------

@Override
public String getId() {
return getDependencyConflictId() + ":" + getBaseVersion();
}

@Override
public String getDependencyConflictId() {
StringBuilder sb = new StringBuilder(128);
sb.append(getGroupId());
Expand All @@ -257,6 +271,7 @@ private void appendArtifactTypeClassifierString(StringBuilder sb) {
}
}

@Override
public void addMetadata(ArtifactMetadata metadata) {
if (metadataMap == null) {
metadataMap = new HashMap<>();
Expand All @@ -270,6 +285,7 @@ public void addMetadata(ArtifactMetadata metadata) {
}
}

@Override
public Collection<ArtifactMetadata> getMetadataList() {
if (metadataMap == null) {
return Collections.emptyList();
Expand All @@ -282,6 +298,7 @@ public Collection<ArtifactMetadata> getMetadataList() {
// Object overrides
// ----------------------------------------------------------------------

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
if (getGroupId() != null) {
Expand Down Expand Up @@ -323,6 +340,7 @@ public int hashCode() {
return Objects.hash(groupId, artifactId, type, classifier, version);
}

@Override
public String getBaseVersion() {
if (baseVersion == null && version != null) {
setBaseVersionInternal(version);
Expand All @@ -339,6 +357,7 @@ protected String getBaseVersionInternal() {
return baseVersion;
}

@Override
public void setBaseVersion(String baseVersion) {
setBaseVersionInternal(baseVersion);
}
Expand All @@ -347,6 +366,7 @@ protected void setBaseVersionInternal(String baseVersion) {
this.baseVersion = ArtifactUtils.toSnapshotVersion(baseVersion);
}

@Override
public int compareTo(Artifact a) {
int result = groupId.compareTo(a.getGroupId());
if (result == 0) {
Expand Down Expand Up @@ -376,47 +396,58 @@ public int compareTo(Artifact a) {
return result;
}

@Override
public void updateVersion(String version, ArtifactRepository localRepository) {
setResolvedVersion(version);
setFile(new File(localRepository.getBasedir(), localRepository.pathOf(this)));
}

@Override
public String getDownloadUrl() {
return downloadUrl;
}

@Override
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}

@Override
public ArtifactFilter getDependencyFilter() {
return dependencyFilter;
}

@Override
public void setDependencyFilter(ArtifactFilter artifactFilter) {
dependencyFilter = artifactFilter;
}

@Override
public ArtifactHandler getArtifactHandler() {
return artifactHandler;
}

@Override
public List<String> getDependencyTrail() {
return dependencyTrail;
}

@Override
public void setDependencyTrail(List<String> dependencyTrail) {
this.dependencyTrail = dependencyTrail;
}

@Override
public void setScope(String scope) {
this.scope = scope;
}

@Override
public VersionRange getVersionRange() {
return versionRange;
}

@Override
public void setVersionRange(VersionRange versionRange) {
this.versionRange = versionRange;
selectVersionFromNewRangeIfAvailable();
Expand All @@ -431,70 +462,86 @@ private void selectVersionFromNewRangeIfAvailable() {
}
}

@Override
public void selectVersion(String version) {
this.version = version;
setBaseVersionInternal(version);
}

@Override
public void setGroupId(String groupId) {
this.groupId = groupId;
}

@Override
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}

@Override
public boolean isSnapshot() {
return getBaseVersion() != null
&& (getBaseVersion().endsWith(SNAPSHOT_VERSION)
|| getBaseVersion().equals(LATEST_VERSION));
}

@Override
public void setResolved(boolean resolved) {
this.resolved = resolved;
}

@Override
public boolean isResolved() {
return resolved;
}

@Override
public void setResolvedVersion(String version) {
this.version = version;
// retain baseVersion
}

@Override
public void setArtifactHandler(ArtifactHandler artifactHandler) {
this.artifactHandler = artifactHandler;
}

@Override
public void setRelease(boolean release) {
this.release = release;
}

@Override
public boolean isRelease() {
return release;
}

@Override
public List<ArtifactVersion> getAvailableVersions() {
return availableVersions;
}

@Override
public void setAvailableVersions(List<ArtifactVersion> availableVersions) {
this.availableVersions = availableVersions;
}

@Override
public boolean isOptional() {
return optional;
}

@Override
public ArtifactVersion getSelectedVersion() throws OverConstrainedVersionException {
return versionRange.getSelectedVersion(this);
}

@Override
public boolean isSelectedVersionKnown() throws OverConstrainedVersionException {
return versionRange.isSelectedVersionKnown(this);
}

@Override
public void setOptional(boolean optional) {
this.optional = optional;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void setExtension(String extension) {
this.extension = extension;
}

@Override
public String getExtension() {
return extension;
}
Expand All @@ -35,6 +36,7 @@ public void setDirectory(String directory) {
this.directory = directory;
}

@Override
public String getDirectory() {
return directory;
}
Expand All @@ -43,6 +45,7 @@ public void setClassifier(String classifier) {
this.classifier = classifier;
}

@Override
public String getClassifier() {
return classifier;
}
Expand All @@ -51,6 +54,7 @@ public void setPackaging(String packaging) {
this.packaging = packaging;
}

@Override
public String getPackaging() {
return packaging;
}
Expand All @@ -59,6 +63,7 @@ public void setIncludesDependencies(boolean includesDependencies) {
this.includesDependencies = includesDependencies;
}

@Override
public boolean isIncludesDependencies() {
return includesDependencies;
}
Expand All @@ -67,6 +72,7 @@ public void setLanguage(String language) {
this.language = language;
}

@Override
public String getLanguage() {
return language;
}
Expand All @@ -75,6 +81,7 @@ public void setAddedToClasspath(boolean addedToClasspath) {
this.addedToClasspath = addedToClasspath;
}

@Override
public boolean isAddedToClasspath() {
return addedToClasspath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,37 @@ public TestArtifactHandler(String type, String extension) {
this.extension = extension;
}

@Override
public String getClassifier() {
return null;
}

@Override
public String getDirectory() {
return getPackaging() + "s";
}

@Override
public String getExtension() {
return extension;
}

@Override
public String getLanguage() {
return "java";
}

@Override
public String getPackaging() {
return type;
}

@Override
public boolean isAddedToClasspath() {
return true;
}

@Override
public boolean isIncludesDependencies() {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void onEvent(Object event) {
}
}

@Override
public ArtifactHandler getArtifactHandler(String id) {
return allHandlers.computeIfAbsent(id, k -> {
Type type = typeRegistry.require(id);
Expand All @@ -79,6 +80,7 @@ public ArtifactHandler getArtifactHandler(String id) {
// but to create those, proper filtering should happen via Type properties.
}

@Override
public void addHandlers(Map<String, ArtifactHandler> handlers) {
throw new UnsupportedOperationException("Adding handlers programmatically is not supported anymore");
}
Expand Down
Loading

0 comments on commit fc9a7d8

Please sign in to comment.