View Javadoc

1   /*
2    * Copyright  2000-2004 The Apache Software Foundation
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.apache.bcel.verifier.structurals;
18  
19  
20  import org.apache.bcel.Constants;
21  import org.apache.bcel.generic.ObjectType;
22  import org.apache.bcel.generic.ReferenceType;
23  
24  /***
25   * This class represents an uninitialized object type; see The Java
26   * Virtual Machine Specification, Second Edition, page 147: 4.9.4 for
27   * more details.
28   *
29   * @version $Id: UninitializedObjectType.java 386056 2006-03-15 11:31:56Z tcurdt $
30   * @author Enver Haase
31   */
32  public class UninitializedObjectType extends ReferenceType implements Constants{
33  
34  	/*** The "initialized" version. */
35  	private ObjectType initialized;
36  	
37  	/*** Creates a new instance. */
38  	public UninitializedObjectType(ObjectType t){
39  		super(T_UNKNOWN, "<UNINITIALIZED OBJECT OF TYPE '"+t.getClassName()+"'>");
40  		initialized = t;
41  	}
42  
43  	/***
44  	 * Returns the ObjectType of the same class as the one of the uninitialized object
45  	 * represented by this UninitializedObjectType instance.
46  	 */
47  	public ObjectType getInitialized(){
48  		return initialized;
49  	}
50  
51  	/*** @return a hash code value for the object.
52       */
53  	public int hashCode() { return initialized.hashCode(); }
54  
55  	/***
56  	 * Returns true on equality of this and o.
57  	 * Equality means the ObjectType instances of "initialized"
58  	 * equal one another in this and the o instance.
59  	 *
60  	 */
61  	public boolean equals(Object o){
62  		if (! (o instanceof UninitializedObjectType)) {
63              return false;
64          }
65  		return initialized.equals(((UninitializedObjectType)o).initialized);
66  	}
67  }