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 44388 - [gjast] Cannot open a java file becauses of ClassCastException from MDRParser
Summary: [gjast] Cannot open a java file becauses of ClassCastException from MDRParser
Status: CLOSED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 4.x
Hardware: PC Linux
: P1 blocker (vote)
Assignee: _ tball
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-06 22:31 UTC by _ ttran
Modified: 2007-04-03 18:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log file (20.86 KB, text/plain)
2004-06-06 22:51 UTC, _ ttran
Details
Quick-fix diff. (964 bytes, patch)
2004-06-07 01:33 UTC, Martin Matula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ ttran 2004-06-06 22:31:38 UTC
IDE built from CVS 2004-06-05

I wanted to open a java file and got this
exception.  The editor pane intended for a new
file is gray.  Switching to another editor tab
works, switching back causes this exception again.
 Will try to restart the IDE if it helps.


Annotation: Exception occurred in Request Processor
java.lang.ClassCastException:
org.netbeans.lib.gjast.ASTypeArray
	at
org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:521)
	at
org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:176)
	at
org.netbeans.modules.javacore.parser.MDRParser.resolveTypeName(MDRParser.java:1005)
	at
org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:424)
	at
org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:262)
	at
org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:347)
	at
org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:230)
	at
org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:196)
	at
org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:176)
	at
org.netbeans.modules.javacore.parser.MDRParser.enterMembers(MDRParser.java:134)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.directUpdate(ResourceImpl.java:494)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.initResource(ResourceImpl.java:329)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.initCheck(MetadataElement.java:120)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.getElementInfo(SemiPersistentElement.java:110)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.getInternalForm(SemiPersistentElement.java:462)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.getASTree(MetadataElement.java:428)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.getParser(SemiPersistentElement.java:457)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl$ErrorList.initCheck(ResourceImpl.java:1032)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl$ErrorList.size(ResourceImpl.java:1044)
	at
org.netbeans.modules.java.JavaEditor.refreshAnnotations(JavaEditor.java:378)
	at
org.netbeans.modules.java.JavaEditor.access$100(JavaEditor.java:62)
	at
org.netbeans.modules.java.JavaEditor$16.run(JavaEditor.java:1308)
	at org.openide.util.Task.run(Task.java:136)
	at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
Comment 1 _ ttran 2004-06-06 22:47:31 UTC
Restart didn't help.  I can open other java files but one java file
(the same one) refuses to open.  I shut down the IDE and delete
~/.netbeans/dev/var/cache/mdrstorage and restart the IDE.  Still
doesn't work.
Comment 2 _ ttran 2004-06-06 22:49:35 UTC
deleted the userdir.  Same exception.  I am sorry but this is P1, I
can't use the IDE.  Will attach message.log shortly
Comment 3 _ ttran 2004-06-06 22:51:16 UTC
Created attachment 15503 [details]
IDE log file
Comment 4 Martin Matula 2004-06-07 00:46:42 UTC
Please attach the problematic file. This looks like a parser bug -
there is probably a construct in your file that the gjast bridge
handles incorrectly. We have to make AST dump of that file to see
what's wrong. Thanks.
Comment 5 Martin Matula 2004-06-07 00:57:25 UTC
I think the problematic construct is a field declaration of array type
that looks e.g. as follows:
    Foo foo[];
In this case ASTypeArray represents "Foo", which is IDENTIFIER - i.e.
a token. However ASTypeArray does not implement Token interface. Tom,
could you please look at it. Thanks.
Comment 6 Martin Matula 2004-06-07 01:32:15 UTC
For some reason the bug did not occur for simple one-dimensional array
declarations like the one in my previous comments, but for
multi-dimensional array declarations when the dims were not at the
type identifier but rather behind the field identifier:

Foo field[][];

I have commited a quick-fix to ASTypeArray:
Checking in libsrc/org/netbeans/lib/gjast/ASTypeArray.java;
/nbextra/java/gjast/libsrc/org/netbeans/lib/gjast/Attic/ASTypeArray.java,v
 <--  ASTypeArray.java
new revision: 1.1.2.7; previous revision: 1.1.2.6
done

Diff is attached. 
Tom, I am not sure if the fix is complete and optimal. I should
mention that we probably no longer require replacement of the original
tokens in token array by the astree (if it is of token type) - we
tried to eliminate the code that required this since our last
conversation on this topic. So you do not need to care about it when
working on the real fix (if necessary) for now. I will let you know if
we find out it still causes problems.
Comment 7 Martin Matula 2004-06-07 01:33:02 UTC
Created attachment 15506 [details]
Quick-fix diff.
Comment 8 Martin Matula 2004-06-07 01:35:24 UTC
Fixed.

Checking in gjast.jar.scrambled;
/cvs/java/external/gjast.jar.scrambled,v  <--  gjast.jar.scrambled
new revision: 1.46; previous revision: 1.45
done

Comment 9 Jiri Prox 2005-07-19 11:04:09 UTC
verified in 4.2 (200507181000)