@Override public boolean isFunctionalInterface(Scope scope) { MethodBinding method; return isInterface() && (method = getSingleAbstractMethod(scope, true)) != null && method.isValidBinding(); }
public MethodBinding findExactMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes, null); if (exactMethod != null){ if (receiverType.isInterface() || canBeSeenByForCodeSnippet(exactMethod, receiverType, invocationSite, this)) return exactMethod; } return null; } // Internal use only
@Override public MethodBinding findExactMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes, null); if (exactMethod != null){ if (receiverType.isInterface() || canBeSeenByForCodeSnippet(exactMethod, receiverType, invocationSite, this)) return exactMethod; } return null; } // Internal use only
public MethodBinding findExactMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes, null); if (exactMethod != null){ if (receiverType.isInterface() || canBeSeenByForCodeSnippet(exactMethod, receiverType, invocationSite, this)) return exactMethod; } return null; } // Internal use only
public MethodBinding findExactMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes, null); if (exactMethod != null){ if (receiverType.isInterface() || canBeSeenByForCodeSnippet(exactMethod, receiverType, invocationSite, this)) return exactMethod; } return null; } // Internal use only
private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList<MethodBinding> collector) { if (!binding.isInterface()) return; MethodBinding[] methodBindings = binding.methods(); for (int i = 0, max = methodBindings.length; i < max; i++) { collector.add(methodBindings[i]); } ReferenceBinding[] superInterfaces = binding.superInterfaces(); for (int i = 0, max = superInterfaces.length; i < max; i++) { getAllInheritedMethods0(superInterfaces[i], collector); } }
private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList<MethodBinding> collector) { if (!binding.isInterface()) return; MethodBinding[] methodBindings = binding.methods(); for (int i = 0, max = methodBindings.length; i < max; i++) { collector.add(methodBindings[i]); } ReferenceBinding[] superInterfaces = binding.superInterfaces(); for (int i = 0, max = superInterfaces.length; i < max; i++) { getAllInheritedMethods0(superInterfaces[i], collector); } }
private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList<MethodBinding> collector) { if (!binding.isInterface()) return; MethodBinding[] methodBindings = binding.methods(); for (int i = 0, max = methodBindings.length; i < max; i++) { collector.add(methodBindings[i]); } ReferenceBinding[] superInterfaces = binding.superInterfaces(); for (int i = 0, max = superInterfaces.length; i < max; i++) { getAllInheritedMethods0(superInterfaces[i], collector); } }
private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList collector) { if (!binding.isInterface()) return; MethodBinding[] methodBindings = binding.methods(); for (int i = 0, max = methodBindings.length; i < max; i++) { collector.add(methodBindings[i]); } ReferenceBinding[] superInterfaces = binding.superInterfaces(); for (int i = 0, max = superInterfaces.length; i < max; i++) { getAllInheritedMethods0(superInterfaces[i], collector); } }
boolean isInterfaceMethodImplemented(MethodBinding inheritedMethod, MethodBinding existingMethod, ReferenceBinding superType) { if (inheritedMethod.original() != inheritedMethod && existingMethod.declaringClass.isInterface()) return false; // must hold onto ParameterizedMethod to see if a bridge method is necessary inheritedMethod = computeSubstituteMethod(inheritedMethod, existingMethod); return inheritedMethod != null && (TypeBinding.equalsEquals(inheritedMethod.returnType, existingMethod.returnType) // need to keep around to produce bridge methods? ... || (TypeBinding.notEquals(this.type, existingMethod.declaringClass) // ... not if inheriting the bridge situation from a superclass && !existingMethod.declaringClass.isInterface())) && doesMethodOverride(existingMethod, inheritedMethod); } public boolean isMethodSubsignature(MethodBinding method, MethodBinding inheritedMethod) {
boolean isInterfaceMethodImplemented(MethodBinding inheritedMethod, MethodBinding existingMethod, ReferenceBinding superType) { if (inheritedMethod.original() != inheritedMethod && existingMethod.declaringClass.isInterface()) return false; // must hold onto ParameterizedMethod to see if a bridge method is necessary inheritedMethod = computeSubstituteMethod(inheritedMethod, existingMethod); if (inheritedMethod == null || !doesMethodOverride(existingMethod, inheritedMethod)) return false; return TypeBinding.equalsEquals(inheritedMethod.returnType, existingMethod.returnType) || (TypeBinding.notEquals(this.type, existingMethod.declaringClass) // ... not if inheriting the bridge situation from a superclass && !existingMethod.declaringClass.isInterface() && areReturnTypesCompatible(existingMethod, inheritedMethod)); // may have to report incompatible return type } public boolean isMethodSubsignature(MethodBinding method, MethodBinding inheritedMethod) {
boolean isInterfaceMethodImplemented(MethodBinding inheritedMethod, MethodBinding existingMethod, ReferenceBinding superType) { if (inheritedMethod.original() != inheritedMethod && existingMethod.declaringClass.isInterface()) return false; // must hold onto ParameterizedMethod to see if a bridge method is necessary inheritedMethod = computeSubstituteMethod(inheritedMethod, existingMethod); return inheritedMethod != null && inheritedMethod.returnType == existingMethod.returnType // keep around to produce bridge methods && doesMethodOverride(existingMethod, inheritedMethod); } public boolean isMethodSubsignature(MethodBinding method, MethodBinding inheritedMethod) {
@Override public Set<Modifier> getModifiers() { ReferenceBinding refBinding = (ReferenceBinding)_binding; int modifiers = refBinding.modifiers; if (refBinding.isInterface() && refBinding.isNestedType()) { modifiers |= ClassFileConstants.AccStatic; } return Factory.getModifiers(modifiers, getKind(), refBinding.isBinaryBinding()); }
@Override public Set<Modifier> getModifiers() { ReferenceBinding refBinding = (ReferenceBinding)_binding; int modifiers = refBinding.modifiers; if (refBinding.isInterface() && refBinding.isNestedType()) { modifiers |= ClassFileConstants.AccStatic; } return Factory.getModifiers(modifiers, getKind(), refBinding.isBinaryBinding()); }
@Override public Set<Modifier> getModifiers() { ReferenceBinding refBinding = (ReferenceBinding)_binding; int modifiers = refBinding.modifiers; if (refBinding.isInterface() && refBinding.isNestedType()) { modifiers |= ClassFileConstants.AccStatic; } return Factory.getModifiers(modifiers, getKind(), refBinding.isBinaryBinding()); }
@Override public TypeMirror getSuperclass() { ReferenceBinding binding = (ReferenceBinding)_binding; ReferenceBinding superBinding = binding.superclass(); if (null == superBinding || binding.isInterface()) { return _env.getFactory().getNoType(TypeKind.NONE); } // superclass of a type must be a DeclaredType return _env.getFactory().newTypeMirror(superBinding); }
@Override public TypeMirror getSuperclass() { ReferenceBinding binding = (ReferenceBinding)_binding; ReferenceBinding superBinding = binding.superclass(); if (null == superBinding || binding.isInterface()) { return _env.getFactory().getNoType(TypeKind.NONE); } // superclass of a type must be a DeclaredType return _env.getFactory().newTypeMirror(superBinding); }
public int literalIndexForMethodHandle(MethodBinding binding) { boolean isInterface = binding.declaringClass.isInterface(); int referenceKind = isInterface ? binding.isStatic() ? MethodHandleRefKindInvokeStatic : binding.isPrivate() ? MethodHandleRefKindInvokeSpecial : MethodHandleRefKindInvokeInterface : binding.isConstructor() ? MethodHandleRefKindNewInvokeSpecial : binding.isStatic() ? MethodHandleRefKindInvokeStatic : MethodHandleRefKindInvokeVirtual; return literalIndexForMethodHandle(referenceKind, binding.declaringClass, binding.selector, binding.signature(), isInterface); }
public int literalIndexForMethodHandle(MethodBinding binding) { boolean isInterface = binding.declaringClass.isInterface(); int referenceKind = isInterface ? binding.isStatic() ? MethodHandleRefKindInvokeStatic : binding.isPrivate() ? MethodHandleRefKindInvokeSpecial : MethodHandleRefKindInvokeInterface : binding.isConstructor() ? MethodHandleRefKindNewInvokeSpecial : binding.isStatic() ? MethodHandleRefKindInvokeStatic : binding.isPrivate() ? MethodHandleRefKindInvokeSpecial : MethodHandleRefKindInvokeVirtual; return literalIndexForMethodHandle(referenceKind, binding.declaringClass, binding.selector, binding.signature(), isInterface); }
public int literalIndexForMethodHandle(MethodBinding binding) { boolean isInterface = binding.declaringClass.isInterface(); int referenceKind = isInterface ? binding.isStatic() ? MethodHandleRefKindInvokeStatic : binding.isPrivate() ? MethodHandleRefKindInvokeSpecial : MethodHandleRefKindInvokeInterface : binding.isConstructor() ? MethodHandleRefKindNewInvokeSpecial : binding.isStatic() ? MethodHandleRefKindInvokeStatic : binding.isPrivate() ? MethodHandleRefKindInvokeSpecial : MethodHandleRefKindInvokeVirtual; return literalIndexForMethodHandle(referenceKind, binding.declaringClass, binding.selector, binding.signature(), isInterface); }