use of org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope in project lombok by rzwitserloot.
the class PatchExtensionMethod method getApplicableExtensionMethodsDefinedInProvider.
private static List<MethodBinding> getApplicableExtensionMethodsDefinedInProvider(EclipseNode typeNode, ReferenceBinding extensionMethodProviderBinding, TypeBinding receiverType) {
List<MethodBinding> extensionMethods = new ArrayList<MethodBinding>();
CompilationUnitScope cuScope = ((CompilationUnitDeclaration) typeNode.top().get()).scope;
for (MethodBinding method : extensionMethodProviderBinding.methods()) {
if (!method.isStatic())
continue;
if (!method.isPublic())
continue;
if (method.parameters == null || method.parameters.length == 0)
continue;
TypeBinding firstArgType = method.parameters[0];
if (receiverType.isProvablyDistinct(firstArgType) && !receiverType.isCompatibleWith(firstArgType.erasure()))
continue;
TypeBinding[] argumentTypes = Arrays.copyOfRange(method.parameters, 1, method.parameters.length);
if ((receiverType instanceof ReferenceBinding) && ((ReferenceBinding) receiverType).getExactMethod(method.selector, argumentTypes, cuScope) != null)
continue;
extensionMethods.add(method);
}
return extensionMethods;
}
Aggregations