New TR: Static Analysis Techniques for Evaluating Runtime Monitoring Properties Ahead-of-Time

Eric | November 23, 2007

imageToday I am proud to present our brand new Technical Report in which Patrick Lam, Laurie Hendren and me present how you can use static analysis to evaluate runtime monitoring properties ahead-of-time, i.e. at compile time opposed to at runtime.

We have been working on this topic for about a year now, with different approaches and it actually took us until some weeks ago to get it actually all worked out. The coolest thing is that the approach we found in the end is really surprisingly simple, yet very effective. All it needs is a good static abstraction and super-precise pointer analysis. That’s it. The problem that we had before was that we were tying to make things more complicated than they were.

Read the rest of this entry »

Java and generics: handle with care – part 2

Eric | November 23, 2007

This is a follow-up to my earlier posting in which I was ranting about Java generics. Subject of the post were these two pieces of Java code:

Set<String> stringSet = new HashSet<String>();
Set<String> otherStringSet = new HashSet<String>();
otherStringSet.add((String) stringSet);
Set<List> listSet = new HashSet<List>();
Set<List> otherListSet = new HashSet<List>();
otherListSet.add((List) listSet);

The first one gives a static type error in line 3 because obviously one cannot cast a Set to a String. What confused me was that the second piece of code is (statically) well-typed. You will get a runtime error on the cast (List) listSet, but no compile time error. Why is that?

Read the rest of this entry »

Comments
Comments Off on Java and generics: handle with care – part 2
Categories
Research
Tags
Java, Programming

How delegates impose contracts on their wrappers

Eric | November 15, 2007

This week I was working a lot on our new PLDI submission, which we just submitted (more about that later). During this work I came around an interesting subtlety with respect to delegates and Design By Contract (DBC) . We wanted to validate the fulfillment of a contract for the Iterator interface: When using an iterator i you are only allowed to call i.next() if before that you have checked whether i.hasNext() holds. For PLDI we developed a static analysis approach (using tracematches) that allows you to flag potential violations of this contract. Here is one that we found in Jython, a Python implementation for the Java Virtual Machine and part of the DaCapo benchmark suite:

Read the rest of this entry »

Comments
Comments Off on How delegates impose contracts on their wrappers
Categories
Research
Tags
Bug finding, Java, Programming