From ad5b844e1f9a11b45302b5011ee99c56b9edd5e6 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Wed, 6 Dec 2023 11:22:54 +0100 Subject: [PATCH] Fix checkstyle issues MissingParametersFailureAnalyzer looks like it has been commited by accident. --- .../MissingParameterNamesFailureAnalyzer.java | 2 +- .../MissingParametersFailureAnalyzer.java | 83 ------------------- 2 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParametersFailureAnalyzer.java diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParameterNamesFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParameterNamesFailureAnalyzer.java index 442a2cabbb..68a7aca5b6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParameterNamesFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParameterNamesFailureAnalyzer.java @@ -106,7 +106,7 @@ class MissingParameterNamesFailureAnalyzer implements FailureAnalyzer { return ex.getClass().getName() + (StringUtils.hasText(message) ? ": " + message : ""); } - public static void appendPossibility(StringBuilder description) { + static void appendPossibility(StringBuilder description) { if (!description.toString().endsWith(System.lineSeparator())) { description.append("%n".formatted()); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParametersFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParametersFailureAnalyzer.java deleted file mode 100644 index 350e30aafa..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/MissingParametersFailureAnalyzer.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2012-2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.diagnostics.analyzer; - -import java.util.HashSet; -import java.util.Set; - -import org.springframework.boot.diagnostics.FailureAnalysis; -import org.springframework.boot.diagnostics.FailureAnalyzer; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; - -/** - * @author Phillip Webb - */ -@Order(Ordered.HIGHEST_PRECEDENCE) -class MissingParametersFailureAnalyzer implements FailureAnalyzer { - - private static final String USE_PARAMETERS_MESSAGE = "Ensure that the compiler uses the '-parameters' flag"; - - @Override - public FailureAnalysis analyze(Throwable failure) { - return analyze(failure, failure, new HashSet<>()); - } - - private FailureAnalysis analyze(Throwable rootFailure, Throwable cause, Set seen) { - if (cause == null || !seen.add(cause)) { - return null; - } - if (isSpringParametersException(cause)) { - return getAnalysis(rootFailure, cause); - } - FailureAnalysis analysis = analyze(rootFailure, cause.getCause(), seen); - if (analysis != null) { - return analysis; - } - for (Throwable suppressed : cause.getSuppressed()) { - analysis = analyze(rootFailure, suppressed, seen); - if (analysis != null) { - return analysis; - } - } - return null; - } - - private boolean isSpringParametersException(Throwable failure) { - String message = failure.getMessage(); - return message != null && message.contains(USE_PARAMETERS_MESSAGE) && isSpringException(failure); - } - - private boolean isSpringException(Throwable failure) { - StackTraceElement[] elements = failure.getStackTrace(); - return elements.length > 0 && isSpringClass(elements[0].getClassName()); - } - - private boolean isSpringClass(String className) { - return className != null && className.startsWith("org.springframework."); - } - - private FailureAnalysis getAnalysis(Throwable rootFailure, Throwable cause) { - String description = ""; - if (rootFailure != cause) { - - } - String action = ""; - return new FailureAnalysis(description, action, rootFailure); - } - -}