| 1 24 25 package org.aspectj.compiler.base.bcg.pool; 26 27 import org.aspectj.compiler.base.bcg.*; 28 29 import java.io.*; 30 import java.util.*; 31 32 import org.aspectj.compiler.base.ast.ArrayType; 33 import org.aspectj.compiler.base.ast.NameType; 34 import org.aspectj.compiler.base.ast.RefType; 35 36 public class ClassConstant extends Constant { 37 Utf8Constant name; 38 ClassConstant() {} 39 ClassConstant(Utf8Constant name) { 40 this.name = name; 41 } 42 void writeTo(DataOutputStream stream) throws IOException { 43 stream.writeByte(CLASS_TAG); 44 name.writeIndex(stream); 45 } 46 public String toString() { 47 return rep(getIndex(), 48 "(class " + name +")"); 49 } 50 public boolean equals(Object other) { 51 if (! (other instanceof ClassConstant)) return false; 52 ClassConstant o = (ClassConstant) other; 53 return name == o.name; 54 } 55 public int hashCode() { 56 return name.hashCode() + CLASS_TAG; 57 } 58 void readFrom(DataInputStream stream, ConstantPool pool) throws IOException { 59 name = (Utf8Constant) 60 pool.get(stream.readUnsignedShort(), new Utf8Constant()); 61 } 62 } 63 | Popular Tags |