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.
Summary: | ClassCastException: com.sun.tools.javac.tree.JCTree$JCArrayTypeTree cannot be cast to com.sun.source.tree.IdentifierTree | ||
---|---|---|---|
Product: | projects | Reporter: | jonathanramsey <jonathanramsey> |
Component: | Maven | Assignee: | Milos Kleint <mkleint> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | dbalek, hohonuuli, jlahoda, sustaining |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://statistics.netbeans.org/exceptions/detail.do?id=136319 | ||
Issue Type: | DEFECT | Exception Reporter: | 136319 |
Attachments: |
stacktrace
stacktrace |
Description
jonathanramsey
2009-04-14 14:46:56 UTC
Created attachment 80043 [details]
stacktrace
Build: NetBeans IDE Dev (Build 200904011705) VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284 OS: Mac OS X, 10.5.6, i386 User Comments: Stacktrace: java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCPrimitiveTypeTree at org.netbeans.modules.maven.hints.errors.SearchClassDependencyInRepo.run(SearchClassDependencyInRepo.java:238) at org.netbeans.modules.java.hints.infrastructure.CreatorBasedLazyFixList.compute(CreatorBasedLazyFixList.java:144) at org.netbeans.modules.java.hints.infrastructure.LazyHintComputation.run(LazyHintComputation.java:109) at org.netbeans.modules.java.hints.infrastructure.LazyHintComputation.run(LazyHintComputation.java:55) at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288) at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:681) Created attachment 80180 [details]
stacktrace
dbalek: any hints? the code looks like this: case NEW_ARRAY: { NewArrayTree arrayTree = (NewArrayTree) initializer; Tree type = arrayTree.getType(); if (type != null) { itName = ((IdentifierTree) type).getName(); } } break; the exception comes from the IdentifierTree cast.. reassigning to java for evaluation, please advice how to improve the code mentioned above What is wrong in Java? Consider: -new Object[0] - is a new array, whose type is IdentifierTree "Object" -new Object[0][] - is a new array, whose type is ArrayTypeTree "Object[]" -int[0] - is a new array, whose type is PrimiteTypeTree "int" Not sure that code is supposed to do, but it should check whether the type is an identifier (through getKind ideally) before casting to an IdentifierTree, and possibly handle the other cases too. Integrated into 'main-golden', will be available in build *200906270201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/8d60f647ad73 User: Milos Kleint <mkleint@netbeans.org> Log: #162595 prevent casting error v. The fix has been ported into the release67_fixes repository. http://hg.netbeans.org/release67_fixes/rev/e970030d5df5 |