Clean up and format code

pull/9539/head
Andy Wilkinson 8 years ago
parent 5d69318e2d
commit 59122358d3

@ -216,8 +216,8 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe
ApplicationContext applicationContext) { ApplicationContext applicationContext) {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
if (applicationContext instanceof DefaultResourceLoader) { if (applicationContext instanceof DefaultResourceLoader) {
Collection<ProtocolResolver> protocolResolvers = Collection<ProtocolResolver> protocolResolvers = ((DefaultResourceLoader) applicationContext)
((DefaultResourceLoader) applicationContext).getProtocolResolvers(); .getProtocolResolvers();
for (ProtocolResolver protocolResolver : protocolResolvers) { for (ProtocolResolver protocolResolver : protocolResolvers) {
resourceLoader.addProtocolResolver(protocolResolver); resourceLoader.addProtocolResolver(protocolResolver);
} }
@ -247,11 +247,11 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe
private ResourceLoader createResourceLoader( private ResourceLoader createResourceLoader(
WebApplicationContext applicationContext) { WebApplicationContext applicationContext) {
WebApplicationContextResourceLoader resourceLoader = WebApplicationContextResourceLoader resourceLoader = new WebApplicationContextResourceLoader(
new WebApplicationContextResourceLoader(applicationContext); applicationContext);
if (applicationContext instanceof DefaultResourceLoader) { if (applicationContext instanceof DefaultResourceLoader) {
Collection<ProtocolResolver> protocolResolvers = Collection<ProtocolResolver> protocolResolvers = ((DefaultResourceLoader) applicationContext)
((DefaultResourceLoader) applicationContext).getProtocolResolvers(); .getProtocolResolvers();
for (ProtocolResolver protocolResolver : protocolResolvers) { for (ProtocolResolver protocolResolver : protocolResolvers) {
resourceLoader.addProtocolResolver(protocolResolver); resourceLoader.addProtocolResolver(protocolResolver);
} }

@ -168,8 +168,7 @@ public class ClassLoaderFilesResourcePatternResolverTests {
private ProtocolResolver mockProtocolResolver(String path, Resource resource) { private ProtocolResolver mockProtocolResolver(String path, Resource resource) {
ProtocolResolver resolver = mock(ProtocolResolver.class); ProtocolResolver resolver = mock(ProtocolResolver.class);
given(resolver.resolve(eq(path), any(ResourceLoader.class))) given(resolver.resolve(eq(path), any(ResourceLoader.class))).willReturn(resource);
.willReturn(resource);
return resolver; return resolver;
} }

@ -133,6 +133,7 @@ public class Author extends TableImpl<Record> {
/** /**
* Rename this table * Rename this table
*/ */
@Override
public Author rename(String name) { public Author rename(String name) {
return new Author(name, null); return new Author(name, null);
} }

@ -136,6 +136,7 @@ public class Book extends TableImpl<Record> {
/** /**
* Rename this table * Rename this table
*/ */
@Override
public Book rename(String name) { public Book rename(String name) {
return new Book(name, null); return new Book(name, null);
} }

@ -94,6 +94,7 @@ public class BookStore extends TableImpl<Record> {
/** /**
* Rename this table * Rename this table
*/ */
@Override
public BookStore rename(String name) { public BookStore rename(String name) {
return new BookStore(name, null); return new BookStore(name, null);
} }

@ -124,6 +124,7 @@ public class BookToBookStore extends TableImpl<Record> {
/** /**
* Rename this table * Rename this table
*/ */
@Override
public BookToBookStore rename(String name) { public BookToBookStore rename(String name) {
return new BookToBookStore(name, null); return new BookToBookStore(name, null);
} }

@ -114,6 +114,7 @@ public class Language extends TableImpl<Record> {
/** /**
* Rename this table * Rename this table
*/ */
@Override
public Language rename(String name) { public Language rename(String name) {
return new Language(name, null); return new Language(name, null);
} }

@ -24,7 +24,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import samples.websocket.jetty93.SampleJetty93WebSocketsApplication;
import samples.websocket.jetty93.client.GreetingService; import samples.websocket.jetty93.client.GreetingService;
import samples.websocket.jetty93.client.SimpleClientWebSocketHandler; import samples.websocket.jetty93.client.SimpleClientWebSocketHandler;
import samples.websocket.jetty93.client.SimpleGreetingService; import samples.websocket.jetty93.client.SimpleGreetingService;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,8 +19,6 @@ package samples.websocket.jetty93.snake;
import java.io.IOException; import java.io.IOException;
import org.junit.Test; import org.junit.Test;
import samples.websocket.jetty93.snake.Snake;
import samples.websocket.jetty93.snake.SnakeTimer;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.willThrow; import static org.mockito.BDDMockito.willThrow;

@ -76,7 +76,8 @@ public class TestDatabaseAutoConfigurationTests {
this.context = doLoad(config, environment); this.context = doLoad(config, environment);
} }
private ConfigurableApplicationContext doLoad(Class<?> config, String... environment) { private ConfigurableApplicationContext doLoad(Class<?> config,
String... environment) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
if (config != null) { if (config != null) {
ctx.register(config); ctx.register(config);

@ -179,8 +179,8 @@ class TypeElementMembers {
return candidate; return candidate;
} }
TypeMirror alternative = this.typeUtils.getWrapperOrPrimitiveFor(type); TypeMirror alternative = this.typeUtils.getWrapperOrPrimitiveFor(type);
if (alternative != null && if (alternative != null
this.env.getTypeUtils().isSameType(returnType, alternative)) { && this.env.getTypeUtils().isSameType(returnType, alternative)) {
return candidate; return candidate;
} }
} }

@ -71,8 +71,8 @@ public class ItemDeprecation {
@Override @Override
public String toString() { public String toString() {
return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", " return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", "
+ "replacement='" + this.replacement + '\'' + ", " + "replacement='" + this.replacement + '\'' + ", " + "level='"
+ "level='" + this.level + '\'' + '}'; + this.level + '\'' + '}';
} }
@Override @Override

@ -490,8 +490,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test @Test
public void lombokInnerClassWithGetterProperties() throws IOException { public void lombokInnerClassWithGetterProperties() throws IOException {
ConfigurationMetadata metadata = ConfigurationMetadata metadata = compile(
compile(LombokInnerClassWithGetterProperties.class); LombokInnerClassWithGetterProperties.class);
assertThat(metadata).has(Metadata.withGroup("config") assertThat(metadata).has(Metadata.withGroup("config")
.fromSource(LombokInnerClassWithGetterProperties.class)); .fromSource(LombokInnerClassWithGetterProperties.class));
assertThat(metadata).has(Metadata.withGroup("config.first") assertThat(metadata).has(Metadata.withGroup("config.first")
@ -541,16 +541,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test @Test
public void mergeExistingPropertyDeprecation() throws Exception { public void mergeExistingPropertyDeprecation() throws Exception {
ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null, ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null,
null, null, null, null, null, null, null, null, new ItemDeprecation("Don't use this.",
new ItemDeprecation("Don't use this.", "simple.complex-comparator", "simple.complex-comparator", "error"));
"error"));
writeAdditionalMetadata(property); writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class); ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata) assertThat(metadata)
.has(Metadata.withProperty("simple.comparator", "java.util.Comparator<?>") .has(Metadata.withProperty("simple.comparator", "java.util.Comparator<?>")
.fromSource(SimpleProperties.class) .fromSource(SimpleProperties.class).withDeprecation(
.withDeprecation("Don't use this.", "simple.complex-comparator", "Don't use this.", "simple.complex-comparator", "error"));
"error"));
assertThat(metadata.getItems()).hasSize(4); assertThat(metadata.getItems()).hasSize(4);
} }
@ -576,8 +574,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
ConfigurationMetadata metadata = compile(DeprecatedSingleProperty.class); ConfigurationMetadata metadata = compile(DeprecatedSingleProperty.class);
assertThat(metadata).has( assertThat(metadata).has(
Metadata.withProperty("singledeprecated.name", String.class.getName()) Metadata.withProperty("singledeprecated.name", String.class.getName())
.fromSource(DeprecatedSingleProperty.class) .fromSource(DeprecatedSingleProperty.class).withDeprecation(
.withDeprecation("renamed", "singledeprecated.new-name", "error")); "renamed", "singledeprecated.new-name", "error"));
assertThat(metadata.getItems()).hasSize(3); assertThat(metadata.getItems()).hasSize(3);
} }

@ -320,8 +320,7 @@ public class SpringBootPluginExtension {
* Module Layout. * Module Layout.
* @deprecated as of 1.5 in favor of a custom {@link LayoutFactory} * @deprecated as of 1.5 in favor of a custom {@link LayoutFactory}
*/ */
@Deprecated @Deprecated MODULE(new Layouts.Module()),
MODULE(new Layouts.Module()),
/** /**
* No layout. * No layout.

@ -79,8 +79,8 @@ public class JsonComponentModule extends SimpleModule implements BeanFactoryAwar
addDeserializerWithDeducedType((JsonDeserializer<?>) bean); addDeserializerWithDeducedType((JsonDeserializer<?>) bean);
} }
for (Class<?> innerClass : bean.getClass().getDeclaredClasses()) { for (Class<?> innerClass : bean.getClass().getDeclaredClasses()) {
if (!Modifier.isAbstract(innerClass.getModifiers()) && if (!Modifier.isAbstract(innerClass.getModifiers())
(JsonSerializer.class.isAssignableFrom(innerClass) && (JsonSerializer.class.isAssignableFrom(innerClass)
|| JsonDeserializer.class.isAssignableFrom(innerClass))) { || JsonDeserializer.class.isAssignableFrom(innerClass))) {
try { try {
addJsonBean(innerClass.newInstance()); addJsonBean(innerClass.newInstance());

@ -109,7 +109,8 @@ public class JsonComponentModuleTests {
@JsonComponent @JsonComponent
static class ComponentWithInnerAbstractClass { static class ComponentWithInnerAbstractClass {
private static abstract class AbstractSerializer extends NameAndAgeJsonComponent.Serializer { private static abstract class AbstractSerializer
extends NameAndAgeJsonComponent.Serializer {
} }

Loading…
Cancel
Save