Syntax patterns: more statistics.

Mark Mahieu markmahieu at googlemail.com
Mon Apr 20 14:48:51 PDT 2009


Hi Ruslan,

Very nice - it'll be interesting to see the results when run against some
other libraries I used for my own analysis.  Thanks for sharing it!

Regards,

Mark


2009/4/20 Ruslan Shevchenko <Ruslan at shevchenko.kiev.ua>

> Good day, community !
>
>  I want to share some statistics about java usage patterns, related to
> some of coin-dev proposals.
>
> Main changes from previous post are:
>  - added counts for 'if' syntax constructions, so we can say, hom many
>  percents of if's can be eliminated by elvis operator ( [4-5]%)
>  - added counts for 'catch' syntax constructions, so we can say that
> multicath eliminate 6-8% of all catch clauses.
>  - added count for big integers integers (where undescore can be
> applicable, I guess this is x: x > 100000 || x < -10000) and for all
> integer literals.
>   (underscore can be applicable to near 1%)
>  - added count for object-switch proposal by Ulf Zibis (refining, that
> Left/Right part of expressions are first operand in equalirty expression
> or object in method call)
>  - added count for rethrow proposal by Mark Mahieu (near 50% of all
> catches in some packages (!) ).
>  - added count for catches inside finally block. (Is this is a real
> problem [?]).
>
> If anybody whant run checks on own dataset or/and add own check
> definitions: all  procedure is the same as in my previous letter (see
> http://mail.openjdk.java.net/pipermail/coin-dev/2009-April/001442.html)
> except URL for last version
>  is
>
> http://datacenter.gradsoft.ua/public.repository/ua.gradsoft/javachecker/installations/JavaCheckerSourceInstaller-2.5.0p1.jar
>
> Now summary statistics for some well-known packages:
> jetty (web server)
> all catchs      :       281
> all ifs :       764
> all integer literals    :       2903
> big integer literals(undescores)        :       25
> byte literal    :       52
> catch in finally        :       3
> elvis   :       43
> instanceof switch       :       8
> loop with remove        :       0
> multi catch     :       22
> object switch   :       31
> rethrow clause  :       34
> string in switch        :       19
> Files:187
>
> gwt-users (google java ajax client library)
> all catchs      :       171
> all ifs :       735
> all integer literals    :       2282
> big integer literals(undescores)        :       24
> byte literal    :       2
> catch in finally        :       2
> elvis   :       30
> instanceof switch       :       6
> loop with remove        :       5
> multi catch     :       9
> object switch   :       27
> rethrow clause  :       84
> string in switch        :       10
> Files:920
>
> hibernate (ORM toolkit)
> all catchs      :       650
> all ifs :       2410
> all integer literals    :       3240
> big integer literals(undescores)        :       12
> byte literal    :       1
> catch in finally        :       27
> elvis   :       182
> instanceof switch       :       28
> loop with remove        :       12
> multi catch     :       25
> object switch   :       94
> rethrow clause  :       450
> string in switch        :       86
> Files:1372
>
> openjdk7 (standard java library)
> all catchs      :       8404
> all ifs :       28494
> all integer literals    :       124356
> big integer literals(undescores)        :       4066
> byte literal    :       1454
> catch in finally        :       103
> elvis   :       877
> instanceof switch       :       318
> loop with remove        :       62
> multi catch     :       411
> object switch   :       1363
> rethrow clause  :       3264
> string in switch        :       445
> Files:9252
>
> Hope, this data will be useful in some cases.
> Regards !
>
>
>
>



More information about the coin-dev mailing list