jaxp/src/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java
changeset 17538 d8d911c4e5d4
parent 12457 c348e06f0e82
equal deleted inserted replaced
17537:50528ec0ea37 17538:d8d911c4e5d4
    56  * individuals on behalf of the Apache Software Foundation.  For more
    56  * individuals on behalf of the Apache Software Foundation.  For more
    57  * information on the Apache Software Foundation, please see
    57  * information on the Apache Software Foundation, please see
    58  * <http://www.apache.org/>.
    58  * <http://www.apache.org/>.
    59  */
    59  */
    60 
    60 
    61 import com.sun.org.apache.bcel.internal.Constants;
       
    62 import com.sun.org.apache.bcel.internal.classfile.*;
    61 import com.sun.org.apache.bcel.internal.classfile.*;
    63 
    62 
    64 /**
    63 /**
    65  * This class represents a line number within a method, i.e., give an instruction
    64  * This class represents a line number within a method, i.e., give an instruction
    66  * a line number corresponding to the source code line.
    65  * a line number corresponding to the source code line.
    86   }
    85   }
    87 
    86 
    88   /**
    87   /**
    89    * @return true, if ih is target of this line number
    88    * @return true, if ih is target of this line number
    90    */
    89    */
       
    90   @Override
    91   public boolean containsTarget(InstructionHandle ih) {
    91   public boolean containsTarget(InstructionHandle ih) {
    92     return this.ih == ih;
    92     return this.ih == ih;
    93   }
    93   }
    94 
    94 
    95   /**
    95   /**
    96    * @param old_ih old target
    96    * @param old_ih old target
    97    * @param new_ih new target
    97    * @param new_ih new target
    98    */
    98    */
       
    99   @Override
    99   public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
   100   public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
   100     if(old_ih != ih)
   101     if(old_ih != ih)
   101       throw new ClassGenException("Not targeting " + old_ih + ", but " + ih + "}");
   102       throw new ClassGenException("Not targeting " + old_ih + ", but " + ih + "}");
   102     else
   103     else
   103       setInstruction(new_ih);
   104       setInstruction(new_ih);
   111    */
   112    */
   112   public LineNumber getLineNumber() {
   113   public LineNumber getLineNumber() {
   113     return new LineNumber(ih.getPosition(), src_line);
   114     return new LineNumber(ih.getPosition(), src_line);
   114   }
   115   }
   115 
   116 
   116   public void setInstruction(InstructionHandle ih) {
   117   public final void setInstruction(InstructionHandle ih) {
   117     BranchInstruction.notifyTarget(this.ih, ih, this);
   118     BranchInstruction.notifyTargetChanging(this.ih, this);
   118 
       
   119     this.ih = ih;
   119     this.ih = ih;
       
   120     BranchInstruction.notifyTargetChanged(this.ih, this);
   120   }
   121   }
   121 
   122 
       
   123   @Override
   122   public Object clone() {
   124   public Object clone() {
   123     try {
   125     try {
   124       return super.clone();
   126       return super.clone();
   125     } catch(CloneNotSupportedException e) {
   127     } catch(CloneNotSupportedException e) {
   126       System.err.println(e);
   128       System.err.println(e);