From 31b0e81765b73e4e5fcc1d06e0cf75ea27c6f85e Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 27 Jan 2017 16:39:44 +0000 Subject: [PATCH] Add @FunctionalInterface to remaining public and protected interfaces See gh-6857 --- .../boot/actuate/endpoint/mvc/HeapdumpMvcEndpoint.java | 1 + .../boot/actuate/endpoint/mvc/NamePatternFilter.java | 4 ++-- .../boot/actuate/metrics/dropwizard/ReservoirFactory.java | 3 ++- .../boot/actuate/metrics/util/SimpleInMemoryRepository.java | 3 ++- .../boot/autoconfigure/AutoConfigurationImportFilter.java | 1 + .../boot/autoconfigure/AutoConfigurationImportListener.java | 1 + .../autoconfigure/cassandra/ClusterBuilderCustomizer.java | 3 ++- .../elasticsearch/jest/HttpClientConfigBuilderCustomizer.java | 3 ++- .../boot/autoconfigure/security/IgnoredRequestCustomizer.java | 3 ++- .../security/oauth2/resource/UserInfoRestTemplateFactory.java | 1 + .../transaction/PlatformTransactionManagerCustomizer.java | 3 ++- .../context/DefaultTestExecutionListenersPostProcessor.java | 3 ++- .../configurationprocessor/fieldvalues/javac/TreeVisitor.java | 3 +-- .../springframework/boot/loader/tools/CustomLoaderLayout.java | 3 ++- .../org/springframework/boot/loader/tools/LayoutFactory.java | 3 ++- .../org/springframework/boot/loader/tools/Repackager.java | 1 + .../org/springframework/boot/loader/jar/JarEntryFilter.java | 3 +-- .../java/org/springframework/boot/BeanDefinitionLoader.java | 4 ++-- .../boot/bind/PropertyNamePatternsMatcher.java | 3 +-- .../ConfigurationWarningsApplicationContextInitializer.java | 1 + .../boot/orm/jpa/EntityManagerFactoryBuilder.java | 3 ++- 21 files changed, 33 insertions(+), 20 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpoint.java index 041292b302..66e3f321b8 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpoint.java @@ -168,6 +168,7 @@ public class HeapdumpMvcEndpoint extends AbstractNamedMvcEndpoint { /** * Strategy interface used to dump the heap to a file. */ + @FunctionalInterface protected interface HeapDumper { /** diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java index 270a507aaa..ec8fcef7d7 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/NamePatternFilter.java @@ -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"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ abstract class NamePatternFilter { /** * Callback used to add a name. */ - protected interface NameCallback { + interface NameCallback { void addName(String name); diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/ReservoirFactory.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/ReservoirFactory.java index 64396043c5..2d7f79871b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/ReservoirFactory.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/dropwizard/ReservoirFactory.java @@ -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"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import com.codahale.metrics.Reservoir; * @author Phillip Webb * @since 1.5.0 */ +@FunctionalInterface public interface ReservoirFactory { /** diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java index cb420b6b8a..c6a43002f8 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/util/SimpleInMemoryRepository.java @@ -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"); * you may not use this file except in compliance with the License. @@ -102,6 +102,7 @@ public class SimpleInMemoryRepository { * * @param the value type */ + @FunctionalInterface public interface Callback { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportFilter.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportFilter.java index 38f102038d..564721c109 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportFilter.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportFilter.java @@ -39,6 +39,7 @@ import org.springframework.context.ResourceLoaderAware; * @author Phillip Webb * @since 1.5.0 */ +@FunctionalInterface public interface AutoConfigurationImportFilter { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportListener.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportListener.java index f904c145b7..223172ab9a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportListener.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportListener.java @@ -41,6 +41,7 @@ import org.springframework.context.ResourceLoaderAware; * @author Phillip Webb * @since 1.5.0 */ +@FunctionalInterface public interface AutoConfigurationImportListener extends EventListener { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/ClusterBuilderCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/ClusterBuilderCustomizer.java index cf52090b31..94d2b3f758 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/ClusterBuilderCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/ClusterBuilderCustomizer.java @@ -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"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import com.datastax.driver.core.Cluster.Builder; * @author EddĂș MelĂ©ndez * @since 1.5.0 */ +@FunctionalInterface public interface ClusterBuilderCustomizer { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/HttpClientConfigBuilderCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/HttpClientConfigBuilderCustomizer.java index b955bb364a..60e7b1b7fc 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/HttpClientConfigBuilderCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/HttpClientConfigBuilderCustomizer.java @@ -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"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import io.searchbox.client.config.HttpClientConfig.Builder; * @author Stephane Nicoll * @since 1.5.0 */ +@FunctionalInterface public interface HttpClientConfigBuilderCustomizer { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/IgnoredRequestCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/IgnoredRequestCustomizer.java index bdba36efae..a5d750dd09 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/IgnoredRequestCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/IgnoredRequestCustomizer.java @@ -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"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.springframework.security.config.annotation.web.builders.WebSecurity.I * @author Madhura Bhave * @since 1.5.0 */ +@FunctionalInterface public interface IgnoredRequestCustomizer { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateFactory.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateFactory.java index 2595230b75..5360e56142 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateFactory.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateFactory.java @@ -26,6 +26,7 @@ import org.springframework.security.oauth2.client.OAuth2RestTemplate; * @author Stephane Nicoll * @since 1.4.0 */ +@FunctionalInterface public interface UserInfoRestTemplateFactory { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java index 5c9d4325fe..91931cb3ef 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java @@ -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"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import org.springframework.transaction.PlatformTransactionManager; * @author Phillip Webb * @since 1.5.0 */ +@FunctionalInterface public interface PlatformTransactionManagerCustomizer { /** diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/DefaultTestExecutionListenersPostProcessor.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/DefaultTestExecutionListenersPostProcessor.java index ee177ddfc2..8c05213c49 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/DefaultTestExecutionListenersPostProcessor.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/DefaultTestExecutionListenersPostProcessor.java @@ -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"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.springframework.test.context.TestExecutionListener; * @since 1.4.1 * @see SpringBootTest */ +@FunctionalInterface public interface DefaultTestExecutionListenersPostProcessor { /** diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/TreeVisitor.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/TreeVisitor.java index 9c785feeaa..10f2bc4a2f 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/TreeVisitor.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/TreeVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -22,7 +22,6 @@ package org.springframework.boot.configurationprocessor.fieldvalues.javac; * @author Phillip Webb * @since 1.2.0 */ -@FunctionalInterface interface TreeVisitor { void visitVariable(VariableTree variable) throws Exception; diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/CustomLoaderLayout.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/CustomLoaderLayout.java index 746a12fd3a..4c5433d5c8 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/CustomLoaderLayout.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/CustomLoaderLayout.java @@ -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"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import java.io.IOException; * @author Phillip Webb * @since 1.5.0 */ +@FunctionalInterface public interface CustomLoaderLayout { /** diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LayoutFactory.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LayoutFactory.java index 0a6e7eeb33..280f6ea014 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LayoutFactory.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LayoutFactory.java @@ -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"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import java.io.File; * @author Dave Syer * @author Phillip Webb */ +@FunctionalInterface public interface LayoutFactory { /** diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java index ba4124e4b3..1450c48205 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java @@ -404,6 +404,7 @@ public class Repackager { * Callback interface used to present a warning when finding the main class takes too * long. */ + @FunctionalInterface public interface MainClassTimeoutWarningListener { /** diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryFilter.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryFilter.java index bbf7f95ea8..17c2a6d85b 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryFilter.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntryFilter.java @@ -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"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ package org.springframework.boot.loader.jar; * * @author Phillip Webb */ -@FunctionalInterface interface JarEntryFilter { /** diff --git a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index c394016f15..4546b76a50 100644 --- a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -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"); * you may not use this file except in compliance with the License. @@ -326,7 +326,7 @@ class BeanDefinitionLoader { /** * Source for Bean definitions defined in Groovy. */ - protected interface GroovyBeanDefinitionSource { + interface GroovyBeanDefinitionSource { Closure getBeans(); diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertyNamePatternsMatcher.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertyNamePatternsMatcher.java index e51ce3f7d8..d82bd2d63a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertyNamePatternsMatcher.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertyNamePatternsMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2017 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. @@ -22,7 +22,6 @@ package org.springframework.boot.bind; * @author Phillip Webb * @since 1.2.0 */ -@FunctionalInterface interface PropertyNamePatternsMatcher { PropertyNamePatternsMatcher ALL = new PropertyNamePatternsMatcher() { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java index 203ff05083..73ba57fbb4 100755 --- a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java @@ -114,6 +114,7 @@ public class ConfigurationWarningsApplicationContextInitializer /** * A single check that can be applied. */ + @FunctionalInterface protected interface Check { /** diff --git a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java index ca40524ded..ebc691a177 100644 --- a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java @@ -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"); * you may not use this file except in compliance with the License. @@ -220,6 +220,7 @@ public class EntityManagerFactoryBuilder { /** * A callback for new entity manager factory beans created by a Builder. */ + @FunctionalInterface public interface EntityManagerFactoryBeanCallback { void execute(LocalContainerEntityManagerFactoryBean factory);