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.
Steps to reproduce: - create a package; - create java class in the package; - select java class node and expand it; - select child node; - select copy from context menu; - select package node and paste class there; - an exception occurs: Annotation: File Class.java already exists in E:\b_10. java.io.SyncFailedException: File Class.java already exists in E:\b_10. at org.openide.filesystems.LocalFileSystem.createData(LocalFileSystem.java:211) at org.openide.filesystems.LocalFileSystem$Impl.createData(LocalFileSystem.java:458) at org.openide.filesystems.AbstractFileObject.createData(AbstractFileObject.java:388) at org.openide.src.nodes.SourceEditSupport.createJavaFile(SourceEditSupport.java:397) at org.openide.src.nodes.SourceEditSupport$PackagePaste$Type.paste(SourceEditSupport.java:495) at org.openide.actions.PasteAction.executePasteType(PasteAction.java:183) at org.openide.actions.PasteAction.access$100(PasteAction.java:60) at org.openide.actions.PasteAction$ActionPT.actionPerformed(PasteAction.java:777) at org.netbeans.core.ModuleActions$1.run(ModuleActions.java:97) at org.openide.util.Task.run(Task.java:136) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:328) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:670)
Since this bug is there for a long time and has been discovered just recently, I would consider this use case as an edge case. I would propose this "correct" behavior, if possible: I would keep it consistent with the behavior on files level -- automatically add numbered suffix (like _1, _2, etc.).
Yeah, there is a typo in SourceEditSupport.createJavaFile. The new name is generated but the original one is used in spite of that. If you like to see this fixed in nb 3.6 raise the priority to P2. Otherwise it will be fixed in the next release.
Cannot reproduce in promo-D