SAM interface/class figures [Re: Preparing for the 0.2
Alex Buckley
Alex.Buckley at Sun.COM
Fri Feb 5 12:58:22 PST 2010
Hi Alexey,
Alexey Kudravtsev wrote:
> In any case, in this post by Neal Gafter, where these classes are supposed
> to be SAM types, the majority of them are obviously not.
> ==================
>> Below are all the distinct classes
>>
>> com.sun.tools.example.debug.tty.Commands.AsyncExecution
>> com.sun.tools.hat.internal.model.AbstractJavaHeapObjectVisitor
>> com.sun.tools.hat.internal.util.Comparer
>> java.awt.font.TextLine.Function
>> java.io.InputStream
>> java.io.OutputStream
>> java.lang.Thread
>> java.nio.charset.CoderResult.Cache
>> java.util.TimerTask
>> java.util.regex.Pattern.CharProperty
>> java.util.regex.Pattern.CharPropertyNames.CharPropertyFactory
>> java.util.regex.Pattern.CharPropertyNames.CloneableProperty
>> javax.swing.AbstractAction
> ======================
1) I did not interpret Neal as saying that these classes are SAMs. He said:
Total anonymous classes: 1155
...
And where the type is a SAM type: 811
...
Those that are interfaces: 752
Those that are classes: 59
Total distinct interfaces: 50 (see below)
Total distinct classes: 13 (see below)
That is, 1155 anon.classes implement/extend 50 interfaces and 13
classes. Only 811 anon.classes implement/extend SAM types; Neal did not
say how many of the 50 interfaces and 13 classes are SAM types.
2) As it happens, a majority of the classes are SAM types. Only
com.sun.tools.example.debug.tty.Commands.AsyncExecution,
java.lang.Thread, and javax.swing.AbstractAction are not. Probably you
said a majority are not SAM types because a majority are not top-level
classes. However, if a nested class is static, then it ought to qualify
(other conditions permitting) as a SAM type. The key is that a SAM is
non-inner, not that it's top-level.
3) It would be interesting to know how many distinct interfaces (of
the 50) are implemented by the 752 anon.classes that implement a SAM type.
Alex
More information about the lambda-dev
mailing list