javax.lang.model.util.Types.isSubsignature()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中javax.lang.model.util.Types.isSubsignature()方法的一些代码示例,展示了Types.isSubsignature()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.isSubsignature()方法的具体详情如下:
包路径:javax.lang.model.util.Types
类名称:Types
方法名:isSubsignature

Types.isSubsignature介绍

[英]Tests whether the signature of one method is a subsignature of another.
[中]测试一个方法的签名是否是另一个方法的子签名。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

|| state.types.isSubsignature(domainMethod, (ExecutableType) found.asType())) {
found = domainMethodElement;

代码示例来源:origin: org.uberfire/uberfire-workbench-processors

@Override
public boolean isSubsignature(ExecutableType arg0,
               ExecutableType arg1) {
  return realImpl.isSubsignature(arg0,
                  arg1);
}

代码示例来源:origin: kiegroup/appformer

@Override
public boolean isSubsignature(ExecutableType arg0,
               ExecutableType arg1) {
  return realImpl.isSubsignature(arg0,
                  arg1);
}

代码示例来源:origin: org.vesalainen.bcc/bcc

public static boolean isSubsignature(ExecutableType m1, ExecutableType m2)
{
  return types.isSubsignature(m1, m2);
}

代码示例来源:origin: com.google.dagger/dagger-compiler

@Override
public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
 return types.isSubsignature(m1, m2);
}

代码示例来源:origin: org.mapstruct/mapstruct-processor

@Override
public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
  return delegate.isSubsignature( m1, m2 );
}

代码示例来源:origin: sk.seges.sesam/sesam-annotation-core-support

@Override
public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
  return this.types.isSubsignature(m1, m2);
}

代码示例来源:origin: domaframework/doma

public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
 return typeUtils.isSubsignature(m1, m2);
}

代码示例来源:origin: org.juzu/juzu-core

public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
 return env.getTypeUtils().isSubsignature(m1, m2);
}

代码示例来源:origin: juzu/juzu

public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
 return env.getTypeUtils().isSubsignature(m1, m2);
}

代码示例来源:origin: sk.seges.sesam/sesam-annotation-core-support

private static boolean hasMethod(ProcessingEnvironment processingEnv, TypeElement typeElement, ExecutableElement method) {
  for (ExecutableElement elementMethod: ElementFilter.methodsIn(typeElement.getEnclosedElements())) {
    if (processingEnv.getTypeUtils().isSubsignature((ExecutableType)elementMethod.asType(), (ExecutableType)method.asType())) {
      return true;
    }
  }
  
  return false;
}

代码示例来源:origin: stoicflame/enunciate

public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
 while (m1 instanceof DecoratedExecutableType) {
  m1 = ((DecoratedExecutableType) m1).getDelegate();
 }
 while (m2 instanceof DecoratedExecutableType) {
  m2 = ((DecoratedExecutableType) m2).getDelegate();
 }
 return delegate.isSubsignature(m1, m2);
}

代码示例来源:origin: com.webcohesion.enunciate/enunciate-javac-support

public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
 while (m1 instanceof DecoratedExecutableType) {
  m1 = ((DecoratedExecutableType) m1).getDelegate();
 }
 while (m2 instanceof DecoratedExecutableType) {
  m2 = ((DecoratedExecutableType) m2).getDelegate();
 }
 return delegate.isSubsignature(m1, m2);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base

private boolean isHidden(Element member, List<? extends Element> members, Elements elements, Types types) {
  for (ListIterator<? extends Element> it = members.listIterator(); it.hasNext();) {
    Element hider = it.next();
    if (hider == member)
      return true;
    if (hider.getSimpleName().contentEquals(member.getSimpleName())) {
      if (elements.hides(member, hider)) {
        it.remove();
      } else {
        if (member instanceof VariableElement && hider instanceof VariableElement
            && (!member.getKind().isField() || hider.getKind().isField()))
          return true;
        TypeMirror memberType = member.asType();
        TypeMirror hiderType = hider.asType();
        if (memberType.getKind() == TypeKind.EXECUTABLE && hiderType.getKind() == TypeKind.EXECUTABLE) {
          if (types.isSubsignature((ExecutableType)hiderType, (ExecutableType)memberType))
            return true;
        } else {
          return false;
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: derive4j/derive4j

@Override
public List<ExecutableElement> allAbstractMethods(DeclaredType declaredType) {
 return asTypeElement.visit(declaredType.asElement()).map(typeElement -> {
  List<P2<ExecutableElement, ExecutableType>> unorderedAbstractMethods = getMethods(
    Elements.getAllMembers(typeElement)).filter(this::abstractMethod)
      .map(e -> p2(e, (ExecutableType) Types.asMemberOf(declaredType, e)))
      .collect(toList());
  Set<ExecutableElement> deduplicatedUnorderedAbstractMethods = IntStream.range(0, unorderedAbstractMethods.size())
    .filter(i -> unorderedAbstractMethods.subList(0, i)
      .stream()
      .noneMatch(m -> m.match((predExecutableElement, predExecutableType) -> unorderedAbstractMethods.get(i)
        .match((executableElement,
          executableType) -> predExecutableElement.getSimpleName().equals(executableElement.getSimpleName())
            && Types.isSubsignature(predExecutableType, executableType)))))
    .mapToObj(i -> unorderedAbstractMethods.get(i).match((executableElement, __) -> executableElement))
    .collect(toSet());
  return Stream.concat(getSuperTypeElements(typeElement), Stream.of(typeElement))
    .flatMap(te -> te.getEnclosedElements().stream())
    .map(asExecutableElement::visit)
    .flatMap(Utils::optionalAsStream)
    .filter(deduplicatedUnorderedAbstractMethods::contains)
    .collect(toList());
 }).orElse(emptyList());
}

代码示例来源:origin: org.derive4j/derive4j

@Override
public List<ExecutableElement> allAbstractMethods(DeclaredType declaredType) {
 return asTypeElement.visit(declaredType.asElement()).map(typeElement -> {
  List<P2<ExecutableElement, ExecutableType>> unorderedAbstractMethods = getMethods(
    Elements.getAllMembers(typeElement)).filter(this::abstractMethod)
      .map(e -> p2(e, (ExecutableType) Types.asMemberOf(declaredType, e)))
      .collect(toList());
  Set<ExecutableElement> deduplicatedUnorderedAbstractMethods = IntStream.range(0, unorderedAbstractMethods.size())
    .filter(i -> unorderedAbstractMethods.subList(0, i)
      .stream()
      .noneMatch(m -> m.match((predExecutableElement, predExecutableType) -> unorderedAbstractMethods.get(i)
        .match((executableElement,
          executableType) -> predExecutableElement.getSimpleName().equals(executableElement.getSimpleName())
            && Types.isSubsignature(predExecutableType, executableType)))))
    .mapToObj(i -> unorderedAbstractMethods.get(i).match((executableElement, __) -> executableElement))
    .collect(toSet());
  return Stream.concat(getSuperTypeElements(typeElement), Stream.of(typeElement))
    .flatMap(te -> te.getEnclosedElements().stream())
    .map(asExecutableElement::visit)
    .flatMap(Utils::optionalAsStream)
    .filter(deduplicatedUnorderedAbstractMethods::contains)
    .collect(toList());
 }).orElse(emptyList());
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base

public boolean alreadyDefinedIn(CharSequence name, ExecutableType method, TypeElement enclClass) {
  Type.MethodType meth = ((Type)method).asMethodType();
  ClassSymbol clazz = (ClassSymbol)enclClass;
  Scope scope = clazz.members();
  Name n = names.fromString(name.toString());
  for (Symbol sym : scope.getSymbolsByName(n, Scope.LookupKind.NON_RECURSIVE)) {
    if(sym.type instanceof ExecutableType &&
        types.isSubsignature(meth, (ExecutableType)sym.type))
      return true;
  }
  return false;
}

代码示例来源:origin: com.google.web.bindery/requestfactory-apt

|| state.types.isSubsignature(domainMethod, (ExecutableType) found.asType())) {
found = domainMethodElement;

代码示例来源:origin: com.google.auto/auto-common

ExecutableType overriddenExecutable =
   MoreTypes.asExecutable(typeUtils.asMemberOf(inType, overridden));
 return typeUtils.isSubsignature(overriderExecutable, overriddenExecutable);
} catch (IllegalArgumentException e) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-java-completion

if (smartType.getKind() == TypeKind.DECLARED) {
  ExecutableType descriptorType = tu.getDescriptorType((DeclaredType) smartType);
  if (descriptorType != null && types.isSubsignature((ExecutableType) type, descriptorType)
      && types.isSubtype(((ExecutableType) type).getReturnType(), descriptorType.getReturnType())) {
    return true;

相关文章