This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Consider the application of Convert Anonymous to Inner to the two instantiations of Foo in the following code: public class Test { class Foo { Foo(int n) { } } { new Foo(Math.abs(-5)) { }; } { int n = -2; new Foo(Math.abs(n) + 3) { }; } } I suggest that converting the first anonymous class should result in: { new FooImpl(); } private class FooImpl extends Test.Foo { private FooImpl() { super(Math.abs(-5)); } } That is, constructor argument expressions which do not depend on the local or inner-class context should be moved into the generated constructor. In the second instantiation of Foo above, the constructor argument expression does depend on a local context ("n" is a local variable), so either keep the expression as-is: { int n = -2; new FooImpl(Math.abs(n) + 3) { }; } private class FooImpl extends Test.Foo { private FooImpl(int n) { super(n); } } Or alternatively, only retain dependant sub-expressions in the instantiation expression: { int n = -2; new FooImpl(n) { }; } private class FooImpl extends Test.Foo { private FooImpl(int n) { super(Math.abs(n) + 3); } } The main point is, that for the typical case of a constant expression or literal argument (e.g. "new Foo(5)"), the expression should be placed in the generated constructor rather than introducting redundant constructor parameters in the generated class. In other words, translate the original argument list directly into the argument list of the super constructor call (which must be generated anyway). The other cases are just generalizations of this.