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.
While working on issue 26790 I realized that it would be very useful if the bytecode patching could handle rename of methods (and fields). Something like the old postprocessing task that changed r3fr3shRoot to refreshRoot so there could be two methods with different return type. In the current system this was handled by moving of one of the methods into a superclass ($SystemAction$Patch$.getIcon for example), but the problem is that this does not work for static methods and also, that even the generated patched version of SystemAction (with $SA$Patch$ superclass) cannot be subclassed by someone who overrides the old method (ImageIcon getIcon). For this reason I decided to enhance the patching system to be able to rename members during runtime.
Created attachment 7250 [details] Patching with ability to rename members
The patch does not look too complicated. Actually I just copied method markMemberPublic into renameMember and mangle it a bit, moreover the rename ability allowed me to delete two fake superclasses. $AbstractFileSystem$Patch$ and $SystemAction$Patch$ All tests seem to work, but remembering all the problems that you (Jesse) found last time, it is definitivelly better to wait for your review. Can you review & apply or review & give me permision to apply?
Will apply this.
Applied: committed * Up-To-Date 1.9 core/src/org/netbeans/PatchByteCode.java committed * Up-To-Date 1.7 core/test/unit/src/org/netbeans/PatchByteCodeTest.java committed * Up-To-Date 1.3 nbbuild/antsrc/org/netbeans/nbbuild/NbEnhanceClass.java committed * Up-To-Date 1.111 openide/build.xml removed * Up-To-Date 1.3 openide/compat/src/org/openide/filesystems/$AbstractFileSystem$Patch$.java removed * Up-To-Date 1.2 openide/compat/src/org/openide/util/actions/$SystemAction$Patch$.java committed * Up-To-Date 1.48 openide/src/org/openide/filesystems/AbstractFileSystem.java committed * Up-To-Date 1.60 openide/src/org/openide/util/actions/SystemAction.java