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: | NullPointerException at org.netbeans.api.java.source.GeneratorUtilities.addImports | ||
---|---|---|---|
Product: | java | Reporter: | Vladimir Riha <vriha> |
Component: | Compiler | Assignee: | Dusan Balek <dbalek> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | jglick, vriha |
Priority: | P2 | Keywords: | REGRESSION |
Version: | 7.0 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | 181003 |
Bug Depends on: | |||
Bug Blocks: | 122109 | ||
Attachments: | stacktrace |
Description
Vladimir Riha
2011-09-07 09:36:12 UTC
Created attachment 110467 [details]
stacktrace
Update: Exception is thrown after I confirm the "REST Resources Configuration" dialog which appears right after pressing Finish button Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/15bd6072f5fc Seems to completely break "Use @NbBundle.Messages" hint. http://statistics.netbeans.org/exceptions/messageslog?id=526667 is the same stack trace but when running with the purported fix. getImportedElement returns null on the static wildcard import. By the way this code (run later, after the bug occurs) is probably wrong: for (Element e : parent.getEnclosedElements()) { if (name == e.getSimpleName() && e.getModifiers().contains(Modifier.STATIC) && trees.isAccessible(s, e, (DeclaredType)parent.asType())); return e; } You do some test and then ignore the result and return the first enclosed element unconditionally. Noticed because indentation does not match reality. Delete the stray semicolon. imp is e.g. "import static pkg.Bundle.*;\n" with qualIdent "pkg.Bundle.*" of kind IDENTIFIER. I tried something like this: String qualIdentS = qualIdent.toString(); if (qualIdentS.endsWith(".*")) { String fqn = qualIdentS.substring(0, qualIdentS.length() - 2); element = elements.getTypeElement(fqn); if (element == null) { element = elements.getPackageElement(fqn); } return element; } but it does not help; fqn "pkg.Bundle" is not yet available in elements, because it will be created by an AP only after the file has been saved. BTW to reproduce, simply create a new standalone module, add a custom wizard iterator with one panel, find one of the NbBundle.getMessage calls, and accept the hint on it. Only known workaround is to use 7.0.1 for this hint. OOPS - second attempt http://hg.netbeans.org/jet-main/rev/0c6b5cd053df Jesse thanks for your investigation. Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/15bd6072f5fc User: Dusan Balek <dbalek@netbeans.org> Log: Issue #201730: NullPointerException at org.netbeans.api.java.source.GeneratorUtilities.addImports - fixed. Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/0c6b5cd053df User: Dusan Balek <dbalek@netbeans.org> Log: Issue #201730: NullPointerException at org.netbeans.api.java.source.GeneratorUtilities.addImports - fix cont. verified |