Remove or use unused method parameters

This commit is contained in:
igor-suhorukov 2018-01-27 15:13:04 +03:00 committed by Andy Wilkinson
parent c1c0385dbc
commit 717bd2c580
21 changed files with 37 additions and 52 deletions

View File

@ -34,7 +34,7 @@ public class CloudFoundryAuthorizationException extends RuntimeException {
public CloudFoundryAuthorizationException(Reason reason, String message,
Throwable cause) {
super(message);
super(message, cause);
this.reason = reason;
}

View File

@ -115,7 +115,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
for (Map.Entry<String, Object> entry : beans.entrySet()) {
String beanName = entry.getKey();
Object bean = entry.getValue();
String prefix = extractPrefix(context, beanFactoryMetaData, beanName, bean);
String prefix = extractPrefix(context, beanFactoryMetaData, beanName);
beanDescriptors.put(beanName, new ConfigurationPropertiesBeanDescriptor(
prefix, sanitize(prefix, safeSerialize(mapper, bean, prefix))));
}
@ -201,12 +201,10 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
* @param context the application context
* @param beanFactoryMetaData the bean factory meta-data
* @param beanName the bean name
* @param bean the bean
* @return the prefix
*/
private String extractPrefix(ApplicationContext context,
ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
Object bean) {
ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName) {
ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
ConfigurationProperties.class);
if (beanFactoryMetaData != null) {

View File

@ -136,7 +136,7 @@ public class SpringIntegrationMetrics implements MeterBinder, SmartInitializingS
private <T> void registerGauge(MeterRegistry registry, T object, Iterable<Tag> tags,
String name, String description, ToDoubleFunction<T> value) {
Gauge.Builder<?> builder = Gauge.builder(name, object, value);
builder.tags(this.tags).description(description).register(registry);
builder.tags(tags).description(description).register(registry);
}
private <T> void registerTimedGauge(MeterRegistry registry, T object,

View File

@ -237,7 +237,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
return getConfigurationClassFactoryBeanGeneric(beanFactory, definition, name);
}
if (StringUtils.hasLength(definition.getBeanClassName())) {
return getDirectFactoryBeanGeneric(beanFactory, definition, name);
return getDirectFactoryBeanGeneric(beanFactory, definition);
}
return null;
}
@ -305,8 +305,8 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
}
private Class<?> getDirectFactoryBeanGeneric(
ConfigurableListableBeanFactory beanFactory, BeanDefinition definition,
String name) throws ClassNotFoundException, LinkageError {
ConfigurableListableBeanFactory beanFactory,
BeanDefinition definition) throws ClassNotFoundException, LinkageError {
Class<?> factoryBeanClass = ClassUtils.forName(definition.getBeanClassName(),
beanFactory.getBeanClassLoader());
Class<?> generic = ResolvableType.forClass(factoryBeanClass).as(FactoryBean.class)

View File

@ -49,8 +49,7 @@ abstract class AbstractSessionCondition extends SpringBootCondition {
ConditionMessage.Builder message = ConditionMessage
.forCondition("Session Condition");
Environment environment = context.getEnvironment();
StoreType required = SessionStoreMappings.getType(this.webApplicationType,
((AnnotationMetadata) metadata).getClassName());
StoreType required = SessionStoreMappings.getType(((AnnotationMetadata) metadata).getClassName());
if (!environment.containsProperty("spring.session.store-type")) {
return ConditionOutcome.match(message.didNotFind("property", "properties")
.items(ConditionMessage.Style.QUOTE, "spring.session.store-type"));

View File

@ -80,8 +80,7 @@ final class SessionStoreMappings {
return configurationClass.getName();
}
static StoreType getType(WebApplicationType webApplicationType,
String configurationClassName) {
static StoreType getType(String configurationClassName) {
for (Map.Entry<StoreType, Map<WebApplicationType, Class<?>>> storeEntry : MAPPINGS
.entrySet()) {
for (Map.Entry<WebApplicationType, Class<?>> entry : storeEntry.getValue()

View File

@ -183,7 +183,7 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
Set<URL> urls = new HashSet<>();
findGroovyJarsDirectly(parent, urls);
if (urls.isEmpty()) {
findGroovyJarsFromClassPath(parent, urls);
findGroovyJarsFromClassPath(urls);
}
Assert.state(!urls.isEmpty(), "Unable to find groovy JAR");
return new ArrayList<>(urls).toArray(new URL[urls.size()]);
@ -202,7 +202,7 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
}
}
private void findGroovyJarsFromClassPath(ClassLoader parent, Set<URL> urls) {
private void findGroovyJarsFromClassPath(Set<URL> urls) {
String classpath = System.getProperty("java.class.path");
String[] entries = classpath.split(System.getProperty("path.separator"));
for (String entry : entries) {

View File

@ -280,8 +280,7 @@ public class GroovyCompiler {
public void call(SourceUnit source, GeneratorContext context, ClassNode classNode)
throws CompilationFailedException {
ImportCustomizer importCustomizer = new SmartImportCustomizer(source, context,
classNode);
ImportCustomizer importCustomizer = new SmartImportCustomizer(source);
ClassNode mainClassNode = MainClass.get(source.getAST().getClasses());
// Additional auto configuration

View File

@ -17,8 +17,6 @@
package org.springframework.boot.cli.compiler;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.classgen.GeneratorContext;
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.control.customizers.ImportCustomizer;
@ -33,8 +31,7 @@ class SmartImportCustomizer extends ImportCustomizer {
private SourceUnit source;
SmartImportCustomizer(SourceUnit source, GeneratorContext context,
ClassNode classNode) {
SmartImportCustomizer(SourceUnit source) {
this.source = source;
}

View File

@ -80,11 +80,10 @@ public class SpringBootCompilerAutoConfiguration extends CompilerAutoConfigurati
public void applyToMainClass(GroovyClassLoader loader,
GroovyCompilerConfiguration configuration, GeneratorContext generatorContext,
SourceUnit source, ClassNode classNode) throws CompilationFailedException {
addEnableAutoConfigurationAnnotation(source, classNode);
addEnableAutoConfigurationAnnotation(classNode);
}
private void addEnableAutoConfigurationAnnotation(SourceUnit source,
ClassNode classNode) {
private void addEnableAutoConfigurationAnnotation(ClassNode classNode) {
if (!hasEnableAutoConfigureAnnotation(classNode)) {
AnnotationNode annotationNode = new AnnotationNode(
ClassHelper.make("EnableAutoConfiguration"));

View File

@ -80,7 +80,7 @@ class Connection {
public void run() throws Exception {
if (this.header.contains("Upgrade: websocket")
&& this.header.contains("Sec-WebSocket-Version: 13")) {
runWebSocket(this.header);
runWebSocket();
}
if (this.header.contains("GET /livereload.js")) {
this.outputStream.writeHttp(getClass().getResourceAsStream("livereload.js"),
@ -88,7 +88,7 @@ class Connection {
}
}
private void runWebSocket(String header) throws Exception {
private void runWebSocket() throws Exception {
String accept = getWebsocketAcceptResponse();
this.outputStream.writeHeaders("HTTP/1.1 101 Switching Protocols",
"Upgrade: websocket", "Connection: Upgrade",

View File

@ -372,7 +372,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
private void postProcessField(Object bean, Field field) {
RegisteredField registered = this.fieldRegistry.get(field);
if (registered != null && StringUtils.hasLength(registered.getBeanName())) {
inject(field, bean, registered.getBeanName(), registered.getDefinition());
inject(field, bean, registered.getBeanName());
}
}
@ -380,11 +380,10 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
String beanName = this.beanNameRegistry.get(definition);
Assert.state(StringUtils.hasLength(beanName),
() -> "No bean found for definition " + definition);
inject(field, target, beanName, definition);
inject(field, target, beanName);
}
private void inject(Field field, Object target, String beanName,
Definition definition) {
private void inject(Field field, Object target, String beanName) {
try {
field.setAccessible(true);
Assert.state(ReflectionUtils.getField(field, target) == null,

View File

@ -65,12 +65,11 @@ class WebTestClientContextCustomizer implements ContextCustomizer {
private void registerWebTestClient(ConfigurableApplicationContext context) {
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
if (beanFactory instanceof BeanDefinitionRegistry) {
registerWebTestClient(context, (BeanDefinitionRegistry) context);
registerWebTestClient((BeanDefinitionRegistry) context);
}
}
private void registerWebTestClient(ConfigurableApplicationContext context,
BeanDefinitionRegistry registry) {
private void registerWebTestClient(BeanDefinitionRegistry registry) {
RootBeanDefinition definition = new RootBeanDefinition(
WebTestClientRegistrar.class);
definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);

View File

@ -99,12 +99,11 @@ class JarFileEntries implements CentralDirectoryVisitor, Iterable<JarEntry> {
public void visitFileHeader(CentralDirectoryFileHeader fileHeader, int dataOffset) {
AsciiBytes name = applyFilter(fileHeader.getName());
if (name != null) {
add(name, fileHeader, dataOffset);
add(name, dataOffset);
}
}
private void add(AsciiBytes name, CentralDirectoryFileHeader fileHeader,
int dataOffset) {
private void add(AsciiBytes name, int dataOffset) {
this.hashCodes[this.size] = name.hashCode();
this.centralDirectoryOffsets[this.size] = dataOffset;
this.positions[this.size] = this.size;

View File

@ -451,7 +451,7 @@ public class ConfigFileApplicationListener
String loadProfile) {
try {
Resource resource = this.resourceLoader.getResource(location);
String description = getDescription(profile, location, resource);
String description = getDescription(location, resource);
if (profile != null) {
description = description + " for profile " + profile;
}
@ -482,8 +482,7 @@ public class ConfigFileApplicationListener
}
}
private String getDescription(Profile profile, String location,
Resource resource) {
private String getDescription(String location, Resource resource) {
try {
if (resource != null) {
String uri = resource.getURI().toASCIIString();

View File

@ -246,7 +246,7 @@ public class Binder {
}
if (property != null) {
try {
return bindProperty(name, target, handler, context, property);
return bindProperty(target, context, property);
}
catch (ConverterNotFoundException ex) {
// We might still be able to bind it as a bean
@ -295,8 +295,7 @@ public class Binder {
.filter(Objects::nonNull).findFirst().orElse(null);
}
private <T> Object bindProperty(ConfigurationPropertyName name, Bindable<T> target,
BindHandler handler, Context context, ConfigurationProperty property) {
private <T> Object bindProperty(Bindable<T> target, Context context, ConfigurationProperty property) {
context.setConfigurationProperty(property);
Object result = property.getValue();
result = this.placeholdersResolver.resolvePlaceholders(result);

View File

@ -49,11 +49,10 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
SpringIterableConfigurationPropertySource(EnumerablePropertySource<?> propertySource,
PropertyMapper mapper) {
super(propertySource, mapper, null);
assertEnumerablePropertySource(propertySource);
assertEnumerablePropertySource();
}
private void assertEnumerablePropertySource(
EnumerablePropertySource<?> propertySource) {
private void assertEnumerablePropertySource() {
if (getPropertySource() instanceof MapPropertySource) {
try {
((MapPropertySource) getPropertySource()).getSource().size();

View File

@ -48,10 +48,10 @@ class TomcatErrorPage {
this.location = errorPage.getPath();
this.exceptionType = errorPage.getExceptionName();
this.errorCode = errorPage.getStatusCode();
this.nativePage = createNativePage(errorPage);
this.nativePage = createNativePage();
}
private Object createNativePage(ErrorPage errorPage) {
private Object createNativePage() {
try {
if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) {
return BeanUtils

View File

@ -190,7 +190,7 @@ public class TomcatWebServer implements WebServer {
addPreviouslyRemovedConnectors();
Connector connector = this.tomcat.getConnector();
if (connector != null && this.autoStart) {
startConnector(connector);
startConnector();
}
checkThatConnectorsHaveStarted();
this.started = true;
@ -264,7 +264,7 @@ public class TomcatWebServer implements WebServer {
}
}
private void startConnector(Connector connector) {
private void startConnector() {
try {
for (Container child : this.tomcat.getHost().findChildren()) {
if (child instanceof TomcatEmbeddedContext) {

View File

@ -72,7 +72,7 @@ class SslBuilderCustomizer implements UndertowBuilderCustomizer {
SSLContext sslContext = SSLContext.getInstance(this.ssl.getProtocol());
sslContext.init(getKeyManagers(this.ssl, this.sslStoreProvider),
getTrustManagers(this.ssl, this.sslStoreProvider), null);
builder.addHttpsListener(this.port, getListenAddress(this.address),
builder.addHttpsListener(this.port, getListenAddress(),
sslContext);
builder.setSocketOption(Options.SSL_CLIENT_AUTH_MODE,
getSslClientAuthMode(this.ssl));
@ -93,7 +93,7 @@ class SslBuilderCustomizer implements UndertowBuilderCustomizer {
}
}
private String getListenAddress(InetAddress address) {
private String getListenAddress() {
if (this.address == null) {
return "0.0.0.0";
}

View File

@ -51,7 +51,7 @@ abstract class ServletComponentHandler {
protected String[] extractUrlPatterns(String attribute,
Map<String, Object> attributes) {
String[] value = (String[]) attributes.get("value");
String[] urlPatterns = (String[]) attributes.get("urlPatterns");
String[] urlPatterns = (String[]) attributes.get(attribute);
if (urlPatterns.length > 0) {
Assert.state(value.length == 0,
"The urlPatterns and value attributes are mutually exclusive.");