Some time ago, NetBeans was able to bytecode-patch classes during loading and inject some things to preserve binary compatibility. The ability was removed as of issue #155796.
In order to better comply with Java 8 Compact profiles, we should make some changes and obsolete code cleanups in NetBeans core APIs, but still it would be highly desirable to preserve binary compatibility for an extended period of time.
The compatibility can be achieved by providing support for patch modules (aka module framgents, similar to OSGi bundle fragments) together with bytecode instrumentation which injects implementation classes into the loaded class hierarchy.
Also see http://wiki.netbeans.org/Main_Page/BackwardCompatibilityPatches
Summary of changes (patch will follow shortly):
1/ API in openide.modules: @PatchFor, @ConstructorDelegate, manifest entry defined in @PatchFor. Annotation Processor enhanced to work with @PatchFor
2/ Changes in o.n.bootstrap:
* Processing of @PatchFor and @ConstructorDelegate (no API)
* Reading of manifest entries, processing OpenIDE-Module-Fragment-Host
* Ability to merge into other module's classloader, fragments use the host classloader
3/ Visible API changes
Possible serialization incompatbility - ModuleData serializes the fragmentHostCodeName.
Friend API change:
public void refineClassLoader(Module m, List parents);
public ClassLoader refineClassLoader(Module m, List parents);
4/ Inclusion of OW2 ASM 5.0 library
Created attachment 146649 [details]
Proposed changes to openide.modules, o.n.bootstrap
Note: the target for the patch is the server_split branch
committed to branch server_split as jet-main#30cc839f4091
Y01 Serialization is not a problem
Y02 description of functionality should not be in apichanges.xml. Rather put it into Javadoc of @PatchFor & co. and just link to it from apichanges.xml
Y02 addressed in jet-main#0afbfa1021d6 (server_split branch)
Note: After successful review, I am going to merge the changes into trunk.
Integrated into 'main-silver', will be available in build *201410180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Svata Dedic <email@example.com>
Log: #243561: support for runtime bytecode patching of superclass and constructor generation, support for fragment modules (see OSGi)