Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342074

Summary: [move method] Refactor->Move an instance method to another causes IAE in SimpleName.setIdentifier
Product: [Eclipse Project] JDT Reporter: Chris Leon <chris.leon>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.6.2   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Stack trace
none
Fix none

Description Chris Leon CLA 2011-04-06 16:13:13 EDT
Build Identifier: M20110210-1200

I want to move some functionality of class A to a new composing class B.  I created a new class B, which has nothing in it.  I change A.method() to take a B as a parameter, so that I can use the instance method Move refactoring to move method() to B.  That fails with a NullPointerException, in the attached stack trace.

Reproducible: Always

Steps to Reproduce:
I tried to create a new set of classes that demonstrate this problem, but haven't been able to find whatever makes this refactoring fail in this case.  I can however reproduce it every time with my code, but confidentiality prohibits my posting that code here.
Comment 1 Chris Leon CLA 2011-04-06 16:14:20 EDT
Created attachment 192667 [details]
Stack trace
Comment 2 Chris Leon CLA 2011-04-06 16:17:56 EDT
I checked 328554 and 328786 which seemed similar, but this stack trace is different so I assume the underlying cause is new.
Comment 3 Dani Megert CLA 2011-04-07 02:23:45 EDT
Just to clarify: you do this in the Java editor, right?
Comment 4 Chris Leon CLA 2011-04-07 09:11:31 EDT
(In reply to comment #3)
> Just to clarify: you do this in the Java editor, right?

That's correct.  Refactor menu -> Move.  Select the object I want to move the method to, and hit either preview or OK, then get the error.
Comment 5 Markus Keller CLA 2011-04-07 10:01:51 EDT
Snippet to reproduce (move A#foo(B) to B):

package p;
import com.example.Outer.Inner;
public class A {
	public void foo(B b) {
		Inner<String> i;
	}
}

package p;
public class B {
}

package com.example;
public class Outer {
	public static class Inner<E> {}
}
Comment 6 Markus Keller CLA 2011-04-07 13:52:24 EDT
Created attachment 192766 [details]
Fix
Comment 7 Markus Keller CLA 2011-04-07 13:53:02 EDT
Fixed in HEAD.