Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342074 - [move method] Refactor->Move an instance method to another causes IAE in SimpleName.setIdentifier
Summary: [move method] Refactor->Move an instance method to another causes IAE in Simp...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-06 16:13 EDT by Chris Leon CLA
Modified: 2011-04-07 13:53 EDT (History)
2 users (show)

See Also:


Attachments
Stack trace (11.10 KB, text/plain)
2011-04-06 16:14 EDT, Chris Leon CLA
no flags Details
Fix (2.95 KB, patch)
2011-04-07 13:52 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.