public static RuntimeException rawMethodBindingFailure(final MethodBase method) { return new IllegalStateException( format( "Could not bind to runtime method '%s' on type '%s'.", method.getDescription(), method.getDeclaringType().toString() ) ); }
public static RuntimeException rawMethodBindingFailure(final MethodBase method) { return new IllegalStateException( format( "Could not bind to runtime method '%s' on type '%s'.", method.getDescription(), method.getDeclaringType().toString() ) ); }
public static RuntimeException rawMethodBindingFailure(final MethodBase method) { return new IllegalStateException( format( "Could not bind to runtime method '%s' on type '%s'.", method.getDescription(), method.getDeclaringType().toString() ) ); }
static MethodBase findMostDerivedNewSlotMethod(final MethodBase[] match, final int cMatches) { int deepestHierarchy = 0; MethodBase methodWithDeepestHierarchy = null; for (int i = 0; i < cMatches; i++) { // Calculate the depth of the hierarchy of the declaring type of the // current method. final int currentHierarchyDepth = getHierarchyDepth(match[i].getDeclaringType()); // The two methods have the same name, signature, and hierarchy depth. // This can only happen if at least one is vararg or generic. if (currentHierarchyDepth == deepestHierarchy) { throw Error.ambiguousMatch(); } // Check to see if this method is on the most derived class. if (currentHierarchyDepth > deepestHierarchy) { deepestHierarchy = currentHierarchyDepth; methodWithDeepestHierarchy = match[i]; } } return methodWithDeepestHierarchy; }
static MethodBase findMostDerivedNewSlotMethod(final MethodBase[] match, final int cMatches) { int deepestHierarchy = 0; MethodBase methodWithDeepestHierarchy = null; for (int i = 0; i < cMatches; i++) { // Calculate the depth of the hierarchy of the declaring type of the // current method. final int currentHierarchyDepth = getHierarchyDepth(match[i].getDeclaringType()); // The two methods have the same name, signature, and hierarchy depth. // This can only happen if at least one is vararg or generic. if (currentHierarchyDepth == deepestHierarchy) { throw Error.ambiguousMatch(); } // Check to see if this method is on the most derived class. if (currentHierarchyDepth > deepestHierarchy) { deepestHierarchy = currentHierarchyDepth; methodWithDeepestHierarchy = match[i]; } } return methodWithDeepestHierarchy; }
static MethodBase findMostDerivedNewSlotMethod(final MethodBase[] match, final int cMatches) { int deepestHierarchy = 0; MethodBase methodWithDeepestHierarchy = null; for (int i = 0; i < cMatches; i++) { // Calculate the depth of the hierarchy of the declaring type of the // current method. final int currentHierarchyDepth = getHierarchyDepth(match[i].getDeclaringType()); // The two methods have the same name, signature, and hierarchy depth. // This can only happen if at least one is vararg or generic. if (currentHierarchyDepth == deepestHierarchy) { throw Error.ambiguousMatch(); } // Check to see if this method is on the most derived class. if (currentHierarchyDepth > deepestHierarchy) { deepestHierarchy = currentHierarchyDepth; methodWithDeepestHierarchy = match[i]; } } return methodWithDeepestHierarchy; }
short getMethodToken(final MethodBase method) { VerifyArgument.notNull(method, "method"); if (method.getDeclaringType().isInterface()) { return (short) (constantPool.getInterfaceMethodReference((MethodInfo) method).index & 0xFFFF); } return (short) (constantPool.getMethodReference(method).index & 0xFFFF); }
public MethodReference getMethodReference(final MethodBase method) { final TypeInfo typeInfo = getTypeInfo(method.getDeclaringType()); final NameAndTypeDescriptor nameAndDescriptor = getNameAndTypeDescriptor( method.getName(), method.getErasedSignature() ); _lookupKey.set(Tag.MethodReference, typeInfo.index, nameAndDescriptor.index); Entry entry = _entryMap.get(_lookupKey); if (entry == null) { entry = new MethodReference(this, typeInfo.index, nameAndDescriptor.index); } _lookupKey.clear(); return (MethodReference)entry; }
public MethodReference getMethodReference(final MethodBase method) { final TypeInfo typeInfo = getTypeInfo(method.getDeclaringType()); final NameAndTypeDescriptor nameAndDescriptor = getNameAndTypeDescriptor( method.getName(), method.getErasedSignature() ); _lookupKey.set(Tag.MethodReference, typeInfo.index, nameAndDescriptor.index); Entry entry = _entryMap.get(_lookupKey); if (entry == null) { entry = new MethodReference(this, typeInfo.index, nameAndDescriptor.index); } _lookupKey.clear(); return (MethodReference)entry; }
public MethodReference getMethodReference(final MethodBase method) { final TypeInfo typeInfo = getTypeInfo(method.getDeclaringType()); final NameAndTypeDescriptor nameAndDescriptor = getNameAndTypeDescriptor( method.getName(), method.getErasedSignature() ); _lookupKey.set(Tag.MethodReference, typeInfo.index, nameAndDescriptor.index); Entry entry = _entryMap.get(_lookupKey); if (entry == null) { entry = new MethodReference(this, typeInfo.index, nameAndDescriptor.index); } _lookupKey.clear(); return (MethodReference)entry; }
private static MethodBase erase(final MethodBase m) { if (m instanceof MethodInfo) { return ((MethodInfo) m).getErasedMethodDefinition(); } if (!m.getDeclaringType().isGenericType()) { return m; } final Type<?> erasedType = erase(m.getDeclaringType()); final Object rawMethod = ((ConstructorInfo) m).getRawConstructor(); final MemberList<?> members = erasedType.findMembers( MemberType.constructorsOnly(), BindingFlags.AllDeclared, Type.FilterRawMember, rawMethod ); if (!members.isEmpty()) { return (MethodBase) members.get(0); } throw ContractUtils.unreachable(); }
short getMethodToken(final MethodBase method) { VerifyArgument.notNull(method, "method"); if (method.getDeclaringType().isInterface()) { return (short) (constantPool.getInterfaceMethodReference((MethodInfo) erase(method)).index & 0xFFFF); } return (short) (constantPool.getMethodReference(erase(method)).index & 0xFFFF); }
short getMethodToken(final MethodBase method) { VerifyArgument.notNull(method, "method"); if (method.getDeclaringType().isInterface()) { return (short) (constantPool.getInterfaceMethodReference((MethodInfo) erase(method)).index & 0xFFFF); } return (short) (constantPool.getMethodReference(erase(method)).index & 0xFFFF); }
private static MethodBase erase(final MethodBase m) { if (m instanceof MethodInfo) { return ((MethodInfo) m).getErasedMethodDefinition(); } if (!m.getDeclaringType().isGenericType()) { return m; } final Type<?> erasedType = erase(m.getDeclaringType()); final Object rawMethod = ((ConstructorInfo) m).getRawConstructor(); final MemberList<?> members = erasedType.findMembers( MemberType.constructorsOnly(), BindingFlags.AllDeclared, Type.FilterRawMember, rawMethod ); if (!members.isEmpty()) { return (MethodBase) members.get(0); } throw ContractUtils.unreachable(); }
private int writeEnclosingMethodAttribute(final TypeBuilder<?> t) { final MethodBase method = t.getDeclaringMethod(); if (method == null) { return 0; } final int enclosingMethodStart = writeAttribute("EnclosingMethod"); final Type declaringType = method.getDeclaringType(); _dataBuffer.putShort(declaringType != null ? t.getTypeToken(declaringType) : 0); _dataBuffer.putShort(t.getMethodToken(method)); endAttribute(enclosingMethodStart); return 1; }
private int writeEnclosingMethodAttribute(final TypeBuilder<?> t) { final MethodBase method = t.getDeclaringMethod(); if (method == null) { return 0; } final int enclosingMethodStart = writeAttribute("EnclosingMethod"); final Type declaringType = method.getDeclaringType(); _dataBuffer.putShort(declaringType != null ? t.getTypeToken(declaringType) : 0); _dataBuffer.putShort(t.getMethodToken(method)); endAttribute(enclosingMethodStart); return 1; }
private int writeEnclosingMethodAttribute(final TypeBuilder<?> t) { final MethodBase method = t.getDeclaringMethod(); if (method == null) { return 0; } final int enclosingMethodStart = writeAttribute("EnclosingMethod"); final Type declaringType = method.getDeclaringType(); _dataBuffer.putShort(declaringType != null ? t.getTypeToken(declaringType) : 0); _dataBuffer.putShort(t.getMethodToken(method)); endAttribute(enclosingMethodStart); return 1; }
private void writeInnerTypeInfo(final Type<?> type) { final Type declaringType = type.getDeclaringType(); final MethodBase declaringMethod = type.getDeclaringMethod(); _dataBuffer.putShort(_typeBuilder.getTypeToken(type)); if (declaringType != null) { _dataBuffer.putShort(_typeBuilder.getTypeToken(declaringType)); } else if (declaringMethod != null) { final Type methodDeclaringType = declaringMethod.getDeclaringType(); if (methodDeclaringType != null) { _dataBuffer.putShort(_typeBuilder.getTypeToken(methodDeclaringType)); } else { _dataBuffer.putShort(0); } } final String shortName = type.getShortName(); if (StringUtilities.isNullOrWhitespace(shortName)) { _dataBuffer.putShort(0); } else { _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(shortName)); } _dataBuffer.putShort(type.getModifiers() & Flags.MemberClassFlags); }
private void writeInnerTypeInfo(final Type<?> type) { final Type declaringType = type.getDeclaringType(); final MethodBase declaringMethod = type.getDeclaringMethod(); _dataBuffer.putShort(_typeBuilder.getTypeToken(type)); if (declaringType != null) { _dataBuffer.putShort(_typeBuilder.getTypeToken(declaringType)); } else if (declaringMethod != null) { final Type methodDeclaringType = declaringMethod.getDeclaringType(); if (methodDeclaringType != null) { _dataBuffer.putShort(_typeBuilder.getTypeToken(methodDeclaringType)); } else { _dataBuffer.putShort(0); } } final String shortName = type.getShortName(); if (StringUtilities.isNullOrWhitespace(shortName)) { _dataBuffer.putShort(0); } else { _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(shortName)); } _dataBuffer.putShort(type.getModifiers() & Flags.MemberClassFlags); }
private void writeInnerTypeInfo(final Type<?> type) { final Type declaringType = type.getDeclaringType(); final MethodBase declaringMethod = type.getDeclaringMethod(); _dataBuffer.putShort(_typeBuilder.getTypeToken(type)); if (declaringType != null) { _dataBuffer.putShort(_typeBuilder.getTypeToken(declaringType)); } else if (declaringMethod != null) { final Type methodDeclaringType = declaringMethod.getDeclaringType(); if (methodDeclaringType != null) { _dataBuffer.putShort(_typeBuilder.getTypeToken(methodDeclaringType)); } else { _dataBuffer.putShort(0); } } final String shortName = type.getShortName(); if (StringUtilities.isNullOrWhitespace(shortName)) { _dataBuffer.putShort(0); } else { _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(shortName)); } _dataBuffer.putShort(type.getModifiers() & Flags.MemberClassFlags); }