677 }
678
679 /** Get the definition of this member name.
680 * This may be in a super-class of the declaring class of this member.
681 */
682 public MemberName getDefinition() {
683 if (!isResolved()) throw new IllegalStateException("must be resolved: "+this);
684 if (isType()) return this;
685 MemberName res = this.clone();
686 res.clazz = null;
687 res.type = null;
688 res.name = null;
689 res.resolution = res;
690 res.expandFromVM();
691 assert(res.getName().equals(this.getName()));
692 return res;
693 }
694
695 @Override
696 public int hashCode() {
697 return Objects.hash(clazz, getReferenceKind(), name, getType());
698 }
699 @Override
700 public boolean equals(Object that) {
701 return (that instanceof MemberName && this.equals((MemberName)that));
702 }
703
704 /** Decide if two member names have exactly the same symbolic content.
705 * Does not take into account any actual class members, so even if
706 * two member names resolve to the same actual member, they may
707 * be distinct references.
708 */
709 public boolean equals(MemberName that) {
710 if (this == that) return true;
711 if (that == null) return false;
712 return this.clazz == that.clazz
713 && this.getReferenceKind() == that.getReferenceKind()
714 && Objects.equals(this.name, that.name)
715 && Objects.equals(this.getType(), that.getType());
716 }
717
718 // Construction from symbolic parts, for queries:
|
677 }
678
679 /** Get the definition of this member name.
680 * This may be in a super-class of the declaring class of this member.
681 */
682 public MemberName getDefinition() {
683 if (!isResolved()) throw new IllegalStateException("must be resolved: "+this);
684 if (isType()) return this;
685 MemberName res = this.clone();
686 res.clazz = null;
687 res.type = null;
688 res.name = null;
689 res.resolution = res;
690 res.expandFromVM();
691 assert(res.getName().equals(this.getName()));
692 return res;
693 }
694
695 @Override
696 public int hashCode() {
697 int hash = 1;
698 hash = 31 * hash + Objects.hashCode(this.clazz);
699 hash = 31 * hash + Byte.hashCode(getReferenceKind());
700 hash = 31 * hash + Objects.hashCode(this.name);
701 hash = 31 * hash + Objects.hashCode(getType());
702 return hash;
703 }
704
705 @Override
706 public boolean equals(Object that) {
707 return (that instanceof MemberName && this.equals((MemberName)that));
708 }
709
710 /** Decide if two member names have exactly the same symbolic content.
711 * Does not take into account any actual class members, so even if
712 * two member names resolve to the same actual member, they may
713 * be distinct references.
714 */
715 public boolean equals(MemberName that) {
716 if (this == that) return true;
717 if (that == null) return false;
718 return this.clazz == that.clazz
719 && this.getReferenceKind() == that.getReferenceKind()
720 && Objects.equals(this.name, that.name)
721 && Objects.equals(this.getType(), that.getType());
722 }
723
724 // Construction from symbolic parts, for queries:
|