KickJava   Java API By Example, From Geeks To Geeks.

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


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 program 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 program 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 General Public License for
15  * more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21 package proguard.classfile.attribute.preverification;
22
23 import proguard.evaluation.value.*;
24 import proguard.classfile.*;
25 import proguard.classfile.util.ClassUtil;
26
27 /**
28  * This class provides methods to create and reuse IntegerType objects.
29  *
30  * @author Eric Lafortune
31  */

32 public class VerificationTypeFactory
33 {
34     // Shared copies of Type objects, to avoid creating a lot of objects.
35
static final IntegerType INTEGER_TYPE = new IntegerType();
36     static final LongType LONG_TYPE = new LongType();
37     static final FloatType FLOAT_TYPE = new FloatType();
38     static final DoubleType DOUBLE_TYPE = new DoubleType();
39     static final TopType TOP_TYPE = new TopType();
40     static final NullType NULL_TYPE = new NullType();
41     static final UninitializedThisType UNINITIALIZED_THIS_TYPE = new UninitializedThisType();
42
43
44     /**
45      * Creates a new IntegerType.
46      */

47     public static IntegerType createIntegerType()
48     {
49         return INTEGER_TYPE;
50     }
51
52     /**
53      * Creates a new LongType.
54      */

55     public static LongType createLongType()
56     {
57         return LONG_TYPE;
58     }
59
60     /**
61      * Creates a new FloatType.
62      */

63     public static FloatType createFloatType()
64     {
65         return FLOAT_TYPE;
66     }
67
68     /**
69      * Creates a new DoubleType.
70      */

71     public static DoubleType createDoubleType()
72     {
73         return DOUBLE_TYPE;
74     }
75
76     /**
77      * Creates a new TopType.
78      */

79     public static TopType createTopType()
80     {
81         return TOP_TYPE;
82     }
83
84     /**
85      * Creates a new NullType.
86      */

87     public static NullType createNullType()
88     {
89         return NULL_TYPE;
90     }
91
92     /**
93      * Creates a new UninitializedThisType.
94      */

95     public static UninitializedThisType createUninitializedThisType()
96     {
97         return UNINITIALIZED_THIS_TYPE;
98     }
99
100     /**
101      * Creates a new UninitializedType for an instance that was created at
102      * the given offset.
103      */

104     public static UninitializedType createUninitializedType(int newInstructionOffset)
105     {
106         return new UninitializedType(newInstructionOffset);
107     }
108
109     /**
110      * Creates a new ObjectType of the given type.
111      */

112     public static ObjectType createObjectType(int classIndex)
113     {
114         return new ObjectType(classIndex);
115     }
116 }
117
Popular Tags