< prev index next >

src/java.base/share/classes/java/lang/constant/ReferenceClassDescImpl.java

Print this page
rev 58428 : [mq]: XXXXXXX-typos


  71 
  72         if (c.isPrimitive())
  73             return lookup.findClass(descriptorString());
  74         else {
  75             Class<?> clazz = lookup.findClass(internalToBinary(dropFirstAndLastChar(c.descriptorString())));
  76             for (int i = 0; i < depth; i++)
  77                 clazz = clazz.arrayType();
  78             return clazz;
  79         }
  80     }
  81 
  82     /**
  83      * Returns {@code true} if this {@linkplain ReferenceClassDescImpl} is
  84      * equal to another {@linkplain ReferenceClassDescImpl}.  Equality is
  85      * determined by the two class descriptors having equal class descriptor
  86      * strings.
  87      *
  88      * @param o the {@code ClassDesc} to compare to this
  89      *       {@code ClassDesc}
  90      * @return {@code true} if the specified {@code ClassDesc} is
  91      *      equals to this {@code ClassDesc}.
  92      */
  93     @Override
  94     public boolean equals(Object o) {
  95         if (this == o) return true;
  96         if (o == null || getClass() != o.getClass()) return false;
  97 
  98         ClassDesc constant = (ClassDesc) o;
  99         return descriptor.equals(constant.descriptorString());
 100     }
 101 
 102     @Override
 103     public int hashCode() {
 104         return descriptor.hashCode();
 105     }
 106 
 107     @Override
 108     public String toString() {
 109         return String.format("ClassDesc[%s]", displayName());
 110     }
 111 }


  71 
  72         if (c.isPrimitive())
  73             return lookup.findClass(descriptorString());
  74         else {
  75             Class<?> clazz = lookup.findClass(internalToBinary(dropFirstAndLastChar(c.descriptorString())));
  76             for (int i = 0; i < depth; i++)
  77                 clazz = clazz.arrayType();
  78             return clazz;
  79         }
  80     }
  81 
  82     /**
  83      * Returns {@code true} if this {@linkplain ReferenceClassDescImpl} is
  84      * equal to another {@linkplain ReferenceClassDescImpl}.  Equality is
  85      * determined by the two class descriptors having equal class descriptor
  86      * strings.
  87      *
  88      * @param o the {@code ClassDesc} to compare to this
  89      *       {@code ClassDesc}
  90      * @return {@code true} if the specified {@code ClassDesc} is
  91      *      equal to this {@code ClassDesc}.
  92      */
  93     @Override
  94     public boolean equals(Object o) {
  95         if (this == o) return true;
  96         if (o == null || getClass() != o.getClass()) return false;
  97 
  98         ClassDesc constant = (ClassDesc) o;
  99         return descriptor.equals(constant.descriptorString());
 100     }
 101 
 102     @Override
 103     public int hashCode() {
 104         return descriptor.hashCode();
 105     }
 106 
 107     @Override
 108     public String toString() {
 109         return String.format("ClassDesc[%s]", displayName());
 110     }
 111 }
< prev index next >