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.
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)
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.
deleted the userdir. Same exception. I am sorry but this is P1, I can't use the IDE. Will attach message.log shortly
Created attachment 15503 [details] IDE log file
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.
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.
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.
Created attachment 15506 [details] Quick-fix diff.
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
verified in 4.2 (200507181000)