Skip to content

Commit 8137254

Browse files
author
Vincent Potucek
committed
inline variable
1 parent 29d00bd commit 8137254

File tree

31 files changed

+75
-141
lines changed

31 files changed

+75
-141
lines changed

compat/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,7 @@ public boolean checkOutOfDate(Date lastModified) {
132132

133133
@Override
134134
public String toString() {
135-
String buffer = "{enabled=" +
136-
enabled +
137-
", checksums=" +
138-
checksumPolicy +
139-
", updates=" +
140-
updatePolicy +
141-
'}';
142-
return buffer;
135+
return "{enabled=" + enabled + ", checksums=" + checksumPolicy + ", updates=" + updatePolicy + '}';
143136
}
144137

145138
public void merge(ArtifactRepositoryPolicy policy) {

compat/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,10 @@ public void merge(ArtifactMetadata metadata) {
160160

161161
public String extendedToString() {
162162

163-
String buffer = LS + "Repository Metadata" + LS + "--------------------------" +
164-
LS + "GroupId: " + getGroupId() +
165-
LS + "ArtifactId: " + getArtifactId() +
166-
LS + "Metadata Type: " + getClass().getName();
167-
168-
return buffer;
163+
return LS + "Repository Metadata" + LS + "--------------------------" + LS
164+
+ "GroupId: " + getGroupId() + LS
165+
+ "ArtifactId: " + getArtifactId() + LS
166+
+ "Metadata Type: " + getClass().getName();
169167
}
170168

171169
public int getNature() {

compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,18 @@ public boolean isResolveTransitively() {
207207
}
208208

209209
public String toString() {
210-
String sb = "REQUEST: " +
211-
LS +
212-
"artifact: " +
213-
artifact +
214-
LS +
215-
artifactDependencies +
216-
LS +
217-
"localRepository: " +
218-
localRepository +
219-
LS +
220-
"remoteRepositories: " +
221-
remoteRepositories;
222-
223-
return sb;
210+
211+
return "REQUEST: " + LS
212+
+ "artifact: "
213+
+ artifact
214+
+ LS
215+
+ artifactDependencies
216+
+ LS
217+
+ "localRepository: "
218+
+ localRepository
219+
+ LS
220+
+ "remoteRepositories: "
221+
+ remoteRepositories;
224222
}
225223

226224
public boolean isOffline() {

compat/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,19 @@ public MetadataResolutionRequest setManagedVersionMap(Map managedVersionMap) {
134134
}
135135

136136
public String toString() {
137-
String sb = "REQUEST: " +
138-
"\n" +
139-
"artifact: " +
140-
mad +
141-
"\n" +
142-
artifactDependencies +
143-
"\n" +
144-
"localRepository: " +
145-
localRepository +
146-
"\n" +
147-
"remoteRepositories: " +
148-
remoteRepositories +
149-
"\n";
150-
151-
return sb;
137+
138+
return "REQUEST: " + "\n"
139+
+ "artifact: "
140+
+ mad
141+
+ "\n"
142+
+ artifactDependencies
143+
+ "\n"
144+
+ "localRepository: "
145+
+ localRepository
146+
+ "\n"
147+
+ "remoteRepositories: "
148+
+ remoteRepositories
149+
+ "\n";
152150
}
153151

154152
public boolean isAsList() {

compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ public String getArtifactId() {
4848

4949
public String extendedToString() {
5050

51-
String buffer = LS + "Artifact Metadata" + LS + "--------------------------" +
52-
LS + "GroupId: " + getGroupId() +
53-
LS + "ArtifactId: " + getArtifactId() +
54-
LS + "Metadata Type: " + getClass().getName();
55-
56-
return buffer;
51+
return LS + "Artifact Metadata" + LS + "--------------------------" + LS
52+
+ "GroupId: " + getGroupId() + LS
53+
+ "ArtifactId: " + getArtifactId() + LS
54+
+ "Metadata Type: " + getClass().getName();
5755
}
5856
}

compat/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,8 @@ protected Artifact createArtifact(String artifactId, String version, String type
282282
}
283283

284284
protected Artifact createArtifact(String groupId, String artifactId, String version, String type) throws Exception {
285-
Artifact a = artifactFactory.createBuildArtifact(groupId, artifactId, version, type);
286285

287-
return a;
286+
return artifactFactory.createBuildArtifact(groupId, artifactId, version, type);
288287
}
289288

290289
protected void deleteLocalArtifact(Artifact artifact) throws Exception {

compat/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,8 @@ protected static File getFileForClasspathResource(String resource)
112112
protected ArtifactRepository getLocalRepository() throws Exception {
113113
ArtifactRepositoryLayout repoLayout = getContainer().lookup(ArtifactRepositoryLayout.class);
114114

115-
ArtifactRepository r = repositorySystem.createArtifactRepository(
115+
return repositorySystem.createArtifactRepository(
116116
"local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout, null, null);
117-
118-
return r;
119117
}
120118

121119
// ----------------------------------------------------------------------

compat/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ public void transferInitiated(TransferEvent event) {
199199
String direction = event.getRequestType() == TransferEvent.RequestType.PUT ? "to" : "from";
200200

201201
TransferResource resource = event.getResource();
202-
String message = darkOn + action + ' ' + direction + ' ' +
203-
darkOff + resource.getRepositoryId() +
204-
darkOn + ": " + resource.getRepositoryUrl() +
205-
darkOff + resource.getResourceName();
202+
String message = darkOn + action + ' ' + direction + ' ' + darkOff
203+
+ resource.getRepositoryId() + darkOn
204+
+ ": " + resource.getRepositoryUrl() + darkOff
205+
+ resource.getResourceName();
206206

207207
out.println(message);
208208
}

compat/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public void transferInitiated(TransferEvent event) {
4848
String direction = event.getRequestType() == TransferEvent.RequestType.PUT ? "to" : "from";
4949

5050
TransferResource resource = event.getResource();
51-
String message = action + ' ' + direction + ' ' + resource.getRepositoryId() +
52-
": " +
53-
resource.getRepositoryUrl() + resource.getResourceName();
51+
String message = action + ' ' + direction + ' ' + resource.getRepositoryId() + ": "
52+
+ resource.getRepositoryUrl()
53+
+ resource.getResourceName();
5454

5555
out.info(message);
5656
}

compat/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -984,9 +984,7 @@ private ModelData readParentLocally(
984984
* if ( version == null || !version.equals( parent.getVersion() ) ) { return null; }
985985
*/
986986

987-
ModelData parentData = new ModelData(candidateSource, candidateModel, groupId, artifactId, version);
988-
989-
return parentData;
987+
return new ModelData(candidateSource, candidateModel, groupId, artifactId, version);
990988
}
991989

992990
private boolean rawChildVersionReferencesParent(String rawChildModelVersion) {
@@ -1094,10 +1092,8 @@ public int getValidationLevel() {
10941092
// MNG-2199: What else to check here ?
10951093
}
10961094

1097-
ModelData parentData = new ModelData(
1095+
return new ModelData(
10981096
modelSource, parentModel, parent.getGroupId(), parent.getArtifactId(), parent.getVersion());
1099-
1100-
return parentData;
11011097
}
11021098

11031099
private Model getSuperModel() {

0 commit comments

Comments
 (0)