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.
Adding duplicate inner class or interface doesn't throw SourceException. Source code: ClassElement innerClass = new ClassElement(); if (contition1) { innerClass.setClassOrInterface(true); } else if (condition2) { innerClass.setClassOrInterface(false); } // get simple class name(not fully qualified) String className = getNewClassName(); Identifier name = Identifier.create(className); innerClass.setName(name); innerClass.setModifiers(Modifier.PUBLIC); classElement.addClass(innerClass);
The error occurs if a class with some FQN != simple name is being added twice; the bounding ClassElement incorrectly tries to find a class using its FQN instead of using either simple name or FQN constructed to match the target of the addition.
[dev-22] ClassElement.addClass() and addClasses() now checks for existence of innerclasses using SimpleNames, not FQNs.
[1120] Verified
Resolved for 3.4.x or earlier, no new info since then -> closing.