Bug 252920 - [rename] Internal error when trying to rename a method: Java Model Status [1.0.com.sun.tools.xjc.generator.util [in C:\work\glassfish\lib\webservices-tools.jar] does not exist
Summary: [rename] Internal error when trying to rename a method: Java Model Status [1...
Status: CLOSED DUPLICATE of bug 293861
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-30 23:45 EDT by Dobes Vandermeer CLA
Modified: 2009-11-02 05:11 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dobes Vandermeer CLA 2008-10-30 23:45:15 EDT
Build ID: M20080911-1700

Steps To Reproduce:
In my workspace I am no longer able to perform refactorings and I'm pretty confused about why.  Here's the error from the log:

eclipse.buildId=M20080911-1700
java.version=1.6.0_10-rc
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_CA
Command-line arguments:  -os win32 -ws win32 -arch x86 -clean


Error
Thu Oct 30 20:39:15 PDT 2008
Internal Error

java.lang.reflect.InvocationTargetException
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:96)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: Java Model Exception: Java Model Status [1.0.com.sun.tools.xjc.generator.util [in C:\work\glassfish\lib\webservices-tools.jar] does not exist]
at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:501)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:245)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:503)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:239)
at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:107)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:514)
at org.eclipse.jdt.internal.core.BinaryType.getElementInfo(BinaryType.java:264)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:237)
at org.eclipse.jdt.internal.core.BinaryType.isInterface(BinaryType.java:701)
at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.findAllRippleMethods(RippleMethodFinder2.java:241)
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.rename.RenameMethodProcessor.initializeMethodsToRename(RenameMethodProcessor.java:235)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.doCheckFinalConditions(RenameMethodProcessor.java:363)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor.doCheckFinalConditions(RenameVirtualMethodProcessor.java:143)
at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45)
at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225)
at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160)
at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:77)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4650)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:92)
... 1 more
Root exception:
Java Model Exception: Java Model Status [1.0.com.sun.tools.xjc.generator.util [in C:\work\glassfish\lib\webservices-tools.jar] does not exist]
at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:501)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:245)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:503)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:239)
at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:107)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:514)
at org.eclipse.jdt.internal.core.BinaryType.getElementInfo(BinaryType.java:264)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:237)
at org.eclipse.jdt.internal.core.BinaryType.isInterface(BinaryType.java:701)
at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.findAllRippleMethods(RippleMethodFinder2.java:241)
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.rename.RenameMethodProcessor.initializeMethodsToRename(RenameMethodProcessor.java:235)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.doCheckFinalConditions(RenameMethodProcessor.java:363)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor.doCheckFinalConditions(RenameVirtualMethodProcessor.java:143)
at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45)
at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225)
at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160)
at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:77)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4650)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:92)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

If you can give me some clues as to how this error could be triggered that would be nice, so I can figure out a work-around or temporary fix.

Ideally this error would be handled more gracefully.





More information:
Comment 1 Dobes Vandermeer CLA 2008-10-31 00:06:07 EDT
Removing glassfish from the classpath seems to resolve this, at least temporarily.  Not sure how to reproduce it.

Comment 2 Olivier Thomann CLA 2008-11-04 15:30:15 EST
Moving to JDT/UI
Comment 3 Markus Keller CLA 2008-11-06 07:18:18 EST
It looks like your workspace was out of sync with the file system, because C:\work\glassfish\lib\webservices-tools.jar could not be found.

Did you touch the affected JAR in the Windows Explorer? How did you initially add it to the classpath?
Comment 4 Dobes Vandermeer CLA 2008-11-06 16:07:31 EST
This file is not in any project in the workspace; it was added automatically to the class path by the Web Tools Platform as part of the GlassFish libraries.  This happens when I associate a web project with the glassfish "runtime".

I had in fact updated that jar (but not deleted it) outside of eclipse.

Restarting eclipse was not enough to refresh that resource, I guess - but I really have no idea what I could do to refresh it since it's not in any project.

In this case, I suppose the only way to "refresh" that resource was to delete and re-add the glassfish runtime to eclipse.

It seems like a bug to me that the refactoring engine requires that all jars are up-to-date; perhaps it could show a warning and continue.

It also seems like a bug to me that this jar was not automatically updated since I do have "refresh automatically" enabled for that workspace.  The "refresh automatically" feature doesn't work very well for me, though - I often have to refresh manually anyway, so maybe something is wrong with my automatic refreshing.


Comment 5 Dani Megert CLA 2008-11-13 07:18:20 EST
I can reproduce using 3.4 and I20081111-0800:

1. create a JAR with ClassInJAR.doIt()
2. add it to the build path as external JAR
3. paste following source:
public class Source extends ClassInJAR {
	public void doIt() {
		super.doIt();
	}
}
4. replace the JAR with something that doesn't contain that method
5. do a lightweight (no dialog) rename refactoring of Source.doIt() inside the 
   editor

Note that when doing the refactoring via dialog the problem doesn't happen as we do more checks.

>Restarting eclipse was not enough to refresh that resource,
I cannot reproduce this i.e. it does refresh the JAR for me.

Refresh (F5) works for me if I do it on the Package Explorer. It does not work if executed in the Project Explorer or Navigator (see bug 255162 for details).
Comment 6 Jochen Stiepel CLA 2009-04-21 14:10:48 EDT
I get the same error during renaming. but only in some eclipse projects.
The jar 'jaxb-xjc.jar' exists I checked it on the filesystem and the content seams's to look ok.

java.lang.reflect.InvocationTargetException
	at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:96)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: Java Model Exception: Java Model Status [1.0.com.sun.xml.xsom [in D:\lib\jaxb\2.0.5\jaxb-xjc.jar] does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:501)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:245)
	at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:503)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:239)
	at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:107)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:514)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:251)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:237)
	at org.eclipse.jdt.internal.core.BinaryMethod.getFlags(BinaryMethod.java:113)
	at org.eclipse.jdt.internal.corext.util.JavaModelUtil.isVisibleInHierarchy(JavaModelUtil.java:240)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.uniteWithSupertypes(RippleMethodFinder2.java:406)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.createUnionFind(RippleMethodFinder2.java:383)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.findAllRippleMethods(RippleMethodFinder2.java:195)
	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.rename.RenameMethodProcessor.initializeMethodsToRename(RenameMethodProcessor.java:235)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.doCheckFinalConditions(RenameMethodProcessor.java:363)
	at org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor.doCheckFinalConditions(RenameVirtualMethodProcessor.java:143)
	at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45)
	at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225)
	at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160)
	at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:77)
	at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:716)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4563)
	at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:92)
	... 1 more

eclipse.buildId=M20090211-1700
java.version=1.6.0_13
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -showlocation
Command-line arguments:  -os win32 -ws win32 -arch x86 -showlocation


Comment 7 Markus Keller CLA 2009-04-21 14:30:16 EDT
(In reply to comment #6)
> I get the same error during renaming. but only in some eclipse projects.
> The jar 'jaxb-xjc.jar' exists I checked it on the filesystem and the content
> seams's to look ok.

It could still be out of sync with the workspace resource model. Did you select the affected projects in the Package Explorer and then choose 'File > Refresh'? You can also select nothing and then do 'File > Refresh' to refresh the whole workspace.
Comment 8 Jochen Stiepel CLA 2009-04-21 16:43:33 EDT
I refresh the complete workspace and made a "clean all projects", but still I can't rename the method.

The method is:
    /**
     * @return String
     */
    @Field(offset = 510, length = 5, align = Align.LEFT, paddingChar = ' ')
    public String getType()
    {
    	return type;
    }
The annotation '@Field' is of the jar fixedformat4j (http://fixedformat4j.ancientprogramming.com/) Eclipse uses Java 1.6 and the workspace projects use Java 1.5.0_18 to compile the java source files.

The next method in the same class called getNumber() works fine to rename! The only difference I can see is the name getType or getNumber.
    /**
     * @return String
     */
    @Field(offset = 515, length = 30, align = Align.LEFT, paddingChar = ' ')
    public String getNumber_jochen()
    {
        return number;
    }

Can I provide more information? log's? debug output?
Comment 9 Jochen Stiepel CLA 2009-04-21 16:45:00 EDT
As you can see I renamed the methode from 'getNumber()' to 'getNumber_jochen()'.
Comment 10 Dani Megert CLA 2009-04-22 02:25:12 EDT
>The jar 'jaxb-xjc.jar' exists I checked it on the filesystem and the content
>seams's to look ok.
Is it only used in one or more projects? If it's on more than one: is it the identical one?

Would it be possible to strip down the workspace, so that you attach it here? 
Otherwise there's not much we can do.
Comment 11 Jochen Stiepel CLA 2009-04-23 03:55:07 EDT
I tried to create an example workspace, but that is not that easy - the problem goes away.
What I found also out is, that there is a relation - in my case - with the name of the method.

1. Rename from getType() to getType_new() with refactor doesn't work.

2. Rename from getType() to getType_new2() manually works of course.
   Then Rename getType_new2() with refactor to getType() works!
   Then Rename getType() to getType_new3() doesn't work!

Maybe this info help's.

Comment 12 Dani Megert CLA 2009-11-02 05:11:30 EST
Marking as dup of bug 293861 which has a test case.

*** This bug has been marked as a duplicate of bug 293861 ***