Class LocalVariableTable


  • final class LocalVariableTable
    extends java.lang.Object
    This class is used to assemble the local variable table. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int len  
      (package private) LocalVariable[] locals  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void define​(MemberDefinition field, int slot, int from, int to)
      Define a new local variable.
      private void trim_ranges()
      Trim overlapping local ranges.
      (package private) void write​(Environment env, java.io.DataOutputStream out, ConstantPool tab)
      Write out the data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocalVariableTable

        LocalVariableTable()
    • Method Detail

      • define

        void define​(MemberDefinition field,
                    int slot,
                    int from,
                    int to)
        Define a new local variable. Merge entries where possible.
      • trim_ranges

        private void trim_ranges()
        Trim overlapping local ranges. Java forbids shadowing of locals in nested scopes, but non-nested scopes may still declare locals with the same name. Because local variable ranges are computed using flow analysis as part of assembly, it isn't possible to simply make sure variable ranges end where the enclosing lexical scope ends. This method makes sure that variables with the same name don't overlap, giving priority to fields with higher slot numbers that should have appeared later in the source.
      • write

        void write​(Environment env,
                   java.io.DataOutputStream out,
                   ConstantPool tab)
            throws java.io.IOException
        Write out the data.
        Throws:
        java.io.IOException