Class ConstantPoolCollector

java.lang.Object
eu.bandm.tools.lljava.sema.ConstantPoolCollector

public class ConstantPoolCollector extends Object
Processor that elicits and records all constant pool entries in a class definition.

Preconditions

As a prerequisite for precessing, all erasure fields (FIXME: in which classes) and the pre fields of instructions must be set. This can be achieved by means of a TypeChecker run.

Furthermore, the strategy fields of Invoke instructions must be set.

Postconditions

Processing a class with the method collect(eu.bandm.tools.lljava.absy.Class) overwrites its pool field and BootstrapMethodAttribute with new ones computed from scratch. This guarantees the following properties:

  • The resulting constant pool and bootstrap method table contain no unreachable entries.
  • The resulting constant pool and bootstrap method table contain no duplicate entries.
  • Processing is idempotent; repeated runs have no further semantic effect.

As a side effect of processing, all entry fields (FIXME: in which classes) are set. The entries in the resulting constant pool are ordered by first encounter as the value of an entry field in the standard visitor traversal order.

  • Constructor Details

    • ConstantPoolCollector

      public ConstantPoolCollector()
  • Method Details

    • collect

      public void collect(Class c)
      Processes the given class, and finds and records all implied constant pool entries.

      The constant pool entries are stored centrally in the field pool, in traversal order and without duplicates. They are also stored decentrally in entry fields.