KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > proguard > classfile > attribute > preverification > VerificationType


1 /*
2  * ProGuard -- shrinking, optimization, obfuscation, and preverification
3  * of Java bytecode.
4  *
5  * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu)
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the Free
9  * Software Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21 package proguard.classfile.attribute.preverification;
22
23 import proguard.classfile.*;
24 import proguard.classfile.attribute.CodeAttribute;
25 import proguard.classfile.attribute.preverification.visitor.VerificationTypeVisitor;
26
27 /**
28  * This abstract class represents a verification type of a local variable or
29  * a stack element. Specific verification types are subclassed from it.
30  *
31  * @author Eric Lafortune
32  */

33 public abstract class VerificationType implements VisitorAccepter
34 {
35     public static final int TOP_TYPE = 0;
36     public static final int INTEGER_TYPE = 1;
37     public static final int FLOAT_TYPE = 2;
38     public static final int DOUBLE_TYPE = 3;
39     public static final int LONG_TYPE = 4;
40     public static final int NULL_TYPE = 5;
41     public static final int UNINITIALIZED_THIS_TYPE = 6;
42     public static final int OBJECT_TYPE = 7;
43     public static final int UNINITIALIZED_TYPE = 8;
44
45
46     /**
47      * An extra field in which visitors can store information.
48      */

49     public Object JavaDoc visitorInfo;
50
51
52     /**
53      * Returns the tag of the verification type.
54      */

55     public abstract int getTag();
56
57
58     /**
59      * Accepts the given visitor in the context of a method's code, either on
60      * a stack or as a variable.
61      */

62     public abstract void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int instructionOffset, VerificationTypeVisitor verificationTypeVisitor);
63
64
65     /**
66      * Accepts the given visitor in the context of a stack in a method's code .
67      */

68     public abstract void stackAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, int instructionOffset, int stackIndex, VerificationTypeVisitor verificationTypeVisitor);
69
70
71     /**
72      * Accepts the given visitor in the context of a variable in a method's code.
73      */

74     public abstract void variablesAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, int instructionOffset, int variableIndex, VerificationTypeVisitor verificationTypeVisitor);
75
76
77     // Implementations for VisitorAccepter.
78

79     public Object JavaDoc getVisitorInfo()
80     {
81         return visitorInfo;
82     }
83
84     public void setVisitorInfo(Object JavaDoc visitorInfo)
85     {
86         this.visitorInfo = visitorInfo;
87     }
88
89
90     // Implementations for Object.
91

92     public boolean equals(Object JavaDoc object)
93     {
94         return object != null &&
95                this.getClass() == object.getClass();
96     }
97
98
99     public int hashCode()
100     {
101         return this.getClass().hashCode();
102     }
103 }
104
Popular Tags