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

Bug 428808

Summary: [1.8][change method signature] IllegalArgumentException while editing the method parameter
Product: [Eclipse Project] JDT Reporter: Martin Mathew <manju656>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta
Version: 4.4   
Target Milestone: BETA J8   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Martin Mathew CLA 2014-02-21 17:22:02 EST
Consider the below code snippet:
package p1;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

public class Snippet {
	public void foo(java.io.@NonNull FileNotFoundException arg)
				throws java.io.@NonNull EOFException {
	}
}

@Target(ElementType.TYPE_USE)
@interface NonNull {
}

Invoke "Alt+Shift+C" on #foo to invoke the "Change method signature".
In the dialog select the parameter and click Edit button
Replace the Type field with "java.io.@NonNull FileNotFoundException", press OK
Click Preview or OK, the exception is thrown.

Caused by: java.lang.IllegalArgumentException: java.io.@NonNull FileNotFoundException
	at org.eclipse.jdt.core.Signature.createCharArrayTypeSignature(Signature.java:1077)
	at org.eclipse.jdt.core.Signature.createTypeSignature(Signature.java:1236)
	at org.eclipse.jdt.core.Signature.createTypeSignature(Signature.java:1264)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor.getParticipantArguments(ChangeSignatureProcessor.java:1229)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor.loadParticipants(ChangeSignatureProcessor.java:2826)
	at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:233)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:85)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:121)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 1 Noopur Gupta CLA 2014-02-26 02:02:00 EST
I pasted the example given in comment #0 inside a Java 1.8 project that already had some existing packages and compilation units. Following the given steps, I got the following exception:

java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:422)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:331)
...
...
Caused by: java.lang.ClassCastException: org.eclipse.jdt.internal.core.ResolvedSourceField cannot be cast to org.eclipse.jdt.core.IMethod
	at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2$1MethodRequestor.acceptSearchMatch(RippleMethodFinder2.java:337)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.report(MatchLocator.java:1958)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2273)
	at org.eclipse.jdt.internal.core.search.matching.MemberDeclarationVisitor.visit(MemberDeclarationVisitor.java:213)
	at org.eclipse.jdt.internal.compiler.ast.LambdaExpression.traverse(LambdaExpression.java:632)
	at org.eclipse.jdt.internal.compiler.ast.FieldDeclaration.traverse(FieldDeclaration.java:343)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2637)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2870)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:2597)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:1810)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1219)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1260)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1392)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:122)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:232)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:516)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:584)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.findAllDeclarations(RippleMethodFinder2.java:356)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.findAllRippleMethods(RippleMethodFinder2.java:187)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.getAllRippleMethods(RippleMethodFinder2.java:168)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.getRelatedMethods(RippleMethodFinder2.java:161)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor.checkFinalConditions(ChangeSignatureProcessor.java:830)
	at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:224)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:85)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:121)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2333)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Comment 2 Martin Mathew CLA 2014-02-26 02:57:02 EST
I still get IAE when following the step in comment 0.  Check bug 400905 comment 19, similar CCE is reported.
Comment 3 Eclipse Genie CLA 2020-03-04 05:26:52 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.