SAM interface/class figures [Re: Preparing for the 0.2
Alexey Kudravtsev
cdr at intellij.com
Fri Feb 5 01:07:05 PST 2010
>
> Thanks Alexey and Stephen. How are you producing these statistics?
I've cobbled up plugin for Intellij IDEA which analyses current project and
produces statistics.
You can get the plugin jar and source files at the
http://dl.dropbox.com/u/4469125/lambdaStat.jar
Interestingly, the most difficult part was to realize what the SAM type is.
I've used the definition from
http://mail.openjdk.java.net/pipermail/lambda-dev/attachments/20100122/3764c21a/attachment.txt
except the requirement for SAM to be top level class.
And I am still not completely sure I got it right.
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
======================
>
> Alexey, do you really mean 1920 SAM *classes*, or 1920 SAM types?
> Because if 7474 anon.classes extend a class, and 12597 anon.classes
> extend a "SAM", then some of those "SAM" things must be interfaces. What
> is really interesting is how many of those 12597 anon.classes extend a
> SAM class v. implement a SAM interface.
Yes, I meant both SAM classes and SAM interfaces.
Here is the revised and more elaborate statistics (Numbers are different a
little since the codebase is live):
Total files inspected: 34842
Total LOC: 3771256
Total java classes: 69822
All SAM types: 1249 (1,8%)
SAM classes: 1124 (90,0%)
SAM interfaces: 125 (10,0%)
Anonymous classes: 21956 (31,4%)
anonymous classes which extend class: 7492 (34,1%)
anonymous classes which implement interface: 14464 (65,9%)
anonymous classes which extend SAM type: 13013 (59,3%)
anonymous classes which extend SAM class: 244 (1,9%)
anonymous classes which implement SAM interface: 12769 (98,1%)
anon classes with single method: 18470 (84,1%)
anon classes with fields: 240 (1,1%)
anon classes with 'this' references: 116 (0,5%)
anon classes with qualified 'this' references: 77 (0,4%)
anon classes which recurse: 15 (0,1%)
anon classes extending SAM, with single method, no fields, no ctr
parameters: 12811 (58,3%)
and they extend 34 classes and implement 547 interfaces.
--regards,
Alexey Kudravtsev
>
> Alex
>
> Alexey Kudravtsev wrote:
>> These are figures for the Intellij IDEA (http://www.jetbrains.com/idea/)
>> source base.
>>
>> Total files inspected: 34794
>> Total java classes: 69703
>> All SAM classes: 1920 (2,8%)
>> All Anonymous classes: 21908 (31,4%)
>> anonymous classes which Extend class: 7474 (34,1%)
>> anonymous classes which implement interface: 14434 (65,9%)
>>
>> anonymous classes which extend SAM: 12597 (57,5%)
>>
>> anon classes with single method: 18431 (84,1%)
>> anon classes with fields: 149 (0,7%)
>> anon classes with 'this' references: 116 (0,5%)
>> anon classes with qualified 'this' references: 77 (0,4%)
>> anon classes which recurse: 15 (0,1%)
More information about the lambda-dev
mailing list