Community
Participate
Working Groups
N20050601 or JDT UI Head Steps to reproduce: - Setup attached JUnit project - Install breakpoint at row 516, method endVisit(MethodInvocation), class SuperTypeConstraintsCreator with condition "binding.getName().equals("trace");" - Invoke Extract Interface on class 'TestFailure' from the attached project, change type references to interface, selecting all 6 methods - Examine the method binding of the method invocation -> The declaring class binding of the method binding has no super interface bindings, although when the ASTs where created, the working copy owner of the refactoring has been passed. This working copy owner owns the working copy of the newly extracted interface and the original class that has been rewritten to implement the created interface. -> Only non-workingcopy compilation units are passed to ASTParser#createASTs. Since I have set the workingcopy owner before compilation, I exspect the compiler to resolve references to type 'TestFailure' to the declaration in the workingcopy, which implements the extracted interface. The Use Supertype Refactoring is also affected by this problem
Created attachment 22059 [details] project
Reproduced. Problem is in JavaModelManager#getWorkingCopies(...). We add the primary working even if a working copy for the given owner exists.
+1 for RC2
Changed JavaModelManager#getWorkingCopies(...) to not add primary working copies that have a corresponding working copy with the given owner. Added regression test BatchASTCreationTests#tes066().
Verified in N20050606-0010 + JDT/Core HEAD
Verified for 3.1 RC2 using build I20050610-0010