Module System API
Official

Overview of Module System API module

What is New (see all changes)?

  • Sep 26 '14 Better support for constructor invocation

    Allows the generated constructor to call any constructor, signature is derived from specified static method parameters. See javadoc for @ConstructorDelegate

  • Apr 11 '14 Support for binary compatibility patches

    Special annotation @PatchFor allows to require that a class should serve as a superclass of some other class. See @PatchFor javadoc for further constraints.

    To support removing obsolete constructors, @ConstructorDelegate has been created to mark moved initialization code. See @ConstructorDelegate javadoc for more details.

  • Dec 23 '13 JavaFX Library Wrapper

    Most of JDK installations come with additional JavaFX JAR. Alas the location of the JAR is different on JDK7 and JDK8, moreover on some operating systems (think of Solaris) the JAR is not present at all. To hide the differences and allow smooth consumption of JavaFX APIs NetBeans provide following conventions.

    If you want to code against JavaFX APIs, add dependency on org.netbeans.libs.javafx library. Then you'll be able to compile and run while using the API.

    If you want to depend on presence of JavaFX JAR inside of JDK installation structure, use:

    OpenIDE-Module-Needs: org.openide.modules.jre.JavaFX

    This token is made available by the module system, if the JavaFX module is present in the JDK. Btw. the org.netbeans.libs.javafx library has such dependency and as a result, all modules that depend on it will be disabled on Solaris or on OpenJDK (if installed without JavaFX).

  • Feb 12 '13 Find ModuleInfo by code name base easily

    New findCodeNameBase(String) method returning ModuleInfo or null.

  • May 24 '12 Less restrictive check of code names of modules and OSGi bundles

    Dependency.create now allows code name base where dot is followed by number (like org.apache.servicemix.specs.jsr303_api_1.0.0). This increases the inter-operability with OSGi bundles using such naming style.

Use Cases

Cover of NetBeans Platform for Beginners book For general overview of the concepts, together with code samples, see chapter 2, of NetBeans Platform for Beginners by Jason Wexbridge and Walter Nyland. Gory technical details are explained on API overview page . Other interesting topic(s) follow:

How a classpath of my module is constructed?

The NetBeans is defacto a container that manages individual module's lifecycle and other runtime aspects. One of the important things is that it creates a runtime classpath for provided modules based on dependencies they specify in their manifests. The overview of the runtime infrastructure is a good starting place for everyone who wishes to learn more about the NetBeans runtime container behaviour.

Runtime compatibility patches

To maintain binary compatibility, method implementations may be injected at runtime, in a form of a superclass in the class' inheritance hierarchy. Modules compiled against older version of APIs which contains MethodReferences to methods removed from the oficial APIs will be then linked according to JVM Resolution algorithm to a matching method present in the superclass of the referenced type.

Annotations are used to instruct the ClassLoader to make transformations to the API classes. PatchFor causes the annotated class to be injected as a superclass of the API class identified by the annotation's value. ConstructorDelegate marks a method, which is called as constructor implementation in the case that it is necessary to preserve a constructor for binary compatibility.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...

Group of java interfaces

Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
ModulesAPIExportedOfficial .../org/openide/modules/doc-files/api.html
CoreModulesAPIExportedFriend

Group of systemproperty interfaces

Group of systemproperty interfaces
Interface NameIn/OutStabilitySpecified in What Document?
netbeans.systemclassloader.patchesExportedFriend Classpath appended to the system class loader. Used for automated testing infrastructure.
netbeans.cache.manifestsExportedPrivate By default true, may be turned off to disable manifest caching.
netbeans.patches.MODULE.CODE.NAME.BASEExportedFriend Patch directories or JARs to add to the class loader for a module, besides patches/MODULE-CODE-NAME-BASE/*.jar.
netbeans.preresolve.classesExportedPrivate If true, all module classes are forcibly loaded at startup, to help detect possible linkage errors.
org.netbeans.core.modules.NbInstaller.noAutoDepsExportedPrivate Disables automatic module dependency upgrades.
org.netbeans.core.modulesExportedPrivate If set to 0, enables logging for the module system.
org.netbeans.core.modules.NbInstaller.NO_COMPAT_AUTO_TRANSITIVE_DEPSExportedPrivate Disabled automatic transitive class loader dependencies for old modules.
netbeans.modules.quietExportedPrivate Avoids text messaging (other than ErrorManager logging) to the console from the module system.
netbeans.moduleitem.dontverifyclassloaderExportedPrivate Suppresses checks to ensure that module section classes are actually loaded from the module itself.
netbeans.security.nocheckExportedFriend Suppress security checks in the VM, even from "untrusted" code.
netbeans.classloader.verboseExportedPrivate Prints messages when resources or classes are loaded from JARs.
netbeans.cache.layersExportedPrivate

Used to control the XML layer cache mechanism. Value may be a fully-qualified class name to load as a manager (implement org.netbeans.core.projects.cache.LayerCacheManager), or - to disable caching and always parse the XML layers directly. Current default is to use a binary cache manager.

Group of dtd interfaces

Group of dtd interfaces
Interface NameIn/OutStabilitySpecified in What Document?
module-status-1_0.dtdExportedUnder Development .../dtds/module-status-1_0.dtd-//NetBeans//DTD Module Status 1.0//EN
module-auto-deps-1_0.dtdExportedUnder Development .../dtds/module-auto-deps-1_0.dtd-//NetBeans//DTD Module Automatic Dependencies 1.0//EN
filesystem-1_1.dtdExportedStable .../www.netbeans.org/dtds/filesystem-1_1.dtd-//NetBeans//DTD Filesystem 1.1//EN

Implementation Details

Read more about the implementation in the answers to architecture questions.

Module System API
Package
Description
NetBeans is capable of being extended by pluggable modules providing additional functionality.