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

Remove unnecessary synchronization in AbstractVersionDetails #882

Merged
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 @@ -58,22 +58,14 @@ public abstract class AbstractVersionDetails implements VersionDetails {
+ "[-.]?(\\d{0,2}[a-z]?|\\d{6}\\.\\d{4})|\\d{8}(?:\\.?\\d{6})?)$");

/**
* The current version. Guarded by {@link #currentVersionLock}.
* Current version of the dependency artifact.
*
* @since 1.0-beta-1
*/
private ArtifactVersion currentVersion = null;

protected boolean verboseDetail = true;

/**
* Not sure if we need to be thread safe, but there's no harm being careful, after all we could be invoked from an
* IDE.
*
* @since 1.0-beta-1
*/
private final Object currentVersionLock = new Object();

protected AbstractVersionDetails() {}

@Override
Expand Down Expand Up @@ -121,16 +113,12 @@ public final boolean isCurrentVersionDefined() {

@Override
public final ArtifactVersion getCurrentVersion() {
synchronized (currentVersionLock) {
return currentVersion;
}
return currentVersion;
}

@Override
public final void setCurrentVersion(ArtifactVersion currentVersion) {
synchronized (currentVersionLock) {
this.currentVersion = currentVersion;
}
this.currentVersion = currentVersion;
}

@Override
Expand Down