JSR 335 Lambda Specification, 0.6.3
daniel.smith at oracle.com
Fri Sep 20 16:03:16 PDT 2013
An updated specification can be found here:
One-page HTML: http://cr.openjdk.java.net/~dlsmith/jsr335-0.6.3.html
Downloadable zip: http://cr.openjdk.java.net/~dlsmith/jsr335-0.6.3.zip
This ties up most loose ends, and can be viewed as a preview of the Public Review (planned for next month). There are likely some rough edges to polish before that time (broken links, unclear wording, etc.). Parts F, G, and J are much more stable than in the past, documenting final plans for overload resolution, type inference, and VM changes.
Full change log, from the document:
> Functional Interfaces: Renamed the term function descriptor to function type (undoing the previous renaming of functional interface type to function type). Cleaned up the conditions under which an intersection type can be considered a functional interface type. Addressed a negative interaction of wildcards with derivation of a function type.
> Lambda Expressions: Introduced the terms explicitly-typed lambda and implicitly-typed lambda. Changed treatment of "_" to allow it as a name in non-lambda contexts (noting the possibility of future deprecation).
> Typing and Evaluation: Introduced the terms exact method reference and inexact method reference. Removed the compatibility condition for lambda expressions that their body not contain errors. Introduced a section detailing the process of identifying a compile-time declaration for a method reference (distinct from testing for compatibility). Adjusted resolution of an unbound/static method reference to be less brittle.
> Overload Resolution: Asserted that arguments involving implicitly-typed lambdas and inexact method references are not pertinent to applicability; they are only checked for arity during overload resolution. (This replaces the approach of considering some methods to be only provisionally applicable.) Minimized the changes to most-specific analysis, so that extra (non-subtyping) work is only done when two functional interfaces are compared and correspond to an explicitly-typed lambda or an exact method reference. Adjusted potential applicability of an unbound/static method reference to be less brittle. Made the accessibility of a varargs type a post-resolution check.
> Type Inference: Added new bounds to represent capture variables and variables that appear in throws clauses, and described their impact on incorporation and resolution. Eliminated the notion of "delayed constraints". Defined special reduction rules for exact method references. Described reduction of throws constraints. Described how invocation type inference handles sequencing of reduction for constraints on arguments that are not pertinent to applicability, as well as throws constraints (interleaved with resolution of variables, as needed). Made use of capture bounds during invocation type inference.
> Default Methods: Prohibited static and default methods from the body of annotation type declarations (@interfaces).
> Java Virtual Machine: Introduced the term maximally-specific superinterface methods for use in resolution and selection. Adjusted resolution to be more flexible and to ignore static andprivate methods in superinterfaces. Prohibited invokespecial from referring to indirect superinterfaces. Cleaned up the selection logic of invokespecial. Clarified how the changes affect older class files. Adjusted definition of overriding to be consistent with actual behavior in VMs.
More information about the lambda-spec-experts