7. Detecting Manifest Requirements

Bundlor's main function is to scan an existing JAR file and determine its runtime dependencies. With this information it can then generate the OSGi-compliant manifest headers needed for proper runtime operation. This analysis is comprised of looking for class references and class names in Java classes and certain well-known file types.

7.1 Java Detection Criteria

Bundlor scans any Java class it can find in the artifact created by the underlying build system. This means that if a build process has custom behavior (i.e. weaving with AspectJ or jarjaring), Bundlor will be able to see and analyze the changes made by that process as long as the changes are in the artifact created by the build system.

There are a number of places in a Java class that another Java type can be referenced from. Bundlor detects these references and adds manifest requirements for them.

7.1.1 Export Package

Bundlor exports any package that contains a class.

7.1.2 Import Package

The following is a list of the places that Bundlor will search for type names

  • Declared Type Superclass Types
  • Declared Type Implemented Interfaces Types
  • Declared Type Annotation Types
  • Declared Field Types
  • Declared Field Values Types
  • Declared Method Argument Types
  • Declared Method Return Types
  • Declared Method Exception Types
  • Declared Method Annotation Types
  • Reference To Field Owner Type
  • Reference To Field Type
  • Declared Local Variable Type
  • Reference to Method Declaring Type
  • Reference to Method Return Type
  • Reference to Method Argument Types
  • Allocation of Array Type
  • Declared Parameter Annotation Types
  • Caught Exception Type
  • Instantiated Type
  • Cast Target Type
  • Instanceof Type
  • Declared Constant Type