Unify method visibility of private classes

Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.

Closes gh-7316
This commit is contained in:
Phillip Webb
2019-07-01 12:29:51 -07:00
parent 0a02a3a19c
commit a66c4d3096
910 changed files with 3754 additions and 3945 deletions

View File

@@ -92,7 +92,7 @@ class BeanDefinitionLoader {
* Set the bean name generator to be used by the underlying readers and scanner.
* @param beanNameGenerator the bean name generator
*/
public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) {
void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) {
this.annotatedReader.setBeanNameGenerator(beanNameGenerator);
this.xmlReader.setBeanNameGenerator(beanNameGenerator);
this.scanner.setBeanNameGenerator(beanNameGenerator);
@@ -102,7 +102,7 @@ class BeanDefinitionLoader {
* Set the resource loader to be used by the underlying readers and scanner.
* @param resourceLoader the resource loader
*/
public void setResourceLoader(ResourceLoader resourceLoader) {
void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
this.xmlReader.setResourceLoader(resourceLoader);
this.scanner.setResourceLoader(resourceLoader);
@@ -112,7 +112,7 @@ class BeanDefinitionLoader {
* Set the environment to be used by the underlying readers and scanner.
* @param environment the environment
*/
public void setEnvironment(ConfigurableEnvironment environment) {
void setEnvironment(ConfigurableEnvironment environment) {
this.annotatedReader.setEnvironment(environment);
this.xmlReader.setEnvironment(environment);
this.scanner.setEnvironment(environment);
@@ -122,7 +122,7 @@ class BeanDefinitionLoader {
* Load the sources into the reader.
* @return the number of loaded beans
*/
public int load() {
int load() {
int count = 0;
for (Object source : this.sources) {
count += load(source);

View File

@@ -36,13 +36,13 @@ class ExitCodeGenerators implements Iterable<ExitCodeGenerator> {
private List<ExitCodeGenerator> generators = new ArrayList<>();
public void addAll(Throwable exception, ExitCodeExceptionMapper... mappers) {
void addAll(Throwable exception, ExitCodeExceptionMapper... mappers) {
Assert.notNull(exception, "Exception must not be null");
Assert.notNull(mappers, "Mappers must not be null");
addAll(exception, Arrays.asList(mappers));
}
public void addAll(Throwable exception, Iterable<? extends ExitCodeExceptionMapper> mappers) {
void addAll(Throwable exception, Iterable<? extends ExitCodeExceptionMapper> mappers) {
Assert.notNull(exception, "Exception must not be null");
Assert.notNull(mappers, "Mappers must not be null");
for (ExitCodeExceptionMapper mapper : mappers) {
@@ -50,25 +50,25 @@ class ExitCodeGenerators implements Iterable<ExitCodeGenerator> {
}
}
public void add(Throwable exception, ExitCodeExceptionMapper mapper) {
void add(Throwable exception, ExitCodeExceptionMapper mapper) {
Assert.notNull(exception, "Exception must not be null");
Assert.notNull(mapper, "Mapper must not be null");
add(new MappedExitCodeGenerator(exception, mapper));
}
public void addAll(ExitCodeGenerator... generators) {
void addAll(ExitCodeGenerator... generators) {
Assert.notNull(generators, "Generators must not be null");
addAll(Arrays.asList(generators));
}
public void addAll(Iterable<? extends ExitCodeGenerator> generators) {
void addAll(Iterable<? extends ExitCodeGenerator> generators) {
Assert.notNull(generators, "Generators must not be null");
for (ExitCodeGenerator generator : generators) {
add(generator);
}
}
public void add(ExitCodeGenerator generator) {
void add(ExitCodeGenerator generator) {
Assert.notNull(generator, "Generator must not be null");
this.generators.add(generator);
}
@@ -82,7 +82,7 @@ class ExitCodeGenerators implements Iterable<ExitCodeGenerator> {
* Get the final exit code that should be returned based on all contained generators.
* @return the final exit code.
*/
public int getExitCode() {
int getExitCode() {
int exitCode = 0;
for (ExitCodeGenerator generator : this.generators) {
try {

View File

@@ -259,11 +259,11 @@ public class ImageBanner implements Banner {
this.delayTime = delayTime;
}
public BufferedImage getImage() {
BufferedImage getImage() {
return this.image;
}
public int getDelayTime() {
int getDelayTime() {
return this.delayTime;
}

View File

@@ -55,7 +55,7 @@ class SpringApplicationBannerPrinter {
this.fallbackBanner = fallbackBanner;
}
public Banner print(Environment environment, Class<?> sourceClass, Log logger) {
Banner print(Environment environment, Class<?> sourceClass, Log logger) {
Banner banner = getBanner(environment);
try {
logger.info(createStringFromBanner(banner, environment, sourceClass));
@@ -66,7 +66,7 @@ class SpringApplicationBannerPrinter {
return new PrintedBanner(banner, sourceClass);
}
public Banner print(Environment environment, Class<?> sourceClass, PrintStream out) {
Banner print(Environment environment, Class<?> sourceClass, PrintStream out) {
Banner banner = getBanner(environment);
banner.printBanner(environment, sourceClass, out);
return new PrintedBanner(banner, sourceClass);
@@ -124,13 +124,13 @@ class SpringApplicationBannerPrinter {
private final List<Banner> banners = new ArrayList<>();
public void addIfNotNull(Banner banner) {
void addIfNotNull(Banner banner) {
if (banner != null) {
this.banners.add(banner);
}
}
public boolean hasAtLeastOneBanner() {
boolean hasAtLeastOneBanner() {
return !this.banners.isEmpty();
}

View File

@@ -42,43 +42,43 @@ class SpringApplicationRunListeners {
this.listeners = new ArrayList<>(listeners);
}
public void starting() {
void starting() {
for (SpringApplicationRunListener listener : this.listeners) {
listener.starting();
}
}
public void environmentPrepared(ConfigurableEnvironment environment) {
void environmentPrepared(ConfigurableEnvironment environment) {
for (SpringApplicationRunListener listener : this.listeners) {
listener.environmentPrepared(environment);
}
}
public void contextPrepared(ConfigurableApplicationContext context) {
void contextPrepared(ConfigurableApplicationContext context) {
for (SpringApplicationRunListener listener : this.listeners) {
listener.contextPrepared(context);
}
}
public void contextLoaded(ConfigurableApplicationContext context) {
void contextLoaded(ConfigurableApplicationContext context) {
for (SpringApplicationRunListener listener : this.listeners) {
listener.contextLoaded(context);
}
}
public void started(ConfigurableApplicationContext context) {
void started(ConfigurableApplicationContext context) {
for (SpringApplicationRunListener listener : this.listeners) {
listener.started(context);
}
}
public void running(ConfigurableApplicationContext context) {
void running(ConfigurableApplicationContext context) {
for (SpringApplicationRunListener listener : this.listeners) {
listener.running(context);
}
}
public void failed(ConfigurableApplicationContext context, Throwable exception) {
void failed(ConfigurableApplicationContext context, Throwable exception) {
for (SpringApplicationRunListener listener : this.listeners) {
callFailedListener(listener, context, exception);
}

View File

@@ -52,11 +52,11 @@ class SpringBootExceptionHandler implements UncaughtExceptionHandler {
this.parent = parent;
}
public void registerLoggedException(Throwable exception) {
void registerLoggedException(Throwable exception) {
this.loggedExceptions.add(exception);
}
public void registerExitCode(int exitCode) {
void registerExitCode(int exitCode) {
this.exitCode = exitCode;
}

View File

@@ -50,13 +50,13 @@ class StartupInfoLogger {
this.sourceClass = sourceClass;
}
public void logStarting(Log applicationLog) {
void logStarting(Log applicationLog) {
Assert.notNull(applicationLog, "Log must not be null");
applicationLog.info(LogMessage.of(this::getStartingMessage));
applicationLog.debug(LogMessage.of(this::getRunningMessage));
}
public void logStarted(Log applicationLog, StopWatch stopWatch) {
void logStarted(Log applicationLog, StopWatch stopWatch) {
if (applicationLog.isInfoEnabled()) {
applicationLog.info(getStartedMessage(stopWatch));
}

View File

@@ -120,7 +120,7 @@ public final class AnsiColors {
}
// See https://en.wikipedia.org/wiki/Color_difference#CIE94
public double getDistance(LabColor other) {
double getDistance(LabColor other) {
double c1 = Math.sqrt(this.a * this.a + this.b * this.b);
double deltaC = c1 - Math.sqrt(other.a * other.a + other.b * other.b);
double deltaA = this.a - other.a;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -98,11 +98,11 @@ public class AnsiPropertySource extends PropertySource<AnsiElement> {
}
public String getPrefix() {
String getPrefix() {
return this.prefix;
}
public Set<E> getEnums() {
Set<E> getEnums() {
return this.enums;
}

View File

@@ -319,7 +319,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
getClass().getClassLoader());
}
public void load() {
void load() {
FilteredPropertySource.apply(this.environment, DEFAULT_PROPERTIES, LOAD_FILTERED_PROPERTY,
(defaultProperties) -> {
this.profiles = new LinkedList<>();
@@ -735,11 +735,11 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
this.defaultProfile = defaultProfile;
}
public String getName() {
String getName() {
return this.name;
}
public boolean isDefaultProfile() {
boolean isDefaultProfile() {
return this.defaultProfile;
}
@@ -820,19 +820,19 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
this.includeProfiles = includeProfiles;
}
public PropertySource<?> getPropertySource() {
PropertySource<?> getPropertySource() {
return this.propertySource;
}
public String[] getProfiles() {
String[] getProfiles() {
return this.profiles;
}
public Set<Profile> getActiveProfiles() {
Set<Profile> getActiveProfiles() {
return this.activeProfiles;
}
public Set<Profile> getIncludeProfiles() {
Set<Profile> getIncludeProfiles() {
return this.includeProfiles;
}

View File

@@ -46,8 +46,7 @@ final class ConfigurationPropertiesBeanDefinitionRegistrar {
private ConfigurationPropertiesBeanDefinitionRegistrar() {
}
public static void register(BeanDefinitionRegistry registry, ConfigurableListableBeanFactory beanFactory,
Class<?> type) {
static void register(BeanDefinitionRegistry registry, ConfigurableListableBeanFactory beanFactory, Class<?> type) {
MergedAnnotation<ConfigurationProperties> annotation = MergedAnnotations.from(type, SearchStrategy.EXHAUSTIVE)
.get(ConfigurationProperties.class);
String name = getName(type, annotation);

View File

@@ -85,13 +85,13 @@ class ConfigurationPropertiesBinder implements ApplicationContextAware {
this.jsr303Present = ConfigurationPropertiesJsr303Validator.isJsr303Present(applicationContext);
}
public <T> BindResult<T> bind(Bindable<T> target) {
<T> BindResult<T> bind(Bindable<T> target) {
ConfigurationProperties annotation = getAnnotation(target);
BindHandler bindHandler = getBindHandler(target, annotation);
return getBinder().bind(annotation.prefix(), target, bindHandler);
}
public <T> T bindOrCreate(Bindable<T> target) {
<T> T bindOrCreate(Bindable<T> target) {
ConfigurationProperties annotation = getAnnotation(target);
BindHandler bindHandler = getBindHandler(target, annotation);
return getBinder().bindOrCreate(annotation.prefix(), target, bindHandler);

View File

@@ -51,7 +51,7 @@ final class ConfigurationPropertiesJsr303Validator implements Validator {
this.delegate.validate(target, errors);
}
public static boolean isJsr303Present(ApplicationContext applicationContext) {
static boolean isJsr303Present(ApplicationContext applicationContext) {
ClassLoader classLoader = applicationContext.getClassLoader();
for (String validatorClass : VALIDATOR_CLASSES) {
if (!ClassUtils.isPresent(validatorClass, classLoader)) {

View File

@@ -45,7 +45,7 @@ class ConversionServiceDeducer {
this.applicationContext = applicationContext;
}
public ConversionService getConversionService() {
ConversionService getConversionService() {
try {
return this.applicationContext.getBean(ConfigurableApplicationContext.CONVERSION_SERVICE_BEAN_NAME,
ConversionService.class);
@@ -79,7 +79,7 @@ class ConversionServiceDeducer {
BeanFactoryAnnotationUtils.qualifiedBeansOfType(beanFactory, type, qualifier).values());
}
public ConversionService create() {
ConversionService create() {
if (this.converters.isEmpty() && this.genericConverters.isEmpty()) {
return ApplicationConversionService.getSharedInstance();
}

View File

@@ -43,7 +43,7 @@ class PropertySourcesDeducer {
this.applicationContext = applicationContext;
}
public PropertySources getPropertySources() {
PropertySources getPropertySources() {
PropertySourcesPlaceholderConfigurer configurer = getSinglePropertySourcesPlaceholderConfigurer();
if (configurer != null) {
return configurer.getAppliedPropertySources();

View File

@@ -52,7 +52,7 @@ abstract class AggregateBinder<T> {
* @return the bound aggregate or null
*/
@SuppressWarnings("unchecked")
public final Object bind(ConfigurationPropertyName name, Bindable<?> target, AggregateElementBinder elementBinder) {
final Object bind(ConfigurationPropertyName name, Bindable<?> target, AggregateElementBinder elementBinder) {
Object result = bindAggregate(name, target, elementBinder);
Supplier<?> value = target.getValue();
if (result == null || value == null) {

View File

@@ -79,17 +79,17 @@ final class BindConverter {
return services;
}
public boolean canConvert(Object value, ResolvableType type, Annotation... annotations) {
boolean canConvert(Object value, ResolvableType type, Annotation... annotations) {
return this.conversionService.canConvert(TypeDescriptor.forObject(value),
new ResolvableTypeDescriptor(type, annotations));
}
public <T> T convert(Object result, Bindable<T> target) {
<T> T convert(Object result, Bindable<T> target) {
return convert(result, target.getType(), target.getAnnotations());
}
@SuppressWarnings("unchecked")
public <T> T convert(Object value, ResolvableType type, Annotation... annotations) {
<T> T convert(Object value, ResolvableType type, Annotation... annotations) {
if (value == null) {
return null;
}

View File

@@ -518,11 +518,11 @@ public class Binder {
this.configurationProperty = null;
}
public PlaceholdersResolver getPlaceholdersResolver() {
PlaceholdersResolver getPlaceholdersResolver() {
return Binder.this.placeholdersResolver;
}
public BindConverter getConverter() {
BindConverter getConverter() {
return this.converter;
}

View File

@@ -33,7 +33,7 @@ abstract class DataObjectPropertyName {
* @param name the source name
* @return the dashed from
*/
public static String toDashedForm(String name) {
static String toDashedForm(String name) {
StringBuilder result = new StringBuilder();
String replaced = name.replace('_', '-');
for (int i = 0; i < replaced.length(); i++) {

View File

@@ -174,12 +174,12 @@ class JavaBeanBinder implements DataObjectBinder {
}
}
public Map<String, BeanProperty> getProperties() {
Map<String, BeanProperty> getProperties() {
return this.properties;
}
@SuppressWarnings("unchecked")
public BeanSupplier<T> getSupplier(Bindable<T> target) {
BeanSupplier<T> getSupplier(Bindable<T> target) {
return new BeanSupplier<>(() -> {
T instance = null;
if (target.getValue() != null) {
@@ -193,7 +193,7 @@ class JavaBeanBinder implements DataObjectBinder {
}
@SuppressWarnings("unchecked")
public static <T> Bean<T> get(Bindable<T> bindable, boolean canCallGetValue) {
static <T> Bean<T> get(Bindable<T> bindable, boolean canCallGetValue) {
ResolvableType type = bindable.getType();
Class<?> resolvedType = type.resolve(Object.class);
Supplier<T> value = bindable.getValue();
@@ -275,13 +275,13 @@ class JavaBeanBinder implements DataObjectBinder {
this.declaringClassType = declaringClassType;
}
public void addGetter(Method getter) {
void addGetter(Method getter) {
if (this.getter == null) {
this.getter = getter;
}
}
public void addSetter(Method setter) {
void addSetter(Method setter) {
if (this.setter == null || isBetterSetter(setter)) {
this.setter = setter;
}
@@ -291,17 +291,17 @@ class JavaBeanBinder implements DataObjectBinder {
return this.getter != null && this.getter.getReturnType().equals(setter.getParameterTypes()[0]);
}
public void addField(Field field) {
void addField(Field field) {
if (this.field == null) {
this.field = field;
}
}
public String getName() {
String getName() {
return this.name;
}
public ResolvableType getType() {
ResolvableType getType() {
if (this.setter != null) {
MethodParameter methodParameter = new MethodParameter(this.setter, 0);
return ResolvableType.forMethodParameter(methodParameter, this.declaringClassType);
@@ -310,7 +310,7 @@ class JavaBeanBinder implements DataObjectBinder {
return ResolvableType.forMethodParameter(methodParameter, this.declaringClassType);
}
public Annotation[] getAnnotations() {
Annotation[] getAnnotations() {
try {
return (this.field != null) ? this.field.getDeclaredAnnotations() : null;
}
@@ -319,7 +319,7 @@ class JavaBeanBinder implements DataObjectBinder {
}
}
public Supplier<Object> getValue(Supplier<?> instance) {
Supplier<Object> getValue(Supplier<?> instance) {
if (this.getter == null) {
return null;
}
@@ -334,11 +334,11 @@ class JavaBeanBinder implements DataObjectBinder {
};
}
public boolean isSettable() {
boolean isSettable() {
return this.setter != null;
}
public void setValue(Supplier<?> instance, Object value) {
void setValue(Supplier<?> instance, Object value) {
try {
this.setter.setAccessible(true);
this.setter.invoke(instance.get(), value);

View File

@@ -148,7 +148,7 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
this.valueType = this.mapType.getGeneric(1);
}
public void bindEntries(ConfigurationPropertySource source, Map<Object, Object> map) {
void bindEntries(ConfigurationPropertySource source, Map<Object, Object> map) {
if (source instanceof IterableConfigurationPropertySource) {
for (ConfigurationPropertyName name : (IterableConfigurationPropertySource) source) {
Bindable<?> valueBindable = getValueBindable(name);

View File

@@ -90,14 +90,14 @@ class ValueObjectBinder implements DataObjectBinder {
this.constructor = constructor;
}
public T instantiate(List<Object> args) {
T instantiate(List<Object> args) {
return BeanUtils.instantiateClass(this.constructor, args.toArray());
}
public abstract List<ConstructorParameter> getConstructorParameters();
abstract List<ConstructorParameter> getConstructorParameters();
@SuppressWarnings("unchecked")
public static <T> ValueObject<T> get(Bindable<T> bindable) {
static <T> ValueObject<T> get(Bindable<T> bindable) {
if (bindable.getValue() != null) {
return null;
}
@@ -138,11 +138,11 @@ class ValueObjectBinder implements DataObjectBinder {
}
@Override
public List<ConstructorParameter> getConstructorParameters() {
List<ConstructorParameter> getConstructorParameters() {
return this.constructorParameters;
}
public static <T> ValueObject<T> get(Class<T> type) {
static <T> ValueObject<T> get(Class<T> type) {
Constructor<T> primaryConstructor = BeanUtils.findPrimaryConstructor(type);
if (primaryConstructor == null || primaryConstructor.getParameterCount() == 0) {
return null;
@@ -186,7 +186,7 @@ class ValueObjectBinder implements DataObjectBinder {
}
@Override
public List<ConstructorParameter> getConstructorParameters() {
List<ConstructorParameter> getConstructorParameters() {
return this.constructorParameters;
}
@@ -231,7 +231,7 @@ class ValueObjectBinder implements DataObjectBinder {
this.annotations = annotations;
}
public Object getDefaultValue(BindConverter converter) {
Object getDefaultValue(BindConverter converter) {
for (Annotation annotation : this.annotations) {
if (annotation instanceof DefaultValue) {
return converter.convert(((DefaultValue) annotation).value(), this.type, this.annotations);
@@ -240,7 +240,7 @@ class ValueObjectBinder implements DataObjectBinder {
return null;
}
public Object bind(DataObjectPropertyBinder propertyBinder) {
Object bind(DataObjectPropertyBinder propertyBinder) {
return propertyBinder.bindProperty(this.name, Bindable.of(this.type).withAnnotations(this.annotations));
}

View File

@@ -50,7 +50,7 @@ final class OriginTrackedFieldError extends FieldError implements OriginProvider
return super.toString() + "; origin " + this.origin;
}
public static FieldError of(FieldError fieldError, Origin origin) {
static FieldError of(FieldError fieldError, Origin origin) {
if (fieldError == null || origin == null) {
return fieldError;
}

View File

@@ -659,7 +659,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
this.resolved = resolved;
}
public Elements append(Elements additional) {
Elements append(Elements additional) {
Assert.isTrue(additional.getSize() == 1,
() -> "Element value '" + additional.getSource() + "' must be a single item");
ElementType[] type = new ElementType[this.size + 1];
@@ -670,7 +670,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
return new Elements(this.source, this.size + 1, this.start, this.end, type, resolved);
}
public Elements chop(int size) {
Elements chop(int size) {
CharSequence[] resolved = newResolved(size);
return new Elements(this.source, size, this.start, this.end, this.type, resolved);
}
@@ -683,11 +683,11 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
return resolved;
}
public int getSize() {
int getSize() {
return this.size;
}
public CharSequence get(int index) {
CharSequence get(int index) {
if (this.resolved != null && this.resolved[index] != null) {
return this.resolved[index];
}
@@ -696,7 +696,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
return this.source.subSequence(start, end);
}
public int getLength(int index) {
int getLength(int index) {
if (this.resolved != null && this.resolved[index] != null) {
return this.resolved[index].length();
}
@@ -705,7 +705,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
return end - start;
}
public char charAt(int index, int charIndex) {
char charAt(int index, int charIndex) {
if (this.resolved != null && this.resolved[index] != null) {
return this.resolved[index].charAt(charIndex);
}
@@ -713,11 +713,11 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
return this.source.charAt(start + charIndex);
}
public ElementType getType(int index) {
ElementType getType(int index) {
return this.type[index];
}
public CharSequence getSource() {
CharSequence getSource() {
return this.source;
}
@@ -727,7 +727,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
* @param requiredType the required type
* @return {@code true} if all elements match at least one of the types
*/
public boolean canShortcutWithSource(ElementType requiredType) {
boolean canShortcutWithSource(ElementType requiredType) {
return canShortcutWithSource(requiredType, requiredType);
}
@@ -738,7 +738,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
* @param alternativeType and alternative required type
* @return {@code true} if all elements match at least one of the types
*/
public boolean canShortcutWithSource(ElementType requiredType, ElementType alternativeType) {
boolean canShortcutWithSource(ElementType requiredType, ElementType alternativeType) {
if (this.resolved != null) {
return false;
}
@@ -789,11 +789,11 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
this.type = new ElementType[capacity];
}
public Elements parse() {
Elements parse() {
return parse(null);
}
public Elements parse(Function<CharSequence, CharSequence> valueProcessor) {
Elements parse(Function<CharSequence, CharSequence> valueProcessor) {
int length = this.source.length();
int openBracketCount = 0;
int start = 0;
@@ -901,11 +901,11 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
return dest;
}
public static boolean isValidChar(char ch, int index) {
static boolean isValidChar(char ch, int index) {
return isAlpha(ch) || isNumeric(ch) || (index != 0 && ch == '-');
}
public static boolean isAlphaNumeric(char ch) {
static boolean isAlphaNumeric(char ch) {
return isAlpha(ch) || isNumeric(ch);
}

View File

@@ -87,11 +87,11 @@ final class DefaultPropertyMapper implements PropertyMapper {
this.mapping = mapping;
}
public boolean isFrom(T from) {
boolean isFrom(T from) {
return ObjectUtils.nullSafeEquals(from, this.from);
}
public PropertyMapping[] getMapping() {
PropertyMapping[] getMapping() {
return this.mapping;
}

View File

@@ -47,7 +47,7 @@ class PropertyMapping {
* Return the mapped {@link PropertySource} name.
* @return the property source name (never {@code null})
*/
public String getPropertySourceName() {
String getPropertySourceName() {
return this.propertySourceName;
}
@@ -57,7 +57,7 @@ class PropertyMapping {
* {@link ConfigurationPropertyName}.
* @return the configuration property source name (never {@code null})
*/
public ConfigurationPropertyName getConfigurationPropertyName() {
ConfigurationPropertyName getConfigurationPropertyName() {
return this.configurationPropertyName;
}
@@ -68,7 +68,7 @@ class PropertyMapping {
* @param name the name to check
* @return if the mapping is applicable
*/
public boolean isApplicable(ConfigurationPropertyName name) {
boolean isApplicable(ConfigurationPropertyName name) {
return this.configurationPropertyName.equals(name);
}

View File

@@ -137,7 +137,7 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource {
* @return a {@link SpringConfigurationPropertySource} or
* {@link SpringIterableConfigurationPropertySource} instance
*/
public static SpringConfigurationPropertySource from(PropertySource<?> source) {
static SpringConfigurationPropertySource from(PropertySource<?> source) {
Assert.notNull(source, "Source must not be null");
PropertyMapper mapper = getPropertyMapper(source);
if (isFullEnumerable(source)) {

View File

@@ -163,23 +163,23 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
this.key = key;
}
public boolean hasKeyEqualTo(CacheKey key) {
boolean hasKeyEqualTo(CacheKey key) {
return this.key.equals(key);
}
public List<ConfigurationPropertyName> getNames() {
List<ConfigurationPropertyName> getNames() {
return this.names;
}
public void setNames(List<ConfigurationPropertyName> names) {
void setNames(List<ConfigurationPropertyName> names) {
this.names = names;
}
public PropertyMapping[] getMappings() {
PropertyMapping[] getMappings() {
return this.mappings;
}
public void setMappings(PropertyMapping[] mappings) {
void setMappings(PropertyMapping[] mappings) {
this.mappings = mappings;
}
@@ -195,7 +195,7 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
this.key = key;
}
public CacheKey copy() {
CacheKey copy() {
if (this == IMMUTABLE_PROPERTY_SOURCE) {
return IMMUTABLE_PROPERTY_SOURCE;
}
@@ -226,7 +226,7 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
return this.key.hashCode();
}
public static CacheKey get(EnumerablePropertySource<?> source) {
static CacheKey get(EnumerablePropertySource<?> source) {
if (isImmutable(source)) {
return IMMUTABLE_PROPERTY_SOURCE;
}

View File

@@ -98,11 +98,11 @@ class BeanCurrentlyInCreationFailureAnalyzer extends AbstractFailureAnalyzer<Bea
this.cycleStart = cycleStart;
}
public List<BeanInCycle> getBeansInCycle() {
List<BeanInCycle> getBeansInCycle() {
return this.beansInCycle;
}
public int getCycleStart() {
int getCycleStart() {
return this.cycleStart;
}
@@ -158,7 +158,7 @@ class BeanCurrentlyInCreationFailureAnalyzer extends AbstractFailureAnalyzer<Bea
return this.name + this.description;
}
public static BeanInCycle get(Throwable ex) {
static BeanInCycle get(Throwable ex) {
if (ex instanceof BeanCreationException) {
return get((BeanCreationException) ex);
}

View File

@@ -99,15 +99,15 @@ class BindValidationFailureAnalyzer extends AbstractFailureAnalyzer<Throwable> {
this.cause = cause;
}
public Object getTarget() {
Object getTarget() {
return this.target;
}
public List<ObjectError> getErrors() {
List<ObjectError> getErrors() {
return this.errors;
}
public Throwable getCause() {
Throwable getCause() {
return this.cause;
}

View File

@@ -133,15 +133,15 @@ class InvalidConfigurationPropertyValueFailureAnalyzer
this.origin = origin;
}
public String getPropertySource() {
String getPropertySource() {
return this.propertySource;
}
public Object getValue() {
Object getValue() {
return this.value;
}
public void appendOrigin(StringBuilder message) {
void appendOrigin(StringBuilder message) {
if (this.origin != null) {
message.append(" (originating from '").append(this.origin).append("')");
}

View File

@@ -59,7 +59,7 @@ class OriginTrackedPropertiesLoader {
* @return the loaded properties
* @throws IOException on read error
*/
public Map<String, OriginTrackedValue> load() throws IOException {
Map<String, OriginTrackedValue> load() throws IOException {
return load(true);
}
@@ -70,7 +70,7 @@ class OriginTrackedPropertiesLoader {
* @return the loaded properties
* @throws IOException on read error
*/
public Map<String, OriginTrackedValue> load(boolean expandLists) throws IOException {
Map<String, OriginTrackedValue> load(boolean expandLists) throws IOException {
try (CharacterReader reader = new CharacterReader(this.resource)) {
Map<String, OriginTrackedValue> result = new LinkedHashMap<>();
StringBuilder buffer = new StringBuilder();
@@ -162,11 +162,11 @@ class OriginTrackedPropertiesLoader {
this.reader.close();
}
public boolean read() throws IOException {
boolean read() throws IOException {
return read(false);
}
public boolean read(boolean wrappedLine) throws IOException {
boolean read(boolean wrappedLine) throws IOException {
this.escaped = false;
this.character = this.reader.read();
this.columnNumber++;
@@ -237,31 +237,31 @@ class OriginTrackedPropertiesLoader {
}
}
public boolean isWhiteSpace() {
boolean isWhiteSpace() {
return !this.escaped && (this.character == ' ' || this.character == '\t' || this.character == '\f');
}
public boolean isEndOfFile() {
boolean isEndOfFile() {
return this.character == -1;
}
public boolean isEndOfLine() {
boolean isEndOfLine() {
return this.character == -1 || (!this.escaped && this.character == '\n');
}
public boolean isListDelimiter() {
boolean isListDelimiter() {
return !this.escaped && this.character == ',';
}
public boolean isPropertyDelimiter() {
boolean isPropertyDelimiter() {
return !this.escaped && (this.character == '=' || this.character == ':');
}
public char getCharacter() {
char getCharacter() {
return (char) this.character;
}
public Location getLocation() {
Location getLocation() {
return new Location(this.reader.getLineNumber(), this.columnNumber);
}

View File

@@ -70,7 +70,7 @@ class OriginTrackedYamlLoader extends YamlProcessor {
return new Yaml(constructor, representer, dumperOptions, loaderOptions, resolver);
}
public List<Map<String, Object>> load() {
List<Map<String, Object>> load() {
final List<Map<String, Object>> result = new ArrayList<>();
process((properties, map) -> result.add(getFlattenedMap(map)));
return result;
@@ -124,7 +124,7 @@ class OriginTrackedYamlLoader extends YamlProcessor {
super(node.getTag(), node.getValue(), node.getStartMark(), node.getEndMark(), node.getScalarStyle());
}
public static NodeTuple get(NodeTuple nodeTuple) {
static NodeTuple get(NodeTuple nodeTuple) {
Node keyNode = nodeTuple.getKeyNode();
Node valueNode = nodeTuple.getValueNode();
return new NodeTuple(KeyScalarNode.get(keyNode), valueNode);

View File

@@ -182,15 +182,15 @@ public class SpringApplicationJsonEnvironmentPostProcessor implements Environmen
this.json = json;
}
public String getJson() {
String getJson() {
return this.json;
}
public Origin getOrigin() {
Origin getOrigin() {
return PropertySourceOrigin.get(this.propertySource, this.propertyName);
}
public static JsonPropertyValue get(PropertySource<?> propertySource) {
static JsonPropertyValue get(PropertySource<?> propertySource) {
for (String candidate : CANDIDATES) {
Object value = propertySource.getProperty(candidate);
if (value != null && value instanceof String && StringUtils.hasLength((String) value)) {

View File

@@ -50,7 +50,7 @@ public class LiquibaseServiceLocatorApplicationListener implements ApplicationLi
*/
private static class LiquibasePresent {
public void replaceServiceLocator() {
void replaceServiceLocator() {
CustomResolverServiceLocator customResolverServiceLocator = new CustomResolverServiceLocator(
new SpringPackageScanClassResolver(logger));
ServiceLocator.setInstance(customResolverServiceLocator);

View File

@@ -250,15 +250,15 @@ public class DeferredLog implements Log {
this.throwable = throwable;
}
public LogLevel getLevel() {
LogLevel getLevel() {
return this.level;
}
public Object getMessage() {
Object getMessage() {
return this.message;
}
public Throwable getThrowable() {
Throwable getThrowable() {
return this.throwable;
}

View File

@@ -16,6 +16,7 @@
package org.springframework.boot.logging;
import java.lang.reflect.Constructor;
import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedHashMap;
@@ -162,7 +163,9 @@ public abstract class LoggingSystem {
private static LoggingSystem get(ClassLoader classLoader, String loggingSystemClass) {
try {
Class<?> systemClass = ClassUtils.forName(loggingSystemClass, classLoader);
return (LoggingSystem) systemClass.getConstructor(ClassLoader.class).newInstance(classLoader);
Constructor<?> constructor = systemClass.getDeclaredConstructor(ClassLoader.class);
constructor.setAccessible(true);
return (LoggingSystem) constructor.newInstance(classLoader);
}
catch (Exception ex) {
throw new IllegalStateException(ex);

View File

@@ -84,7 +84,7 @@ class DefaultLogbackConfiguration {
return environment;
}
public void apply(LogbackConfigurator config) {
void apply(LogbackConfigurator config) {
synchronized (config.getConfigurationLock()) {
base(config);
Appender<ILoggingEvent> consoleAppender = consoleAppender(config);

View File

@@ -45,16 +45,16 @@ class LogbackConfigurator {
this.context = context;
}
public LoggerContext getContext() {
LoggerContext getContext() {
return this.context;
}
public Object getConfigurationLock() {
Object getConfigurationLock() {
return this.context.getConfigurationLock();
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public void conversionRule(String conversionWord, Class<? extends Converter> converterClass) {
void conversionRule(String conversionWord, Class<? extends Converter> converterClass) {
Assert.hasLength(conversionWord, "Conversion word must not be empty");
Assert.notNull(converterClass, "Converter class must not be null");
Map<String, String> registry = (Map<String, String>) this.context
@@ -66,20 +66,20 @@ class LogbackConfigurator {
registry.put(conversionWord, converterClass.getName());
}
public void appender(String name, Appender<?> appender) {
void appender(String name, Appender<?> appender) {
appender.setName(name);
start(appender);
}
public void logger(String name, Level level) {
void logger(String name, Level level) {
logger(name, level, true);
}
public void logger(String name, Level level, boolean additive) {
void logger(String name, Level level, boolean additive) {
logger(name, level, additive, null);
}
public void logger(String name, Level level, boolean additive, Appender<ILoggingEvent> appender) {
void logger(String name, Level level, boolean additive, Appender<ILoggingEvent> appender) {
Logger logger = this.context.getLogger(name);
if (level != null) {
logger.setLevel(level);
@@ -91,7 +91,7 @@ class LogbackConfigurator {
}
@SafeVarargs
public final void root(Level level, Appender<ILoggingEvent>... appenders) {
final void root(Level level, Appender<ILoggingEvent>... appenders) {
Logger logger = this.context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
if (level != null) {
logger.setLevel(level);
@@ -101,7 +101,7 @@ class LogbackConfigurator {
}
}
public void start(LifeCycle lifeCycle) {
void start(LifeCycle lifeCycle) {
if (lifeCycle instanceof ContextAware) {
((ContextAware) lifeCycle).setContext(this.context);
}

View File

@@ -96,8 +96,12 @@ public final class LambdaSafe {
/**
* Abstract base class for lambda safe callbacks.
*
* @param <C> the callback type
* @param <A> the primary argument type
* @param <SELF> the self class reference
*/
private abstract static class LambdaSafeCallback<C, A, SELF extends LambdaSafeCallback<C, A, SELF>> {
protected abstract static class LambdaSafeCallback<C, A, SELF extends LambdaSafeCallback<C, A, SELF>> {
private final Class<C> callbackType;
@@ -109,7 +113,7 @@ public final class LambdaSafe {
private Filter<C, A> filter = new GenericTypeFilter<>();
protected LambdaSafeCallback(Class<C> callbackType, A argument, Object[] additionalArguments) {
LambdaSafeCallback(Class<C> callbackType, A argument, Object[] additionalArguments) {
this.callbackType = callbackType;
this.argument = argument;
this.additionalArguments = additionalArguments;
@@ -143,7 +147,7 @@ public final class LambdaSafe {
* @param filter the filter to use
* @return this instance
*/
public SELF withFilter(Filter<C, A> filter) {
SELF withFilter(Filter<C, A> filter) {
Assert.notNull(filter, "Filter must not be null");
this.filter = filter;
return self();

View File

@@ -43,7 +43,7 @@ class BasicAuthentication {
this.charset = charset;
}
public void applyTo(HttpHeaders headers) {
void applyTo(HttpHeaders headers) {
if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
headers.setBasicAuth(this.username, this.password, this.charset);
}

View File

@@ -726,15 +726,15 @@ public class RestTemplateBuilder {
this.bufferRequestBody = bufferRequestBody;
}
public RequestFactoryCustomizer connectTimeout(Duration connectTimeout) {
RequestFactoryCustomizer connectTimeout(Duration connectTimeout) {
return new RequestFactoryCustomizer(connectTimeout, this.readTimeout, this.bufferRequestBody);
}
public RequestFactoryCustomizer readTimeout(Duration readTimeout) {
RequestFactoryCustomizer readTimeout(Duration readTimeout) {
return new RequestFactoryCustomizer(this.connectTimeout, readTimeout, this.bufferRequestBody);
}
public RequestFactoryCustomizer bufferRequestBody(boolean bufferRequestBody) {
RequestFactoryCustomizer bufferRequestBody(boolean bufferRequestBody) {
return new RequestFactoryCustomizer(this.connectTimeout, this.readTimeout, bufferRequestBody);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -32,7 +32,7 @@ class JettyEmbeddedWebAppContext extends WebAppContext {
return new JettyEmbeddedServletHandler();
}
public void deferredInitialize() throws Exception {
void deferredInitialize() throws Exception {
((JettyEmbeddedServletHandler) getServletHandler()).deferredInitialize();
}
@@ -42,7 +42,7 @@ class JettyEmbeddedWebAppContext extends WebAppContext {
public void initialize() throws Exception {
}
public void deferredInitialize() throws Exception {
void deferredInitialize() throws Exception {
super.initialize();
}

View File

@@ -60,7 +60,7 @@ class TomcatEmbeddedContext extends StandardContext {
super.setManager(manager);
}
public void deferredLoadOnStartup() throws LifecycleException {
void deferredLoadOnStartup() throws LifecycleException {
doWithThreadContextClassLoader(getLoader().getClassLoader(),
() -> getLoadOnStartupWrappers(findChildren()).forEach(this::load));
}
@@ -113,11 +113,11 @@ class TomcatEmbeddedContext extends StandardContext {
}
}
public void setStarter(TomcatStarter starter) {
void setStarter(TomcatStarter starter) {
this.starter = starter;
}
public TomcatStarter getStarter() {
TomcatStarter getStarter() {
return this.starter;
}

View File

@@ -63,7 +63,7 @@ class TomcatErrorPage {
return null;
}
public void addToContext(Context context) {
void addToContext(Context context) {
Assert.state(this.nativePage != null, "No Tomcat 8 detected so no native error page exists");
if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) {
org.apache.tomcat.util.descriptor.web.ErrorPage errorPage = (org.apache.tomcat.util.descriptor.web.ErrorPage) this.nativePage;

View File

@@ -64,7 +64,7 @@ class TomcatStarter implements ServletContainerInitializer {
}
}
public Exception getStartUpException() {
Exception getStartUpException() {
return this.startUpException;
}

View File

@@ -137,7 +137,7 @@ class FileSessionPersistence implements SessionPersistenceManager {
this.sessionData = new LinkedHashMap<>(session.getSessionData());
}
public PersistentSession getPersistentSession() {
PersistentSession getPersistentSession() {
return new PersistentSession(this.expiration, this.sessionData);
}

View File

@@ -52,7 +52,7 @@ final class UndertowCompressionConfigurer {
* @param httpHandler the HTTP handler to wrap
* @return the wrapped HTTP handler if compression is enabled, or the handler itself
*/
public static HttpHandler configureCompression(Compression compression, HttpHandler httpHandler) {
static HttpHandler configureCompression(Compression compression, HttpHandler httpHandler) {
if (compression == null || !compression.getEnabled()) {
return httpHandler;
}

View File

@@ -328,7 +328,7 @@ public class UndertowServletWebServer implements WebServer {
this.protocol = protocol;
}
public int getNumber() {
int getNumber() {
return this.number;
}

View File

@@ -259,7 +259,7 @@ public class UndertowWebServer implements WebServer {
this.protocol = protocol;
}
public int getNumber() {
int getNumber() {
return this.number;
}

View File

@@ -240,19 +240,19 @@ public class ReactiveWebServerApplicationContext extends GenericReactiveWebAppli
return this.handler.handle(request, response);
}
public HttpHandler getHandler() {
HttpHandler getHandler() {
return this.handler;
}
public static ServerManager get(ReactiveWebServerFactory factory, boolean lazyInit) {
static ServerManager get(ReactiveWebServerFactory factory, boolean lazyInit) {
return new ServerManager(factory, lazyInit);
}
public static WebServer getWebServer(ServerManager manager) {
static WebServer getWebServer(ServerManager manager) {
return (manager != null) ? manager.server : null;
}
public static void start(ServerManager manager, Supplier<HttpHandler> handlerSupplier) {
static void start(ServerManager manager, Supplier<HttpHandler> handlerSupplier) {
if (manager != null && manager.server != null) {
manager.handler = manager.lazyInit ? new LazyHttpHandler(Mono.fromSupplier(handlerSupplier))
: handlerSupplier.get();
@@ -260,7 +260,7 @@ public class ReactiveWebServerApplicationContext extends GenericReactiveWebAppli
}
}
public static void stop(ServerManager manager) {
static void stop(ServerManager manager) {
if (manager != null && manager.server != null) {
try {
manager.server.stop();

View File

@@ -44,11 +44,11 @@ class DocumentRoot {
this.logger = logger;
}
public File getDirectory() {
File getDirectory() {
return this.directory;
}
public void setDirectory(File directory) {
void setDirectory(File directory) {
this.directory = directory;
}
@@ -57,7 +57,7 @@ class DocumentRoot {
* warning and returning {@code null} otherwise.
* @return the valid document root
*/
public final File getValidDirectory() {
final File getValidDirectory() {
File file = this.directory;
file = (file != null) ? file : getWarFileDocumentRoot();
file = (file != null) ? file : getExplodedWarFileDocumentRoot();
@@ -120,7 +120,7 @@ class DocumentRoot {
}
}
public final File getExplodedWarFileDocumentRoot(File codeSourceFile) {
final File getExplodedWarFileDocumentRoot(File codeSourceFile) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Code archive: " + codeSourceFile);
}

View File

@@ -32,15 +32,15 @@ class SessionStoreDirectory {
private File directory;
public File getDirectory() {
File getDirectory() {
return this.directory;
}
public void setDirectory(File directory) {
void setDirectory(File directory) {
this.directory = directory;
}
public File getValidDirectory(boolean mkdirs) {
File getValidDirectory(boolean mkdirs) {
File dir = getDirectory();
if (dir == null) {
return new ApplicationTemp().getDir("servlet-sessions");

View File

@@ -350,11 +350,11 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry {
}
}
public String getMessage() {
String getMessage() {
return this.message;
}
public boolean hasErrorToSend() {
boolean hasErrorToSend() {
return this.hasErrorToSend;
}

View File

@@ -28,7 +28,7 @@ import org.springframework.context.annotation.Configuration;
class ErrorPageFilterConfiguration {
@Bean
public ErrorPageFilter errorPageFilter() {
ErrorPageFilter errorPageFilter() {
return new ErrorPageFilter();
}

View File

@@ -101,7 +101,7 @@ public class HttpWebServiceMessageSenderBuilder {
this.methodName = methodName;
}
public void customize(ClientHttpRequestFactory factory) {
void customize(ClientHttpRequestFactory factory) {
ReflectionUtils.invokeMethod(findMethod(factory), factory, Math.toIntExact(this.timeout.toMillis()));
}

View File

@@ -135,7 +135,7 @@ class BannerTests {
}
@Configuration(proxyBeanMethods = false)
public static class Config {
static class Config {
}

View File

@@ -61,43 +61,43 @@ class OverrideSourcesTests {
}
@Configuration(proxyBeanMethods = false)
protected static class TestConfiguration {
static class TestConfiguration {
@Bean
@Primary
public TestBean another() {
TestBean another() {
return new TestBean("bar");
}
}
@Configuration(proxyBeanMethods = false)
protected static class MainConfiguration {
static class MainConfiguration {
@Bean
public TestBean first() {
TestBean first() {
return new TestBean("foo");
}
@Bean
public Service Service() {
Service Service() {
return new Service();
}
}
protected static class Service {
static class Service {
@Autowired
private TestBean bean;
}
protected static class TestBean {
static class TestBean {
private final String name;
public TestBean(String name) {
TestBean(String name) {
this.name = name;
}

View File

@@ -171,7 +171,7 @@ class ReproTests {
}
@Configuration(proxyBeanMethods = false)
public static class Config {
static class Config {
}

View File

@@ -120,7 +120,7 @@ class ResourceBannerTests {
return out.toString();
}
private static class MockResourceBanner extends ResourceBanner {
static class MockResourceBanner extends ResourceBanner {
private final String bootVersion;

View File

@@ -1123,14 +1123,14 @@ class SpringApplicationTests {
}
@Configuration
protected static class InaccessibleConfiguration {
static class InaccessibleConfiguration {
private InaccessibleConfiguration() {
}
}
public static class SpyApplicationContext extends AnnotationConfigApplicationContext {
static class SpyApplicationContext extends AnnotationConfigApplicationContext {
ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext());
@@ -1139,7 +1139,7 @@ class SpringApplicationTests {
this.applicationContext.registerShutdownHook();
}
public ConfigurableApplicationContext getApplicationContext() {
ConfigurableApplicationContext getApplicationContext() {
return this.applicationContext;
}
@@ -1150,7 +1150,7 @@ class SpringApplicationTests {
}
private static class TestSpringApplication extends SpringApplication {
static class TestSpringApplication extends SpringApplication {
private BeanDefinitionLoader loader;
@@ -1166,7 +1166,7 @@ class SpringApplicationTests {
super(resourceLoader, primarySources);
}
public void setUseMockLoader(boolean useMockLoader) {
void setUseMockLoader(boolean useMockLoader) {
this.useMockLoader = useMockLoader;
}
@@ -1181,7 +1181,7 @@ class SpringApplicationTests {
return this.loader;
}
public BeanDefinitionLoader getLoader() {
BeanDefinitionLoader getLoader() {
return this.loader;
}
@@ -1191,7 +1191,7 @@ class SpringApplicationTests {
this.bannerMode = bannerMode;
}
public Banner.Mode getBannerMode() {
Banner.Mode getBannerMode() {
return this.bannerMode;
}
@@ -1201,7 +1201,7 @@ class SpringApplicationTests {
static class ExampleConfig {
@Bean
public String someBean() {
String someBean() {
return "test";
}
@@ -1211,7 +1211,7 @@ class SpringApplicationTests {
static class OverrideConfig {
@Bean
public String someBean() {
String someBean() {
return "override";
}
@@ -1221,14 +1221,14 @@ class SpringApplicationTests {
static class BrokenPostConstructConfig {
@Bean
public Thing thing() {
Thing thing() {
return new Thing();
}
static class Thing {
@PostConstruct
public void boom() {
void boom() {
throw new IllegalStateException();
}
@@ -1240,7 +1240,7 @@ class SpringApplicationTests {
static class ListenerConfig {
@Bean
public ApplicationListener<?> testApplicationListener() {
ApplicationListener<?> testApplicationListener() {
return mock(ApplicationListener.class);
}
@@ -1250,7 +1250,7 @@ class SpringApplicationTests {
static class Multicaster {
@Bean(name = AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME)
public ApplicationEventMulticaster applicationEventMulticaster() {
ApplicationEventMulticaster applicationEventMulticaster() {
return spy(new SimpleApplicationEventMulticaster());
}
@@ -1260,7 +1260,7 @@ class SpringApplicationTests {
static class ExampleWebConfig {
@Bean
public TomcatServletWebServerFactory webServer() {
TomcatServletWebServerFactory webServer() {
return new TomcatServletWebServerFactory(0);
}
@@ -1270,12 +1270,12 @@ class SpringApplicationTests {
static class ExampleReactiveWebConfig {
@Bean
public NettyReactiveWebServerFactory webServerFactory() {
NettyReactiveWebServerFactory webServerFactory() {
return new NettyReactiveWebServerFactory(0);
}
@Bean
public HttpHandler httpHandler() {
HttpHandler httpHandler() {
return (serverHttpRequest, serverHttpResponse) -> Mono.empty();
}
@@ -1285,7 +1285,7 @@ class SpringApplicationTests {
static class FailingConfig {
@Bean
public Object fail() {
Object fail() {
throw new RuntimeException("ExpectedError");
}
@@ -1295,17 +1295,17 @@ class SpringApplicationTests {
static class CommandLineRunConfig {
@Bean
public TestCommandLineRunner runnerC() {
TestCommandLineRunner runnerC() {
return new TestCommandLineRunner(Ordered.LOWEST_PRECEDENCE, "runnerB", "runnerA");
}
@Bean
public TestApplicationRunner runnerB() {
TestApplicationRunner runnerB() {
return new TestApplicationRunner(Ordered.LOWEST_PRECEDENCE - 1, "runnerA");
}
@Bean
public TestCommandLineRunner runnerA() {
TestCommandLineRunner runnerA() {
return new TestCommandLineRunner(Ordered.HIGHEST_PRECEDENCE);
}
@@ -1315,7 +1315,7 @@ class SpringApplicationTests {
static class ExitCodeCommandLineRunConfig {
@Bean
public CommandLineRunner runner() {
CommandLineRunner runner() {
return (args) -> {
throw new IllegalStateException(new ExitStatusException());
};
@@ -1327,14 +1327,14 @@ class SpringApplicationTests {
static class MappedExitCodeCommandLineRunConfig {
@Bean
public CommandLineRunner runner() {
CommandLineRunner runner() {
return (args) -> {
throw new IllegalStateException();
};
}
@Bean
public ExitCodeExceptionMapper exceptionMapper() {
ExitCodeExceptionMapper exceptionMapper() {
return (exception) -> {
if (exception instanceof IllegalStateException) {
return 11;
@@ -1349,7 +1349,7 @@ class SpringApplicationTests {
static class RefreshFailureConfig {
@PostConstruct
public void fail() {
void fail() {
throw new RefreshFailureException();
}
@@ -1359,12 +1359,12 @@ class SpringApplicationTests {
static class LazyInitializationConfig {
@Bean
public AtomicInteger counter() {
AtomicInteger counter() {
return new AtomicInteger(0);
}
@Bean
public LazyBean lazyBean(AtomicInteger counter) {
LazyBean lazyBean(AtomicInteger counter) {
return new LazyBean(counter);
}
@@ -1382,13 +1382,13 @@ class SpringApplicationTests {
static class NotLazyInitializationConfig {
@Bean
public AtomicInteger counter() {
AtomicInteger counter() {
return new AtomicInteger(0);
}
@Bean
@Lazy(false)
public NotLazyBean NotLazyBean(AtomicInteger counter) {
NotLazyBean NotLazyBean(AtomicInteger counter) {
return new NotLazyBean(counter);
}
@@ -1440,7 +1440,7 @@ class SpringApplicationTests {
return this.order;
}
public void markAsRan() {
void markAsRan() {
this.run = true;
for (String name : this.expectedBefore) {
AbstractTestRunner bean = this.applicationContext.getBean(name, AbstractTestRunner.class);
@@ -1448,13 +1448,13 @@ class SpringApplicationTests {
}
}
public boolean hasRun() {
boolean hasRun() {
return this.run;
}
}
private static class TestCommandLineRunner extends AbstractTestRunner implements CommandLineRunner {
static class TestCommandLineRunner extends AbstractTestRunner implements CommandLineRunner {
TestCommandLineRunner(int order, String... expectedBefore) {
super(order, expectedBefore);
@@ -1467,7 +1467,7 @@ class SpringApplicationTests {
}
private static class TestApplicationRunner extends AbstractTestRunner implements ApplicationRunner {
static class TestApplicationRunner extends AbstractTestRunner implements ApplicationRunner {
TestApplicationRunner(int order, String... expectedBefore) {
super(order, expectedBefore);
@@ -1480,7 +1480,7 @@ class SpringApplicationTests {
}
private static class ExitCodeListener implements ApplicationListener<ExitCodeEvent> {
static class ExitCodeListener implements ApplicationListener<ExitCodeEvent> {
private Integer exitCode;
@@ -1489,17 +1489,17 @@ class SpringApplicationTests {
this.exitCode = event.getExitCode();
}
public Integer getExitCode() {
Integer getExitCode() {
return this.exitCode;
}
}
private static class MockResourceLoader implements ResourceLoader {
static class MockResourceLoader implements ResourceLoader {
private final Map<String, Resource> resources = new HashMap<>();
public void addResource(String source, String path) {
void addResource(String source, String path) {
this.resources.put(source, new ClassPathResource(path, getClass()));
}

View File

@@ -46,12 +46,12 @@ class SpringBootConfigurationTests {
}
@SpringBootConfiguration
private static class DefaultSpringBootConfiguration {
static class DefaultSpringBootConfiguration {
}
@SpringBootConfiguration(proxyBeanMethods = false)
private static class NoBeanMethodProxyingSpringBootConfiguration {
static class NoBeanMethodProxyingSpringBootConfiguration {
}

View File

@@ -176,8 +176,7 @@ class SpringApplicationAdminMXBeanRegistrarTests {
static class Config {
@Bean
public SpringApplicationAdminMXBeanRegistrar springApplicationAdminRegistrar()
throws MalformedObjectNameException {
SpringApplicationAdminMXBeanRegistrar springApplicationAdminRegistrar() throws MalformedObjectNameException {
return new SpringApplicationAdminMXBeanRegistrar(OBJECT_NAME);
}

View File

@@ -279,7 +279,7 @@ class SpringApplicationBuilderTests {
}
public static class SpyApplicationContext extends AnnotationConfigApplicationContext {
static class SpyApplicationContext extends AnnotationConfigApplicationContext {
private final ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext());
@@ -292,7 +292,7 @@ class SpringApplicationBuilderTests {
this.applicationContext.setParent(parent);
}
public ConfigurableApplicationContext getApplicationContext() {
ConfigurableApplicationContext getApplicationContext() {
return this.applicationContext;
}
@@ -302,7 +302,7 @@ class SpringApplicationBuilderTests {
this.resourceLoader = resourceLoader;
}
public ResourceLoader getResourceLoader() {
ResourceLoader getResourceLoader() {
return this.resourceLoader;
}
@@ -312,7 +312,7 @@ class SpringApplicationBuilderTests {
this.registeredShutdownHook = true;
}
public boolean getRegisteredShutdownHook() {
boolean getRegisteredShutdownHook() {
return this.registeredShutdownHook;
}

View File

@@ -120,7 +120,7 @@ class ConfigurationWarningsApplicationContextInitializerTests {
/**
* Testable version of {@link ConfigurationWarningsApplicationContextInitializer}.
*/
public static class TestConfigurationWarningsApplicationContextInitializer
static class TestConfigurationWarningsApplicationContextInitializer
extends ConfigurationWarningsApplicationContextInitializer {
@Override

View File

@@ -92,7 +92,7 @@ class AnsiOutputApplicationListenerTests {
}
@Configuration(proxyBeanMethods = false)
public static class Config {
static class Config {
}

View File

@@ -1005,55 +1005,55 @@ class ConfigFileApplicationListenerTests {
}
@Configuration(proxyBeanMethods = false)
protected static class Config {
static class Config {
}
@Configuration(proxyBeanMethods = false)
@PropertySource("classpath:/specificlocation.properties")
protected static class WithPropertySource {
static class WithPropertySource {
}
@Configuration(proxyBeanMethods = false)
@PropertySource("classpath:/${source.location}.properties")
protected static class WithPropertySourcePlaceholders {
static class WithPropertySourcePlaceholders {
}
@Configuration(proxyBeanMethods = false)
@PropertySource(value = "classpath:/specificlocation.properties", name = "foo")
protected static class WithPropertySourceAndName {
static class WithPropertySourceAndName {
}
@Configuration(proxyBeanMethods = false)
@PropertySource("classpath:/enableprofile.properties")
protected static class WithPropertySourceInProfile {
static class WithPropertySourceInProfile {
}
@Configuration(proxyBeanMethods = false)
@PropertySource("classpath:/enableprofile-myprofile.properties")
@Profile("myprofile")
protected static class WithPropertySourceAndProfile {
static class WithPropertySourceAndProfile {
}
@Configuration(proxyBeanMethods = false)
@PropertySource({ "classpath:/specificlocation.properties", "classpath:/moreproperties.properties" })
protected static class WithPropertySourceMultipleLocations {
static class WithPropertySourceMultipleLocations {
}
@Configuration(proxyBeanMethods = false)
@PropertySource(value = { "classpath:/specificlocation.properties", "classpath:/moreproperties.properties" },
name = "foo")
protected static class WithPropertySourceMultipleLocationsAndName {
static class WithPropertySourceMultipleLocationsAndName {
}
private static class TestConfigFileApplicationListener extends ConfigFileApplicationListener {
static class TestConfigFileApplicationListener extends ConfigFileApplicationListener {
@Override
List<EnvironmentPostProcessor> loadPostProcessors() {
@@ -1063,7 +1063,7 @@ class ConfigFileApplicationListenerTests {
}
@Order(Ordered.LOWEST_PRECEDENCE)
private static class LowestPrecedenceEnvironmentPostProcessor implements EnvironmentPostProcessor {
static class LowestPrecedenceEnvironmentPostProcessor implements EnvironmentPostProcessor {
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {

View File

@@ -151,7 +151,7 @@ class ConfigFileApplicationListenerYamlProfileNegationTests {
}
@Configuration(proxyBeanMethods = false)
public static class Config {
static class Config {
}

View File

@@ -90,7 +90,7 @@ class DelegatingApplicationContextInitializerTests {
}
@Order(Ordered.HIGHEST_PRECEDENCE)
private static class MockInitA implements ApplicationContextInitializer<ConfigurableApplicationContext> {
static class MockInitA implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
@@ -100,7 +100,7 @@ class DelegatingApplicationContextInitializerTests {
}
@Order(Ordered.LOWEST_PRECEDENCE)
private static class MockInitB implements ApplicationContextInitializer<ConfigurableApplicationContext> {
static class MockInitB implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
@@ -110,7 +110,7 @@ class DelegatingApplicationContextInitializerTests {
}
private static class NotSuitableInit implements ApplicationContextInitializer<ConfigurableWebApplicationContext> {
static class NotSuitableInit implements ApplicationContextInitializer<ConfigurableWebApplicationContext> {
@Override
public void initialize(ConfigurableWebApplicationContext applicationContext) {

View File

@@ -75,7 +75,7 @@ class DelegatingApplicationListenerTests {
}
@Order(Ordered.HIGHEST_PRECEDENCE)
private static class MockInitA implements ApplicationListener<ContextRefreshedEvent> {
static class MockInitA implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
@@ -87,7 +87,7 @@ class DelegatingApplicationListenerTests {
}
@Order(Ordered.LOWEST_PRECEDENCE)
private static class MockInitB implements ApplicationListener<ContextRefreshedEvent> {
static class MockInitB implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -65,7 +65,7 @@ class FilteredPropertySourceTests {
}
private static class TestOperation implements Consumer<PropertySource<?>> {
static class TestOperation implements Consumer<PropertySource<?>> {
private boolean called;
@@ -90,11 +90,11 @@ class FilteredPropertySourceTests {
}
}
public boolean isCalled() {
boolean isCalled() {
return this.called;
}
public PropertySource<?> getOriginal() {
PropertySource<?> getOriginal() {
return this.original;
}

View File

@@ -615,11 +615,11 @@ public class LoggingApplicationListenerTests {
environment.getPropertySources().addFirst(propertySource);
}
public static class TestShutdownHandlerLoggingSystem extends AbstractLoggingSystem {
static class TestShutdownHandlerLoggingSystem extends AbstractLoggingSystem {
private static CountDownLatch shutdownLatch;
public TestShutdownHandlerLoggingSystem(ClassLoader classLoader) {
TestShutdownHandlerLoggingSystem(ClassLoader classLoader) {
super(classLoader);
TestShutdownHandlerLoggingSystem.shutdownLatch = new CountDownLatch(1);
}
@@ -659,7 +659,7 @@ public class LoggingApplicationListenerTests {
}
public static class TestLoggingApplicationListener extends LoggingApplicationListener {
static class TestLoggingApplicationListener extends LoggingApplicationListener {
private Thread shutdownHook;

View File

@@ -123,7 +123,7 @@ class ConfigurationPropertiesBeanRegistrarTests {
}
@ConfigurationProperties(prefix = "bar")
public static class BarProperties {
static class BarProperties {
BarProperties(String foo) {
}
@@ -131,7 +131,7 @@ class ConfigurationPropertiesBeanRegistrarTests {
}
@ConfigurationProperties(prefix = "bing")
public static class BingProperties {
static class BingProperties {
BingProperties() {
}

View File

@@ -154,7 +154,7 @@ class ConfigurationPropertiesBindHandlerAdvisorTests {
private Map<String, BindingProperties> bindings = new TreeMap<>();
public Map<String, BindingProperties> getBindings() {
Map<String, BindingProperties> getBindings() {
return this.bindings;
}
@@ -166,19 +166,19 @@ class ConfigurationPropertiesBindHandlerAdvisorTests {
private String contentType = "application/json";
public String getDestination() {
String getDestination() {
return this.destination;
}
public void setDestination(String destination) {
void setDestination(String destination) {
this.destination = destination;
}
public String getContentType() {
String getContentType() {
return this.contentType;
}
public void setContentType(String contentType) {
void setContentType(String contentType) {
this.contentType = contentType;
}

View File

@@ -848,7 +848,7 @@ class ConfigurationPropertiesTests {
@Bean
@Validated
public NonValidatedJsr303Properties properties() {
NonValidatedJsr303Properties properties() {
return new NonValidatedJsr303Properties();
}
@@ -888,7 +888,7 @@ class ConfigurationPropertiesTests {
static class DefaultsInJavaConfiguration {
@Bean
public BasicProperties basicProperties() {
BasicProperties basicProperties() {
BasicProperties test = new BasicProperties();
test.setName("bar");
return test;
@@ -901,7 +901,7 @@ class ConfigurationPropertiesTests {
static class PrefixPropertiesDeclaredAsBeanConfiguration {
@Bean
public PrefixProperties prefixProperties() {
PrefixProperties prefixProperties() {
return new PrefixProperties();
}
@@ -925,7 +925,7 @@ class ConfigurationPropertiesTests {
@Bean
@ConfigurationProperties(prefix = "spam")
public PrefixProperties prefixProperties() {
PrefixProperties prefixProperties() {
return new PrefixProperties();
}
@@ -936,7 +936,7 @@ class ConfigurationPropertiesTests {
static class ValidatedImplementationConfiguration {
@Bean
public ValidatedImplementationProperties testProperties() {
ValidatedImplementationProperties testProperties() {
return new ValidatedImplementationProperties();
}
@@ -951,16 +951,16 @@ class ConfigurationPropertiesTests {
private boolean initialized;
public void setBar(String bar) {
void setBar(String bar) {
this.bar = bar;
}
public String getBar() {
String getBar() {
return this.bar;
}
@PostConstruct
public void init() {
void init() {
assertThat(this.bar).isNotNull();
this.initialized = true;
}
@@ -972,7 +972,7 @@ class ConfigurationPropertiesTests {
static class WithPropertyPlaceholderValueConfiguration {
@Bean
public static PropertySourcesPlaceholderConfigurer configurer() {
static PropertySourcesPlaceholderConfigurer configurer() {
return new PropertySourcesPlaceholderConfigurer();
}
@@ -983,7 +983,7 @@ class ConfigurationPropertiesTests {
static class WithPropertyPlaceholderWithLocalPropertiesValueConfiguration {
@Bean
public static PropertySourcesPlaceholderConfigurer configurer() {
static PropertySourcesPlaceholderConfigurer configurer() {
PropertySourcesPlaceholderConfigurer placeholderConfigurer = new PropertySourcesPlaceholderConfigurer();
Properties properties = new Properties();
properties.put("com.example.bar", "b");
@@ -997,7 +997,7 @@ class ConfigurationPropertiesTests {
@EnableConfigurationProperties
static class WithFactoryBeanConfiguration {
public static boolean factoryBeanInitialized;
static boolean factoryBeanInitialized;
}
@@ -1006,12 +1006,12 @@ class ConfigurationPropertiesTests {
static class MultiplePropertySourcesPlaceholderConfigurerConfiguration {
@Bean
public static PropertySourcesPlaceholderConfigurer configurer1() {
static PropertySourcesPlaceholderConfigurer configurer1() {
return new PropertySourcesPlaceholderConfigurer();
}
@Bean
public static PropertySourcesPlaceholderConfigurer configurer2() {
static PropertySourcesPlaceholderConfigurer configurer2() {
return new PropertySourcesPlaceholderConfigurer();
}
@@ -1024,7 +1024,7 @@ class ConfigurationPropertiesTests {
@Bean
@Scope("prototype")
@ConfigurationProperties("example")
public PrototypeBean prototypeBean() {
PrototypeBean prototypeBean() {
return new PrototypeBean();
}
@@ -1032,23 +1032,23 @@ class ConfigurationPropertiesTests {
@EnableConfigurationProperties
@ConfigurationProperties(prefix = "test")
public static class PropertiesWithResource {
static class PropertiesWithResource {
private Resource resource;
public Resource getResource() {
Resource getResource() {
return this.resource;
}
public void setResource(Resource resource) {
void setResource(Resource resource) {
this.resource = resource;
}
}
private static class TestProtocolResolver implements ProtocolResolver {
static class TestProtocolResolver implements ProtocolResolver {
public static final String PREFIX = "test:/";
static final String PREFIX = "test:/";
@Override
public Resource resolve(String location, ResourceLoader resourceLoader) {
@@ -1066,7 +1066,7 @@ class ConfigurationPropertiesTests {
@Bean
@ConfigurationPropertiesBinding
public Converter<String, Person> personConverter() {
Converter<String, Person> personConverter() {
return new PersonConverter();
}
@@ -1076,7 +1076,7 @@ class ConfigurationPropertiesTests {
static class NonQualifiedConverterConfiguration {
@Bean
public Converter<String, Person> personConverter() {
Converter<String, Person> personConverter() {
return new PersonConverter();
}
@@ -1087,7 +1087,7 @@ class ConfigurationPropertiesTests {
@Bean
@ConfigurationPropertiesBinding
public GenericConverter genericPersonConverter() {
GenericConverter genericPersonConverter() {
return new GenericPersonConverter();
}
@@ -1097,7 +1097,7 @@ class ConfigurationPropertiesTests {
static class NonQualifiedGenericConverterConfiguration {
@Bean
public GenericConverter genericPersonConverter() {
GenericConverter genericPersonConverter() {
return new GenericPersonConverter();
}
@@ -1109,7 +1109,7 @@ class ConfigurationPropertiesTests {
@Bean
@ConfigurationProperties("foo")
public AGenericClass<String> aBeanToBind() {
AGenericClass<String> aBeanToBind() {
return new AGenericClass<>();
}
@@ -1120,7 +1120,7 @@ class ConfigurationPropertiesTests {
static class WithCustomValidatorConfiguration {
@Bean(name = ConfigurationPropertiesBindingPostProcessorRegistrar.VALIDATOR_BEAN_NAME)
public CustomPropertiesValidator validator() {
CustomPropertiesValidator validator() {
return new CustomPropertiesValidator();
}
@@ -1131,7 +1131,7 @@ class ConfigurationPropertiesTests {
static class WithUnsupportedCustomValidatorConfiguration {
@Bean(name = ConfigurationPropertiesBindingPostProcessorRegistrar.VALIDATOR_BEAN_NAME)
public CustomPropertiesValidator validator() {
CustomPropertiesValidator validator() {
return new CustomPropertiesValidator();
}
@@ -1141,11 +1141,11 @@ class ConfigurationPropertiesTests {
private T bar;
public T getBar() {
T getBar() {
return this.bar;
}
public void setBar(T bar) {
void setBar(T bar) {
this.bar = bar;
}
@@ -1157,19 +1157,19 @@ class ConfigurationPropertiesTests {
private String two;
public String getOne() {
String getOne() {
return this.one;
}
public void setOne(String one) {
void setOne(String one) {
this.one = one;
}
public String getTwo() {
String getTwo() {
return this.two;
}
public void setTwo(String two) {
void setTwo(String two) {
this.two = two;
}
@@ -1202,7 +1202,7 @@ class ConfigurationPropertiesTests {
}
@ConfigurationProperties
static class BasicProperties {
public static class BasicProperties {
private String name;
@@ -1215,30 +1215,31 @@ class ConfigurationPropertiesTests {
// No getter - you should be able to bind to a write-only bean
public void setName(String name) {
// Must be public for XML
this.name = name;
}
public void setArray(int... values) {
void setArray(int... values) {
this.array = values;
}
public int[] getArray() {
int[] getArray() {
return this.array;
}
public List<Integer> getList() {
List<Integer> getList() {
return this.list;
}
public void setList(List<Integer> list) {
void setList(List<Integer> list) {
this.list = list;
}
public Duration getDuration() {
Duration getDuration() {
return this.duration;
}
public void setDuration(Duration duration) {
void setDuration(Duration duration) {
this.duration = duration;
}
@@ -1251,19 +1252,19 @@ class ConfigurationPropertiesTests {
private final Nested nested = new Nested();
public void setName(String name) {
void setName(String name) {
this.name = name;
}
public Nested getNested() {
Nested getNested() {
return this.nested;
}
protected static class Nested {
static class Nested {
private String name;
public void setName(String name) {
void setName(String name) {
this.name = name;
}
@@ -1282,11 +1283,11 @@ class ConfigurationPropertiesTests {
private long bar;
public void setBar(long bar) {
void setBar(long bar) {
this.bar = bar;
}
public long getBar() {
long getBar() {
return this.bar;
}
@@ -1307,11 +1308,11 @@ class ConfigurationPropertiesTests {
@NotEmpty
private String description;
public String getDescription() {
String getDescription() {
return this.description;
}
public void setDescription(String description) {
void setDescription(String description) {
this.description = description;
}
@@ -1335,7 +1336,7 @@ class ConfigurationPropertiesTests {
private Jsr303Properties properties;
public Jsr303Properties getProperties() {
Jsr303Properties getProperties() {
return this.properties;
}
@@ -1349,7 +1350,7 @@ class ConfigurationPropertiesTests {
@Valid
private List<Jsr303Properties> properties = Collections.singletonList(new Jsr303Properties());
public List<Jsr303Properties> getProperties() {
List<Jsr303Properties> getProperties() {
return this.properties;
}
@@ -1364,7 +1365,7 @@ class ConfigurationPropertiesTests {
private String name;
public void setName(String name) {
void setName(String name) {
this.name = name;
}
@@ -1378,11 +1379,11 @@ class ConfigurationPropertiesTests {
private Map<String, String> mymap;
public void setMymap(Map<String, String> mymap) {
void setMymap(Map<String, String> mymap) {
this.mymap = mymap;
}
public Map<String, String> getMymap() {
Map<String, String> getMymap() {
return this.mymap;
}
@@ -1395,11 +1396,11 @@ class ConfigurationPropertiesTests {
private BasicProperties properties;
@PostConstruct
public void init() {
void init() {
assertThat(this.properties).isNotNull();
}
public String getName() {
String getName() {
return this.properties.name;
}
@@ -1423,7 +1424,7 @@ class ConfigurationPropertiesTests {
return this.foo;
}
public void setFoo(String foo) {
void setFoo(String foo) {
this.foo = foo;
}
@@ -1436,11 +1437,11 @@ class ConfigurationPropertiesTests {
@Value("${default.value}")
private String value;
public void setValue(String value) {
void setValue(String value) {
this.value = value;
}
public String getValue() {
String getValue() {
return this.value;
}
@@ -1454,19 +1455,19 @@ class ConfigurationPropertiesTests {
private List<FooEnum> theValues;
public void setTheValue(FooEnum value) {
void setTheValue(FooEnum value) {
this.theValue = value;
}
public FooEnum getTheValue() {
FooEnum getTheValue() {
return this.theValue;
}
public List<FooEnum> getTheValues() {
List<FooEnum> getTheValues() {
return this.theValues;
}
public void setTheValues(List<FooEnum> theValues) {
void setTheValues(List<FooEnum> theValues) {
this.theValues = theValues;
}
@@ -1484,11 +1485,11 @@ class ConfigurationPropertiesTests {
private char[] chars;
public char[] getChars() {
char[] getChars() {
return this.chars;
}
public void setChars(char[] chars) {
void setChars(char[] chars) {
this.chars = chars;
}
@@ -1502,19 +1503,19 @@ class ConfigurationPropertiesTests {
private String barBAZ;
public String getFooBar() {
String getFooBar() {
return this.fooBar;
}
public void setFooBar(String fooBar) {
void setFooBar(String fooBar) {
this.fooBar = fooBar;
}
public String getBarBAZ() {
String getBarBAZ() {
return this.barBAZ;
}
public void setBarBAZ(String barBAZ) {
void setBarBAZ(String barBAZ) {
this.barBAZ = barBAZ;
}
@@ -1527,11 +1528,11 @@ class ConfigurationPropertiesTests {
private Map<String, String> map;
public Map<String, String> getMap() {
Map<String, String> getMap() {
return this.map;
}
public void setMap(Map<String, String> map) {
void setMap(Map<String, String> map) {
this.map = map;
}
@@ -1543,11 +1544,11 @@ class ConfigurationPropertiesTests {
private Map<String, Map<String, String>> map;
public Map<String, Map<String, String>> getMap() {
Map<String, Map<String, String>> getMap() {
return this.map;
}
public void setMap(Map<String, Map<String, String>> map) {
void setMap(Map<String, Map<String, String>> map) {
this.map = map;
}
@@ -1559,11 +1560,11 @@ class ConfigurationPropertiesTests {
private Map<String, Map<Integer, Foo>> map;
public Map<String, Map<Integer, Foo>> getMap() {
Map<String, Map<Integer, Foo>> getMap() {
return this.map;
}
public void setMap(Map<String, Map<Integer, Foo>> map) {
void setMap(Map<String, Map<Integer, Foo>> map) {
this.map = map;
}
@@ -1577,19 +1578,19 @@ class ConfigurationPropertiesTests {
private String bar;
public void setBar(String bar) {
this.bar = bar;
}
public String getBar() {
String getBar() {
return this.bar;
}
public int getFoo() {
void setBar(String bar) {
this.bar = bar;
}
int getFoo() {
return this.foo;
}
public void setFoo(int foo) {
void setFoo(int foo) {
this.foo = foo;
}
@@ -1601,11 +1602,11 @@ class ConfigurationPropertiesTests {
private Person person;
public Person getPerson() {
Person getPerson() {
return this.person;
}
public void setPerson(Person person) {
void setPerson(Person person) {
this.person = person;
}
@@ -1617,7 +1618,7 @@ class ConfigurationPropertiesTests {
private Map<String, BasicProperties> properties = new LinkedHashMap<>();
public Map<String, BasicProperties> getProperties() {
Map<String, BasicProperties> getProperties() {
return this.properties;
}
@@ -1625,7 +1626,9 @@ class ConfigurationPropertiesTests {
@EnableConfigurationProperties
@ConfigurationProperties
static class ValidatorProperties implements Validator {
public static class ValidatorProperties implements Validator {
// Needs to be public due to validator (see gh-17394)
private String foo;
@@ -1655,11 +1658,11 @@ class ConfigurationPropertiesTests {
private String foo;
public String getFoo() {
String getFoo() {
return this.foo;
}
public void setFoo(String foo) {
void setFoo(String foo) {
this.foo = foo;
if (!foo.equals("bar")) {
throw new IllegalArgumentException("Wrong value for foo");
@@ -1669,7 +1672,9 @@ class ConfigurationPropertiesTests {
}
@ConfigurationProperties(prefix = "custom")
static class WithCustomValidatorProperties {
public static class WithCustomValidatorProperties {
// Needs to be public due to validator (see gh-17394)
private String foo;
@@ -1689,11 +1694,11 @@ class ConfigurationPropertiesTests {
private List<Class<? extends Throwable>> list;
public List<Class<? extends Throwable>> getList() {
List<Class<? extends Throwable>> getList() {
return this.list;
}
public void setList(List<Class<? extends Throwable>> list) {
void setList(List<Class<? extends Throwable>> list) {
this.list = list;
}
@@ -1705,11 +1710,11 @@ class ConfigurationPropertiesTests {
private File file;
public File getFile() {
File getFile() {
return this.file;
}
public void setFile(File file) {
void setFile(File file) {
this.file = file;
}
@@ -1724,19 +1729,19 @@ class ConfigurationPropertiesTests {
@DataSizeUnit(DataUnit.KILOBYTES)
private DataSize anotherSize;
public DataSize getSize() {
DataSize getSize() {
return this.size;
}
public void setSize(DataSize size) {
void setSize(DataSize size) {
this.size = size;
}
public DataSize getAnotherSize() {
DataSize getAnotherSize() {
return this.anotherSize;
}
public void setAnotherSize(DataSize anotherSize) {
void setAnotherSize(DataSize anotherSize) {
this.anotherSize = anotherSize;
}
@@ -1773,11 +1778,11 @@ class ConfigurationPropertiesTests {
this.bar = bar;
}
public String getFoo() {
String getFoo() {
return this.foo;
}
public int getBar() {
int getBar() {
return this.bar;
}
@@ -1794,7 +1799,7 @@ class ConfigurationPropertiesTests {
this.foo = foo;
}
public String getFoo() {
String getFoo() {
return this.foo;
}
@@ -1878,19 +1883,19 @@ class ConfigurationPropertiesTests {
private int b;
public String getA() {
String getA() {
return this.a;
}
public void setA(String a) {
void setA(String a) {
this.a = a;
}
public int getB() {
int getB() {
return this.b;
}
public void setB(int b) {
void setB(int b) {
this.b = b;
}

View File

@@ -207,7 +207,7 @@ class PropertyMapperTests {
assertThat(result).isEqualTo("123");
}
private static class Count<T> implements Supplier<T> {
static class Count<T> implements Supplier<T> {
private final Supplier<T> source;
@@ -223,13 +223,13 @@ class PropertyMapperTests {
return this.source.get();
}
public int getCount() {
int getCount() {
return this.count;
}
}
private static class ExampleSource {
static class ExampleSource {
private final String name;
@@ -237,21 +237,21 @@ class PropertyMapperTests {
this.name = name;
}
public String getName() {
String getName() {
return this.name;
}
}
private static class ExampleDest {
static class ExampleDest {
private String name;
public void setName(String name) {
void setName(String name) {
this.name = name;
}
public String getName() {
String getName() {
return this.name;
}

View File

@@ -57,29 +57,29 @@ class BackCompatibilityBinderIntegrationTests {
assertThat(result.getPassword()).isEqualTo("test");
}
public static class ExampleCamelCaseBean {
static class ExampleCamelCaseBean {
private String zkNodes;
public String getZkNodes() {
String getZkNodes() {
return this.zkNodes;
}
public void setZkNodes(String zkNodes) {
void setZkNodes(String zkNodes) {
this.zkNodes = zkNodes;
}
}
protected static class PasswordProperties {
static class PasswordProperties {
private String password;
public String getPassword() {
String getPassword() {
return this.password;
}
public void setPassword(String password) {
void setPassword(String password) {
this.password = password;
}

View File

@@ -206,7 +206,7 @@ class BindConverterTests {
private String text;
public String getText() {
String getText() {
return this.text;
}
@@ -238,7 +238,7 @@ class BindConverterTests {
private String text;
public String getText() {
String getText() {
return this.text;
}
@@ -258,7 +258,7 @@ class BindConverterTests {
/**
* {@link ConversionService} that always throws an {@link AssertionError}.
*/
private static class ThrowingConversionService implements ConversionService {
static class ThrowingConversionService implements ConversionService {
@Override
public boolean canConvert(Class<?> sourceType, Class<?> targetType) {

View File

@@ -221,7 +221,7 @@ class BindResultTests {
this.value = value;
}
public String getValue() {
String getValue() {
return this.value;
}

View File

@@ -169,11 +169,11 @@ class BindableTests {
private String foo = "hello world";
public String getFoo() {
String getFoo() {
return this.foo;
}
public void setFoo(String foo) {
void setFoo(String foo) {
this.foo = foo;
}
@@ -187,11 +187,11 @@ class BindableTests {
private String foo = "hello world";
public String getFoo() {
String getFoo() {
return this.foo;
}
public void setFoo(String foo) {
void setFoo(String foo) {
this.foo = foo;
}

View File

@@ -304,55 +304,55 @@ class BinderTests {
assertThat(value).isInstanceOf(JavaBean.class);
}
public static class JavaBean {
static class JavaBean {
private String value;
private List<String> items = Collections.emptyList();
public String getValue() {
String getValue() {
return this.value;
}
public void setValue(String value) {
void setValue(String value) {
this.value = value;
}
public List<String> getItems() {
List<String> getItems() {
return this.items;
}
}
public static class NestedJavaBean {
static class NestedJavaBean {
private DefaultValuesBean valuesBean = new DefaultValuesBean();
public DefaultValuesBean getValuesBean() {
DefaultValuesBean getValuesBean() {
return this.valuesBean;
}
public void setValuesBean(DefaultValuesBean valuesBean) {
void setValuesBean(DefaultValuesBean valuesBean) {
this.valuesBean = valuesBean;
}
}
public static class DefaultValuesBean {
static class DefaultValuesBean {
private String value = "hello";
private List<String> items = Collections.emptyList();
public String getValue() {
String getValue() {
return this.value;
}
public void setValue(String value) {
void setValue(String value) {
this.value = value;
}
public List<String> getItems() {
List<String> getItems() {
return this.items;
}
@@ -365,63 +365,63 @@ class BinderTests {
}
@Validated
public static class ResourceBean {
static class ResourceBean {
private Resource resource;
public Resource getResource() {
Resource getResource() {
return this.resource;
}
public void setResource(Resource resource) {
void setResource(Resource resource) {
this.resource = resource;
}
}
public static class CycleBean1 {
static class CycleBean1 {
private CycleBean2 two;
public CycleBean2 getTwo() {
CycleBean2 getTwo() {
return this.two;
}
public void setTwo(CycleBean2 two) {
void setTwo(CycleBean2 two) {
this.two = two;
}
}
public static class CycleBean2 {
static class CycleBean2 {
private CycleBean1 one;
public CycleBean1 getOne() {
CycleBean1 getOne() {
return this.one;
}
public void setOne(CycleBean1 one) {
void setOne(CycleBean1 one) {
this.one = one;
}
}
public static class GenericBean<T> {
static class GenericBean<T> {
private T bar;
public T getBar() {
T getBar() {
return this.bar;
}
public void setBar(T bar) {
void setBar(T bar) {
this.bar = bar;
}
}
public static class JavaBeanPropertyEditor extends PropertyEditorSupport {
static class JavaBeanPropertyEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {

View File

@@ -429,46 +429,46 @@ class CollectionBinderTests {
assertThat(result.getValues().get(0)).containsExactly(ExampleEnum.FOO_BAR, ExampleEnum.BAR_BAZ);
}
public static class ExampleCollectionBean {
static class ExampleCollectionBean {
private List<String> items = new ArrayList<>();
private Set<String> itemsSet = new HashSet<>();
public List<String> getItems() {
List<String> getItems() {
return this.items;
}
public void setItems(List<String> items) {
void setItems(List<String> items) {
this.items.add("d");
}
public Set<String> getItemsSet() {
Set<String> getItemsSet() {
return this.itemsSet;
}
public void setItemsSet(Set<String> itemsSet) {
void setItemsSet(Set<String> itemsSet) {
this.itemsSet = itemsSet;
}
}
public static class ExampleCustomNoDefaultConstructorBean {
static class ExampleCustomNoDefaultConstructorBean {
private MyCustomNoDefaultConstructorList items = new MyCustomNoDefaultConstructorList(
Collections.singletonList("foo"));
public MyCustomNoDefaultConstructorList getItems() {
MyCustomNoDefaultConstructorList getItems() {
return this.items;
}
public void setItems(MyCustomNoDefaultConstructorList items) {
void setItems(MyCustomNoDefaultConstructorList items) {
this.items = items;
}
}
public static class MyCustomNoDefaultConstructorList extends ArrayList<String> {
static class MyCustomNoDefaultConstructorList extends ArrayList<String> {
MyCustomNoDefaultConstructorList(List<String> items) {
addAll(items);
@@ -476,86 +476,86 @@ class CollectionBinderTests {
}
public static class ExampleCustomWithDefaultConstructorBean {
static class ExampleCustomWithDefaultConstructorBean {
private MyCustomWithDefaultConstructorList items = new MyCustomWithDefaultConstructorList();
public MyCustomWithDefaultConstructorList getItems() {
MyCustomWithDefaultConstructorList getItems() {
return this.items;
}
public void setItems(MyCustomWithDefaultConstructorList items) {
void setItems(MyCustomWithDefaultConstructorList items) {
this.items.clear();
this.items.addAll(items);
}
}
public static class MyCustomWithDefaultConstructorList extends ArrayList<String> {
static class MyCustomWithDefaultConstructorList extends ArrayList<String> {
}
public static class BeanWithNestedCollection {
static class BeanWithNestedCollection {
private String value;
private List<BeanWithNestedCollection> foos;
public List<BeanWithNestedCollection> getFoos() {
List<BeanWithNestedCollection> getFoos() {
return this.foos;
}
public void setFoos(List<BeanWithNestedCollection> foos) {
void setFoos(List<BeanWithNestedCollection> foos) {
this.foos = foos;
}
public String getValue() {
String getValue() {
return this.value;
}
public void setValue(String value) {
void setValue(String value) {
this.value = value;
}
}
public static class ClonedArrayBean {
static class ClonedArrayBean {
private String[] bar;
public String[] getBar() {
String[] getBar() {
return this.bar.clone();
}
public void setBar(String[] bar) {
void setBar(String[] bar) {
this.bar = bar;
}
}
public static class BeanWithGetterException {
static class BeanWithGetterException {
private List<String> values;
public void setValues(List<String> values) {
void setValues(List<String> values) {
this.values = values;
}
public List<String> getValues() {
List<String> getValues() {
return Collections.unmodifiableList(this.values);
}
}
public static class BeanWithEnumSetCollection {
static class BeanWithEnumSetCollection {
private List<EnumSet<ExampleEnum>> values;
public void setValues(List<EnumSet<ExampleEnum>> values) {
void setValues(List<EnumSet<ExampleEnum>> values) {
this.values = values;
}
public List<EnumSet<ExampleEnum>> getValues() {
List<EnumSet<ExampleEnum>> getValues() {
return this.values;
}

View File

@@ -538,7 +538,7 @@ class JavaBeanBinderTests {
assertThat(bean.getProperty()).isEqualTo("test");
}
public static class ExampleValueBean {
static class ExampleValueBean {
private int intValue;
@@ -548,220 +548,220 @@ class JavaBeanBinderTests {
private ExampleEnum enumValue;
public int getIntValue() {
int getIntValue() {
return this.intValue;
}
public void setIntValue(int intValue) {
void setIntValue(int intValue) {
this.intValue = intValue;
}
public long getLongValue() {
long getLongValue() {
return this.longValue;
}
public void setLongValue(long longValue) {
void setLongValue(long longValue) {
this.longValue = longValue;
}
public String getStringValue() {
String getStringValue() {
return this.stringValue;
}
public void setStringValue(String stringValue) {
void setStringValue(String stringValue) {
this.stringValue = stringValue;
}
public ExampleEnum getEnumValue() {
ExampleEnum getEnumValue() {
return this.enumValue;
}
public void setEnumValue(ExampleEnum enumValue) {
void setEnumValue(ExampleEnum enumValue) {
this.enumValue = enumValue;
}
}
public static class ExampleDefaultsBean {
static class ExampleDefaultsBean {
private int foo = 123;
private int bar = 456;
public int getFoo() {
int getFoo() {
return this.foo;
}
public void setFoo(int foo) {
void setFoo(int foo) {
this.foo = foo;
}
public int getBar() {
int getBar() {
return this.bar;
}
public void setBar(int bar) {
void setBar(int bar) {
this.bar = bar;
}
}
public static class ExampleMapBean {
static class ExampleMapBean {
private Map<ExampleEnum, Integer> map;
public Map<ExampleEnum, Integer> getMap() {
Map<ExampleEnum, Integer> getMap() {
return this.map;
}
public void setMap(Map<ExampleEnum, Integer> map) {
void setMap(Map<ExampleEnum, Integer> map) {
this.map = map;
}
}
public static class ExampleListBean {
static class ExampleListBean {
private List<ExampleEnum> list;
public List<ExampleEnum> getList() {
List<ExampleEnum> getList() {
return this.list;
}
public void setList(List<ExampleEnum> list) {
void setList(List<ExampleEnum> list) {
this.list = list;
}
}
public static class ExampleSetBean {
static class ExampleSetBean {
private Set<ExampleEnum> set;
public Set<ExampleEnum> getSet() {
Set<ExampleEnum> getSet() {
return this.set;
}
public void setSet(Set<ExampleEnum> set) {
void setSet(Set<ExampleEnum> set) {
this.set = set;
}
}
public static class ExampleCollectionBean {
static class ExampleCollectionBean {
private Collection<ExampleEnum> collection;
public Collection<ExampleEnum> getCollection() {
Collection<ExampleEnum> getCollection() {
return this.collection;
}
public void setCollection(Collection<ExampleEnum> collection) {
void setCollection(Collection<ExampleEnum> collection) {
this.collection = collection;
}
}
public static class ExampleMapBeanWithoutSetter {
static class ExampleMapBeanWithoutSetter {
private Map<ExampleEnum, Integer> map = new LinkedHashMap<>();
public Map<ExampleEnum, Integer> getMap() {
Map<ExampleEnum, Integer> getMap() {
return this.map;
}
}
public static class ExampleListBeanWithoutSetter {
static class ExampleListBeanWithoutSetter {
private List<ExampleEnum> list = new ArrayList<>();
public List<ExampleEnum> getList() {
List<ExampleEnum> getList() {
return this.list;
}
}
public static class ExampleSetBeanWithoutSetter {
static class ExampleSetBeanWithoutSetter {
private Set<ExampleEnum> set = new LinkedHashSet<>();
public Set<ExampleEnum> getSet() {
Set<ExampleEnum> getSet() {
return this.set;
}
}
public static class ExampleCollectionBeanWithoutSetter {
static class ExampleCollectionBeanWithoutSetter {
private Collection<ExampleEnum> collection = new ArrayList<>();
public Collection<ExampleEnum> getCollection() {
Collection<ExampleEnum> getCollection() {
return this.collection;
}
}
public static class ExampleCollectionBeanWithDelimiter {
static class ExampleCollectionBeanWithDelimiter {
@Delimiter("|")
private Collection<ExampleEnum> collection;
public Collection<ExampleEnum> getCollection() {
Collection<ExampleEnum> getCollection() {
return this.collection;
}
public void setCollection(Collection<ExampleEnum> collection) {
void setCollection(Collection<ExampleEnum> collection) {
this.collection = collection;
}
}
public static class ExampleNestedBean {
static class ExampleNestedBean {
private ExampleValueBean valueBean;
public ExampleValueBean getValueBean() {
ExampleValueBean getValueBean() {
return this.valueBean;
}
public void setValueBean(ExampleValueBean valueBean) {
void setValueBean(ExampleValueBean valueBean) {
this.valueBean = valueBean;
}
}
public static class ExampleNestedBeanWithoutSetter {
static class ExampleNestedBeanWithoutSetter {
private ExampleValueBean valueBean = new ExampleValueBean();
public ExampleValueBean getValueBean() {
ExampleValueBean getValueBean() {
return this.valueBean;
}
}
public static class ExampleNestedBeanWithoutSetterOrType {
static class ExampleNestedBeanWithoutSetterOrType {
private ExampleValueBean valueBean = new ExampleValueBean();
public Object getValueBean() {
Object getValueBean() {
return this.valueBean;
}
}
public static class ExampleImmutableNestedBeanWithoutSetter {
static class ExampleImmutableNestedBeanWithoutSetter {
private NestedImmutable nested = new NestedImmutable();
public NestedImmutable getNested() {
NestedImmutable getNested() {
return this.nested;
}
public static class NestedImmutable {
static class NestedImmutable {
public String getFoo() {
String getFoo() {
return "foo";
}
@@ -769,7 +769,7 @@ class JavaBeanBinderTests {
}
public static class ExampleWithNonDefaultConstructor {
static class ExampleWithNonDefaultConstructor {
private String value;
@@ -777,145 +777,145 @@ class JavaBeanBinderTests {
this.value = value;
}
public String getValue() {
String getValue() {
return this.value;
}
public void setValue(String value) {
void setValue(String value) {
this.value = value;
}
}
public abstract static class ExampleSuperClassBean {
static class ExampleSuperClassBean {
private int intValue;
public int getIntValue() {
int getIntValue() {
return this.intValue;
}
public void setIntValue(int intValue) {
void setIntValue(int intValue) {
this.intValue = intValue;
}
}
public static class ExampleSubclassBean extends ExampleSuperClassBean {
static class ExampleSubclassBean extends ExampleSuperClassBean {
private long longValue;
public long getLongValue() {
long getLongValue() {
return this.longValue;
}
public void setLongValue(long longValue) {
void setLongValue(long longValue) {
this.longValue = longValue;
}
}
public static class ExampleMismatchBean {
static class ExampleMismatchBean {
private int value;
public String getValue() {
String getValue() {
return String.valueOf(this.value);
}
public void setValue(int value) {
void setValue(int value) {
this.value = value;
}
}
public static class ExampleWithThrowingGetters {
static class ExampleWithThrowingGetters {
private int value;
public int getValue() {
int getValue() {
return this.value;
}
public void setValue(int value) {
void setValue(int value) {
this.value = value;
}
public List<String> getNames() {
List<String> getNames() {
throw new RuntimeException();
}
public ExampleValueBean getNested() {
ExampleValueBean getNested() {
throw new RuntimeException();
}
}
public static class ExampleWithSelfReference {
static class ExampleWithSelfReference {
private int value;
private ExampleWithSelfReference self;
public int getValue() {
int getValue() {
return this.value;
}
public void setValue(int value) {
void setValue(int value) {
this.value = value;
}
public ExampleWithSelfReference getSelf() {
ExampleWithSelfReference getSelf() {
return this.self;
}
public void setSelf(ExampleWithSelfReference self) {
void setSelf(ExampleWithSelfReference self) {
this.self = self;
}
}
public static class ExampleWithInvalidAccessors {
static class ExampleWithInvalidAccessors {
private String name;
public String getName() {
String getName() {
return this.name;
}
public void setName(String name) {
void setName(String name) {
this.name = name;
}
public String get() {
String get() {
throw new IllegalArgumentException("should not be invoked");
}
public boolean is() {
boolean is() {
throw new IllegalArgumentException("should not be invoked");
}
}
public static class ExampleWithStaticAccessors {
static class ExampleWithStaticAccessors {
private static String name;
private int counter;
public static String getName() {
static String getName() {
return name;
}
public static void setName(String name) {
static void setName(String name) {
ExampleWithStaticAccessors.name = name;
}
public int getCounter() {
int getCounter() {
return this.counter;
}
public void setCounter(int counter) {
void setCounter(int counter) {
this.counter = counter;
}
@@ -929,102 +929,102 @@ class JavaBeanBinderTests {
}
public static class ConverterAnnotatedExampleBean {
static class ConverterAnnotatedExampleBean {
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private LocalDate date;
public LocalDate getDate() {
LocalDate getDate() {
return this.date;
}
public void setDate(LocalDate date) {
void setDate(LocalDate date) {
this.date = date;
}
}
public static class ExampleWithPropertyEditorType {
static class ExampleWithPropertyEditorType {
private Class<? extends Throwable> value;
public Class<? extends Throwable> getValue() {
Class<? extends Throwable> getValue() {
return this.value;
}
public void setValue(Class<? extends Throwable> value) {
void setValue(Class<? extends Throwable> value) {
this.value = value;
}
}
public static class ExampleWithGenericMap {
static class ExampleWithGenericMap {
private final Map<String, GenericValue<Integer>> integers = new LinkedHashMap<>();
private final Map<String, GenericValue<Boolean>> booleans = new LinkedHashMap<>();
public Map<String, GenericValue<Integer>> getIntegers() {
Map<String, GenericValue<Integer>> getIntegers() {
return this.integers;
}
public Map<String, GenericValue<Boolean>> getBooleans() {
Map<String, GenericValue<Boolean>> getBooleans() {
return this.booleans;
}
}
public static class GenericValue<T> {
static class GenericValue<T> {
private T value;
public T getValue() {
T getValue() {
return this.value;
}
public void setValue(T value) {
void setValue(T value) {
this.value = value;
}
}
public static class PropertyWithOverloadedSetter {
static class PropertyWithOverloadedSetter {
private String property;
public void setProperty(int property) {
void setProperty(int property) {
this.property = String.valueOf(property);
}
public void setProperty(String property) {
void setProperty(String property) {
this.property = property;
}
public String getProperty() {
String getProperty() {
return this.property;
}
}
public static class NestedJavaBean {
static class NestedJavaBean {
private ExampleDefaultsBean nested = new ExampleDefaultsBean();
public ExampleDefaultsBean getNested() {
ExampleDefaultsBean getNested() {
return this.nested;
}
public void setNested(ExampleDefaultsBean nested) {
void setNested(ExampleDefaultsBean nested) {
this.nested = nested;
}
}
public static class PackagePrivateSetterBean {
static class PackagePrivateSetterBean {
private String property;
public String getProperty() {
String getProperty() {
return this.property;
}

View File

@@ -601,7 +601,7 @@ class MapBinderTests {
return Bindable.of(ResolvableType.forClassWithGenerics(List.class, type));
}
public static class Foo {
static class Foo {
private String pattern;
@@ -612,11 +612,11 @@ class MapBinderTests {
this.pattern = pattern;
}
public String getPattern() {
String getPattern() {
return this.pattern;
}
public void setPattern(String pattern) {
void setPattern(String pattern) {
this.pattern = pattern;
}
@@ -628,15 +628,15 @@ class MapBinderTests {
private String value;
public Map<String, NestableFoo> getFoos() {
Map<String, NestableFoo> getFoos() {
return this.foos;
}
public String getValue() {
String getValue() {
return this.value;
}
public void setValue(String value) {
void setValue(String value) {
this.value = value;
}
@@ -651,22 +651,22 @@ class MapBinderTests {
}
public static class ExampleCustomNoDefaultConstructorBean {
static class ExampleCustomNoDefaultConstructorBean {
private MyCustomNoDefaultConstructorMap items = new MyCustomNoDefaultConstructorMap(
Collections.singletonMap("foo", "bar"));
public MyCustomNoDefaultConstructorMap getItems() {
MyCustomNoDefaultConstructorMap getItems() {
return this.items;
}
public void setItems(MyCustomNoDefaultConstructorMap items) {
void setItems(MyCustomNoDefaultConstructorMap items) {
this.items = items;
}
}
public static class MyCustomNoDefaultConstructorMap extends HashMap<String, String> {
static class MyCustomNoDefaultConstructorMap extends HashMap<String, String> {
MyCustomNoDefaultConstructorMap(Map<String, String> items) {
putAll(items);
@@ -674,34 +674,34 @@ class MapBinderTests {
}
public static class ExampleCustomWithDefaultConstructorBean {
static class ExampleCustomWithDefaultConstructorBean {
private MyCustomWithDefaultConstructorMap items = new MyCustomWithDefaultConstructorMap();
public MyCustomWithDefaultConstructorMap getItems() {
MyCustomWithDefaultConstructorMap getItems() {
return this.items;
}
public void setItems(MyCustomWithDefaultConstructorMap items) {
void setItems(MyCustomWithDefaultConstructorMap items) {
this.items.clear();
this.items.putAll(items);
}
}
public static class MyCustomWithDefaultConstructorMap extends HashMap<String, String> {
static class MyCustomWithDefaultConstructorMap extends HashMap<String, String> {
}
public static class BeanWithGetterException {
static class BeanWithGetterException {
private Map<String, String> values;
public void setValues(Map<String, String> values) {
void setValues(Map<String, String> values) {
this.values = values;
}
public Map<String, String> getValues() {
Map<String, String> getValues() {
return Collections.unmodifiableMap(this.values);
}

View File

@@ -207,7 +207,7 @@ class ValueObjectBinderTests {
assertThat(bean.getDate().toString()).isEqualTo("2019-05-10");
}
public static class ExampleValueBean {
static class ExampleValueBean {
private final int intValue;
@@ -228,23 +228,23 @@ class ValueObjectBinderTests {
this.enumValue = enumValue;
}
public int getIntValue() {
int getIntValue() {
return this.intValue;
}
public long getLongValue() {
long getLongValue() {
return this.longValue;
}
public boolean isBooleanValue() {
boolean isBooleanValue() {
return this.booleanValue;
}
public String getStringValue() {
String getStringValue() {
return this.stringValue;
}
public ExampleEnum getEnumValue() {
ExampleEnum getEnumValue() {
return this.enumValue;
}
@@ -259,7 +259,7 @@ class ValueObjectBinderTests {
}
@SuppressWarnings("unused")
public static class MultipleConstructorsBean {
static class MultipleConstructorsBean {
MultipleConstructorsBean(int intValue) {
this(intValue, 23L, "hello");
@@ -270,7 +270,7 @@ class ValueObjectBinderTests {
}
public abstract static class ExampleAbstractBean {
abstract static class ExampleAbstractBean {
private final String name;
@@ -278,20 +278,20 @@ class ValueObjectBinderTests {
this.name = name;
}
public String getName() {
String getName() {
return this.name;
}
}
public static class DefaultConstructorBean {
static class DefaultConstructorBean {
DefaultConstructorBean() {
}
}
public static class ExampleNestedBean {
static class ExampleNestedBean {
private final ExampleValueBean valueBean;
@@ -299,13 +299,13 @@ class ValueObjectBinderTests {
this.valueBean = valueBean;
}
public ExampleValueBean getValueBean() {
ExampleValueBean getValueBean() {
return this.valueBean;
}
}
public static class ExampleDefaultValueBean {
static class ExampleDefaultValueBean {
private final int intValue;
@@ -321,21 +321,21 @@ class ValueObjectBinderTests {
this.customList = customList;
}
public int getIntValue() {
int getIntValue() {
return this.intValue;
}
public List<String> getStringsList() {
List<String> getStringsList() {
return this.stringsList;
}
public List<String> getCustomList() {
List<String> getCustomList() {
return this.customList;
}
}
public static class ExampleFailingConstructorBean {
static class ExampleFailingConstructorBean {
private final String name;
@@ -348,17 +348,17 @@ class ValueObjectBinderTests {
this.value = value;
}
public String getName() {
String getName() {
return this.name;
}
public Object getValue() {
Object getValue() {
return this.value;
}
}
public static class ConverterAnnotatedExampleBean {
static class ConverterAnnotatedExampleBean {
private final LocalDate date;
@@ -370,17 +370,17 @@ class ValueObjectBinderTests {
this.bar = bar;
}
public LocalDate getDate() {
LocalDate getDate() {
return this.date;
}
public String getBar() {
String getBar() {
return this.bar;
}
}
public static class ExamplePackagePrivateConstructorBean {
static class ExamplePackagePrivateConstructorBean {
private final String property;
@@ -388,7 +388,7 @@ class ValueObjectBinderTests {
this.property = property;
}
public String getProperty() {
String getProperty() {
return this.property;
}

View File

@@ -63,15 +63,15 @@ class IgnoreErrorsBindHandlerTests {
assertThat(bound.getFoo()).isEqualTo(0);
}
public static class Example {
static class Example {
private int foo;
public int getFoo() {
int getFoo() {
return this.foo;
}
public void setFoo(int foo) {
void setFoo(int foo) {
this.foo = foo;
}

View File

@@ -85,25 +85,25 @@ class IgnoreTopLevelConverterNotFoundBindHandlerTests {
.withCauseInstanceOf(ConverterNotFoundException.class);
}
public static class Example {
static class Example {
private int foo;
private Map<String, String> map;
public int getFoo() {
int getFoo() {
return this.foo;
}
public void setFoo(int foo) {
void setFoo(int foo) {
throw new IllegalStateException();
}
public Map<String, String> getMap() {
Map<String, String> getMap() {
return this.map;
}
public void setMap(Map<String, String> map) {
void setMap(Map<String, String> map) {
this.map = map;
}

View File

@@ -131,29 +131,29 @@ class NoUnboundElementsBindHandlerTests {
.contains("The elements [example.foo[0]] were left unbound"));
}
public static class Example {
static class Example {
private String foo;
public String getFoo() {
String getFoo() {
return this.foo;
}
public void setFoo(String foo) {
void setFoo(String foo) {
this.foo = foo;
}
}
public static class ExampleWithList {
static class ExampleWithList {
private List<String> foo;
public List<String> getFoo() {
List<String> getFoo() {
return this.foo;
}
public void setFoo(List<String> foo) {
void setFoo(List<String> foo) {
this.foo = foo;
}

View File

@@ -63,11 +63,11 @@ class PackagePrivateBeanBindingTests {
private int bar;
public int getBar() {
int getBar() {
return this.bar;
}
public void setBar(int bar) {
void setBar(int bar) {
this.bar = bar;
}

View File

@@ -188,32 +188,32 @@ class ValidationBindHandlerTests {
throw new IllegalStateException("Did not throw");
}
public static class ExampleNonValidatedBean {
static class ExampleNonValidatedBean {
@Min(5)
private int age;
public int getAge() {
int getAge() {
return this.age;
}
public void setAge(int age) {
void setAge(int age) {
this.age = age;
}
}
@Validated
public static class ExampleValidatedBean {
static class ExampleValidatedBean {
@Min(5)
private int age;
public int getAge() {
int getAge() {
return this.age;
}
public void setAge(int age) {
void setAge(int age) {
this.age = age;
}
@@ -222,6 +222,8 @@ class ValidationBindHandlerTests {
@Validated
public static class ExampleValidatedWithNestedBean {
// Needs to be public due to validator (see gh-17394)
@Valid
private ExampleNested nested = new ExampleNested();
@@ -237,6 +239,8 @@ class ValidationBindHandlerTests {
public static class ExampleNested {
// Needs to be public due to validator (see gh-17394)
private String name;
@Min(5)
@@ -272,9 +276,9 @@ class ValidationBindHandlerTests {
}
@Validated
public static class ExampleValidatedBeanWithGetterException {
static class ExampleValidatedBeanWithGetterException {
public int getAge() {
int getAge() {
throw new RuntimeException();
}

View File

@@ -46,23 +46,20 @@ public class ConfigurationPropertiesScanConfiguration {
}
@ConfigurationProperties(prefix = "bar")
public static class BarProperties {
public BarProperties(String foo) {
static class BarProperties {
BarProperties(String foo) {
}
}
@ConfigurationProperties(prefix = "bing")
public static class BingProperties {
public BingProperties() {
static class BingProperties {
BingProperties() {
}
public BingProperties(String foo) {
BingProperties(String foo) {
}
}

View File

@@ -150,8 +150,10 @@ class SpringConfigurationPropertySourceTests {
/**
* Test {@link PropertySource} that's also an {@link OriginLookup}.
*
* @param <T> The source type
*/
private static class OriginCapablePropertySource<T> extends PropertySource<T> implements OriginLookup<String> {
static class OriginCapablePropertySource<T> extends PropertySource<T> implements OriginLookup<String> {
private final PropertySource<T> propertySource;

View File

@@ -213,9 +213,10 @@ class SpringIterableConfigurationPropertySourceTests {
/**
* Test {@link PropertySource} that's also an {@link OriginLookup}.
*
* @param <T> the source type
*/
private static class OriginCapablePropertySource<T> extends EnumerablePropertySource<T>
implements OriginLookup<String> {
static class OriginCapablePropertySource<T> extends EnumerablePropertySource<T> implements OriginLookup<String> {
private final EnumerablePropertySource<T> propertySource;
@@ -248,11 +249,11 @@ class SpringIterableConfigurationPropertySourceTests {
}
private static class ConcurrentModificationThrowingMap<K, V> extends LinkedHashMap<K, V> {
static class ConcurrentModificationThrowingMap<K, V> extends LinkedHashMap<K, V> {
private boolean throwException;
public void setThrowException(boolean throwException) {
void setThrowException(boolean throwException) {
this.throwException = throwException;
}

View File

@@ -30,14 +30,14 @@ class TestPropertyMapper implements PropertyMapper {
private MultiValueMap<ConfigurationPropertyName, PropertyMapping> fromConfig = new LinkedMultiValueMap<>();
public void addFromPropertySource(String from, String... to) {
void addFromPropertySource(String from, String... to) {
for (String configurationPropertyName : to) {
this.fromSource.add(from,
new PropertyMapping(from, ConfigurationPropertyName.of(configurationPropertyName)));
}
}
public void addFromConfigurationProperty(ConfigurationPropertyName from, String... to) {
void addFromConfigurationProperty(ConfigurationPropertyName from, String... to) {
for (String propertySourceName : to) {
this.fromConfig.add(from, new PropertyMapping(propertySourceName, from));
}

View File

@@ -91,7 +91,7 @@ class ApplicationConversionServiceTests {
}
}
private static class ExampleGenericConverter implements GenericConverter {
static class ExampleGenericConverter implements GenericConverter {
@Override
public Set<ConvertiblePair> getConvertibleTypes() {
@@ -105,7 +105,7 @@ class ApplicationConversionServiceTests {
}
private static class ExampleConverter implements Converter<String, Integer> {
static class ExampleConverter implements Converter<String, Integer> {
@Override
public Integer convert(String source) {
@@ -114,7 +114,7 @@ class ApplicationConversionServiceTests {
}
private static class ExampleFormatter implements Formatter<Integer> {
static class ExampleFormatter implements Formatter<Integer> {
@Override
public String print(Integer object, Locale locale) {
@@ -128,7 +128,7 @@ class ApplicationConversionServiceTests {
}
private static class ExampleParser implements Parser<Integer> {
static class ExampleParser implements Parser<Integer> {
@Override
public Integer parse(String text, Locale locale) throws ParseException {
@@ -137,7 +137,7 @@ class ApplicationConversionServiceTests {
}
private static class ExamplePrinter implements Printer<Integer> {
static class ExamplePrinter implements Printer<Integer> {
@Override
public String print(Integer object, Locale locale) {

View File

@@ -58,7 +58,7 @@ final class ConversionServiceArguments {
"Application conversion service")));
}
private static class NamedConversionService implements ConversionService {
static class NamedConversionService implements ConversionService {
private final ConversionService delegate;

View File

@@ -50,7 +50,7 @@ class FailureAnalyzersIntegrationTests {
static class TestConfiguration {
@PostConstruct
public void fail() {
void fail() {
throw new PortInUseException(8080);
}

View File

@@ -140,7 +140,7 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
static class CyclicBeanMethodsConfiguration {
@Bean
public BeanThree three(BeanOne one) {
BeanThree three(BeanOne one) {
return new BeanThree();
}
@@ -148,7 +148,7 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
static class InnerConfiguration {
@Bean
public BeanTwo two(BeanThree three) {
BeanTwo two(BeanThree three) {
return new BeanTwo();
}
@@ -156,7 +156,7 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
static class InnerInnerConfiguration {
@Bean
public BeanOne one(BeanTwo two) {
BeanOne one(BeanTwo two) {
return new BeanOne();
}
@@ -170,17 +170,17 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
static class CycleReferencedViaOtherBeansConfiguration {
@Bean
public BeanOne one(BeanTwo two) {
BeanOne one(BeanTwo two) {
return new BeanOne();
}
@Bean
public BeanTwo two(BeanThree three) {
BeanTwo two(BeanThree three) {
return new BeanTwo();
}
@Bean
public BeanThree three(BeanOne beanOne) {
BeanThree three(BeanOne beanOne) {
return new BeanThree();
}
@@ -188,7 +188,7 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
static class InnerConfiguration {
@Bean
public RefererTwo refererTwo() {
RefererTwo refererTwo() {
return new RefererTwo();
}
@@ -196,7 +196,7 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
static class InnerInnerConfiguration {
@Bean
public RefererOne refererOne() {
RefererOne refererOne() {
return new RefererOne();
}
@@ -207,32 +207,32 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
}
@org.springframework.context.annotation.Configuration(proxyBeanMethods = false)
public static class CycleWithAutowiredFields {
static class CycleWithAutowiredFields {
@Bean
public BeanOne one(BeanTwo two) {
BeanOne one(BeanTwo two) {
return new BeanOne();
}
@org.springframework.context.annotation.Configuration(proxyBeanMethods = false)
public static class BeanTwoConfiguration {
static class BeanTwoConfiguration {
@SuppressWarnings("unused")
@Autowired
private BeanThree three;
@Bean
public BeanTwo two() {
BeanTwo two() {
return new BeanTwo();
}
}
@org.springframework.context.annotation.Configuration(proxyBeanMethods = false)
public static class BeanThreeConfiguration {
static class BeanThreeConfiguration {
@Bean
public BeanThree three(BeanOne one) {
BeanThree three(BeanOne one) {
return new BeanThree();
}

View File

@@ -73,7 +73,7 @@ class BeanDefinitionOverrideFailureAnalyzerTests {
static class FirstConfiguration {
@Bean
public String testBean() {
String testBean() {
return "test";
}
@@ -83,7 +83,7 @@ class BeanDefinitionOverrideFailureAnalyzerTests {
static class SecondConfiguration {
@Bean
public String testBean() {
String testBean() {
return "test";
}

View File

@@ -70,7 +70,7 @@ class BeanNotOfRequiredTypeFailureAnalyzerTests {
static class JdkProxyConfiguration {
@Bean
public AsyncBean asyncBean() {
AsyncBean asyncBean() {
return new AsyncBean();
}
@@ -80,7 +80,7 @@ class BeanNotOfRequiredTypeFailureAnalyzerTests {
static class UserConfiguration {
@Bean
public AsyncBeanUser user(AsyncBean bean) {
AsyncBeanUser user(AsyncBean bean) {
return new AsyncBeanUser(bean);
}
@@ -89,7 +89,7 @@ class BeanNotOfRequiredTypeFailureAnalyzerTests {
static class AsyncBean implements SomeInterface {
@Async
public void foo() {
void foo() {
}

Some files were not shown because too many files have changed in this diff Show More