Bug 24567 - problem with hierarchy in working copy
Summary: problem with hierarchy in working copy
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 24522 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-09 09:24 EDT by Martin Aeschlimann CLA
Modified: 2002-10-11 11:40 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2002-10-09 09:24:47 EDT
see bug 3248:
Fixed but can't relase due to the mentioned hierarchy problem. 
Jerome, can you have a look at it? My fix for the NewTypeWizardPage is attached 
here. Attachment 2129 [details]
Replace the existing code from HEAD or 20021009 with this one.
- Set a breakpoint in createInheritedMethods at
   ITypeHierarchy hierarchy= type.newSupertypeHierarchy(monitor);
- Create a new class in the wizard, add e.g. 'MouseListener' as interface, 
check 'inherited abstract methods'
- The type passed in createInheritedMethods is from a woking copy which is 
complete (type + superinterfaces + import)
The original CU only contains a package statement. I suspect that this causes 
the problem.

see also bug 24522
Comment 1 Philipe Mulet CLA 2002-10-09 09:30:19 EDT
Pls investigate. 
Comment 2 Jerome Lanneluc CLA 2002-10-11 06:02:11 EDT
The contents of the working copy at this point is:
/**
 * @author jeromel
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class A implements MouseListener{

}

Note there are no imports, thus MouseListener cannot be resolved.

Martin, please confirm this is a problem on your side.
Comment 3 Martin Aeschlimann CLA 2002-10-11 07:45:56 EDT
I was sure the import was there. Will look again.
Comment 4 Martin Aeschlimann CLA 2002-10-11 07:52:51 EDT
I just checked. The import is there.
(20021008 + head jdt-ui + jcore update 10/09

- I replace NewTypeWizardPage with the one in the attachment (package statement 
is missing, sorry)
- Set a breakpoint in createInheritedMethods
- create class AX in default package, interface: MouseListener
- breakpoint reached, in display view:
display 'hierarchy.getSuperInterfaces(type)'
	 (org.eclipse.jdt.core.IType[]) []

display 'type.getCompilationUnit().getSource()'
	 (java.lang.String) package pack1;

import java.awt.event.MouseListener;

/**
 * @author maeschlimann
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class AX implements MouseListener{

}
Comment 5 Jerome Lanneluc CLA 2002-10-11 09:16:42 EDT
I can see the import now. But the working copy is not consistent:
'type.getCompilationUnit().isConsistent()' returns false.
You need to reconcile it after you updated its buffer.
I did 'type.getCompilationUnit().reconcile()' in the debugger, and after that 
the hierarchy was correct.
Comment 6 Jerome Lanneluc CLA 2002-10-11 09:21:54 EDT
*** Bug 24522 has been marked as a duplicate of this bug. ***
Comment 7 Martin Aeschlimann CLA 2002-10-11 09:39:00 EDT
that's it. added the reconcile, works now!
thanks a lot! ok to close.
Comment 8 Jerome Lanneluc CLA 2002-10-11 11:40:22 EDT
Closing