google-code-export / google-plugin-for-eclipse

Automatically exported from code.google.com/p/google-plugin-for-eclipse
Eclipse Public License 1.0
2 stars 0 forks source link

Participants fail when renaming a member and the corresponding getter/setter #189

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a Java class with a field (ex.: foo) and a getter (ex.: getFoo())
2. select the foo member and hit Alt+Shift+R+R, so that the Rename Field dialog 
appears
3. in the "New name:" text field type bar and ensure the checkbox "Rename 
getter: 'getFoo' to 'getBar'" is checked
4. confirm the renaming

What is the expected output? What do you see instead?
I expect the refactoring to be performed without problems.

Instead, the first time I try to do that I get the preview of the Rename Field 
dialog saying:
- The participant 'Rename member in JSNI blocks' has caused a problem and has 
been removed from the system. See the error log for more details.
- The participant 'Rename a method in a GWT RPC paired interface' has caused a 
problem and has been removed from the system. See the error log for more 
details.

If I hit "Continue" the refactoring is completed. From the second time on, the 
error message does not show any more, since the refactoring participants have 
been remove, but their contribution is obviously not performed on the 
refactoring operation.

This is what I see in the error log:

eclipse.buildId=M20130204-1200
java.version=1.7.0_17
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=it_IT
Framework arguments:  -groovy.compiler.level 18
Command-line arguments:  -os win32 -ws win32 -arch x86_64 
-groovy.compiler.level 18 -data d:\ws\42\k-trunk-fpc

Error
Fri Apr 19 10:10:36 CEST 2013
Participant 
'com.google.gwt.eclipse.core.refactoring.renameMemberInJsniParticipant' removed 
due to the following exception

java.lang.ClassCastException: org.eclipse.jdt.internal.core.SourceField cannot 
be cast to org.eclipse.jdt.core.IMethod
    at com.google.gwt.eclipse.core.refactoring.GWTRenameParticipant.initialize(GWTRenameParticipant.java:114)
    at com.google.gwt.eclipse.core.refactoring.GWTRenameMemberParticipant.initialize(GWTRenameMemberParticipant.java:36)
    at org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant.initialize(RefactoringParticipant.java:105)
    at org.eclipse.ltk.core.refactoring.participants.ParticipantExtensionPoint.getParticipants(ParticipantExtensionPoint.java:100)
    at org.eclipse.ltk.core.refactoring.participants.ParticipantManager.loadRenameParticipants(ParticipantManager.java:74)
    at org.eclipse.jdt.internal.corext.refactoring.rename.RenameModifications.loadParticipants(RenameModifications.java:193)
    at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.loadParticipants(JavaRenameProcessor.java:41)
    at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:233)
    at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:162)
    at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:80)
    at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
    at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5204)
    at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

and:

eclipse.buildId=M20130204-1200
java.version=1.7.0_17
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=it_IT
Framework arguments:  -groovy.compiler.level 18
Command-line arguments:  -os win32 -ws win32 -arch x86_64 
-groovy.compiler.level 18 -data d:\ws\42\k-trunk-fpc

Error
Fri Apr 19 10:10:36 CEST 2013
Participant 
'com.google.gwt.eclipse.core.refactoring.rpc.pairedMethodRenameParticipant' 
removed due to the following exception

java.lang.ClassCastException: org.eclipse.jdt.internal.core.SourceField cannot 
be cast to org.eclipse.jdt.core.IMethod
    at com.google.gwt.eclipse.core.refactoring.GWTRenameParticipant.initialize(GWTRenameParticipant.java:114)
    at com.google.gwt.eclipse.core.refactoring.GWTRenameMemberParticipant.initialize(GWTRenameMemberParticipant.java:36)
    at com.google.gwt.eclipse.core.refactoring.rpc.PairedMethodRenameParticipant.initialize(PairedMethodRenameParticipant.java:222)
    at org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant.initialize(RefactoringParticipant.java:105)
    at org.eclipse.ltk.core.refactoring.participants.ParticipantExtensionPoint.getParticipants(ParticipantExtensionPoint.java:100)
    at org.eclipse.ltk.core.refactoring.participants.ParticipantManager.loadRenameParticipants(ParticipantManager.java:74)
    at org.eclipse.jdt.internal.corext.refactoring.rename.RenameModifications.loadParticipants(RenameModifications.java:193)
    at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.loadParticipants(JavaRenameProcessor.java:41)
    at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:233)
    at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:162)
    at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:80)
    at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
    at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5204)
    at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

What version of the product are you using? On what operating system?
Google Plugin for Eclipse 4.2 version 3.2.2.v201303261859-rel-r42 on Windows 7 
64-bit.
This error has been present in GPE for a very long time.

Please provide any additional information below.

The error appears even for non-GWT projects (i.e.: plain Java projects with no 
GPE features enabled on them).

Original issue reported on code.google.com by mauro...@tiscali.it on 19 Apr 2013 at 8:25