37 import com.sun.tools.javac.util.Assert; |
37 import com.sun.tools.javac.util.Assert; |
38 import com.sun.tools.javac.util.Filter; |
38 import com.sun.tools.javac.util.Filter; |
39 import com.sun.tools.javac.util.Name; |
39 import com.sun.tools.javac.util.Name; |
40 |
40 |
41 import java.util.*; |
41 import java.util.*; |
|
42 |
|
43 import com.sun.tools.javac.util.DefinedBy; |
|
44 import com.sun.tools.javac.util.DefinedBy.Api; |
42 |
45 |
43 /** An internal structure that corresponds to the constant pool of a classfile. |
46 /** An internal structure that corresponds to the constant pool of a classfile. |
44 * |
47 * |
45 * <p><b>This is NOT part of any supported API. |
48 * <p><b>This is NOT part of any supported API. |
46 * If you write code that depends on this, you do so at your own risk. |
49 * If you write code that depends on this, you do so at your own risk. |
153 UniqueType uniqueType; |
156 UniqueType uniqueType; |
154 Method(MethodSymbol m, Types types) { |
157 Method(MethodSymbol m, Types types) { |
155 super(m); |
158 super(m); |
156 this.uniqueType = new UniqueType(m.type, types); |
159 this.uniqueType = new UniqueType(m.type, types); |
157 } |
160 } |
|
161 @DefinedBy(Api.LANGUAGE_MODEL) |
158 public boolean equals(Object any) { |
162 public boolean equals(Object any) { |
159 if (!(any instanceof Method)) return false; |
163 if (!(any instanceof Method)) return false; |
160 MethodSymbol o = ((Method)any).other; |
164 MethodSymbol o = ((Method)any).other; |
161 MethodSymbol m = this.other; |
165 MethodSymbol m = this.other; |
162 return |
166 return |
163 o.name == m.name && |
167 o.name == m.name && |
164 o.owner == m.owner && |
168 o.owner == m.owner && |
165 ((Method)any).uniqueType.equals(uniqueType); |
169 ((Method)any).uniqueType.equals(uniqueType); |
166 } |
170 } |
|
171 @DefinedBy(Api.LANGUAGE_MODEL) |
167 public int hashCode() { |
172 public int hashCode() { |
168 MethodSymbol m = this.other; |
173 MethodSymbol m = this.other; |
169 return |
174 return |
170 m.name.hashCode() * 33 + |
175 m.name.hashCode() * 33 + |
171 m.owner.hashCode() * 9 + |
176 m.owner.hashCode() * 9 + |
179 DynamicMethod(DynamicMethodSymbol m, Types types) { |
184 DynamicMethod(DynamicMethodSymbol m, Types types) { |
180 super(m, types); |
185 super(m, types); |
181 uniqueStaticArgs = getUniqueTypeArray(m.staticArgs, types); |
186 uniqueStaticArgs = getUniqueTypeArray(m.staticArgs, types); |
182 } |
187 } |
183 |
188 |
184 @Override |
189 @Override @DefinedBy(Api.LANGUAGE_MODEL) |
185 public boolean equals(Object any) { |
190 public boolean equals(Object any) { |
186 if (!super.equals(any)) return false; |
191 if (!super.equals(any)) return false; |
187 if (!(any instanceof DynamicMethod)) return false; |
192 if (!(any instanceof DynamicMethod)) return false; |
188 DynamicMethodSymbol dm1 = (DynamicMethodSymbol)other; |
193 DynamicMethodSymbol dm1 = (DynamicMethodSymbol)other; |
189 DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)any).other; |
194 DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)any).other; |
191 dm1.bsmKind == dm2.bsmKind && |
196 dm1.bsmKind == dm2.bsmKind && |
192 Arrays.equals(uniqueStaticArgs, |
197 Arrays.equals(uniqueStaticArgs, |
193 ((DynamicMethod)any).uniqueStaticArgs); |
198 ((DynamicMethod)any).uniqueStaticArgs); |
194 } |
199 } |
195 |
200 |
196 @Override |
201 @Override @DefinedBy(Api.LANGUAGE_MODEL) |
197 public int hashCode() { |
202 public int hashCode() { |
198 int hash = super.hashCode(); |
203 int hash = super.hashCode(); |
199 DynamicMethodSymbol dm = (DynamicMethodSymbol)other; |
204 DynamicMethodSymbol dm = (DynamicMethodSymbol)other; |
200 hash += dm.bsmKind * 7 + |
205 hash += dm.bsmKind * 7 + |
201 dm.bsm.hashCode() * 11; |
206 dm.bsm.hashCode() * 11; |
222 UniqueType uniqueType; |
227 UniqueType uniqueType; |
223 Variable(VarSymbol v, Types types) { |
228 Variable(VarSymbol v, Types types) { |
224 super(v); |
229 super(v); |
225 this.uniqueType = new UniqueType(v.type, types); |
230 this.uniqueType = new UniqueType(v.type, types); |
226 } |
231 } |
|
232 @DefinedBy(Api.LANGUAGE_MODEL) |
227 public boolean equals(Object any) { |
233 public boolean equals(Object any) { |
228 if (!(any instanceof Variable)) return false; |
234 if (!(any instanceof Variable)) return false; |
229 VarSymbol o = ((Variable)any).other; |
235 VarSymbol o = ((Variable)any).other; |
230 VarSymbol v = other; |
236 VarSymbol v = other; |
231 return |
237 return |
232 o.name == v.name && |
238 o.name == v.name && |
233 o.owner == v.owner && |
239 o.owner == v.owner && |
234 ((Variable)any).uniqueType.equals(uniqueType); |
240 ((Variable)any).uniqueType.equals(uniqueType); |
235 } |
241 } |
|
242 @DefinedBy(Api.LANGUAGE_MODEL) |
236 public int hashCode() { |
243 public int hashCode() { |
237 VarSymbol v = other; |
244 VarSymbol v = other; |
238 return |
245 return |
239 v.name.hashCode() * 33 + |
246 v.name.hashCode() * 33 + |
240 v.owner.hashCode() * 9 + |
247 v.owner.hashCode() * 9 + |