View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser;
18  
19  import org.apache.bcel.*;
20  import org.apache.bcel.generic.*;
21  
22  /**
23   * This class represents an uninitialized object type; see The Java
24   * Virtual Machine Specification, Second Edition, page 147: 4.9.4 for
25   * more details.
26   * 
27   * WARNING! These classes are a fork of the bcel verifier.
28   *
29   * @version $Id: UninitializedObjectType.java 480487 2006-11-29 08:54:42Z bayard $
30   * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
31   */
32  public class UninitializedObjectType extends ReferenceType implements Constants {
33  
34  	private static final long serialVersionUID = 1L;
35      
36      /** The "initialized" version. */
37  	private ObjectType initialized;
38  	
39  	/** Creates a new instance. */
40  	public UninitializedObjectType(ObjectType t){
41  		super(T_UNKNOWN, "<UNINITIALIZED OBJECT OF TYPE '"+t.getClassName()+"'>");
42  		initialized = t;
43  	}
44  
45  	/**
46  	 * Returns the ObjectType of the same class as the one of the uninitialized object
47  	 * represented by this UninitializedObjectType instance.
48  	 */
49  	public ObjectType getInitialized(){
50  		return initialized;
51  	}
52  
53  	/**
54  	 * Returns true on equality of this and o.
55  	 * Equality means the ObjectType instances of "initialized"
56  	 * equal one another in this and the o instance.
57  	 *
58  	 */
59  	public boolean equals(Object o){
60  		if (! (o instanceof UninitializedObjectType)) return false;
61  		return initialized.equals(((UninitializedObjectType)o).initialized);
62  	}
63  }