KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > cojen > classfile > Label


1 /*
2  * Copyright 2004 Brian S O'Neill
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.cojen.classfile;
18
19 /**
20  * A label is used to manipulate a branch instruction's branch location. A
21  * label has a location address. Branch instructions have origin addresses,
22  * which contain the address of the opcode that performs the conditional or
23  * unconditional branch.
24  *
25  * <p>Labels are generated by factory methods in the CodeBuilder class.
26  * If a label has any origin addresses, its location address must be set by
27  * the time the CodeBuilder's class file is output.
28  *
29  * @author Brian S O'Neill
30  * @see CodeBuilder
31  */

32 public interface Label extends Location {
33     /**
34      * Sets the location of a label to be at the current postion in the
35      * code being generated.
36      *
37      * @return the Label itself.
38      */

39     Label setLocation();
40
41     /**
42      * Returns -1 if the location isn't yet fully resolved.
43      *
44      * @exception IllegalStateException when the location is unknown because
45      * the setLocation method was never called.
46      */

47     int getLocation() throws IllegalStateException JavaDoc;
48 }
49
Popular Tags