1. Movie with
John Wayne
(1962)
Swahili for
“Danger”
HATARI
Raising Risk Awareness
Jacek Sliwerski, Thomas Zimmermann, and Andreas Zeller
Saarland University
3. resolveClasspath()
/* (non-Javadoc)
* @see org.eclipse.jdt.launching.IRuntimeClasspathProvider#resolveClasspath
* (org.eclipse.jdt.launching.IRuntimeClasspathEntry[], org.eclipse.debug.core.ILaunchConfiguration)
*/
public IRuntimeClasspathEntry[] resolveClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration)
throws CoreException {
List all = new ArrayList(entries.length);
for (int i = 0; i < entries.length; i++) {
switch (entries[i].getType()) {
case IRuntimeClasspathEntry.PROJECT:
// a project resolves to itself for source lookup (rather than the class file output locations)
9 changes,
all.add(entries[i]);
break;
case IRuntimeClasspathEntry.OTHER:
all of them fixes
IRuntimeClasspathEntry2 entry = (IRuntimeClasspathEntry2)entries[i];
if (entry.getTypeId().equals(DefaultProjectClasspathEntry.TYPE_ID)) {
// add the resolved children of the project
8 fix-inducing changes
IRuntimeClasspathEntry[] children = entry.getRuntimeClasspathEntries(configuration);
IRuntimeClasspathEntry[] res = JavaRuntime.resolveSourceLookupPath(children, configuration);
one re-implementation
for (int j = 0; j < res.length; j++) {
all.add(res[j]);
}
}
break;
default:
IRuntimeClasspathEntry[] resolved =JavaRuntime.resolveRuntimeClasspathEntry(entries[i], configuration);
for (int j = 0; j < resolved.length; j++) {
all.add(resolved[j]);
}
break;
}
}
return (IRuntimeClasspathEntry[])all.toArray(new IRuntimeClasspathEntry[all.size()]);
}
4. Fix-Inducing Changes
Fix-Inducing Changes are
Changes that lead to problems as
indicated by later fixes.
Later:
Example:
... ...
if (foo==null) { if (foo!=null) {
foo.bar(); foo.bar();
FIX-INDUCING FIX
6. How to
Locate Fix-Inducing Changes
$ cvs annotate -r 1.17 Foo.java
...
19: 1.11 (john 12-Feb-03): public int a() {
20: 1.11 (john 12-Feb-03): return i/0;
...
39: 1.10 (mary 12-Jan-03): public int b() {
40: 1.14 (kate 23-May-03): return 42;
...
59: 1.10 (mary 17-Jan-03): public void c() {
60: 1.16 (mary 10-Jun-03): int i=0;
1.18
Fixed Bug
42233
Changed:
a() b() c()
line 20 40 60
7. How to
Locate Fix-Inducing Changes
$ cvs annotate -r 1.17 Foo.java
20: 1.11 (john 12-Feb-03): return i/0;
40: 1.14 (kate 23-May-03): return 42;
60: 1.16 (mary 10-Jun-03): int i=0;
1.11 1.14 1.16 1.18
a() was b() was c() was Fixed Bug
changed changed changed 42233
Changed:
FIX-INDUCING FIX-INDUCING FIX-INDUCING
a() b() c()
8. How to
Locate Fix-Inducing Changes
$ cvs annotate -r 1.17 Foo.java
20: 1.11 (john 12-Feb-03): return i/0;
40: 1.14 (kate 23-May-03): return 42;
60: 1.16 (mary 10-Jun-03): int i=0;
Bug 42233 was reported. closed.
1.11 1.14 1.16 1.18
a() was b() was c() was Fixed Bug
changed changed changed 42233
Changed:
FIX-INDUCING FIX-INDUCING FIX-INDUCING
a() b() c()
REMOVE FALSE POSITIVES
9. A Measure for Risk
based on Fix-Inducing Changes
risk(L) is the (past) risk for a location L
“BAD” Changes
# Fix-Inducing Changes to L
risk(L) =
# Changes to L
10. How to Predict Future Risk
0.5
0.4
0.3
Correlation
0.2
0.1
0
0 1 2 3 4 5 6 7 8 9 10
Number of upcoming changes
11. How to Predict Future Risk
0.5
McCabe Cyclomatic Complexity
0.4
0.3
Correlation
0.2
0.1
0
0 1 2 3 4 5 6 7 8 9 10
Number of upcoming changes
12. How to Predict Future Risk
0.5
Nested Block Depth
McCabe Cyclomatic Complexity
0.4
0.3
Correlation
0.2
0.1
0
0 1 2 3 4 5 6 7 8 9 10
Number of upcoming changes
13. How to Predict Future Risk
0.5
Past Risk
Nested Block Depth
McCabe Cyclomatic Complexity
0.4
0.3
Correlation
0.2
0.1
0
0 1 2 3 4 5 6 7 8 9 10
Number of upcoming changes
18. Conclusion
Fix-inducing changes are a measure for
(past) risk.
HATARI makes risk visible for developers.
HATARI will be open source (Nov 1)
http://www.st.cs.uni-sb.de/softevo/