org.eclipse.jdt.core.Signature.removeCapture()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(14.9k)|赞(0)|评价(0)|浏览(111)

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

Signature.removeCapture介绍

[英]Removes any capture information from the given type or method signature and returns the resulting signature. Returns the type or method signature itself if no capture information is present.

For example:

removeCapture("LTest<!+Ljava.lang.Throwable;>;") 
will return: "LTest<+Ljava.lang.Throwable;>;"

[中]从给定的类型或方法签名中删除任何捕获信息,并返回结果签名。如果不存在捕获信息,则返回类型或方法签名本身。
例如:

removeCapture("LTest<!+Ljava.lang.Throwable;>;") 
will return: "LTest<+Ljava.lang.Throwable;>;"

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

/**
 * TODO this is a temporary workaround for
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83600 and
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
 * 
 * @param signature the method signature to convert
 * @return the fixed signature
 */
public static char[] fix83600(char[] signature) {
  if (signature == null || signature.length < 2)
    return signature;
  
  return Signature.removeCapture(signature);
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation

/**
 * TODO this is a temporary workaround for
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83600 and
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
 *
 * @param signature the method signature to convert
 * @return the fixed signature
 */
public static char[] fix83600(char[] signature) {
  if (signature == null || signature.length < 2)
    return signature;
  return Signature.removeCapture(signature);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * TODO this is a temporary workaround for
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83600 and
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
 *
 * @param signature the method signature to convert
 * @return the fixed signature
 */
public static char[] fix83600(char[] signature) {
  if (signature == null || signature.length < 2)
    return signature;
  return Signature.removeCapture(signature);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

/**
 * Removes any capture information from the given type or method signature
 * and returns the resulting signature.
 * Returns the type or method signature itself if no capture information is
 * present.
 * <p>
 * For example:
 * <pre>
 * <code>
 * removeCapture("LTest&lt;!+Ljava.lang.Throwable;&gt;;")
 * will return: "LTest&lt;+Ljava.lang.Throwable;&gt;;"
 * </code>
 * </pre>
 * </p>
 *
 * @param methodOrTypeSignature the signature which may have been captured
 * @return a new signature without capture information or the signature itself
 *     if no specific capture information is present
 * @exception NullPointerException if <code>methodOrTypeSignature</code> is null
 *
 * @since 3.1
 */
public static String removeCapture(String methodOrTypeSignature) {
  char[] array = methodOrTypeSignature.toCharArray();
  char[] result = removeCapture(array);
  if (array == result) return methodOrTypeSignature;
  return new String(result);
}
/**

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Removes any capture information from the given type or method signature
 * and returns the resulting signature.
 * Returns the type or method signature itself if no capture information is
 * present.
 * <p>
 * For example:
 * <pre>
 * <code>
 * removeCapture("LTest&lt;!+Ljava.lang.Throwable;&gt;;")
 * will return: "LTest&lt;+Ljava.lang.Throwable;&gt;;"
 * </code>
 * </pre>
 * </p>
 *
 * @param methodOrTypeSignature the signature which may have been captured
 * @return a new signature without capture information or the signature itself
 *     if no specific capture information is present
 * @exception NullPointerException if <code>methodOrTypeSignature</code> is null
 *
 * @since 3.1
 */
public static String removeCapture(String methodOrTypeSignature) {
  char[] array = methodOrTypeSignature.toCharArray();
  char[] result = removeCapture(array);
  if (array == result) return methodOrTypeSignature;
  return new String(result);
}
/**

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Removes any capture information from the given type or method signature
 * and returns the resulting signature.
 * Returns the type or method signature itself if no capture information is
 * present.
 * <p>
 * For example:
 * <pre>
 * <code>
 * removeCapture("LTest&lt;!+Ljava.lang.Throwable;&gt;;")
 * will return: "LTest&lt;+Ljava.lang.Throwable;&gt;;"
 * </code>
 * </pre>
 * </p>
 *
 * @param methodOrTypeSignature the signature which may have been captured
 * @return a new signature without capture information or the signature itself
 *     if no specific capture information is present
 * @exception NullPointerException if <code>methodOrTypeSignature</code> is null
 *
 * @since 3.1
 */
public static String removeCapture(String methodOrTypeSignature) {
  char[] array = methodOrTypeSignature.toCharArray();
  char[] result = removeCapture(array);
  if (array == result) return methodOrTypeSignature;
  return new String(result);
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Removes any capture information from the given type or method signature
 * and returns the resulting signature.
 * Returns the type or method signature itself if no capture information is
 * present.
 * <p>
 * For example:
 * <pre>
 * <code>
 * removeCapture("LTest&lt;!+Ljava.lang.Throwable;&gt;;")
 * will return: "LTest&lt;+Ljava.lang.Throwable;&gt;;"
 * </code>
 * </pre>
 * </p>
 *
 * @param methodOrTypeSignature the signature which may have been captured
 * @return a new signature without capture information or the signature itself
 *     if no specific capture information is present
 * @exception NullPointerException if <code>methodOrTypeSignature</code> is null
 *
 * @since 3.1
 */
public static String removeCapture(String methodOrTypeSignature) {
  char[] array = methodOrTypeSignature.toCharArray();
  char[] result = removeCapture(array);
  if (array == result) return methodOrTypeSignature;
  return new String(result);
}
/**

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * Removes any capture information from the given type or method signature
 * and returns the resulting signature.
 * Returns the type or method signature itself if no capture information is
 * present.
 * <p>
 * For example:
 * <pre>
 * <code>
 * removeCapture("LTest&lt;!+Ljava.lang.Throwable;&gt;;")
 * will return: "LTest&lt;+Ljava.lang.Throwable;&gt;;"
 * </code>
 * </pre>
 * </p>
 *
 * @param methodOrTypeSignature the signature which may have been captured
 * @return a new signature without capture information or the signature itself
 *     if no specific capture information is present
 * @exception NullPointerException if <code>methodOrTypeSignature</code> is null
 *
 * @since 3.1
 */
public static String removeCapture(String methodOrTypeSignature) {
  char[] array = methodOrTypeSignature.toCharArray();
  char[] result = removeCapture(array);
  if (array == result) return methodOrTypeSignature;
  return new String(result);
}
/**

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Removes any capture information from the given type or method signature
 * and returns the resulting signature.
 * Returns the type or method signature itself if no capture information is
 * present.
 * <p>
 * For example:
 * <pre>
 * <code>
 * removeCapture("LTest&lt;!+Ljava.lang.Throwable;&gt;;")
 * will return: "LTest&lt;+Ljava.lang.Throwable;&gt;;"
 * </code>
 * </pre>
 * </p>
 *
 * @param methodOrTypeSignature the signature which may have been captured
 * @return a new signature without capture information or the signature itself
 *     if no specific capture information is present
 * @exception NullPointerException if <code>methodOrTypeSignature</code> is null
 *
 * @since 3.1
 */
public static String removeCapture(String methodOrTypeSignature) {
  char[] array = methodOrTypeSignature.toCharArray();
  char[] result = removeCapture(array);
  if (array == result) return methodOrTypeSignature;
  return new String(result);
}
/**

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

char[] source = Signature.removeCapture(typeSignature.toCharArray());
CharOperation.replace(source, '$', '.');

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

char[] source = Signature.removeCapture(typeSignature.toCharArray());
CharOperation.replace(source, '$', '.');

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

char[] source = Signature.removeCapture(typeSignature.toCharArray());
CharOperation.replace(source, '$', '.');

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

char[] source = Signature.removeCapture(typeSignature.toCharArray());
CharOperation.replace(source, '$', '.');

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

char[] source = Signature.removeCapture(typeSignature.toCharArray());
CharOperation.replace(source, '$', '.');

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

char[] source = Signature.removeCapture(typeSignature.toCharArray());
CharOperation.replace(source, '$', '.');

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
  public boolean canUseDiamond(CompletionContext coreContext) {
    if (this.getKind() != CONSTRUCTOR_INVOCATION) return false;
    if (coreContext instanceof InternalCompletionContext) {
      InternalCompletionContext internalCompletionContext = (InternalCompletionContext) coreContext;
      if (internalCompletionContext.extendedContext == null) return false;
      char[] name1 = this.declarationPackageName;
      char[] name2 = this.declarationTypeName;
      char[] declarationType = CharOperation.concat(name1, name2, '.');  // fully qualified name
      // even if the type arguments used in the method have been substituted,
      // extract the original type arguments only, since thats what we want to compare with the class
      // type variables (Substitution might have happened when the constructor is coming from another
      // CU and not the current one).
      char[] sign = (this.originalSignature != null)? this.originalSignature : getSignature();
      if (!(sign == null || sign.length < 2)) {
        sign = Signature.removeCapture(sign);
      }
      char[][] types= Signature.getParameterTypes(sign);
      String[] paramTypeNames= new String[types.length];
      for (int i= 0; i < types.length; i++) {
        paramTypeNames[i]= new String(Signature.toCharArray(types[i]));
      }
      return internalCompletionContext.extendedContext.canUseDiamond(paramTypeNames,declarationType);
    }
    else {
      return false;
    }
  }
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

public boolean canUseDiamond(CompletionContext coreContext) {
    if (this.getKind() != CONSTRUCTOR_INVOCATION) return false;
    if (coreContext instanceof InternalCompletionContext) {
      InternalCompletionContext internalCompletionContext = (InternalCompletionContext) coreContext;
      if (internalCompletionContext.extendedContext == null) return false;
      char[] name1 = this.declarationPackageName;
      char[] name2 = this.declarationTypeName;
      char[] declarationType = CharOperation.concat(name1, name2, '.');  // fully qualified name
      // even if the type arguments used in the method have been substituted,
      // extract the original type arguments only, since thats what we want to compare with the class
      // type variables (Substitution might have happened when the constructor is coming from another
      // CU and not the current one).
      char[] sign = (this.originalSignature != null)? this.originalSignature : getSignature();
      if (!(sign == null || sign.length < 2)) {
        sign = Signature.removeCapture(sign);
      }
      char[][] types= Signature.getParameterTypes(sign);
      String[] paramTypeNames= new String[types.length];
      for (int i= 0; i < types.length; i++) {
        paramTypeNames[i]= new String(Signature.toCharArray(types[i]));
      }
      return internalCompletionContext.extendedContext.canUseDiamond(paramTypeNames,declarationType);
    }
    else {
      return false;
    }
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

public boolean canUseDiamond(CompletionContext coreContext) {
    if (this.getKind() != CONSTRUCTOR_INVOCATION) return false;
    if (coreContext instanceof InternalCompletionContext) {
      InternalCompletionContext internalCompletionContext = (InternalCompletionContext) coreContext;
      if (internalCompletionContext.extendedContext == null) return false;
      char[] name1 = this.declarationPackageName;
      char[] name2 = this.declarationTypeName;
      char[] declarationType = CharOperation.concat(name1, name2, '.');  // fully qualified name
      // even if the type arguments used in the method have been substituted,
      // extract the original type arguments only, since thats what we want to compare with the class
      // type variables (Substitution might have happened when the constructor is coming from another
      // CU and not the current one).
      char[] sign = (this.originalSignature != null)? this.originalSignature : getSignature();
      if (!(sign == null || sign.length < 2)) {
        sign = Signature.removeCapture(sign);
      }
      char[][] types= Signature.getParameterTypes(sign);
      String[] paramTypeNames= new String[types.length];
      for (int i= 0; i < types.length; i++) {
        paramTypeNames[i]= new String(Signature.toCharArray(types[i]));
      }
      return internalCompletionContext.extendedContext.canUseDiamond(paramTypeNames,declarationType);
    }
    else {
      return false;
    }
  }
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

public boolean canUseDiamond(CompletionContext coreContext) {
    if (this.getKind() != CONSTRUCTOR_INVOCATION) return false;
    if (coreContext instanceof InternalCompletionContext) {
      InternalCompletionContext internalCompletionContext = (InternalCompletionContext) coreContext;
      if (internalCompletionContext.extendedContext == null) return false;
      char[] name1 = this.declarationPackageName;
      char[] name2 = this.declarationTypeName;
      char[] declarationType = CharOperation.concat(name1, name2, '.');  // fully qualified name
      // even if the type arguments used in the method have been substituted,
      // extract the original type arguments only, since thats what we want to compare with the class
      // type variables (Substitution might have happened when the constructor is coming from another
      // CU and not the current one).
      char[] sign = (this.originalSignature != null)? this.originalSignature : getSignature();
      if (!(sign == null || sign.length < 2)) {
        sign = Signature.removeCapture(sign);
      }
      char[][] types= Signature.getParameterTypes(sign);
      String[] paramTypeNames= new String[types.length];
      for (int i= 0; i < types.length; i++) {
        paramTypeNames[i]= new String(Signature.toCharArray(types[i]));
      }
      return internalCompletionContext.extendedContext.canUseDiamond(paramTypeNames,declarationType);
    }
    else {
      return false;
    }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

public boolean canUseDiamond(CompletionContext coreContext) {
    if (this.getKind() != CONSTRUCTOR_INVOCATION) return false;
    if (coreContext instanceof InternalCompletionContext) {
      InternalCompletionContext internalCompletionContext = (InternalCompletionContext) coreContext;
      if (internalCompletionContext.extendedContext == null) return false;
      char[] name1 = this.declarationPackageName;
      char[] name2 = this.declarationTypeName;
      char[] declarationType = CharOperation.concat(name1, name2, '.');  // fully qualified name
      // even if the type arguments used in the method have been substituted,
      // extract the original type arguments only, since thats what we want to compare with the class
      // type variables (Substitution might have happened when the constructor is coming from another
      // CU and not the current one).
      char[] sign = (this.originalSignature != null)? this.originalSignature : getSignature();
      if (!(sign == null || sign.length < 2)) {
        sign = Signature.removeCapture(sign);
      }
      char[][] types= Signature.getParameterTypes(sign);
      String[] paramTypeNames= new String[types.length];
      for (int i= 0; i < types.length; i++) {
        paramTypeNames[i]= new String(Signature.toCharArray(types[i]));
      }
      return internalCompletionContext.extendedContext.canUseDiamond(paramTypeNames,declarationType);
    }
    else {
      return false;
    }
  }
}

相关文章