PUBLIC OBJECT

Burned by wildcard imports and SwingWorker

The following code uses com.publicobject.swing.SwingWorker from the Java tutorial:

package com.publicobject.demo;

import com.publicobject.swing.*;
import javax.swing.*;

public class HelloWorldWorker extends SwingWorker {
    private final JLabel label;
    public HelloWorldWorker(JLabel label) {
        this.label = label;
    }
    public Object construct() {
        return "Hello World";
    }
    public void finished() {
        label.setText((String)get());
    }
}

It compiles fine under Java 5. But in Java 6, it doesn't even compile! The problem is that the two imports conflict - there's my SwingWorker, and the one Mustang provides in its javax.swing package. If you're using SwingWorker, you should fully qualify your imports now so when Java 6 comes, you're ready.