public bool Equals(InvokeDynamicInfo x, InvokeDynamicInfo y) { if (ReferenceEquals(x, y)) { return(true); } if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) { return(false); } return(x.NameAndTypeIndex == y.NameAndTypeIndex && x.BootstrapMethodIndex == y.BootstrapMethodIndex); }
public int GetDynamicInvocationIndex(DynamicInvocation invocation, int bootstrapIndex) { var info = new InvokeDynamicInfo { BootstrapMethodIndex = (ushort)bootstrapIndex, NameAndTypeIndex = (ushort)GetNameAndTypeIndex(invocation.MethodName, invocation.MethodDescriptor) }; if (!_dynamicInfos.TryGetValue(info, out int index)) { index = AddConstant(info); _dynamicInfos.Add(info, index); } return(index); }
internal DynamicInvocation(JavaClassImage image, InvokeDynamicInfo dynamicInfo) { _bootstrapMethod = new LazyValue <BootstrapMethod>( () => image.ResolveBootstrapMethod(dynamicInfo.BootstrapMethodIndex)); if (image.ClassFile.ConstantPool.ResolveConstant(dynamicInfo.NameAndTypeIndex) is NameAndTypeInfo nameAndType) { _methodName = new LazyValue <string>( () => image.ClassFile.ConstantPool.ResolveString(nameAndType.NameIndex)); _methodDescriptor = new LazyValue <MethodDescriptor>( () => MethodDescriptor.FromString(image.ClassFile.ConstantPool.ResolveString(nameAndType.DescriptorIndex))); } else { _methodName = new LazyValue <string>(); _methodDescriptor = new LazyValue <MethodDescriptor>(); } }
public int GetHashCode(InvokeDynamicInfo obj) { return((obj.BootstrapMethodIndex << 16) | obj.NameAndTypeIndex); }
protected bool Equals(InvokeDynamicInfo other) { return(BootstrapMethodIndex == other.BootstrapMethodIndex && NameAndTypeIndex == other.NameAndTypeIndex); }