Community
Participate
Working Groups
The JDT doesn't report a recursive constructor invocation, whereas javac does. I'm couldn't find any reference in the java language specs saying such a definition is truly illegal, but it's clearly not a good thing to do. I think that JDT should report it as an error (it's never going to work :-))
We have to report these errors. On following test case, I get 2 errors: Kind Status Priority Description Resource In Folder Location Error Recursive constructor invocation RC() RC.java Crap/src line 4 in RC.RC(int) Error Recursive constructor invocation RC(int) RC.java Crap/src line 7 in RC.RC() public class RC { RC(int i){ this(); } RC(){ this(0); } } Can you provide a test case reproducing what you see ?
Sure can. I should have initially, but I thought it was a simple case (obviously it's not, and I apologize for assuming you guys had missed something simple). It appears to be when the constructor would recurse to itself, but there's another constructor with the same number of args or something like that. Test case below: public class TestEclipseBug { private Object root; private Number count; public TestEclipseBug(Class rootClass) { this(rootClass, null); } public TestEclipseBug(Class rootClass, Number count) { this.root=rootClass; this.count=count; } public TestEclipseBug(String objEntityName) { this(objEntityName); } public TestEclipseBug(String aName, Number count) { this.root=aName; this.count=count; } }
Indeed, we have a problem. 3rd constructor should be blamed.
Fixed in latest
Verified.