Skip to content

Commit ad57d7d

Browse files
author
Vincent Potucek
committed
ShortenFullyQualifiedTypeReferences
1 parent cd56eb8 commit ad57d7d

File tree

26 files changed

+71
-92
lines changed

26 files changed

+71
-92
lines changed

compat/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ public void testDefaultBuildTimestampFormatWithLocalTimeZoneMidnightRollover() {
140140
@Test
141141
public void testShouldNotThrowExceptionOnReferenceToNonExistentValue() throws Exception {
142142
Model model = new Model(org.apache.maven.api.model.Model.newBuilder()
143-
.scm(Scm.newBuilder()
144-
.connection("${test}/somepath")
145-
.build())
143+
.scm(Scm.newBuilder().connection("${test}/somepath").build())
146144
.build());
147145

148146
ModelInterpolator interpolator = createInterpolator();
@@ -174,9 +172,7 @@ public void testShouldNotThrowExceptionOnReferenceToValueContainingNakedExpressi
174172
Map<String, String> props = new HashMap<>();
175173
props.put("test", "test");
176174
Model model = new Model(org.apache.maven.api.model.Model.newBuilder()
177-
.scm(Scm.newBuilder()
178-
.connection("${test}/somepath")
179-
.build())
175+
.scm(Scm.newBuilder().connection("${test}/somepath").build())
180176
.properties(props)
181177
.build());
182178

@@ -196,9 +192,7 @@ public void shouldInterpolateOrganizationNameCorrectly() throws Exception {
196192

197193
Model model = new Model(org.apache.maven.api.model.Model.newBuilder()
198194
.name("${project.organization.name} Tools")
199-
.organization(Organization.newBuilder()
200-
.name(orgName)
201-
.build())
195+
.organization(Organization.newBuilder().name(orgName).build())
202196
.build());
203197

204198
ModelInterpolator interpolator = createInterpolator();

compat/maven-model/src/main/java/org/apache/maven/model/InputLocation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,7 @@ public static InputLocation merge(InputLocation target, InputLocation source, bo
290290
* @param source
291291
* @return InputLocation
292292
*/
293-
public static InputLocation merge(
294-
InputLocation target, InputLocation source, Collection<Integer> indices) {
293+
public static InputLocation merge(InputLocation target, InputLocation source, Collection<Integer> indices) {
295294
if (source == null) {
296295
return target;
297296
} else if (target == null) {

compat/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ void testEnvironmentVariablesAreInterpolated() throws Exception {
256256
.get(0)
257257
.getProvides()
258258
.get("key"));
259-
Xpp3Dom toolchainConfiguration = (Xpp3Dom)
260-
result.getEffectiveToolchains().getToolchains().get(0).getConfiguration();
259+
Xpp3Dom toolchainConfiguration =
260+
(Xpp3Dom) result.getEffectiveToolchains().getToolchains().get(0).getConfiguration();
261261
assertEquals(
262262
interpolatedValue, toolchainConfiguration.getChild("jdkHome").getValue());
263263
assertNotNull(result.getProblems());

impl/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ private ArtifactRepositoryLayout getLayout(String id) {
299299
// Taken from LegacyRepositorySystem
300300
//
301301

302-
public static Repository fromSettingsRepository(
303-
org.apache.maven.settings.Repository settingsRepository) {
302+
public static Repository fromSettingsRepository(org.apache.maven.settings.Repository settingsRepository) {
304303
Repository modelRepository = new Repository();
305304
modelRepository.setId(settingsRepository.getId());
306305
modelRepository.setLayout(settingsRepository.getLayout());
@@ -327,8 +326,7 @@ public static ArtifactRepository buildArtifactRepository(org.apache.maven.settin
327326
return buildArtifactRepository(fromSettingsRepository(repo));
328327
}
329328

330-
public static ArtifactRepository buildArtifactRepository(Repository repo)
331-
throws InvalidRepositoryException {
329+
public static ArtifactRepository buildArtifactRepository(Repository repo) throws InvalidRepositoryException {
332330
if (repo != null) {
333331
String id = repo.getId();
334332

@@ -354,8 +352,7 @@ public static ArtifactRepository buildArtifactRepository(Repository repo)
354352
}
355353
}
356354

357-
public static ArtifactRepositoryPolicy buildArtifactRepositoryPolicy(
358-
RepositoryPolicy policy) {
355+
public static ArtifactRepositoryPolicy buildArtifactRepositoryPolicy(RepositoryPolicy policy) {
359356
boolean enabled = true;
360357

361358
String updatePolicy = null;

impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLifecycleRegistry.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ public List<String> computePhases(Lifecycle lifecycle) {
147147
return computed;
148148
}
149149

150-
private static void addPhase(
151-
Graph graph, Graph.Vertex before, Graph.Vertex after, Lifecycle.Phase phase) {
150+
private static void addPhase(Graph graph, Graph.Vertex before, Graph.Vertex after, Lifecycle.Phase phase) {
152151
Graph.Vertex ep0 = graph.addVertex(BEFORE + phase.name());
153152
Graph.Vertex ep1 = graph.addVertex("$$" + phase.name());
154153
Graph.Vertex ep2 = graph.addVertex(phase.name());

impl/maven-core/src/main/java/org/apache/maven/internal/impl/InternalMavenSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ static InternalMavenSession from(RepositorySystemSession session) {
5050
@Nullable
5151
Project getProject(MavenProject project);
5252

53-
List<ArtifactRepository> toArtifactRepositories(
54-
List<RemoteRepository> repositories);
53+
List<ArtifactRepository> toArtifactRepositories(List<RemoteRepository> repositories);
5554

5655
ArtifactRepository toArtifactRepository(RemoteRepository repository);
5756

impl/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public Lifecycle(String id, List<String> phases, Map<String, LifecyclePhase> def
3939
this.defaultPhases = defaultPhases;
4040
}
4141

42-
public Lifecycle(
43-
LifecycleRegistry registry, org.apache.maven.api.Lifecycle lifecycle) {
42+
public Lifecycle(LifecycleRegistry registry, org.apache.maven.api.Lifecycle lifecycle) {
4443
this.lifecycle = lifecycle;
4544
this.id = lifecycle.id();
4645
this.phases = registry.computePhases(lifecycle);

impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DeprecatedCoreExpressionValidator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ protected void doValidate(
8383
}
8484

8585
private boolean isDeprecated(Parameter parameter) {
86-
return Objects.equals(
87-
ArtifactRepository.class.getName(), parameter.getType())
86+
return Objects.equals(ArtifactRepository.class.getName(), parameter.getType())
8887
&& DEPRECATED_CORE_PARAMETERS.containsKey(parameter.getDefaultValue());
8988
}
9089
}

impl/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorV4Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ public void testPluginArtifactMapExpressionReference() throws Exception {
133133
MojoExecution exec = newMojoExecution(session);
134134

135135
@SuppressWarnings("unchecked")
136-
Map<String, Dependency> depResults = (Map<String, Dependency>)
137-
new PluginParameterExpressionEvaluatorV4(session, null, exec)
136+
Map<String, Dependency> depResults =
137+
(Map<String, Dependency>) new PluginParameterExpressionEvaluatorV4(session, null, exec)
138138
.evaluate("${mojo.plugin.dependenciesMap}");
139139

140140
System.out.println("Result: " + depResults);

impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void testBuildFromModelSource() throws Exception {
8282
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
8383
configuration.setRepositorySession(mavenSession.getRepositorySession());
8484
ProjectBuildingResult result = getContainer()
85-
.lookup(ProjectBuilder.class)
85+
.lookup(org.apache.maven.project.ProjectBuilder.class)
8686
.build(pomFile, configuration);
8787

8888
assertNotNull(result.getProject().getParentFile());
@@ -96,7 +96,7 @@ void testVersionlessManagedDependency() throws Exception {
9696
configuration.setRepositorySession(mavenSession.getRepositorySession());
9797

9898
ProjectBuildingException e = assertThrows(ProjectBuildingException.class, () -> getContainer()
99-
.lookup(ProjectBuilder.class)
99+
.lookup(org.apache.maven.project.ProjectBuilder.class)
100100
.build(pomFile, configuration));
101101
assertThat(
102102
e.getResults(),
@@ -116,12 +116,12 @@ void testResolveDependencies() throws Exception {
116116

117117
// single project build entry point
118118
ProjectBuildingResult result = getContainer()
119-
.lookup(ProjectBuilder.class)
119+
.lookup(org.apache.maven.project.ProjectBuilder.class)
120120
.build(pomFile, configuration);
121121
assertEquals(1, result.getProject().getArtifacts().size());
122122
// multi projects build entry point
123123
List<ProjectBuildingResult> results = getContainer()
124-
.lookup(ProjectBuilder.class)
124+
.lookup(org.apache.maven.project.ProjectBuilder.class)
125125
.build(Collections.singletonList(pomFile), false, configuration);
126126
assertEquals(1, results.size());
127127
MavenProject mavenProject = results.get(0).getProject();
@@ -150,12 +150,12 @@ void testDontResolveDependencies() throws Exception {
150150

151151
// single project build entry point
152152
ProjectBuildingResult result = getContainer()
153-
.lookup(ProjectBuilder.class)
153+
.lookup(org.apache.maven.project.ProjectBuilder.class)
154154
.build(pomFile, configuration);
155155
assertEquals(0, result.getProject().getArtifacts().size());
156156
// multi projects build entry point
157157
List<ProjectBuildingResult> results = getContainer()
158-
.lookup(ProjectBuilder.class)
158+
.lookup(org.apache.maven.project.ProjectBuilder.class)
159159
.build(Collections.singletonList(pomFile), false, configuration);
160160
assertEquals(1, results.size());
161161
MavenProject mavenProject = results.get(0).getProject();
@@ -173,8 +173,8 @@ void testReadModifiedPoms(@TempDir Path tempDir) throws Exception {
173173
mavenSession.getRequest().setRootDirectory(tempDir);
174174
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
175175
configuration.setRepositorySession(mavenSession.getRepositorySession());
176-
ProjectBuilder projectBuilder =
177-
getContainer().lookup(ProjectBuilder.class);
176+
org.apache.maven.project.ProjectBuilder projectBuilder =
177+
getContainer().lookup(org.apache.maven.project.ProjectBuilder.class);
178178
File child = new File(tempDir.toFile(), "child/pom.xml");
179179
// build project once
180180
projectBuilder.build(child, configuration);
@@ -198,8 +198,8 @@ void testReadErroneousMavenProjectContainsReference() throws Exception {
198198
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
199199
configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
200200
configuration.setRepositorySession(mavenSession.getRepositorySession());
201-
ProjectBuilder projectBuilder =
202-
getContainer().lookup(ProjectBuilder.class);
201+
org.apache.maven.project.ProjectBuilder projectBuilder =
202+
getContainer().lookup(org.apache.maven.project.ProjectBuilder.class);
203203

204204
// single project build entry point
205205
ProjectBuildingException ex1 =
@@ -230,8 +230,8 @@ void testReadInvalidPom() throws Exception {
230230
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
231231
configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_STRICT);
232232
configuration.setRepositorySession(mavenSession.getRepositorySession());
233-
ProjectBuilder projectBuilder =
234-
getContainer().lookup(ProjectBuilder.class);
233+
org.apache.maven.project.ProjectBuilder projectBuilder =
234+
getContainer().lookup(org.apache.maven.project.ProjectBuilder.class);
235235

236236
// single project build entry point
237237
Exception ex = assertThrows(Exception.class, () -> projectBuilder.build(pomFile, configuration));
@@ -260,8 +260,8 @@ void testReadParentAndChildWithRegularVersionSetParentFile() throws Exception {
260260
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
261261
configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
262262
configuration.setRepositorySession(mavenSession.getRepositorySession());
263-
ProjectBuilder projectBuilder =
264-
getContainer().lookup(ProjectBuilder.class);
263+
org.apache.maven.project.ProjectBuilder projectBuilder =
264+
getContainer().lookup(org.apache.maven.project.ProjectBuilder.class);
265265

266266
// read poms separately
267267
boolean parentFileWasFoundOnChild = false;
@@ -339,7 +339,7 @@ void testBuildFromModelSourceResolvesBasedir() throws Exception {
339339
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
340340
configuration.setRepositorySession(mavenSession.getRepositorySession());
341341
ProjectBuildingResult result = getContainer()
342-
.lookup(ProjectBuilder.class)
342+
.lookup(org.apache.maven.project.ProjectBuilder.class)
343343
.build(pomFile, configuration);
344344

345345
assertEquals(

impl/maven-di/src/main/java/org/apache/maven/di/impl/InjectorImpl.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -431,24 +431,22 @@ private static class SingletonScope implements Scope {
431431
@Nonnull
432432
@SuppressWarnings("unchecked")
433433
@Override
434-
public <T> Supplier<T> scope(
435-
@Nonnull Key<T> key, @Nonnull Supplier<T> unscoped) {
436-
return (Supplier<T>)
437-
cache.computeIfAbsent(key, k -> new Supplier<T>() {
438-
volatile T instance;
434+
public <T> Supplier<T> scope(@Nonnull Key<T> key, @Nonnull Supplier<T> unscoped) {
435+
return (Supplier<T>) cache.computeIfAbsent(key, k -> new Supplier<T>() {
436+
volatile T instance;
439437

440-
@Override
441-
public T get() {
438+
@Override
439+
public T get() {
440+
if (instance == null) {
441+
synchronized (this) {
442442
if (instance == null) {
443-
synchronized (this) {
444-
if (instance == null) {
445-
instance = unscoped.get();
446-
}
447-
}
443+
instance = unscoped.get();
448444
}
449-
return instance;
450445
}
451-
});
446+
}
447+
return instance;
448+
}
449+
});
452450
}
453451
}
454452
}

impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ public abstract class AbstractSession implements InternalSession {
115115
protected final Lookup lookup;
116116
private final Map<Class<? extends Service>, Service> services = new ConcurrentHashMap<>();
117117
private final List<Listener> listeners = new CopyOnWriteArrayList<>();
118-
private final Map<DependencyNode, Node> allNodes =
119-
Collections.synchronizedMap(new WeakHashMap<>());
118+
private final Map<DependencyNode, Node> allNodes = Collections.synchronizedMap(new WeakHashMap<>());
120119
private final Map<Class<? extends Artifact>, Map<org.eclipse.aether.artifact.Artifact, Artifact>> allArtifacts =
121120
new ConcurrentHashMap<>();
122121
private final Map<org.eclipse.aether.repository.RemoteRepository, RemoteRepository> allRepositories =

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactCoordinates.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public class DefaultArtifactCoordinates implements ArtifactCoordinates {
3434
private final @Nonnull InternalSession session;
3535
private final @Nonnull Artifact coordinates;
3636

37-
public DefaultArtifactCoordinates(
38-
@Nonnull InternalSession session, @Nonnull Artifact coordinates) {
37+
public DefaultArtifactCoordinates(@Nonnull InternalSession session, @Nonnull Artifact coordinates) {
3938
this.session = nonNull(session, "session");
4039
this.coordinates = nonNull(coordinates, "coordinates");
4140
}

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactCoordinatesFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public ArtifactCoordinates create(@Nonnull ArtifactCoordinatesFactoryRequest req
3737
nonNull(request, "request");
3838
InternalSession session = InternalSession.from(request.getSession());
3939
if (request.getCoordinatesString() != null) {
40-
return new DefaultArtifactCoordinates(
41-
session, new DefaultArtifact(request.getCoordinatesString()));
40+
return new DefaultArtifactCoordinates(session, new DefaultArtifact(request.getCoordinatesString()));
4241
} else {
4342
ArtifactType type = null;
4443
if (request.getType() != null) {

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyCoordinates.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
import org.eclipse.aether.graph.Dependency;
2929

3030
public class DefaultDependencyCoordinates extends AetherDependencyWrapper implements DependencyCoordinates {
31-
public DefaultDependencyCoordinates(
32-
@Nonnull InternalSession session, @Nonnull Dependency dependency) {
31+
public DefaultDependencyCoordinates(@Nonnull InternalSession session, @Nonnull Dependency dependency) {
3332
super(session, dependency);
3433
}
3534

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDownloadedArtifact.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
*/
3030
public class DefaultDownloadedArtifact extends DefaultArtifact implements DownloadedArtifact {
3131

32-
public DefaultDownloadedArtifact(
33-
@Nonnull InternalSession session, @Nonnull Artifact artifact) {
32+
public DefaultDownloadedArtifact(@Nonnull InternalSession session, @Nonnull Artifact artifact) {
3433
super(session, artifact);
3534
}
3635

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultNode.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public class DefaultNode extends AbstractNode {
3838
protected final @Nonnull DependencyNode node;
3939
protected final boolean verbose;
4040

41-
public DefaultNode(
42-
@Nonnull InternalSession session, @Nonnull DependencyNode node, boolean verbose) {
41+
public DefaultNode(@Nonnull InternalSession session, @Nonnull DependencyNode node, boolean verbose) {
4342
this.session = session;
4443
this.node = node;
4544
this.verbose = verbose;
@@ -114,8 +113,7 @@ public String asString() {
114113
}
115114

116115
List<String> details = new ArrayList<>();
117-
DependencyNode winner =
118-
(DependencyNode) node.getData().get(ConflictResolver.NODE_DATA_WINNER);
116+
DependencyNode winner = (DependencyNode) node.getData().get(ConflictResolver.NODE_DATA_WINNER);
119117
String winnerVersion = winner != null ? winner.getArtifact().getBaseVersion() : null;
120118
boolean included = (winnerVersion == null);
121119

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultProducedArtifact.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
*/
2828
public class DefaultProducedArtifact extends DefaultArtifact implements ProducedArtifact {
2929

30-
public DefaultProducedArtifact(
31-
@Nonnull InternalSession session, @Nonnull Artifact artifact) {
30+
public DefaultProducedArtifact(@Nonnull InternalSession session, @Nonnull Artifact artifact) {
3231
super(session, artifact);
3332
}
3433
}

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRepositoryFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ public List<RemoteRepository> aggregate(
8282
.toList();
8383
}
8484

85-
public static RepositoryPolicy buildRepositoryPolicy(
86-
org.apache.maven.api.model.RepositoryPolicy policy) {
85+
public static RepositoryPolicy buildRepositoryPolicy(org.apache.maven.api.model.RepositoryPolicy policy) {
8786
boolean enabled = true;
8887
String updatePolicy = RepositoryPolicy.UPDATE_POLICY_DAILY;
8988
String checksumPolicy = RepositoryPolicy.CHECKSUM_POLICY_FAIL;

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultVersionResolver.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ public Version getVersion() {
9191
public Optional<Repository> getRepository() {
9292
if (res.getRepository() instanceof LocalRepository localRepository) {
9393
return Optional.of(new DefaultLocalRepository(localRepository));
94-
} else if (res.getRepository()
95-
instanceof RemoteRepository remoteRepository) {
94+
} else if (res.getRepository() instanceof RemoteRepository remoteRepository) {
9695
return Optional.of(new DefaultRemoteRepository(remoteRepository));
9796
} else {
9897
return Optional.empty();

0 commit comments

Comments
 (0)