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.
the following simple code throws a NPE at the indicated line (inside the jmi code called there). JavaClass innerTester = ((JavaModelPackage)tgtClass. refImmediatePackage()). getJavaClass(). createJavaClass(); innerTester.setSimpleName("TestClass"); // <<< NPE HERE tgtClass is another existing JavaClass, with f.q.name set correctly.
Created attachment 16664 [details] exception stack trace
Note that the code mentioned in the issue is a simplified snippet of code from the TestCreator.fillTestClass method, in a version not in the CVS, yet.
Simple workaround: use createJavaClass(name, annotations, modifiers, javadocText, javadoc, features, superClassName, interfaceNames, typeArguments) instead of createJavaClass() and setSimpleName()
Or more simple workaround: call setName() instead of setSimpleName(). Anyway it is fixed: Checking in JavaClassImpl.java; /cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/JavaClassImpl.java,v <-- JavaClassImpl.java new revision: 1.23; previous revision: 1.22 done
I thought there was a difference between simpleName and name. Anyway, thanks for the fix.
Yes, there is a difference between setSimpleName and setName, but only if simple name != fully qualified name (which in case of null name is not true... :))
Reorganization of java component