Bug 21924

Summary: createMethod on inner class puts method in outer class
Product: [Eclipse Project] JDT Reporter: Richard Kulp <richkulp>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Richard Kulp CLA 2002-07-25 18:40:46 EDT
If you do a create method on an inner class, the method in the text is actually 
added to the outer class, though the model thinks it is in the inner class.

Take class:

public class TestChangesClass {
	public static class InnerTestChangesClass {
	}
}

and do:

IType type = jProject.findType("TestChangesClass.InnerTestChangesClass"); 
type.createMethod("public boolean isNew() {}", null, true, monitor); 

and the saved text file becomes:

public class TestChangesClass {
	public static class InnerTestChangesClass {
	}

public boolean isNew() {}}

But, if you go against the IType type right after you did the create, "isNew" 
will be a method within the inner class.

Thanks,
Rich Kulp
Comment 1 Richard Kulp CLA 2002-07-25 18:49:21 EDT
Never mind, I just saw what I did wrong. Everything is correct.
Comment 2 Philipe Mulet CLA 2002-07-26 06:17:24 EDT
What was it ?
Comment 3 Richard Kulp CLA 2002-07-26 14:57:19 EDT
Really stupid! :-) I was looking at the wrong class. I had two classes that 
were almost identical and I didn't notice the name was slightly different!