Polish
This commit changes invocations to immediately return the expression instead of assigning it to a temporary variable. The method name should be sufficient for callers to know exactly what will be returned. Closes gh-12211
This commit is contained in:
parent
c27fa7bf91
commit
98f4692c62
|
|
@ -55,9 +55,8 @@ public class JerseyManagementChildContextConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ServletRegistrationBean<ServletContainer> jerseyServletRegistration() {
|
public ServletRegistrationBean<ServletContainer> jerseyServletRegistration() {
|
||||||
ServletRegistrationBean<ServletContainer> registration = new ServletRegistrationBean<>(
|
return new ServletRegistrationBean<>(
|
||||||
new ServletContainer(endpointResourceConfig()), "/*");
|
new ServletContainer(endpointResourceConfig()), "/*");
|
||||||
return registration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,7 @@ public class ElasticsearchAutoConfiguration {
|
||||||
factory.setClusterNodes(this.properties.getClusterNodes());
|
factory.setClusterNodes(this.properties.getClusterNodes());
|
||||||
factory.setProperties(createProperties());
|
factory.setProperties(createProperties());
|
||||||
factory.afterPropertiesSet();
|
factory.afterPropertiesSet();
|
||||||
TransportClient client = factory.getObject();
|
return factory.getObject();
|
||||||
return client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Properties createProperties() {
|
private Properties createProperties() {
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,7 @@ public class Neo4jDataAutoConfiguration {
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public org.neo4j.ogm.config.Configuration configuration(Neo4jProperties properties) {
|
public org.neo4j.ogm.config.Configuration configuration(Neo4jProperties properties) {
|
||||||
org.neo4j.ogm.config.Configuration configuration = properties
|
return properties.createConfiguration();
|
||||||
.createConfiguration();
|
|
||||||
return configuration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,7 @@ public class SpringApplicationWebApplicationInitializer
|
||||||
|
|
||||||
private Manifest getManifest(ServletContext servletContext) throws IOException {
|
private Manifest getManifest(ServletContext servletContext) throws IOException {
|
||||||
InputStream stream = servletContext.getResourceAsStream("/META-INF/MANIFEST.MF");
|
InputStream stream = servletContext.getResourceAsStream("/META-INF/MANIFEST.MF");
|
||||||
Manifest manifest = (stream == null ? null : new Manifest(stream));
|
return (stream == null ? null : new Manifest(stream));
|
||||||
return manifest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -235,8 +235,7 @@ public class GroovyCompiler {
|
||||||
try {
|
try {
|
||||||
Field field = CompilationUnit.class.getDeclaredField("phaseOperations");
|
Field field = CompilationUnit.class.getDeclaredField("phaseOperations");
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
LinkedList[] phaseOperations = (LinkedList[]) field.get(compilationUnit);
|
return (LinkedList[]) field.get(compilationUnit);
|
||||||
return phaseOperations;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
|
|
||||||
|
|
@ -324,10 +324,9 @@ public class AetherGrapeEngine implements GrapeEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
private DependencyRequest getDependencyRequest(CollectRequest collectRequest) {
|
private DependencyRequest getDependencyRequest(CollectRequest collectRequest) {
|
||||||
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest,
|
return new DependencyRequest(collectRequest,
|
||||||
DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE,
|
DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE,
|
||||||
JavaScopes.RUNTIME));
|
JavaScopes.RUNTIME));
|
||||||
return dependencyRequest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addManagedDependencies(DependencyResult result) {
|
private void addManagedDependencies(DependencyResult result) {
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,7 @@ public abstract class ResourceUtils {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (location.startsWith(FILE_URL_PREFIX)) {
|
if (location.startsWith(FILE_URL_PREFIX)) {
|
||||||
Resource resource = this.files.getResource(location);
|
return this.files.getResource(location);
|
||||||
return resource;
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Try to parse the location as a URL...
|
// Try to parse the location as a URL...
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
|
||||||
private BeanDefinition registerBean(BeanDefinitionRegistry registry,
|
private BeanDefinition registerBean(BeanDefinitionRegistry registry,
|
||||||
AnnotatedBeanDefinitionReader reader, String beanName, Class<?> type) {
|
AnnotatedBeanDefinitionReader reader, String beanName, Class<?> type) {
|
||||||
reader.registerBean(type, beanName);
|
reader.registerBean(type, beanName);
|
||||||
BeanDefinition definition = registry.getBeanDefinition(beanName);
|
return registry.getBeanDefinition(beanName);
|
||||||
return definition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,7 @@ public class SpringBootContextLoader extends AbstractContextLoader {
|
||||||
application.setWebApplicationType(WebApplicationType.NONE);
|
application.setWebApplicationType(WebApplicationType.NONE);
|
||||||
}
|
}
|
||||||
application.setInitializers(initializers);
|
application.setInitializers(initializers);
|
||||||
ConfigurableApplicationContext context = application.run();
|
return application.run();
|
||||||
return context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -95,15 +95,13 @@ public class MetadataStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileObject getMetadataResource() throws IOException {
|
private FileObject getMetadataResource() throws IOException {
|
||||||
FileObject resource = this.environment.getFiler()
|
return this.environment.getFiler()
|
||||||
.getResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH);
|
.getResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH);
|
||||||
return resource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileObject createMetadataResource() throws IOException {
|
private FileObject createMetadataResource() throws IOException {
|
||||||
FileObject resource = this.environment.getFiler()
|
return this.environment.getFiler()
|
||||||
.createResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH);
|
.createResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH);
|
||||||
return resource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputStream getAdditionalMetadataStream() throws IOException {
|
private InputStream getAdditionalMetadataStream() throws IOException {
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,7 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol
|
||||||
loader);
|
loader);
|
||||||
String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
|
String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
|
||||||
+ ClassUtils.convertClassNameToResourcePath(packageName) + "/**/*.class";
|
+ ClassUtils.convertClassNameToResourcePath(packageName) + "/**/*.class";
|
||||||
Resource[] resources = resolver.getResources(pattern);
|
return resolver.getResources(pattern);
|
||||||
return resources;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Class<?> loadClass(ClassLoader loader, MetadataReaderFactory readerFactory,
|
private Class<?> loadClass(ClassLoader loader, MetadataReaderFactory readerFactory,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue