JDK 8 code review request for 8005623: Retrofit FunctionalInterface annotations to core platform interfaces

David Holmes david.holmes at oracle.com
Wed Feb 6 08:42:29 UTC 2013


I don't think Thread belongs in there. ;-)

David

On 6/02/2013 8:16 AM, Joe Darcy wrote:
> Hello,
>
> As a follow-up to adding the FunctionalInterface annotation type to the
> platform, the time has come to annotate JDK classes with the annotation.
>
> I ran an annotation processor over the sources in the jdk repo to look
> for candidates to be marked as FunctionalInterfaces and for a first cut
> I have added the annotation to 34 types, including all of the types in
> java.util.function:
>
> src/share/classes/java/io/Closeable.java
> src/share/classes/java/io/FileFilter.java
> src/share/classes/java/io/FilenameFilter.java
> src/share/classes/java/io/Flushable.java
> src/share/classes/java/lang/AutoCloseable.java
> src/share/classes/java/lang/Comparable.java
> src/share/classes/java/lang/Iterable.java
> src/share/classes/java/lang/Readable.java
> src/share/classes/java/lang/Runnable.java
> src/share/classes/java/lang/Thread.java
> src/share/classes/java/util/Comparator.java
> src/share/classes/java/util/function/BinaryOperator.java
> src/share/classes/java/util/function/Block.java
> src/share/classes/java/util/function/DoubleBinaryOperator.java
> src/share/classes/java/util/function/DoubleBlock.java
> src/share/classes/java/util/function/DoubleFunction.java
> src/share/classes/java/util/function/DoubleSupplier.java
> src/share/classes/java/util/function/DoubleUnaryOperator.java
> src/share/classes/java/util/function/Function.java
> src/share/classes/java/util/function/IntBinaryOperator.java
> src/share/classes/java/util/function/IntBlock.java
> src/share/classes/java/util/function/IntFunction.java
> src/share/classes/java/util/function/IntSupplier.java
> src/share/classes/java/util/function/IntUnaryOperator.java
> src/share/classes/java/util/function/LongBinaryOperator.java
> src/share/classes/java/util/function/LongBlock.java
> src/share/classes/java/util/function/LongFunction.java
> src/share/classes/java/util/function/LongSupplier.java
> src/share/classes/java/util/function/LongUnaryOperator.java
> src/share/classes/java/util/function/Predicate.java
> src/share/classes/java/util/function/Supplier.java
> src/share/classes/java/util/function/UnaryOperator.java
> src/share/classes/java/util/logging/Filter.java
> src/share/classes/java/util/prefs/PreferenceChangeListener.java
>
> Webrev:
> http://cr.openjdk.java.net/~darcy/8005623.0/
>
> This review is both to cover the addition of @FunctionalInterface to the
> types above and also to query if the annotation should be included in
> any of the other types below under the same bug. The sub-areas I have
> not annotated yet include:
>
> * xml
> * jdbc
> * JSR 310
> * JNDI
> * RMI
> * Beans
> * networking
> * JMX/management
> * java.util.concurrent
>
> The annotation can be added in these areas separately later as well; if
> that is done, I recommend sub-tasks of JDK-8005297 "Add
> FunctionalInterface support to the platform" be used to track the work.
>
> I'll separately be sending email to the security and awt/swing teams
> about the functional interface candidates in their areas.
>
> Thanks,
>
> -Joe
>
> misc core
> ========
>
> jdk/src/share/classes/java/lang/annotation/Annotation.java:40: Note:
> Candidate functional interface
> public interface Annotation {
> ^
> jdk/src/share/classes/java/io/ObjectInputValidation.java:38: Note:
> Candidate functional interface
> public interface ObjectInputValidation {
> ^
> jdk/src/share/classes/java/util/ResourceBundle.java:690: Note: Candidate
> functional interface
> private static interface CacheKeyReference {
> ^
> jdk/src/share/classes/java/util/spi/ResourceBundleControlProvider.java:51:
> Note: Candidate functional interface
> public interface ResourceBundleControlProvider {
> ^
> jdk/src/share/classes/java/util/Formattable.java:119: Note: Candidate
> functional interface
> public interface Formattable {
> ^
> jdk/src/share/classes/java/util/Observer.java:35: Note: Candidate
> functional interface
> public interface Observer {
> ^
> jdk/src/share/classes/java/nio/file/WatchEvent.java:76: Note: Candidate
> functional interface
> public static interface Modifier {
> ^
> jdk/src/share/classes/java/nio/file/attribute/AttributeView.java:38:
> Note: Candidate functional interface
> public interface AttributeView {
> ^
> jdk/src/share/classes/java/nio/file/attribute/FileStoreAttributeView.java:35:
> Note: Candidate functional interface
> public interface FileStoreAttributeView
> ^
> jdk/src/share/classes/java/nio/file/attribute/FileAttributeView.java:39:
> Note: Candidate functional interface
> public interface FileAttributeView
> ^
> jdk/src/share/classes/java/nio/file/attribute/UserPrincipal.java:54:
> Note: Candidate functional interface
> public interface UserPrincipal extends Principal { }
> ^
> jdk/src/share/classes/java/nio/file/attribute/GroupPrincipal.java:42:
> Note: Candidate functional interface
> public interface GroupPrincipal extends UserPrincipal { }
> ^
> jdk/src/share/classes/java/nio/file/PathMatcher.java:38: Note: Candidate
> functional interface
> public interface PathMatcher {
> ^
> jdk/src/share/classes/java/nio/file/DirectoryStream.java:133: Note:
> Candidate functional interface
> public static interface Filter<T> {
> ^
> jdk/src/share/classes/javax/accessibility/Accessible.java:39: Note:
> Candidate functional interface
> public interface Accessible {
> ^
>
> jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheData.java:37:
> Note: Candidate functional interface
> public interface ApacheData extends Data {
>
> reflection
> =============
>
> jdk/src/share/classes/java/lang/reflect/GenericArrayType.java:33: Note:
> Candidate functional interface
> public interface GenericArrayType extends Type {
> ^
>
> jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java:33:
> Note: Candidate functional interface
> public interface GenericDeclaration {
> ^
> jdk/src/share/classes/java/lang/reflect/InvocationHandler.java:41: Note:
> Candidate functional interface
> public interface InvocationHandler {
> ^
>
>
> xml
> =====
>
> jdk/src/share/classes/javax/xml/crypto/KeySelectorResult.java:46: Note:
> Candidate functional interface
> public interface KeySelectorResult {
> ^
> jdk/src/share/classes/javax/xml/crypto/URIDereferencer.java:55: Note:
> Candidate functional interface
> public interface URIDereferencer {
> ^
> jdk/src/share/classes/javax/xml/crypto/NodeSetData.java:42: Note:
> Candidate functional interface
> public interface NodeSetData extends Data {
> ^
> jdk/src/share/classes/javax/xml/crypto/XMLStructure.java:39: Note:
> Candidate functional interface
> public interface XMLStructure {
> ^
>
> JDBC - Assuming this will be handled separately under JDBC maintenance
> ======
>
> jdk/src/share/classes/java/sql/RowId.java:63: Note: Candidate functional
> interface
> public interface RowId {
> ^
> jdk/src/share/classes/javax/sql/RowSetReader.java:41: Note: Candidate
> functional interface
> public interface RowSetReader {
> ^
> jdk/src/share/classes/javax/sql/RowSetWriter.java:49: Note: Candidate
> functional interface
> public interface RowSetWriter {
> ^
> JSR 310 - Assuming this will be handled separately under JSR 310 evolution
> =========
>
> jdk/src/share/classes/java/time/temporal/TemporalAdjuster.java:96: Note:
> Candidate functional interface
> public interface TemporalAdjuster {
> ^
> jdk/src/share/classes/java/time/temporal/TemporalQuery.java:101: Note:
> Candidate functional interface
> public interface TemporalQuery<R> {
> ^
> jdk/src/share/classes/java/time/temporal/TemporalAdder.java:95: Note:
> Candidate functional interface
> public interface TemporalAdder {
> ^
> jdk/src/share/classes/java/time/temporal/TemporalSubtractor.java:95:
> Note: Candidate functional interface
> public interface TemporalSubtractor {
> ^
>
> JNDI
> ======
>
> jdk/src/share/classes/javax/naming/event/NamingListener.java:57: Note:
> Candidate functional interface
> public interface NamingListener extends java.util.EventListener {
> ^
> jdk/src/share/classes/javax/naming/ldap/HasControls.java:60: Note:
> Candidate functional interface
> public interface HasControls {
> ^
> jdk/src/share/classes/javax/naming/Referenceable.java:49: Note:
> Candidate functional interface
> public interface Referenceable {
> ^
> jdk/src/share/classes/javax/naming/NameParser.java:45: Note: Candidate
> functional interface
> public interface NameParser {
> ^
> jdk/src/share/classes/javax/naming/spi/StateFactory.java:80: Note:
> Candidate functional interface
> public interface StateFactory {
> ^
> jdk/src/share/classes/javax/naming/spi/ObjectFactoryBuilder.java:57:
> Note: Candidate functional interface
> public interface ObjectFactoryBuilder {
> ^
> jdk/src/share/classes/javax/naming/spi/ObjectFactory.java:70: Note:
> Candidate functional interface
> public interface ObjectFactory {
> ^
> jdk/src/share/classes/javax/naming/spi/InitialContextFactoryBuilder.java:54:
> Note: Candidate functional interface
> public interface InitialContextFactoryBuilder {
> ^
> jdk/src/share/classes/javax/naming/spi/InitialContextFactory.java:53:
> Note: Candidate functional interface
> public interface InitialContextFactory {
> ^
>
> RMI
> =====
>
> jdk/src/share/classes/java/rmi/activation/ActivationInstantiator.java:42: Note:
> Candidate functional interface
> public interface ActivationInstantiator extends Remote {
> ^
> jdk/src/share/classes/java/rmi/activation/Activator.java:64: Note:
> Candidate functional interface
> public interface Activator extends Remote {
> ^
> jdk/src/share/classes/java/rmi/server/RMIServerSocketFactory.java:61:
> Note: Candidate functional interface
> public interface RMIServerSocketFactory {
> ^
> jdk/src/share/classes/java/rmi/server/RMIFailureHandler.java:40: Note:
> Candidate functional interface
> public interface RMIFailureHandler {
> ^
> jdk/src/share/classes/java/rmi/server/RMIClientSocketFactory.java:62:
> Note: Candidate functional interface
> public interface RMIClientSocketFactory {
> ^
> jdk/src/share/classes/java/rmi/server/Unreferenced.java:37: Note:
> Candidate functional interface
> public interface Unreferenced {
> ^
> Beans
> ========
>
> jdk/src/share/classes/java/beans/PropertyChangeListener.java:34: Note:
> Candidate functional interface
> public interface PropertyChangeListener extends java.util.EventListener {
> ^
> jdk/src/share/classes/java/beans/VetoableChangeListener.java:33: Note:
> Candidate functional interface
> public interface VetoableChangeListener extends java.util.EventListener {
> ^
> jdk/src/share/classes/java/beans/ExceptionListener.java:34: Note:
> Candidate functional interface
> public interface ExceptionListener {
> ^
> jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java:37:
> Note: Candidate functional interface
> public interface BeanContextServiceRevokedListener extends EventListener {
> ^
> jdk/src/share/classes/java/beans/beancontext/BeanContextProxy.java:76:
> Note: Candidate functional interface
> public interface BeanContextProxy {
> ^
> jdk/src/share/classes/java/beans/beancontext/BeanContextContainerProxy.java:43:
> Note: Candidate functional interface
> public interface BeanContextContainerProxy {
> ^
> jdk/src/share/classes/java/beans/beancontext/BeanContextChildComponentProxy.java:44:
> Note: Candidate functional interface
> public interface BeanContextChildComponentProxy {
> ^
> networking
> ==========
>
> jdk/src/share/classes/java/net/ContentHandlerFactory.java:41: Note:
> Candidate functional interface
> public interface ContentHandlerFactory {
> ^
> jdk/src/share/classes/java/net/HttpCookie.java:855: Note: Candidate
> functional interface
> static interface CookieAttributeAssignor {
> ^
> jdk/src/share/classes/java/net/SocketImplFactory.java:40: Note:
> Candidate functional interface
> interface SocketImplFactory {
> ^
> jdk/src/share/classes/java/net/CookiePolicy.java:38: Note: Candidate
> functional interface
> public interface CookiePolicy {
> ^
> jdk/src/share/classes/java/net/URLStreamHandlerFactory.java:40: Note:
> Candidate functional interface
> public interface URLStreamHandlerFactory {
> ^
> jdk/src/share/classes/java/net/DatagramSocketImplFactory.java:38: Note:
> Candidate functional interface
> interface DatagramSocketImplFactory {
> ^
> jdk/src/share/classes/java/net/FileNameMap.java:35: Note: Candidate
> functional interface
> public interface FileNameMap {
> ^
> jdk/src/share/classes/java/net/ProtocolFamily.java:34: Note: Candidate
> functional interface
> public interface ProtocolFamily {
> ^
> jdk/src/share/classes/javax/net/ssl/HostnameVerifier.java:46: Note:
> Candidate functional interface
> public interface HostnameVerifier {
> ^
> jdk/src/share/classes/javax/net/ssl/HandshakeCompletedListener.java:44:
> Note: Candidate functional interface
> public interface HandshakeCompletedListener extends EventListener
> ^
> jmx/management
> ================
>
> jdk/src/share/classes/java/lang/management/PlatformManagedObject.java:52: Note:
> Candidate functional interface
> public interface PlatformManagedObject {
> ^
> jdk/src/share/classes/java/lang/management/PlatformComponent.java:279:
> Note: Candidate functional interface
> interface MXBeanFetcher<T extends PlatformManagedObject> {
> ^
> jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java:50:
> Note: Candidate functional interface
> public interface ClassFileTransformer {
> ^
> jdk/src/share/classes/javax/management/openmbean/CompositeDataView.java:109:
> Note: Candidate functional interface
> public interface CompositeDataView {
> ^
> jdk/src/share/classes/javax/management/NotificationFilter.java:35: Note:
> Candidate functional interface
> public interface NotificationFilter extends java.io.Serializable {
> ^
> jdk/src/share/classes/javax/management/remote/JMXAddressable.java:44:
> Note: Candidate functional interface
> public interface JMXAddressable {
> ^
> jdk/src/share/classes/javax/management/remote/JMXAuthenticator.java:52:
> Note: Candidate functional interface
> public interface JMXAuthenticator {
> ^
> jdk/src/share/classes/javax/management/remote/JMXConnectorServerProvider.java:42:
> Note: Candidate functional interface
> public interface JMXConnectorServerProvider {
> ^
> jdk/src/share/classes/javax/management/remote/JMXConnectorProvider.java:41:
> Note: Candidate functional interface
> public interface JMXConnectorProvider {
> ^
> jdk/src/share/classes/javax/management/NotificationListener.java:34:
> Note: Candidate functional interface
> public interface NotificationListener extends java.util.EventListener {
> ^
> jdk/src/share/classes/javax/management/DescriptorRead.java:33: Note:
> Candidate functional interface
> public interface DescriptorRead {
> ^
> concurrent - Assume this will be done first upstream in Doug's repos
> ============
>
> jdk/src/share/classes/java/util/concurrent/ThreadFactory.java:58: Note:
> Candidate functional interface
> public interface ThreadFactory {
> ^
> jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java:545: Note:
> Candidate functional interface
> public static interface ForkJoinWorkerThreadFactory {
> ^
> jdk/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java:44:
> Note: Candidate functional interface
> public interface RejectedExecutionHandler {
> ^
> jdk/src/share/classes/java/util/concurrent/Callable.java:57: Note:
> Candidate functional interface
> public interface Callable<V> {
> ^
> jdk/src/share/classes/java/util/concurrent/Executor.java:128: Note:
> Candidate functional interface
> public interface Executor {
>



More information about the core-libs-dev mailing list