org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(13.5k)|赞(0)|评价(0)|浏览(115)

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

Util.scanTypeSignature介绍

[英]Scans the given string for a type signature starting at the given index and returns the index of the last character.

TypeSignature: 
|  BaseTypeSignature 
|  ArrayTypeSignature 
|  ClassTypeSignature 
|  TypeVariableSignature

[中]扫描给定字符串,寻找从给定索引开始的类型签名,并返回最后一个字符的索引

TypeSignature: 
|  BaseTypeSignature 
|  ArrayTypeSignature 
|  ClassTypeSignature 
|  TypeVariableSignature

代码示例

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

/**
 * Scans the given string for a type signature starting at the given index
 * and returns the index of the last character.
 * <pre>
 * TypeSignature:
 *  |  BaseTypeSignature
 *  |  ArrayTypeSignature
 *  |  ClassTypeSignature
 *  |  TypeVariableSignature
 * </pre>
 *
 * @param string the signature string
 * @param start the 0-based character index of the first character
 * @return the 0-based character index of the last character
 * @exception IllegalArgumentException if this is not a type signature
 */
public static int scanTypeSignature(char[] string, int start) {
  // this method is used in jdt.debug
  return org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(string, start);
}
/**

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

/**
 * Scans the given string for a type signature starting at the given index
 * and returns the index of the last character.
 * <pre>
 * TypeSignature:
 *  |  BaseTypeSignature
 *  |  ArrayTypeSignature
 *  |  ClassTypeSignature
 *  |  TypeVariableSignature
 * </pre>
 *
 * @param string the signature string
 * @param start the 0-based character index of the first character
 * @return the 0-based character index of the last character
 * @exception IllegalArgumentException if this is not a type signature
 */
public static int scanTypeSignature(char[] string, int start) {
  // this method is used in jdt.debug
  return org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(string, start);
}
/**

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

/**
 * Scans the given string for a type signature starting at the given index
 * and returns the index of the last character.
 * <pre>
 * TypeSignature:
 *  |  BaseTypeSignature
 *  |  ArrayTypeSignature
 *  |  ClassTypeSignature
 *  |  TypeVariableSignature
 * </pre>
 *
 * @param string the signature string
 * @param start the 0-based character index of the first character
 * @return the 0-based character index of the last character
 * @exception IllegalArgumentException if this is not a type signature
 */
public static int scanTypeSignature(char[] string, int start) {
  // this method is used in jdt.debug
  return org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(string, start);
}
/**

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

/**
 * Scans the given string for a type signature starting at the given index
 * and returns the index of the last character.
 * <pre>
 * TypeSignature:
 *  |  BaseTypeSignature
 *  |  ArrayTypeSignature
 *  |  ClassTypeSignature
 *  |  TypeVariableSignature
 * </pre>
 *
 * @param string the signature string
 * @param start the 0-based character index of the first character
 * @return the 0-based character index of the last character
 * @exception IllegalArgumentException if this is not a type signature
 */
public static int scanTypeSignature(char[] string, int start) {
  // this method is used in jdt.debug
  return org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(string, start);
}
/**

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

/**
 * Scans the given string for a type signature starting at the given index
 * and returns the index of the last character.
 * <pre>
 * TypeSignature:
 *  |  BaseTypeSignature
 *  |  ArrayTypeSignature
 *  |  ClassTypeSignature
 *  |  TypeVariableSignature
 * </pre>
 *
 * @param string the signature string
 * @param start the 0-based character index of the first character
 * @return the 0-based character index of the last character
 * @exception IllegalArgumentException if this is not a type signature
 */
public static int scanTypeSignature(char[] string, int start) {
  // this method is used in jdt.debug
  return org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(string, start);
}
/**

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

/**
 * Scans the given string for a type signature starting at the given index
 * and returns the index of the last character.
 * <pre>
 * TypeSignature:
 *  |  BaseTypeSignature
 *  |  ArrayTypeSignature
 *  |  ClassTypeSignature
 *  |  TypeVariableSignature
 * </pre>
 *
 * @param string the signature string
 * @param start the 0-based character index of the first character
 * @return the 0-based character index of the last character
 * @exception IllegalArgumentException if this is not a type signature
 */
public static int scanTypeSignature(char[] string, int start) {
  // this method is used in jdt.debug
  return org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(string, start);
}
/**

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

private char[] removeFirstSyntheticParameter(char[] descriptor) {
  if (descriptor == null) return null;
  if (descriptor.length < 3) return descriptor;
  if (descriptor[0] != '(') return descriptor;
  if (descriptor[1] != ')') {
    // remove the first synthetic parameter
    int start = org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(descriptor, 1) + 1;
    int length = descriptor.length - start;
    char[] signature = new char[length + 1];
    signature[0] = descriptor[0];
    System.arraycopy(descriptor, start, signature, 1, length);
    return signature;
  } else {
    return descriptor;
  }
}
/*

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

private char[] removeFirstSyntheticParameter(char[] descriptor) {
  if (descriptor == null) return null;
  if (descriptor.length < 3) return descriptor;
  if (descriptor[0] != '(') return descriptor;
  if (descriptor[1] != ')') {
    // remove the first synthetic parameter
    int start = org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(descriptor, 1) + 1;
    int length = descriptor.length - start;
    char[] signature = new char[length + 1];
    signature[0] = descriptor[0];
    System.arraycopy(descriptor, start, signature, 1, length);
    return signature;
  } else {
    return descriptor;
  }
}
/*

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

private char[] removeFirstSyntheticParameter(char[] descriptor) {
  if (descriptor == null) return null;
  if (descriptor.length < 3) return descriptor;
  if (descriptor[0] != '(') return descriptor;
  if (descriptor[1] != ')') {
    // remove the first synthetic parameter
    int start = org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(descriptor, 1) + 1;
    int length = descriptor.length - start;
    char[] signature = new char[length + 1];
    signature[0] = descriptor[0];
    System.arraycopy(descriptor, start, signature, 1, length);
    return signature;
  } else {
    return descriptor;
  }
}
/*

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

private char[] removeFirstSyntheticParameter(char[] descriptor) {
  if (descriptor == null) return null;
  if (descriptor.length < 3) return descriptor;
  if (descriptor[0] != '(') return descriptor;
  if (descriptor[1] != ')') {
    // remove the first synthetic parameter
    int start = org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(descriptor, 1) + 1;
    int length = descriptor.length - start;
    char[] signature = new char[length + 1];
    signature[0] = descriptor[0];
    System.arraycopy(descriptor, start, signature, 1, length);
    return signature;
  } else {
    return descriptor;
  }
}
/*

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

private char[] removeFirstSyntheticParameter(char[] descriptor) {
  if (descriptor == null) return null;
  if (descriptor.length < 3) return descriptor;
  if (descriptor[0] != '(') return descriptor;
  if (descriptor[1] != ')') {
    // remove the first synthetic parameter
    int start = org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(descriptor, 1) + 1;
    int length = descriptor.length - start;
    char[] signature = new char[length + 1];
    signature[0] = descriptor[0];
    System.arraycopy(descriptor, start, signature, 1, length);
    return signature;
  } else {
    return descriptor;
  }
}
/*

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

private char[] removeFirstSyntheticParameter(char[] descriptor) {
  if (descriptor == null) return null;
  if (descriptor.length < 3) return descriptor;
  if (descriptor[0] != '(') return descriptor;
  if (descriptor[1] != ')') {
    // remove the first synthetic parameter
    int start = org.eclipse.jdt.internal.compiler.util.Util.scanTypeSignature(descriptor, 1) + 1;
    int length = descriptor.length - start;
    char[] signature = new char[length + 1];
    signature[0] = descriptor[0];
    System.arraycopy(descriptor, start, signature, 1, length);
    return signature;
  } else {
    return descriptor;
  }
}
/*

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

public static int getParameterCount(char[] methodSignature) {
  try {
    int count = 0;
    int i = CharOperation.indexOf(C_PARAM_START, methodSignature);
    if (i < 0) {
      throw new IllegalArgumentException();
    } else {
      i++;
    }
    for (;;) {
      if (methodSignature[i] == C_PARAM_END) {
        return count;
      }
      int e= Util.scanTypeSignature(methodSignature, i);
      if (e < 0) {
        throw new IllegalArgumentException();
      } else {
        i = e + 1;
      }
      count++;
    }
  } catch (ArrayIndexOutOfBoundsException e) {
    throw new IllegalArgumentException(e);
  }
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 *
 * @since 2.0
 */
public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
  // skip type parameters
  int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
  if (paren == -1) {
    throw new IllegalArgumentException();
  }
  // there could be thrown exceptions behind, thus scan one type exactly
  int last = Util.scanTypeSignature(methodSignature, paren+1);
  return CharOperation.subarray(methodSignature, paren + 1, last+1);
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 *
 * @since 2.0
 */
public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
  // skip type parameters
  int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
  if (paren == -1) {
    throw new IllegalArgumentException();
  }
  // there could be thrown exceptions behind, thus scan one type exactly
  int last = Util.scanTypeSignature(methodSignature, paren+1);
  return CharOperation.subarray(methodSignature, paren + 1, last+1);
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 *
 * @since 2.0
 */
public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
  // skip type parameters
  int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
  if (paren == -1) {
    throw new IllegalArgumentException();
  }
  // there could be thrown exceptions behind, thus scan one type exactly
  int last = Util.scanTypeSignature(methodSignature, paren+1);
  return CharOperation.subarray(methodSignature, paren + 1, last+1);
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 *
 * @since 2.0
 */
public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
  // skip type parameters
  int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
  if (paren == -1) {
    throw new IllegalArgumentException();
  }
  // there could be thrown exceptions behind, thus scan one type exactly
  int last = Util.scanTypeSignature(methodSignature, paren+1);
  return CharOperation.subarray(methodSignature, paren + 1, last+1);
}

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

/**
 * Extracts the return type from the given method signature. The method signature is expected to be dot-based.
 *
 * @param methodSignature
 *          the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException
 *              if the signature is syntactically incorrect
 * @since 2.0
 */
public static char[] getReturnType(char[] methodSignature) {
 // skip type parameters
 int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
 if (paren == -1) {
  throw new IllegalArgumentException();
 }
 // there could be thrown exceptions behind, thus scan one type exactly
 int last = Util.scanTypeSignature(methodSignature, paren + 1);
 return CharOperation.subarray(methodSignature, paren + 1, last + 1);
}

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 *
 * @since 2.0
 */
public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
  // skip type parameters
  int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
  if (paren == -1) {
    throw new IllegalArgumentException();
  }
  // there could be thrown exceptions behind, thus scan one type exactly
  int last = Util.scanTypeSignature(methodSignature, paren+1);
  return CharOperation.subarray(methodSignature, paren + 1, last+1);
}
/**

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

/**
 * Extracts the return type from the given method signature. The method signature is
 * expected to be dot-based.
 *
 * @param methodSignature the method signature
 * @return the type signature of the return type
 * @exception IllegalArgumentException if the signature is syntactically
 *   incorrect
 *
 * @since 2.0
 */
public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
  // skip type parameters
  int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
  if (paren == -1) {
    throw new IllegalArgumentException();
  }
  // there could be thrown exceptions behind, thus scan one type exactly
  int last = Util.scanTypeSignature(methodSignature, paren+1);
  return CharOperation.subarray(methodSignature, paren + 1, last+1);
}

相关文章