From the Java Language Specification, section 15.9.5.1:
An anonymous class cannot have an explicitly declared constructor.
Sorry :(
As an option, you can build some final local variables, and/or add an instance initializer in the anonymous class. For example:
public class Test {
public static void main(String[] args) throws Exception {
final int fakeConstructorArg = 10;
Object a = new Object() {
{
System.out.println("arg = " + fakeConstructorArg);
}
};
}
}
It's grotty, but it might just assist you. Alternatively, use a peculiar nested class :)