more syntax patterns[ v5]
Ruslan Shevchenko
rssh at gradsoft.com.ua
Mon May 18 06:45:07 PDT 2009
Good day.
Next set of syntax patterns for count of LOCs, affected by coin possible
optimizations with results is available.
main changes from previous set are:
- added count for using collection indexes. (I. e. number of LOCs,
probably will be optimized after implementing index array access)
(pattern named 'simplicified collection element access', for review see
lines from 313 to 353 of checkers_coin.def [
http://redmine.gradsoft.ua/repositories/entry/javachecker/trunk/JavaChecker/etc/checkers_coin.def
])
- added count for using simplicified string builder/buffer append
(pattern named 'simplicified StringBuilder/Buffer syntax', lines 285-311)
- added count for variable declarators with initializers.
('all variable initializers', lines 355-363)
- added count for variable initializers, applicable for proposal: Type
inference for variable definition/initialization using the 'auto' keyword.
('initializers with type arguments or long type names', lines 365-415)
- added count for variable initalizers, applicable for 'diamond' proposal
[i.e. calls of counstructor with type parameters]
('initializers with allocation and type arguments', lines 417-468)
//in short - auto proposal for type inheritance is a clean winner.
- integrated counters for traditional for loops, which not only applicable
to 'Enhanced for each loop iteration control', but can also be transformed
to java5 foreach loop. (file etc/checkers_coin_loop.def)
- removed incorrect counters for elvis proposal (see summary of elvis1 and
nullsafe call of fields and methods instead)
- removed counters for syntax bit-and with 0xFF
- added 'Compiere ERP' for set of analyzed sources.
// And yes, exception catching is differ from frameworks exactly as in
Stephen Colebourne measurements for e-commerce system (see
http://mail.openjdk.java.net/pipermail/coin-dev/2009-April/001597.html)
Results are:
openjdk-jdk:
all bit ands : 6814
all conditional expressions : 6770
all catchs : 8411
all ifs : 28442
all integer literals : 120613
all traditional fors : 11530
all variable initializers : 139836
initializers with type arguments or long type names : 40211
big integer literals(undescores) : 4589
byte literal : 1452
catch in finally : 103
simplicified collection element access : 5438
initializers with allocation and type arguments : 1499
elvis1 : 437
for loop (length),convertable to foreach : 1515
for loop (size),convertable to foreach : 158
for loop from 0 to size or length : 3137
for with limit like it.next() : 235
instanceof switch : 317
loop with remove : 94
multi catch : 412
nullsafe call of fields and methods : 384
object switch : 1360
rethrow clause : 3267
simplicified StringBuilder/Buffer syntax : 5142
string in switch : 444
widening operator (semantics) : 1090
Files:9278
Compiere ERP:
all bit ands : 17
all conditional expressions : 435
all catchs : 2251
all ifs : 6158
all integer literals : 22482
all traditional fors : 719
all variable initializers : 31027
initializers with type arguments or long type names : 9990
big integer literals(undescores) : 1422
byte literal : 1
catch in finally : 82
simplicified collection element access : 732
initializers with allocation and type arguments : 708
elvis1 : 36
for loop (length),convertable to foreach : 130
for loop (size),convertable to foreach : 136
for loop from 0 to size or length : 476
for with limit like it.next() : 2
instanceof switch : 31
loop with remove : 4
multi catch : 7
nullsafe call of fields and methods : 31
object switch : 257
rethrow clause : 46
simplicified StringBuilder/Buffer syntax : 4635
string in switch : 215
widening operator (semantics) : 1
Files:2110
jetty:
all bit ands : 121
all conditional expressions : 277
all catchs : 281
all ifs : 764
all integer literals : 2903
all traditional fors : 315
all variable initializers : 3687
initializers with type arguments or long type names : 837
big integer literals(undescores) : 25
byte literal : 52
catch in finally : 3
simplicified collection element access : 241
initializers with allocation and type arguments : 0
elvis1 : 33
for loop (length),convertable to foreach : 63
for loop (size),convertable to foreach : 16
for loop from 0 to size or length : 100
for with limit like it.next() : 4
instanceof switch : 8
invalid checker comments : 0
loop with remove : 0
multi catch : 22
nullsafe call of fields and methods : 35
object switch : 31
rethrow clause : 34
simplicified StringBuilder/Buffer syntax : 363
string in switch : 19
widening operator (semantics) : 10
Files:187
gwt-user:
all bit ands : 58
all conditional expressions : 208
all catchs : 171
all ifs : 735
all integer literals : 2282
all traditional fors : 271
all variable initializers : 4208
initializers with type arguments or long type names : 1673
big integer literals(undescores) : 24
byte literal : 2
catch in finally : 2
simplicified collection element access : 324
initializers with allocation and type arguments : 252
elvis1 : 18
for loop (length),convertable to foreach : 24
for loop (size),convertable to foreach : 5
for loop from 0 to size or length : 71
for with limit like it.next() : 20
instanceof switch : 6
loop with remove : 7
multi catch : 9
nullsafe call of fields and methods : 10
object switch : 27
rethrow clause : 84
simplicified StringBuilder/Buffer syntax : 216
string in switch : 10
widening operator (semantics) : 0
Files:920
Hibernate:
all bit ands : 2
all conditional expressions : 792
all catchs : 650
all ifs : 2410
all integer literals : 3240
all traditional fors : 708
all variable initializers : 10271
initializers with type arguments or long type names : 4013
big integer literals(undescores) : 12
byte literal : 1
catch in finally : 27
simplicified collection element access : 613
initializers with allocation and type arguments : 100
elvis1 : 77
for loop (length),convertable to foreach : 177
for loop (size),convertable to foreach : 17
for loop from 0 to size or length : 385
for with limit like it.next() : 16
instanceof switch : 28
loop with remove : 12
multi catch : 25
nullsafe call of fields and methods : 116
object switch : 94
rethrow clause : 450
simplicified StringBuilder/Buffer syntax : 1128
string in switch : 86
widening operator (semantics) : 0
Files:1372
If you want run checker on own codeset or play with patterns, it can be
download as
http://datacenter.gradsoft.ua/public.repository/ua.gradsoft/javachecker/installations/JavaCheckerBinaryInstaller-2.5.0p5.jar
How to run: see instructions at the end of the first letter:
http://mail.openjdk.java.net/pipermail/coin-dev/2009-April/001442.html
Hope, this information will be useful.
Regards !
More information about the coin-dev
mailing list