This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 225195 - ClassCastException: org.netbeans.modules.javascript2.editor.model.impl.JsObjectImpl cannot be cast to org.netbeans.modules.javascript2.editor.model.DeclarationScope
Summary: ClassCastException: org.netbeans.modules.javascript2.editor.model.impl.JsObje...
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-22 16:32 UTC by spookee
Modified: 2013-02-04 16:04 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 197143


Attachments
stacktrace (4.91 KB, text/plain)
2013-01-22 16:32 UTC, spookee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spookee 2013-01-22 16:32:19 UTC
Build: NetBeans IDE Dev (Build 201301180001)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.12-b01-434, Java(TM) SE Runtime Environment, 1.6.0_37-b06-434-11M3909
OS: Mac OS X

User Comments:
al_shopov: Initial import of a maven project




Stacktrace: 
java.lang.ClassCastException: org.netbeans.modules.javascript2.editor.model.impl.JsObjectImpl cannot be cast to org.netbeans.modules.javascript2.editor.model.DeclarationScope
   at org.netbeans.modules.javascript2.editor.model.impl.JsObjectImpl.resolveTypes(JsObjectImpl.java:346)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:123)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:126)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:126)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:126)
   at org.netbeans.modules.javascript2.editor.model.Model.getModelVisitor(Model.java:89)
Comment 1 spookee 2013-01-22 16:32:22 UTC
Created attachment 130496 [details]
stacktrace
Comment 2 Exceptions Reporter 2013-01-23 20:34:43 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=197143
Comment 3 Marian Mirilovic 2013-01-24 15:33:30 UTC
22 dups in 3 weeks, please evaluate ASAP
Comment 4 Petr Hejl 2013-01-24 16:29:18 UTC
Reporters can you provide a js file where this is reproducible?

This has been introduced in fix for issue #224215.
Comment 5 Petr Pisl 2013-01-28 13:05:59 UTC
The file, where we can reproduce it, would be very helpful. I'm going to fix it without the reproducible case, but it would be better to have it. It is interesting how it is possible that the global object in our model is not a function.
Comment 6 Petr Pisl 2013-01-28 13:54:36 UTC
Simple fix is committed in the web-main. 
http://hg.netbeans.org/web-main/rev/4d6743222872

Petr Hejl, could you please review the fix?

It's simple. The types are not resolved, when global object is not a DeclarationScope. 

Still it would be nice to have the reproducible test case.
Comment 7 Petr Hejl 2013-01-28 14:55:00 UTC
The fix seems to be ok and safe.
Comment 8 Vladimir Riha 2013-01-28 15:45:18 UTC
I tried some simple editing in more complex JS file, code completion, go to sources, refactoring etc. seems OK, no issue found + fix looks safe 

=> verified in trunk


Product Version: NetBeans IDE Dev (Build web-main-9758-on-20130128)
Java: 1.7.0_11; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_11-b21
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 9 Petr Pisl 2013-01-29 10:50:46 UTC
The patch was tranplanted to the releases. 
http://hg.netbeans.org/releases/rev/1a5961f05895
Comment 10 Vladimir Riha 2013-02-04 16:04:49 UTC
Unable to reproduce in RC2 => verified

Product Version: NetBeans IDE 7.3 RC2 (Build 201302032200)
Java: 1.7.0_13; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_13-b20
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)