本文整理汇总了Java中org.eclipse.jdt.core.Signature.C_STAR属性的典型用法代码示例。如果您正苦于以下问题:Java Signature.C_STAR属性的具体用法?Java Signature.C_STAR怎么用?Java Signature.C_STAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.Signature
的用法示例。
在下文中一共展示了Signature.C_STAR属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendTypeArgumentSignatureForAnchor
private static int appendTypeArgumentSignatureForAnchor(
char[] string, int start, StringBuffer buffer) {
// need a minimum 1 char
if (start >= string.length) {
throw new IllegalArgumentException();
}
char c = string[start];
switch (c) {
case Signature.C_STAR:
return start;
case Signature.C_EXTENDS:
return appendTypeSignatureForAnchor(string, start + 1, buffer, false);
case Signature.C_SUPER:
return appendTypeSignatureForAnchor(string, start + 1, buffer, false);
default:
return appendTypeSignatureForAnchor(string, start, buffer, false);
}
}
示例2: getLowerBound
/**
* Returns the lower bound of a type signature. Returns the null type signature if <code>signature
* </code> is a wildcard or upper bound (<code>? extends T</code>); returns the signature of the
* type <code>T</code> of a lower bound (<code>? super T</code>) or <code>signature</code> itself
* if it is not a bound signature.
*
* @param signature the signature
* @return the lower bound signature of <code>signature</code>
*/
public static char[] getLowerBound(char[] signature) {
if (signature.length < 1) return signature;
if (signature.length == 1 && signature[0] == Signature.C_STAR) return signature;
int superIndex = indexOf(signature, Signature.C_EXTENDS);
if (superIndex == 0) return NULL_TYPE_SIGNATURE_ARRAY;
if (superIndex != -1) {
char afterSuper = signature[superIndex + 1];
if (afterSuper == Signature.C_STAR || afterSuper == Signature.C_EXTENDS)
// impossible captured type
return NULL_TYPE_SIGNATURE_ARRAY;
}
char[][] typeArguments = Signature.getTypeArguments(signature);
for (int i = 0; i < typeArguments.length; i++)
if (Arrays.equals(typeArguments[i], NULL_TYPE_SIGNATURE_ARRAY))
return NULL_TYPE_SIGNATURE_ARRAY;
if (signature[0] == Signature.C_SUPER) {
char[] type = new char[signature.length - 1];
System.arraycopy(signature, 1, type, 0, signature.length - 1);
return type;
}
return signature;
}
示例3: appendTypeSignatureLabel
protected void appendTypeSignatureLabel(IJavaElement enclosingElement, String typeSig, long flags) {
int sigKind= Signature.getTypeSignatureKind(typeSig);
switch (sigKind) {
case Signature.BASE_TYPE_SIGNATURE:
fBuilder.append(Signature.toString(typeSig));
break;
case Signature.ARRAY_TYPE_SIGNATURE:
appendTypeSignatureLabel(enclosingElement, Signature.getElementType(typeSig), flags);
for (int dim= Signature.getArrayCount(typeSig); dim > 0; dim--) {
fBuilder.append('[').append(']');
}
break;
case Signature.CLASS_TYPE_SIGNATURE:
String baseType= getSimpleTypeName(enclosingElement, typeSig);
fBuilder.append(baseType);
String[] typeArguments= Signature.getTypeArguments(typeSig);
appendTypeArgumentSignaturesLabel(enclosingElement, typeArguments, flags);
break;
case Signature.TYPE_VARIABLE_SIGNATURE:
fBuilder.append(getSimpleTypeName(enclosingElement, typeSig));
break;
case Signature.WILDCARD_TYPE_SIGNATURE:
char ch= typeSig.charAt(0);
if (ch == Signature.C_STAR) { //workaround for bug 85713
fBuilder.append('?');
} else {
if (ch == Signature.C_EXTENDS) {
fBuilder.append("? extends "); //$NON-NLS-1$
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
} else if (ch == Signature.C_SUPER) {
fBuilder.append("? super "); //$NON-NLS-1$
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
}
}
break;
case Signature.CAPTURE_TYPE_SIGNATURE:
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
break;
case Signature.INTERSECTION_TYPE_SIGNATURE:
String[] typeBounds= Signature.getIntersectionTypeBounds(typeSig);
appendTypeBoundsSignaturesLabel(enclosingElement, typeBounds, flags);
break;
default:
// unknown
}
}
示例4: appendTypeSignatureLabel
protected void appendTypeSignatureLabel(
IJavaElement enclosingElement, String typeSig, long flags, StringBuilder builder) {
int sigKind = Signature.getTypeSignatureKind(typeSig);
switch (sigKind) {
case Signature.BASE_TYPE_SIGNATURE:
builder.append(Signature.toString(typeSig));
break;
case Signature.ARRAY_TYPE_SIGNATURE:
appendTypeSignatureLabel(
enclosingElement, Signature.getElementType(typeSig), flags, builder);
for (int dim = Signature.getArrayCount(typeSig); dim > 0; dim--) {
builder.append('[').append(']');
}
break;
case Signature.CLASS_TYPE_SIGNATURE:
String baseType = getSimpleTypeName(enclosingElement, typeSig);
builder.append(baseType);
String[] typeArguments = Signature.getTypeArguments(typeSig);
appendTypeArgumentSignaturesLabel(enclosingElement, typeArguments, flags, builder);
break;
case Signature.TYPE_VARIABLE_SIGNATURE:
builder.append(getSimpleTypeName(enclosingElement, typeSig));
break;
case Signature.WILDCARD_TYPE_SIGNATURE:
char ch = typeSig.charAt(0);
if (ch == Signature.C_STAR) { // workaround for bug 85713
builder.append('?');
} else {
if (ch == Signature.C_EXTENDS) {
builder.append("? extends "); // $NON-NLS-1$
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags, builder);
} else if (ch == Signature.C_SUPER) {
builder.append("? super "); // $NON-NLS-1$
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags, builder);
}
}
break;
case Signature.CAPTURE_TYPE_SIGNATURE:
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags, builder);
break;
case Signature.INTERSECTION_TYPE_SIGNATURE:
String[] typeBounds = Signature.getIntersectionTypeBounds(typeSig);
appendTypeBoundsSignaturesLabel(enclosingElement, typeBounds, flags, builder);
break;
default:
// unknown
}
}
示例5: appendTypeSignatureLabel
protected void appendTypeSignatureLabel(
IJavaElement enclosingElement, String typeSig, long flags) {
int sigKind = Signature.getTypeSignatureKind(typeSig);
switch (sigKind) {
case Signature.BASE_TYPE_SIGNATURE:
fBuffer.append(Signature.toString(typeSig));
break;
case Signature.ARRAY_TYPE_SIGNATURE:
appendTypeSignatureLabel(enclosingElement, Signature.getElementType(typeSig), flags);
for (int dim = Signature.getArrayCount(typeSig); dim > 0; dim--) {
fBuffer.append('[').append(']');
}
break;
case Signature.CLASS_TYPE_SIGNATURE:
String baseType = getSimpleTypeName(enclosingElement, typeSig);
fBuffer.append(baseType);
String[] typeArguments = Signature.getTypeArguments(typeSig);
appendTypeArgumentSignaturesLabel(enclosingElement, typeArguments, flags);
break;
case Signature.TYPE_VARIABLE_SIGNATURE:
fBuffer.append(getSimpleTypeName(enclosingElement, typeSig));
break;
case Signature.WILDCARD_TYPE_SIGNATURE:
char ch = typeSig.charAt(0);
if (ch == Signature.C_STAR) { // workaround for bug 85713
fBuffer.append('?');
} else {
if (ch == Signature.C_EXTENDS) {
fBuffer.append("? extends "); // $NON-NLS-1$
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
} else if (ch == Signature.C_SUPER) {
fBuffer.append("? super "); // $NON-NLS-1$
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
}
}
break;
case Signature.CAPTURE_TYPE_SIGNATURE:
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
break;
case Signature.INTERSECTION_TYPE_SIGNATURE:
String[] typeBounds = Signature.getIntersectionTypeBounds(typeSig);
appendTypeBoundsSignaturesLabel(enclosingElement, typeBounds, flags);
break;
default:
// unknown
}
}
示例6: appendTypeSignatureForAnchor
private static int appendTypeSignatureForAnchor(
char[] string, int start, StringBuffer buffer, boolean isVarArgs) {
// need a minimum 1 char
if (start >= string.length) {
throw new IllegalArgumentException();
}
char c = string[start];
if (isVarArgs) {
switch (c) {
case Signature.C_ARRAY:
return appendArrayTypeSignatureForAnchor(string, start, buffer, true);
case Signature.C_RESOLVED:
case Signature.C_TYPE_VARIABLE:
case Signature.C_BOOLEAN:
case Signature.C_BYTE:
case Signature.C_CHAR:
case Signature.C_DOUBLE:
case Signature.C_FLOAT:
case Signature.C_INT:
case Signature.C_LONG:
case Signature.C_SHORT:
case Signature.C_VOID:
case Signature.C_STAR:
case Signature.C_EXTENDS:
case Signature.C_SUPER:
case Signature.C_CAPTURE:
default:
throw new IllegalArgumentException(); // a var args is an array type
}
} else {
switch (c) {
case Signature.C_ARRAY:
return appendArrayTypeSignatureForAnchor(string, start, buffer, false);
case Signature.C_RESOLVED:
return appendClassTypeSignatureForAnchor(string, start, buffer);
case Signature.C_TYPE_VARIABLE:
int e =
org.eclipse.jdt.internal.compiler.util.Util.scanTypeVariableSignature(string, start);
buffer.append(string, start + 1, e - start - 1);
return e;
case Signature.C_BOOLEAN:
buffer.append(BOOLEAN);
return start;
case Signature.C_BYTE:
buffer.append(BYTE);
return start;
case Signature.C_CHAR:
buffer.append(CHAR);
return start;
case Signature.C_DOUBLE:
buffer.append(DOUBLE);
return start;
case Signature.C_FLOAT:
buffer.append(FLOAT);
return start;
case Signature.C_INT:
buffer.append(INT);
return start;
case Signature.C_LONG:
buffer.append(LONG);
return start;
case Signature.C_SHORT:
buffer.append(SHORT);
return start;
case Signature.C_VOID:
buffer.append(VOID);
return start;
case Signature.C_CAPTURE:
return appendCaptureTypeSignatureForAnchor(string, start, buffer);
case Signature.C_STAR:
case Signature.C_EXTENDS:
case Signature.C_SUPER:
return appendTypeArgumentSignatureForAnchor(string, start, buffer);
default:
throw new IllegalArgumentException();
}
}
}
示例7: appendTypeSignatureLabel
protected void appendTypeSignatureLabel(IJavaElement enclosingElement, String typeSig, long flags) {
int sigKind= Signature.getTypeSignatureKind(typeSig);
switch (sigKind) {
case Signature.BASE_TYPE_SIGNATURE:
fBuffer.append(Signature.toString(typeSig));
break;
case Signature.ARRAY_TYPE_SIGNATURE:
appendTypeSignatureLabel(enclosingElement, Signature.getElementType(typeSig), flags);
for (int dim= Signature.getArrayCount(typeSig); dim > 0; dim--) {
fBuffer.append('[').append(']');
}
break;
case Signature.CLASS_TYPE_SIGNATURE:
String baseType= getSimpleTypeName(enclosingElement, typeSig);
fBuffer.append(baseType);
String[] typeArguments= Signature.getTypeArguments(typeSig);
appendTypeArgumentSignaturesLabel(enclosingElement, typeArguments, flags);
break;
case Signature.TYPE_VARIABLE_SIGNATURE:
fBuffer.append(getSimpleTypeName(enclosingElement, typeSig));
break;
case Signature.WILDCARD_TYPE_SIGNATURE:
char ch= typeSig.charAt(0);
if (ch == Signature.C_STAR) { //workaround for bug 85713
fBuffer.append('?');
} else {
if (ch == Signature.C_EXTENDS) {
fBuffer.append("? extends "); //$NON-NLS-1$
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
} else if (ch == Signature.C_SUPER) {
fBuffer.append("? super "); //$NON-NLS-1$
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
}
}
break;
case Signature.CAPTURE_TYPE_SIGNATURE:
appendTypeSignatureLabel(enclosingElement, typeSig.substring(1), flags);
break;
case Signature.INTERSECTION_TYPE_SIGNATURE:
String[] typeBounds= Signature.getIntersectionTypeBounds(typeSig);
appendTypeBoundsSignaturesLabel(enclosingElement, typeBounds, flags);
break;
default:
// unknown
}
}