    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one
    003 * or more contributor license agreements.  See the NOTICE file
    004 * distributed with this work for additional information
    005 * regarding copyright ownership.  The ASF licenses this file
    006 * to you under the Apache License, Version 2.0 (the
    007 * "License"); you may not use this file except in compliance
    008 * with the License.  You may obtain a copy of the License at
    009 *
    010 *   https://www.apache.org/licenses/LICENSE-2.0
    011 *
    012 * Unless required by applicable law or agreed to in writing,
    013 * software distributed under the License is distributed on an
    014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    015 * KIND, either express or implied.  See the License for the
    016 * specific language governing permissions and limitations
    017 * under the License.
    018 */
    019
    020package org.apache.bcel.generic;
    021
    022/**
    023 * Denotes that a class targets InstructionHandles within an InstructionList.
    024 *
    025 * @see BranchHandle
    026 * @see LocalVariableGen
    027 * @see CodeExceptionGen
    028 */
    029public interface InstructionTargeter {
    030
    031    // static final InstructionTargeter[] EMPTY_ARRAY = new InstructionTargeter[0];
    032
    033    /**
    034     * Tests whether this targeter targets the specified instruction handle.
    035     *
    036     * @param instructionHandle the instruction handle to test.
    037     * @return whether this targeter targets the specified instruction handle.
    038     */
    039    boolean containsTarget(InstructionHandle instructionHandle);
    040
    041    /**
    042     * Replaces the target of this targeter from this old handle to the new handle.
    043     *
    044     * @param oldIh the old handle.
    045     * @param newIh the new handle.
    046     * @throws ClassGenException if oldIh is not targeted by this object
    047     */
    048    void updateTarget(InstructionHandle oldIh, InstructionHandle newIh) throws ClassGenException;
    049}