Fixed bug 426112: [move method] NPE on moving instance method having
non-public array type argument
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test66/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test66/in/A.java
new file mode 100644
index 0000000..a637c1c
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test66/in/A.java
@@ -0,0 +1,10 @@
+class X {
+	public void foo(B [] arg, A a) { }
+}
+
+class A {
+	
+}
+class B { 
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test66/out/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test66/out/A.java
new file mode 100644
index 0000000..3f30115
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInstanceMethod/canMove/test66/out/A.java
@@ -0,0 +1,11 @@
+class X {
+}
+
+class A {
+
+	public void foo(B[] arg) { }
+	
+}
+class B { 
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java
index 8bd6974..fd0dae0 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -564,6 +564,11 @@
 		helper1(new String[] { "A" }, "A", 3, 17, 3, 18, PARAMETER, "c", false, false);
 	}
 
+	// bug 426112
+	public void test66() throws Exception {
+		helper1(new String[] { "A" }, "A", 2, 17, 2, 20, PARAMETER, "a", true, true);
+	}
+
 	// Move mA1 to field fB, do not inline delegator
 	public void test3() throws Exception {
 		helper1(new String[] { "p1.A", "p2.B", "p3.C"}, "p1.A", 9, 17, 9, 20, FIELD, "fB", false, false);
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java
index 2cf23c2..1e6f0e7 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -1008,7 +1008,7 @@
 					final AbstractTypeDeclaration declaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(type, rewrite.getRoot());
 					if (declaration != null) {
 						final ITypeBinding declaring= declaration.resolveBinding();
-						if (declaring != null && Bindings.equals(binding.getPackage(), fTarget.getType().getPackage()))
+						if (declaring != null && Bindings.equals(declaring.getPackage(), fTarget.getType().getPackage()))
 							same= true;
 						final Modifier.ModifierKeyword keyword= same ? null : Modifier.ModifierKeyword.PUBLIC_KEYWORD;
 						final String modifier= same ? RefactoringCoreMessages.MemberVisibilityAdjustor_change_visibility_default : RefactoringCoreMessages.MemberVisibilityAdjustor_change_visibility_public;