PowerPoint - KindSoftware

Download Report

Transcript PowerPoint - KindSoftware

escj 28
Compaq Confidential - Need to Know Required
Static checkers
Compaq Confidential - Need to Know Required
Type checking vs.
extended static checking
Type checking

Are annotations needed?
yes

yes
How many annotations per variable/method?
1

E.s.c.
0 -- many
Escape hatch for when annotation gets too
complicated?
dynamic casts
assume, nowarn
Compaq Confidential - Need to Know Required
Compaq Confidential - Need to Know Required
Annotation assistant
Compaq Confidential - Need to Know Required
Annotation assistant
Compaq Confidential - Need to Know Required
Annotation assistant
Compaq Confidential - Need to Know Required
Annotation assistant
Compaq Confidential - Need to Know Required
Annotation assistant
Compaq Confidential - Need to Know Required
Annotation assistant
Compaq Confidential - Need to Know Required
-suggest switch

Use simple (possibly bogus) heuristics
Cup.java:18: Warning: possible null dereference (Null)
x = o.f;
^
Compaq Confidential - Need to Know Required
-suggest switch

Use simple (possibly bogus) heuristics
Cup.java:18: Warning: possible null dereference (Null)
x = o.f;
^
Suggestion: perhaps declare ‘o’ as ‘non_null’
Compaq Confidential - Need to Know Required
Annotation wizard design
repeat
call ESC/Java -suggest on sources;
distill output into update instructions;
act on update instructions
until quiescence
Compaq Confidential - Need to Know Required
Update instructions
insert “/*@ … */” at 6,12 in Cup.java
else “/*@ nowarn … */” at 28,17 in Client.java
Compaq Confidential - Need to Know Required
Pachyclient case study
~11,000 lines of code
 ~650 methods
 43 files
 110 minutes (2.5 minutes to compile)
 13 iterations
 971 annotations

Compaq Confidential - Need to Know Required
How were the 110 minutes spent?
Iteration Warnings
0
392
1
256
2
136
3
78
4
42
5
24
6
20
7
11
8
6
9
3
10
2
11
1
12
0
--------------TOTAL:
13
971
Minutes
14
12
10
9
8
8
7
7
7
7
7
7
7
-------110
Compaq Confidential - Need to Know Required
What became of the 971 warnings?

non_null
instance fields
parameters
local variables
static fields
postcondition RES != null
requires 0 <= x
ensures 0 <= RES
invariant 0 <= x
no heuristic
null related
negative related
suggestion in different file
annotation inserter gives up













304
219
108
5
49
2
2
1
47
16
169
49
(later: 27)
(29 for ‘null’)
Compaq Confidential - Need to Know Required
Did the wizard help?

null and negative checking only



warnings on unannotated code:
warnings on wizard-annotated code:
938
274
all checking (but heuristics only for null and negative)


warnings on unannotated code:
>1100
warnings on wizard-annotated code:
488
Compaq Confidential - Need to Know Required
What kinds of warnings remain?
Null
121
 NonNull
131
 NonNullInit
5
 IndexNegative
15
 NegSize
2

(83)
(83)
(1)
Cast
 Pre
 IndexTooBig
 Post
 ZeroDiv
 Invariant

111
48
32
14
7
2
(Numbers in parentheses indicate how many of the warnings have
annotation suggestions in libraries.)
Compaq Confidential - Need to Know Required
Annotating libraries
Suggestion [359,52]: perhaps declare method 'getText' in
/tmp_mnt/bill/r/dlusers14/sanjay/srcjava1.1/files/../files/jdk-114.zip:
java/awt/TextComponent.class with 'ensures RES != null;'
Compaq Confidential - Need to Know Required
Compaq Confidential - Need to Know Required
Compaq Confidential - Need to Know Required
Compaq Research
Harder questions