Browse Prior Art Database

JAX, An Application Extractor For Java

IP.com Disclosure Number: IPCOM000123177D
Original Publication Date: 1998-Jun-01
Included in the Prior Art Database: 2005-Apr-04
Document File: 4 page(s) / 138K

Publishing Venue

IBM

Related People

Tip, F: AUTHOR [+3]

Abstract

INTRODUCTION JAX is a Java application packaging tool with one major goal: reduce the distribution size of a Java application. This means JAX collects the class files that comprise a given application, and takes out only those elements in the class files that are not needed to execute the application. The result is a smaller "executable". With all optimization techniques currently done by JAX, an estimated 30%-50% reduction of the original application size is feasible.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 45% of the total text.

JAX, An Application Extractor For Java

   INTRODUCTION

JAX is a Java application packaging tool with one major goal: reduce
the distribution size of a Java application.  This means JAX collects
the class files that comprise a given application, and takes out only
those elements in the class files that are not needed to execute the
application.  The result is a smaller "executable".  With all
optimization techniques currently done by JAX, an estimated 30%-50%
reduction of the original application size is feasible.

HOW IT WORKS

   JAX is written in Java, reads in class files, analyses
them, and generates a compressed ZIP file as output.  During
processing, JAX performs the following steps preferably in the
described order:

REMOVAL OF DEAD METHODS AND FIELDS

   A call graph is composed of all reachable methods and
fields.  Entry points to the call graph are formed by:
  - The "main" method
  - Methods declared by external interfaces implemented by
     classes in the program (each of those methods can be
     potentially called).  Interfaces can inherit from other
     interfaces.
  - Methods declared by external classes subclassed by classes
     in the program (each of those methods can be potentially
     called).  Classes inherit from other classes.
  - All methods of "dynamically loaded" classes.  An external
     framework can load classes by name, and manipulate them
     from there on.  Human intervention is required here.
  - Methods that are called using the Java reflection
     API.  Human intervention is required here.

   After building the call graph, all methods and fields that
were not visited are removed from the program.

DETECTING LIVE OVERRIDDEN METHODS

   Live methods for a given class are also live in each of its
subclasses.  This is a pessimistic assumption.  We are currently
incorporating Rapid Type Analysis (RTA) into JAX in order to further
reduce the number of reachable methods.  RTA determines the classes
that are guaranteed not to be instantiated by the application, and
uses to information to narrow the number of potential targets of
dynamically dispatched calls.

REMOVAL OF UNUSED CLASSES AND INTERFACES

   After removing dead methods and fields in a given class or
interface, it may end up containing zero methods and fields.  This
means the class or interface can effectively be removed from the
program.  Special caution needs to be taken when the interface or
class is in the middle of the inheritance hierarchy (in which case
the hierarchy needs to be restructured (flattened)).  Furthermore,
classes that declare that they implement a given empty interface
need to be updated.

INLINING OF METHODS

   Method calls are inlined only when they make the class file
smaller (which is the case for "getters" and "setters").  This is
problemistic for JavaBeans since the JavaBean frameword assumes all
methods starting with "get" and "set" are callable.  Taking those
...