< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java

Print this page

        

*** 23,32 **** --- 23,35 ---- * questions. */ package com.sun.tools.javac.jvm; + import com.sun.tools.javac.code.Type; + import com.sun.tools.javac.code.Types; + import com.sun.tools.javac.code.Types.UniqueType; import com.sun.tools.javac.util.Name; /** A JVM class file. *
*** 184,189 **** --- 187,226 ---- * which defines "internal name" to be the form using "/" instead of "." */ public static byte[] externalize(Name name) { return externalize(name.getByteArray(), name.getByteOffset(), name.getByteLength()); } + + /************************************************************************ + * Name-and-type + ***********************************************************************/ + + /** A class for the name-and-type signature of a method or field. + */ + public static class NameAndType { + Name name; + UniqueType uniqueType; + Types types; + + NameAndType(Name name, Type type, Types types) { + this.name = name; + this.uniqueType = new UniqueType(type, types); + this.types = types; + } + + void setType(Type type) { + this.uniqueType = new UniqueType(type, types); + } + + @Override + public boolean equals(Object other) { + return (other instanceof NameAndType && + name == ((NameAndType) other).name && + uniqueType.equals(((NameAndType) other).uniqueType)); + } + + @Override + public int hashCode() { + return name.hashCode() * uniqueType.hashCode(); + } + } }
< prev index next >