View | Details | Raw Unified | Return to bug 52441
Collapse All | Expand All

(-)src/main/java/org/apache/bcel/generic/InstructionTargeter.java (-1 / +19 lines)
Lines 29-36 Link Here
29
 */
29
 */
30
public interface InstructionTargeter {
30
public interface InstructionTargeter {
31
31
32
	/**
33
	 * Checks whether this targeter targets this instruction handle.
34
	 *
35
	 * @param ih
36
	 * @return
37
	 */
32
    boolean containsTarget( InstructionHandle ih );
38
    boolean containsTarget( InstructionHandle ih );
33
39
34
40
    /**
41
     * Replaces the target of this targeter from this old handle to the new handle.
42
     * 
43
     * This method will throw an exception if old_ih is not targeted by this object.
44
     *
45
     * @param old_ih
46
     * @param new_ih
47
     */
35
    void updateTarget( InstructionHandle old_ih, InstructionHandle new_ih );
48
    void updateTarget( InstructionHandle old_ih, InstructionHandle new_ih );
49
    
50
    /**
51
     * Removes all targets of this targeter.
52
     */
53
    void removeTargets();
36
}
54
}
(-)src/main/java/org/apache/bcel/generic/CodeExceptionGen.java (-1 / +6 lines)
Lines 103-109 Link Here
103
        this.handler_pc = handler_pc;
103
        this.handler_pc = handler_pc;
104
    }
104
    }
105
105
106
106
    public void removeTargets() {
107
    	setStartPC(null);
108
    	setEndPC(null);
109
    	setHandlerPC(null);
110
    }
111
    
107
    /**
112
    /**
108
     * @param old_ih old target, either start or end
113
     * @param old_ih old target, either start or end
109
     * @param new_ih new target
114
     * @param new_ih new target
(-)src/main/java/org/apache/bcel/generic/Select.java (-1 / +7 lines)
Lines 158-164 Link Here
158
        targets[i] = target;
158
        targets[i] = target;
159
    }
159
    }
160
160
161
161
    public void removeTargets() {
162
        setTarget(null);
163
        for (int i = 0; i < targets.length; i++) {
164
            setTarget(i, null);
165
        }
166
    }
167
    
162
    /**
168
    /**
163
     * @param old_ih old target
169
     * @param old_ih old target
164
     * @param new_ih new target
170
     * @param new_ih new target
(-)src/main/java/org/apache/bcel/generic/BranchInstruction.java (-1 / +4 lines)
Lines 202-208 Link Here
202
        }
202
        }
203
    }
203
    }
204
204
205
205
    public void removeTargets() {
206
        setTarget(null);
207
    }
208
    
206
    /**
209
    /**
207
     * @param old_ih old target
210
     * @param old_ih old target
208
     * @param new_ih new target
211
     * @param new_ih new target
(-)src/main/java/org/apache/bcel/generic/MethodGen.java (+6 lines)
Lines 21-26 Link Here
21
import java.util.Hashtable;
21
import java.util.Hashtable;
22
import java.util.List;
22
import java.util.List;
23
import java.util.Stack;
23
import java.util.Stack;
24
24
import org.apache.bcel.Constants;
25
import org.apache.bcel.Constants;
25
import org.apache.bcel.classfile.AnnotationEntry;
26
import org.apache.bcel.classfile.AnnotationEntry;
26
import org.apache.bcel.classfile.Annotations;
27
import org.apache.bcel.classfile.Annotations;
Lines 179-184 Link Here
179
                ((m.getAccessFlags() & (Constants.ACC_ABSTRACT | Constants.ACC_NATIVE)) == 0)
180
                ((m.getAccessFlags() & (Constants.ACC_ABSTRACT | Constants.ACC_NATIVE)) == 0)
180
                        ? new InstructionList(m.getCode().getCode())
181
                        ? new InstructionList(m.getCode().getCode())
181
                        : null, cp);
182
                        : null, cp);
183
        // remove dummy variables created with regular constructor
184
        this.removeLocalVariables();
185
        
182
        Attribute[] attributes = m.getAttributes();
186
        Attribute[] attributes = m.getAttributes();
183
        for (int i = 0; i < attributes.length; i++) {
187
        for (int i = 0; i < attributes.length; i++) {
184
            Attribute a = attributes[i];
188
            Attribute a = attributes[i];
Lines 345-350 Link Here
345
     * Remove all local variables.
349
     * Remove all local variables.
346
     */
350
     */
347
    public void removeLocalVariables() {
351
    public void removeLocalVariables() {
352
    	for (LocalVariableGen var : variable_vec)
353
    		var.removeTargets();
348
        variable_vec.clear();
354
        variable_vec.clear();
349
    }
355
    }
350
356
(-)src/main/java/org/apache/bcel/generic/LineNumberGen.java (-1 / +4 lines)
Lines 53-59 Link Here
53
        return this.ih == ih;
53
        return this.ih == ih;
54
    }
54
    }
55
55
56
56
    public void removeTargets() {
57
    	setInstruction(null);
58
    }
59
    
57
    /**
60
    /**
58
     * @param old_ih old target
61
     * @param old_ih old target
59
     * @param new_ih new target
62
     * @param new_ih new target
(-)src/main/java/org/apache/bcel/generic/LocalVariableGen.java (-1 / +5 lines)
Lines 142-148 Link Here
142
        this.end = end;
142
        this.end = end;
143
    }
143
    }
144
144
145
145
    public void removeTargets() {
146
    	setStart(null);
147
    	setEnd(null);
148
    }
149
    
146
    /**
150
    /**
147
     * @param old_ih old target, either start or end
151
     * @param old_ih old target, either start or end
148
     * @param new_ih new target
152
     * @param new_ih new target

Return to bug 52441