| Summary: | "Organize Imports" on inter-type constructor declaration with this() in body complains "Compilation unit has parse errors" | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] AJDT | Reporter: | Thomas Wieger <thomas.wieger> | ||||
| Component: | UI | Assignee: | AJDT-inbox <AJDT-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | andrew.eisenberg | ||||
| Version: | 2.0.2 | ||||||
| Target Milestone: | 2.1.0 | ||||||
| Hardware: | Macintosh | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Fix is available in the latest dev build. Thanks for the sample project. fixed. |
Created attachment 169412 [details] mini project with problematic inter-type constructor declaration i have an aspect with an inter-type declaration, which looks like this: package de.wieger.sample; public aspect Person_ITD { public Person.new() { this(); // intentionally left blank } } When 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". 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#isARealProblem filters out a lot of problems like the one causing trouble when invoking "organize imports". The method conains an explicit snippet, dealing with the problematic syntactic construct: 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? I have attached an archive with a mini project containing the source code, which demonstrates the problem when invoking "organize imports" on the inter-type declaration. regards, Thomas Wieger