• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * ProGuard -- shrinking, optimization, obfuscation, and preverification
3  *             of Java bytecode.
4  *
5  * Copyright (c) 2002-2014 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 /**
24  * This class provides methods to create and reuse IntegerType objects.
25  *
26  * @author Eric Lafortune
27  */
28 public class VerificationTypeFactory
29 {
30     // Shared copies of Type objects, to avoid creating a lot of objects.
31     static final IntegerType           INTEGER_TYPE            = new IntegerType();
32     static final LongType              LONG_TYPE               = new LongType();
33     static final FloatType             FLOAT_TYPE              = new FloatType();
34     static final DoubleType            DOUBLE_TYPE             = new DoubleType();
35     static final TopType               TOP_TYPE                = new TopType();
36     static final NullType              NULL_TYPE               = new NullType();
37     static final UninitializedThisType UNINITIALIZED_THIS_TYPE = new UninitializedThisType();
38 
39 
40     /**
41      * Creates a new IntegerType.
42      */
createIntegerType()43     public static IntegerType createIntegerType()
44     {
45         return INTEGER_TYPE;
46     }
47 
48     /**
49      * Creates a new LongType.
50      */
createLongType()51     public static LongType createLongType()
52     {
53         return LONG_TYPE;
54     }
55 
56     /**
57      * Creates a new FloatType.
58      */
createFloatType()59     public static FloatType createFloatType()
60     {
61         return FLOAT_TYPE;
62     }
63 
64     /**
65      * Creates a new DoubleType.
66      */
createDoubleType()67     public static DoubleType createDoubleType()
68     {
69         return DOUBLE_TYPE;
70     }
71 
72     /**
73      * Creates a new TopType.
74      */
createTopType()75     public static TopType createTopType()
76     {
77         return TOP_TYPE;
78     }
79 
80     /**
81      * Creates a new NullType.
82      */
createNullType()83     public static NullType createNullType()
84     {
85         return NULL_TYPE;
86     }
87 
88     /**
89      * Creates a new UninitializedThisType.
90      */
createUninitializedThisType()91     public static UninitializedThisType createUninitializedThisType()
92     {
93         return UNINITIALIZED_THIS_TYPE;
94     }
95 
96     /**
97      * Creates a new UninitializedType for an instance that was created at
98      * the given offset.
99      */
createUninitializedType(int newInstructionOffset)100     public static UninitializedType createUninitializedType(int newInstructionOffset)
101     {
102         return new UninitializedType(newInstructionOffset);
103     }
104 
105     /**
106      * Creates a new ObjectType of the given type.
107      */
createObjectType(int classIndex)108     public static ObjectType createObjectType(int classIndex)
109     {
110         return new ObjectType(classIndex);
111     }
112 }
113