langtools/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java
changeset 14949 45f43822bbde
parent 14550 284da8fb4eaf
child 24606 12c0ca21f8dc
equal deleted inserted replaced
14948:6a2008d8e9ba 14949:45f43822bbde
    24  */
    24  */
    25 
    25 
    26 package com.sun.tools.javac.jvm;
    26 package com.sun.tools.javac.jvm;
    27 
    27 
    28 import com.sun.tools.javac.code.Type;
    28 import com.sun.tools.javac.code.Type;
       
    29 import com.sun.tools.javac.code.Types;
       
    30 import com.sun.tools.javac.code.Types.UniqueType;
    29 import com.sun.tools.javac.util.Name;
    31 import com.sun.tools.javac.util.Name;
    30 
    32 
    31 
    33 
    32 /** A JVM class file.
    34 /** A JVM class file.
    33  *
    35  *
   164 
   166 
   165     /** A class for the name-and-type signature of a method or field.
   167     /** A class for the name-and-type signature of a method or field.
   166      */
   168      */
   167     public static class NameAndType {
   169     public static class NameAndType {
   168         Name name;
   170         Name name;
   169         Type type;
   171         UniqueType uniqueType;
       
   172         Types types;
   170 
   173 
   171         NameAndType(Name name, Type type) {
   174         NameAndType(Name name, Type type, Types types) {
   172             this.name = name;
   175             this.name = name;
   173             this.type = type;
   176             this.uniqueType = new UniqueType(type, types);
       
   177             this.types = types;
   174         }
   178         }
   175 
   179 
   176         public boolean equals(Object other) {
   180         void setType(Type type) {
   177             return
   181             this.uniqueType = new UniqueType(type, types);
   178                 other instanceof NameAndType &&
       
   179                 name == ((NameAndType) other).name &&
       
   180                 type.equals(((NameAndType) other).type);
       
   181         }
   182         }
   182 
   183 
       
   184         @Override
       
   185         public boolean equals(Object other) {
       
   186             return (other instanceof NameAndType &&
       
   187                     name == ((NameAndType) other).name &&
       
   188                         uniqueType.equals(((NameAndType) other).uniqueType));
       
   189         }
       
   190 
       
   191         @Override
   183         public int hashCode() {
   192         public int hashCode() {
   184             return name.hashCode() * type.hashCode();
   193             return name.hashCode() * uniqueType.hashCode();
   185         }
   194         }
   186     }
   195     }
   187 }
   196 }