Clean up some warnings during the build (#750)

This commit is contained in:
Guillaume Nodet
2022-12-13 23:00:11 +01:00
committed by GitHub
parent bc021d0577
commit 25b5117749
7 changed files with 35 additions and 79 deletions

View File

@@ -652,7 +652,7 @@ public class CachingProjectBuilder implements ProjectBuilder {
return noErrors;
}
@SuppressWarnings("checkstyle:methodlength")
@SuppressWarnings({"checkstyle:methodlength", "deprecation"})
private void initProject(
MavenProject project,
Map<File, MavenProject> projects,

View File

@@ -49,10 +49,15 @@ public class DependencyGraph<K> {
private final Map<K, Set<K>> transitiveUpstreams;
private final Map<K, List<K>> downstreams;
@SuppressWarnings("unchecked")
public static DependencyGraph<MavenProject> fromMaven(MavenSession session) {
final ProjectDependencyGraph graph = session.getProjectDependencyGraph();
return fromMaven(graph);
Map<String, Object> data = session.getRequest().getData();
DependencyGraph<MavenProject> graph = (DependencyGraph<MavenProject>) data.get(DependencyGraph.class.getName());
if (graph == null) {
graph = fromMaven(session.getProjectDependencyGraph());
data.put(DependencyGraph.class.getName(), graph);
}
return graph;
}
static DependencyGraph<MavenProject> fromMaven(ProjectDependencyGraph graph) {

View File

@@ -99,8 +99,7 @@ public class SmartBuilder implements Builder {
session.getRepositorySession().getData().set(ReactorBuildStatus.class, reactorBuildStatus);
DependencyGraph<MavenProject> graph =
(DependencyGraph<MavenProject>) session.getRequest().getData().get(DependencyGraph.class.getName());
DependencyGraph<MavenProject> graph = DependencyGraph.fromMaven(session);
// log overall build info
final int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();

View File

@@ -53,7 +53,6 @@ public class ClientDispatcher extends BuildEventListener {
final MavenSession session = event.getSession();
final int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
final DependencyGraph<MavenProject> dependencyGraph = DependencyGraph.fromMaven(session);
session.getRequest().getData().put(DependencyGraph.class.getName(), dependencyGraph);
final int maxThreads =
degreeOfConcurrency == 1 ? 1 : dependencyGraph.computeMaxWidth(degreeOfConcurrency, 1000);

View File

@@ -61,6 +61,7 @@ public class DaemonPrompter extends AbstractInputHandler implements Prompter, In
}
@Override
@SuppressWarnings("unchecked")
public String prompt(String message, List possibleValues, String defaultReply) throws PrompterException {
return doPrompt(message, possibleValues, defaultReply, false);
}