Package gnu.bytecode

Class Method

  • All Implemented Interfaces:
    AttrContainer, Member

    public class Method
    extends Object
    implements AttrContainer, Member
    Represents a method in a ClassType.

    A Method contain a CodeAttr object; the interface for generating bytecode instructions is primarily in CodeAttr.

    All the methods whose name start with compile_ are deprecated, and should not be used; use the methods in CodeAttrinstead.

    • Constructor Detail

      • Method

        public Method​(Method base,
                      ClassType clas)
        A copy constructor, except you can override the declaring class. This can be used to improve binary compatibility by emitting method references where the declared class is the type of the receiver.
    • Method Detail

      • setExceptions

        public void setExceptions​(short[] exn_indices)
      • setExceptions

        public void setExceptions​(ClassType[] exn_types)
      • getCode

        public final CodeAttr getCode()
      • setStaticFlag

        public final void setStaticFlag​(boolean is_static)
      • getStaticFlag

        public final boolean getStaticFlag()
        Specified by:
        getStaticFlag in interface Member
      • isAbstract

        public final boolean isAbstract()
      • isNative

        public final boolean isNative()
      • getModifiers

        public int getModifiers()
        Specified by:
        getModifiers in interface Member
      • setModifiers

        public void setModifiers​(int modifiers)
      • pushScope

        public Scope pushScope()
      • reachableHere

        public final boolean reachableHere()
        True if control could reach here.
      • popScope

        public Scope popScope()
      • allocate_local

        @Deprecated
        public void allocate_local​(Variable local)
        Deprecated.
        Allocate slots for a local variable (or parameter).
        Parameters:
        local - the variable we need to allocate
      • initCode

        public void initCode()
        Allocate a Code attribute, and prepare to generate code. Most code generators should use the startCode convenience method.
      • init_param_slots

        public void init_param_slots()
        Deprecated.
        Use startCode instead
      • startCode

        public CodeAttr startCode()
        Recommended method to create a new CodeAttr for this Method.
      • compile_checkcast

        public void compile_checkcast​(Type type)
      • maybe_compile_checkcast

        public void maybe_compile_checkcast​(Type type)
      • push_var

        public void push_var​(Variable var)
        Deprecated.
        Comple code to push the contents of a local variable onto the statck.
        Parameters:
        var - The variable whose contents we want to push.
      • compile_push_value

        @Deprecated
        public void compile_push_value​(Variable var)
        Deprecated.
      • compile_store_value

        @Deprecated
        public void compile_store_value​(Variable var)
        Deprecated.
      • compile_push_this

        public void compile_push_this()
      • makeSignature

        public static String makeSignature​(Type[] arg_types,
                                           Type return_type)
      • makeGenericSignature

        public static String makeGenericSignature​(Type[] arg_types,
                                                  Type return_type)
      • getSignature

        public String getSignature()
      • setSignature

        public void setSignature​(String signature)
      • setSignature

        public void setSignature​(int signature_index)
      • getReturnType

        public final Type getReturnType()
      • setReturnType

        public final void setReturnType​(Type type)
      • getParameterTypes

        public final Type[] getParameterTypes()
      • getExceptions

        public final ClassType[] getExceptions()
      • setName

        public final void setName​(String name)
        Specified by:
        setName in interface Member
      • setName

        public final void setName​(int name_index)
      • getNext

        public final Method getNext()
      • listParameters

        public void listParameters​(StringBuffer sbuf)
      • cleanupAfterCompilation

        public void cleanupAfterCompilation()