Community
Participate
Working Groups
From the forum: http://www.eclipse.org/forums/index.php?t=msg&goto=534694&#msg_534694 ========================= i have an aspect with an inter-type declaration, which looks like this: package de.wieger.domaindriven.sample; <lots of unused imports> privileged aspect Person_ITD { Person.new(PersonBuilder pBuilder) { this(); } } If i invoke "Organize Imports" in eclipse, i get the following error: "Compilation unit has parse errors: Constructor call must be the first statement in a constructor". I'm using AJDT 2.0.2. It looks like this is a bug. Is anybody else experiencing this? Should i file a bug for this in bugzilla? From my prospective, it seems like the method AjOrganizeImportsOperation#collectReferences is a little bit too strict about what should be considered as a relevant parsing error. I have seen, that AjCompilationUnitProblemFinder filters a lot of problems like the one causing trouble when invoking "organize imports" out. There is an explicit snippet, dealing with my problem: if (numArgs == 0 && id == IProblem.InvalidExplicitConstructorCall) { // ITD constructor making explicit this() call. // lots of potential for false negatives return false; } Maybe this could indicate the direction for a fix? What do you think?
The fix described here is the way to go. I have implemented a fix such that the AJCompilationUnitProblemFinder is queried in order to determine if the problem that is found is one that can be ignored. This appears to work, but unfortunately, there are no tests in this area...
Fixed and committed.