src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java

Print this page

        

*** 25,34 **** --- 25,35 ---- package com.sun.tools.javac.code; import java.lang.annotation.Annotation; import java.lang.annotation.Inherited; + import java.util.Arrays; import java.util.Set; import java.util.concurrent.Callable; import javax.lang.model.element.*; import javax.tools.JavaFileObject;
*** 1764,1773 **** --- 1765,1809 ---- @Override public boolean isDynamic() { return true; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + DynamicMethodSymbol that = (DynamicMethodSymbol) o; + + if (bsmKind != that.bsmKind) return false; + if (!bsm.equals(that.bsm)) return false; + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(staticArgs, that.staticArgs)) return false; + + return true; + } + + @Override + public int hashCode() { + int result = Arrays.hashCode(staticArgs); + result = 31 * result + bsm.hashCode(); + result = 31 * result + bsmKind; + return result; + } + + public Object[] getUniqueTypeArray(Types types) { + Object[] result = new Object[staticArgs.length]; + for (int i = 0; i < staticArgs.length; i++) { + if (staticArgs[i] instanceof Type) { + result[i] = new Types.UniqueType((Type)staticArgs[i], types); + } else { + result[i] = staticArgs[i]; + } + } + return result; + } } /** A class for predefined operators. */ public static class OperatorSymbol extends MethodSymbol {