public static boolean hasReferenceEquality(final Type<?> left, final Type<?> right) { if (left.isPrimitive() || right.isPrimitive()) { return false; } // If we have an interface and a reference type then we can do // reference equality. // If we have two reference types and one is assignable to the // other then we can do reference equality. return left.isInterface() || right.isInterface() || areReferenceAssignable(left, right) || areReferenceAssignable(right, left); }
public final boolean isDefault() { if (isAbstract()) { return false; } final Type declaringType = getDeclaringType(); return declaringType != null && declaringType.isInterface(); }
public static boolean hasReferenceEquality(final Type<?> left, final Type<?> right) { if (left.isPrimitive() || right.isPrimitive()) { return false; } // If we have an interface and a reference type then we can do // reference equality. // If we have two reference types and one is assignable to the // other then we can do reference equality. return left.isInterface() || right.isInterface() || areReferenceAssignable(left, right) || areReferenceAssignable(right, left); }
public static boolean hasReferenceEquality(final Type<?> left, final Type<?> right) { if (left.isPrimitive() || right.isPrimitive()) { return false; } // If we have an interface and a reference type then we can do // reference equality. // If we have two reference types and one is assignable to the // other then we can do reference equality. return left.isInterface() || right.isInterface() || areReferenceAssignable(left, right) || areReferenceAssignable(right, left); }
public final boolean isDefault() { if (isAbstract()) { return false; } final Type declaringType = getDeclaringType(); return declaringType != null && declaringType.isInterface(); }
@Override public Type visitTypeParameter(final Type t, final Void ignored) { final Type bound = t.getExtendsBound(); if (!bound.isCompoundType() && !bound.isInterface()) { return bound; } return superType(bound); }
public final boolean isDefault() { if (isAbstract() || isStatic()) { return false; } final Type declaringType = getDeclaringType(); return declaringType != null && declaringType.isInterface(); }
@Override public Type visitTypeParameter(final Type t, final Void ignored) { final Type bound = t.getExtendsBound(); if (!bound.isCompoundType() && !bound.isInterface()) { return bound; } return superType(bound); }
@Override public Type visitTypeParameter(final Type t, final Void ignored) { final Type bound = t.getExtendsBound(); if (!bound.isCompoundType() && !bound.isInterface()) { return bound; } return superType(bound); }
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); }
@Override public ImmutableList<Type<?>> visitTypeParameter(final Type<?> t, final ImmutableList<Type<?>> list) { final Type upperBound = t.getExtendsBound(); if (upperBound.isCompoundType()) { return interfaces(upperBound); } if (upperBound.isInterface()) { return ImmutableList.<Type<?>>of(upperBound); } return ImmutableList.empty(); }
@Override public ImmutableList<Type<?>> visitTypeParameter(final Type<?> t, final ImmutableList<Type<?>> list) { final Type upperBound = t.getExtendsBound(); if (upperBound.isCompoundType()) { return interfaces(upperBound); } if (upperBound.isInterface()) { return ImmutableList.<Type<?>>of(upperBound); } return ImmutableList.empty(); }
@Override public ImmutableList<Type<?>> visitTypeParameter(final Type<?> t, final ImmutableList<Type<?>> list) { final Type upperBound = t.getExtendsBound(); if (upperBound.isCompoundType()) { return interfaces(upperBound); } if (upperBound.isInterface()) { return ImmutableList.<Type<?>>of(upperBound); } return ImmutableList.empty(); }
public void call(final MethodInfo method) { VerifyArgument.notNull(method, "method"); final OpCode opCode; if (method.isStatic()) { emit(OpCode.INVOKESTATIC, method); } else if (method.getDeclaringType().isInterface()) { emit(OpCode.INVOKEINTERFACE, method); } else { emit(OpCode.INVOKEVIRTUAL, method); } }
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); }
public void call(final MethodInfo method) { VerifyArgument.notNull(method, "method"); final OpCode opCode; if (method.isStatic()) { emit(OpCode.INVOKESTATIC, method); } else if (method.getDeclaringType().isInterface()) { emit(OpCode.INVOKEINTERFACE, method); } else { emit(OpCode.INVOKEVIRTUAL, method); } }
public static Type<?> makeCompoundType(final TypeList bounds) { VerifyArgument.notEmpty(bounds, "bounds"); VerifyArgument.noNullElements(bounds, "bounds"); final Type<?> baseType; final TypeList interfaces; if (!bounds.get(0).isInterface()) { baseType = bounds.get(0); interfaces = bounds.subList(1, bounds.size()); } else { baseType = Types.Object; interfaces = bounds; } return makeCompoundType(baseType, interfaces); }
public static Type<?> makeCompoundType(final TypeList bounds) { VerifyArgument.notEmpty(bounds, "bounds"); VerifyArgument.noNullElements(bounds, "bounds"); final Type<?> baseType; final TypeList interfaces; if (!bounds.get(0).isInterface()) { baseType = bounds.get(0); interfaces = bounds.subList(1, bounds.size()); } else { baseType = Types.Object; interfaces = bounds; } return makeCompoundType(baseType, interfaces); }
private static <T> Type<T> makeCompoundTypeCore(final Type<T> baseType, final TypeList interfaces) { if (baseType.isGenericParameter()) { throw Error.compoundTypeMayNotHaveGenericParameterBound(); } for (int i = 0, n = interfaces.size(); i < n; i++) { final Type type = interfaces.get(i); if (type.isGenericParameter()) { throw Error.compoundTypeMayNotHaveGenericParameterBound(); } if (!type.isInterface()) { throw Error.compoundTypeMayOnlyHaveOneClassBound(); } } return new CompoundType<>(interfaces, baseType); }