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

Java and generics: handle with care

Eric | November 7, 2007

Type this in Eclipse and hit “save”. It will happily give you a compile time error in the third line. After all, you are casting a set of Strings to a String, which clearly is not well-typed.

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

Now, type this here in Eclipse… it’s the same code, just with the interface type <List> where there was the class type <String> before.

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

What happens? The code happily compiles!!! Does it run? Well, yes until line 3, where you get a ClassCastException. And the worst: The same happens when you use javac!!! So what? Is that a flaw in the language after all? Or are just all compiler people having a hard time getting their typechecks right? What are generics good for? Since when is a Set a List? I hope that bug 209071 can bring some insight.

Comments
Comments Off on Java and generics: handle with care
Categories
Misc, Research

Seeing the world as Google does: Google Trends

Eric | November 5, 2007

I just learned about the existence of Google Trends. This service allows you to show a graph of how often certain search terms are looked for over time. The typical periodical patterns arise with queries like “gifts“. A growing pattern can be found for example when entering “global warming” (except in the ignorant United States). On the other hand, a query for “microsoft support” suggests that their software indeed has become better over the past few years! Apple seems more worrisome with respect to that. If you compare the two with Linux however, the situation seems pretty clear. Pretty interesting stuff, I find!

Comments
Comments Off on Seeing the world as Google does: Google Trends
Categories
Misc, Research
Tags
Google

You asked for it: Legacy code made available

Eric | November 4, 2007

A few weeks ago, when I started redoing my website, I installed Google analytics on it, together with a WordPress plugin to support it. Surprisingly and disappointingly, it turned out that about 1/3 of access to my web page were not through search engines or direct accesses but rather to websites referring to PHP scripts I wrote ages ago, a seminal paper I wrote about Arithmetic Coding and a report I wrote about how to recover bad sectors from an NTFS partition that are not actually “bad”. Apparently, to people that matters a lot more than performing super-efficient runtime verification. A bit worrisome.. 🙁

Anyway, since those contents were so popular I tried to make them available again. It turned out that all of it was more or less deleted. However I remembered that there was this fabulous website archive.org that captures regular copies of popular pages. As it turns out, I was able to recover about 95% of the content that way – including all the downloads! This is kind of scar, actually. Are they allowed to store all that? Plus they must have huge storage capacities, I guess.

So all the contents are now available here. Happy scripting, arithmetic coding or a happy NTFS recovery!

Comments
Comments Off on You asked for it: Legacy code made available
Categories
Misc, Research

Update to "Generate clone()" plugin for Eclipse

Eric | November 2, 2007

Today it was brought to my attention that the code generation facilities of my my code smell detection and code generation plugin for clone() methods did apparently not work correctly with Eclipse 3.3. This problem should now be fixed in version 0.9.1 of the plugin, which is available here.

Comments
Comments Off on Update to "Generate clone()" plugin for Eclipse
Categories
Research

An AspectJ library for fault tolerance

Eric | November 1, 2007

As a course project at McGill, I developed a little library for fault tolerance, written in AspectJ 5. It contains two components:

  1. Support for automatic N-Version programming.
  2. A full implementation of a recovery cache.

Read the rest of this entry »

Comments
Comments Off on An AspectJ library for fault tolerance
Categories
Research

Relational aspects as tracematches (and "relational tracematches")

Eric | November 1, 2007

Different storage structure of association aspects, the relationship aspects library and relational aspects (our own approach)The relationships between objects in object-oriented applications are an essential property of the program’s design and implementation. Two previous approaches to implement relationships with aspects were association aspects, an AspectJ-based language extension, and the relationship aspects library. While those approaches greatly ease software development, we believe that they are not general enough. For instance, the library approach only works for binary relations, while the language extension does not allow for the association of primitive values or values from non-weavable classes.

Hence, in our work we proposed a generalized alternative implementation via a direct reduction to tracematches, a language feature for executing an advice after having matched a sequence of events.

This new implementation scheme yields multiple benefits. Firstly, our implementation is more general than existing ones, avoiding most previous limitations. It also yields a new language construct, relational tracematches.

Read the rest of this entry »

Comments
Comments Off on Relational aspects as tracematches (and "relational tracematches")
Categories
Research

Generate clone() dialog in Eclipse

Eric | November 1, 2007

Generate clone() dialog in EclipseEver had to deal with cloning of object structures in Java? As my study showed, there is actually a lot that can go wrong with this and many people do get it wrong all the time. Hence, why not have a plugin for Eclipse that helps you generate clone() methods semi-automatically? I have written exactly such a plugin. It first of all detects four different code smells with respect to cloning and in addition offers you to correct those smells by generating a correct implementation of clone().

Download the plugin here. It works with Eclipse 3.2 and later. My presentation slides show how it can be used.

I am currently discussion integration of this plugin into the main Eclipse build stream. If you support this idea, you might want to vote for it here and here.

Comments
Comments Off on Generate clone() dialog in Eclipse
Categories
Research

Identify the Champion

Eric | October 29, 2007

I just read again through Identify the Champion by Oscar Nierstrasz. I have read it before but I just got a paper rejected so I thought I read it again 😉 The paper describes a pattern language for organizing a program committee meeting. What’s really valuable about the document is the fact that this pattern language has become something like the de facto standard in the field of Computer Science. As far as I can tell, all important conferences I submit to (OOPSLA, ECOOP, POPL, PLDI, …) use it for their review process now. You might like that or not. The point is that you have to cope with it and hence you should make sure to know how it works. The advise is already in the paper: Identify the champion! In the paper this is addressed to the program chair. It’s his task to identify persons who will be likely to “champion” a paper, i.e. stand up for it and fight for it to be accepted. In my opinion however, the challenge equally holds for people who submit to the conference. The unfortunate fact of “Identify the champion” is that your paper is not going to make it if there is nobody championing it. Hence, you as an author have to identify your champion as well! If you know people in the program committee and if you know that there is at least somebody of them who cares, write the paper for that person! In my opinion that makes it more likely to get your paper accepted. (I will tell you if it works after the notification deadline 😉 .)

Comments
Comments Off on Identify the Champion
Categories
Research

OOPSLA 2007 Podcast

Eric | October 28, 2007

Quick note: The OOPSLA 2007 Keynotes are now available as Podcasts!

Comments
Comments Off on OOPSLA 2007 Podcast
Categories
Research