[OpenJDK 2D-Dev] 2D-related types that are candidates to be FunctionalInterfaces in JDK 8

Joseph Darcy joe.darcy at oracle.com
Sat Feb 9 00:11:55 UTC 2013


Hello,

As part of Project Lambda, a FunctionalInterface annotation type was 
added to the platform to mark interfaces that are intended to be used in 
lambda expressions.  I've sent out a code review request to add this 
annotation to types in the core-libs area [1] and have just pushed the 
changeset into TL [2].

To assist the 2D team in adding analogous annotations to your types, the 
list of candidate types in for 2D-related classes in java.* and javax.* 
is given below.  I recommend sub-tasks of JDK-8005297 "Add 
FunctionalInterface support to the platform" be used to track the work 
of adding @FunctionalInterface annotations to 2D types

In terms of how the annotation should be used, the benefit of the 
annotation is that is clearly documents the type is intended to be used 
for lambda expressions and is unlikely to evolve such that is cannot be 
used with lambda expressions.

To a first approximation, if a candidate type today is commonly created 
using anonymous inner classes, it is reasonable to add the 
functionalInterface annotation.  Note that the compiler will allow any 
type meeting the structural requirements of a functional interface to be
used in a lambda expression; the annotation just provides documentation 
of intent.

Having misplaced my 2D vs AWT vs Swing decoder ring, consideration of 
these 2D types was previously sent to other aliases [3] [4].

Thanks,

-Joe

[1] 
http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-February/014292.html 


[2] http://hg.openjdk.java.net/jdk8/tl/jdk/rev/522fb3867a3a

[3] http://mail.openjdk.java.net/pipermail/awt-dev/2013-February/004213.html

[4] 
http://mail.openjdk.java.net/pipermail/swing-dev/2013-February/002535.html

-=-=-=-=-

jdk/src/share/classes/java/awt/Stroke.java:58: Note: Candidate 
functional interface
public interface Stroke {
        ^

jdk/src/share/classes/java/awt/image/TileObserver.java:39: Note: 
Candidate functional interface
public interface TileObserver {

jdk/src/share/classes/java/awt/image/ImageObserver.java:40: Note: 
Candidate functional interface
public interface ImageObserver {
        ^
jdk/src/share/classes/java/awt/image/renderable/RenderedImageFactory.java:47: 
Note: Candidate functional interface
public interface RenderedImageFactory {
        ^
jdk/src/share/classes/java/awt/image/TileObserver.java:39: Note: 
Candidate functional interface
public interface TileObserver {

jdk/src/share/classes/java/awt/print/Printable.java:105: Note: Candidate 
functional interface
public interface Printable {
        ^
jdk/src/share/classes/java/awt/PrintGraphics.java:33: Note: Candidate 
functional interface
public interface PrintGraphics {
        ^
jdk/src/share/classes/javax/print/FlavorException.java:39: Note: 
Candidate functional interface
public interface FlavorException {
        ^
jdk/src/share/classes/javax/print/event/PrintServiceAttributeListener.java:37: 
Note: Candidate functional interface
public interface PrintServiceAttributeListener {
        ^
jdk/src/share/classes/javax/print/event/PrintJobAttributeListener.java:34: 
Note: Candidate functional interface
public interface PrintJobAttributeListener {
        ^
jdk/src/share/classes/javax/imageio/IIOParamController.java:99: Note: 
Candidate functional interface
public interface IIOParamController {
        ^
jdk/src/share/classes/javax/imageio/event/IIOWriteWarningListener.java:46: 
Note: Candidate functional interface
public interface IIOWriteWarningListener extends EventListener {
        ^
jdk/src/share/classes/javax/imageio/event/IIOReadWarningListener.java:46: Note: 
Candidate functional interface
public interface IIOReadWarningListener extends EventListener {
        ^
jdk/src/share/classes/javax/imageio/metadata/IIOMetadataController.java:67: 
Note: Candidate functional interface
public interface IIOMetadataController {
        ^
jdk/src/share/classes/javax/imageio/spi/ServiceRegistry.java:464: Note: 
Candidate functional interface
     public interface Filter {





More information about the 2d-dev mailing list