Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355935 - ClassCastException during Import-Linking while editing big xtend-files with many imports
Summary: ClassCastException during Import-Linking while editing big xtend-files with m...
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-26 07:15 EDT by Florian Quadt CLA
Modified: 2017-09-19 17:36 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Quadt CLA 2011-08-26 07:15:46 EDT
Build Identifier: I20110603-0909

while editing files with many imports a ClassCastException occurs if linking is triggered. It seems to be dependent on import resolution (this is at least what I understand from stacktrace). It is unclear which cast causes this exception because the WrappedException don't give further information about the class (don't print the error message of ClassCastException).

Sadly, I was unable to identify if a specific import causes this error.
Once the error occurs I am unable to edit the file. Even element deletion and copy causes this error.

It seems that one of the casts from a EcoreUtil.getAllContents(...) to a specific type is the cause.

It would be nice to make these casts typesafe and add the error message to the wrapper exception.

Best Regards,

Florian Quadt

additional build info:
- happens sometimes in 2.0.1
- happens a lot in Nightly 2.0.1.v201108151710 for big files at some point
- I cannot check newer versions because of other issues

--------------
stacktrace:
--------------
org.eclipse.xtext.linking.lazy.LazyLinkingResource  - resolution of uriFragment 'xtextLink_::0.1.6.12.4.0.0.6.0.1.6::0::/2' failed.
java.lang.ClassCastException
.
An internal error occurred during: "Updating editor state".
org.eclipse.emf.common.util.WrappedException: java.lang.ClassCastException
 at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:206)
 at org.eclipse.xtext.xtend2.resource.Xtend2Resource.getEObject(Xtend2Resource.java:75)
 at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReference(LazyLinkingResource.java:143)
 at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReferences(LazyLinkingResource.java:104)
 at org.eclipse.xtext.EcoreUtil2.resolveLazyCrossReferences(EcoreUtil2.java:435)
 at org.eclipse.xtext.resource.impl.DefaultResourceDescription.getImportedNames(DefaultResourceDescription.java:95)
 at org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager.getImportedNames(DefaultResourceDescriptionManager.java:99)
 at org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager.isAffected(DefaultResourceDescriptionManager.java:95)
 at org.eclipse.xtext.ui.editor.DirtyStateEditorSupport.isReparseRequired(DirtyStateEditorSupport.java:425)
 at org.eclipse.xtext.ui.editor.DirtyStateEditorSupport$UpdateEditorStateJob$1.exec(DirtyStateEditorSupport.java:124)
 at org.eclipse.xtext.ui.editor.DirtyStateEditorSupport$UpdateEditorStateJob$1.exec(DirtyStateEditorSupport.java:1)
 at org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces.readOnly(AbstractReadWriteAcces.java:32)
 at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:86)
 at org.eclipse.xtext.ui.editor.DirtyStateEditorSupport$UpdateEditorStateJob.run(DirtyStateEditorSupport.java:117)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.ClassCastException

Reproducible: Sometimes

Steps to Reproduce:
I have no idea how to reproduce this error. It occurs on some xtend files, but they have nothing in common, except long lists of imports
1. create a xtend-file 
2. add some import statement (xtend and java)
3. edit the file
Comment 1 Sebastian Zarnekow CLA 2011-08-26 07:17:57 EDT
Did you truncate the stacktrace?
Comment 2 Florian Quadt CLA 2011-08-26 07:57:45 EDT
(In reply to comment #1)
> Did you truncate the stacktrace?

No. That's all what I have.
While editing the file a Eclipse ErrorDialog opens that doesn't contain useful information except something like "ClassCastException". I got the stacktrace from the eclipseErrorLog and that's all I have.
Comment 3 Sebastian Zarnekow CLA 2011-08-26 08:33:13 EDT
Could you please set a breakpoint in the exception handler of LazyLinkingResource.getEObject and add the stack of the class cast exception here?
Comment 4 Florian Quadt CLA 2011-09-17 05:23:50 EDT
(In reply to comment #3)
> Could you please set a breakpoint in the exception handler of
> LazyLinkingResource.getEObject and add the stack of the class cast exception
> here?

Hi Sebastian,

since the latest stable the ClassCastException does not happen anymore.
I cannot guarantee that this is fixed, since this error only occurs infrequently.
But I hope it disappeared. So I change to "resolved fixed" and will reopen if it happens again.
Thanks for your assistance,

Florian
Comment 5 Karsten Thoms CLA 2017-09-19 17:24:21 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 6 Karsten Thoms CLA 2017-09-19 17:36:02 EDT
Closing all bugs that were set to RESOLVED before Neon.0