本文整理汇总了Java中org.eclipse.jdt.core.Signature.C_RESOLVED属性的典型用法代码示例。如果您正苦于以下问题:Java Signature.C_RESOLVED属性的具体用法?Java Signature.C_RESOLVED怎么用?Java Signature.C_RESOLVED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.Signature
的用法示例。
在下文中一共展示了Signature.C_RESOLVED属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toUnresolvedTypeSignature
private static int toUnresolvedTypeSignature(
char[] signature, int start, int length, StringBuffer buffer) {
if (signature[start] == Signature.C_RESOLVED) buffer.append(Signature.C_UNRESOLVED);
else buffer.append(signature[start]);
for (int i = start + 1; i < length; i++) {
char c = signature[i];
switch (c) {
case '/':
case Signature.C_DOLLAR:
buffer.append(Signature.C_DOT);
break;
case Signature.C_GENERIC_START:
buffer.append(Signature.C_GENERIC_START);
i = toUnresolvedTypeSignature(signature, i + 1, length, buffer);
break;
case Signature.C_GENERIC_END:
buffer.append(Signature.C_GENERIC_END);
return i;
default:
buffer.append(c);
break;
}
}
return length;
}
示例2: sameParameter
private static boolean sameParameter(ITypeBinding type, String candidate, IType scope)
throws JavaModelException {
if (type.getDimensions() != Signature.getArrayCount(candidate)) return false;
// Normalizes types
if (type.isArray()) type = type.getElementType();
candidate = Signature.getElementType(candidate);
if ((Signature.getTypeSignatureKind(candidate) == Signature.BASE_TYPE_SIGNATURE)
!= type.isPrimitive()) {
return false;
}
if (type.isPrimitive() || type.isTypeVariable()) {
return type.getName().equals(Signature.toString(candidate));
} else {
// normalize (quick hack until binding.getJavaElement works)
candidate = Signature.getTypeErasure(candidate);
type = type.getErasure();
if (candidate.charAt(Signature.getArrayCount(candidate)) == Signature.C_RESOLVED) {
return Signature.toString(candidate).equals(Bindings.getFullyQualifiedName(type));
} else {
String[][] qualifiedCandidates = scope.resolveType(Signature.toString(candidate));
if (qualifiedCandidates == null || qualifiedCandidates.length == 0) return false;
String packageName =
type.getPackage().isUnnamed() ? "" : type.getPackage().getName(); // $NON-NLS-1$
String typeName = getTypeQualifiedName(type);
for (int i = 0; i < qualifiedCandidates.length; i++) {
String[] qualifiedCandidate = qualifiedCandidates[i];
if (qualifiedCandidate[0].equals(packageName) && qualifiedCandidate[1].equals(typeName))
return true;
}
}
}
return false;
}
示例3: appendClassTypeSignature
private static void appendClassTypeSignature(
char[] string, int start, StringBuffer buffer, boolean compact) {
char c = string[start];
if (c != Signature.C_RESOLVED) {
return;
}
int p = start + 1;
int checkpoint = buffer.length();
while (true) {
c = string[p];
switch (c) {
case Signature.C_SEMICOLON:
// all done
return;
case Signature.C_DOT:
case '/':
// erase package prefix
if (compact) {
buffer.setLength(checkpoint);
} else {
buffer.append('.');
}
break;
case Signature.C_DOLLAR:
/**
* Convert '$' in resolved type signatures into '.'. NOTE: This assumes that the type
* signature is an inner type signature. This is true in most cases, but someone can
* define a non-inner type name containing a '$'.
*/
buffer.append('.');
break;
default:
buffer.append(c);
}
p++;
}
}
示例4: sameParameter
private static boolean sameParameter(ITypeBinding type, String candidate, IType scope) throws JavaModelException {
if (type.getDimensions() != Signature.getArrayCount(candidate)) {
return false;
}
// Normalizes types
if (type.isArray()) {
type= type.getElementType();
}
candidate= Signature.getElementType(candidate);
if ((Signature.getTypeSignatureKind(candidate) == Signature.BASE_TYPE_SIGNATURE) != type.isPrimitive()) {
return false;
}
if (type.isPrimitive() || type.isTypeVariable()) {
return type.getName().equals(Signature.toString(candidate));
} else {
// normalize (quick hack until binding.getJavaElement works)
candidate= Signature.getTypeErasure(candidate);
type= type.getErasure();
if (candidate.charAt(Signature.getArrayCount(candidate)) == Signature.C_RESOLVED) {
return Signature.toString(candidate).equals(Bindings.getFullyQualifiedName(type));
} else {
String[][] qualifiedCandidates= scope.resolveType(Signature.toString(candidate));
if (qualifiedCandidates == null || qualifiedCandidates.length == 0) {
return false;
}
String packageName= type.getPackage().isUnnamed() ? "" : type.getPackage().getName(); //$NON-NLS-1$
String typeName= getTypeQualifiedName(type);
for (int i= 0; i < qualifiedCandidates.length; i++) {
String[] qualifiedCandidate= qualifiedCandidates[i];
if ( qualifiedCandidate[0].equals(packageName) &&
qualifiedCandidate[1].equals(typeName)) {
return true;
}
}
}
}
return false;
}
示例5: appendTypeSignature
static void appendTypeSignature(char[] string, int start, StringBuffer buffer, boolean compact) {
char c = string[start];
switch (c) {
case Signature.C_ARRAY:
appendArrayTypeSignature(string, start, buffer, compact);
break;
case Signature.C_RESOLVED:
appendClassTypeSignature(string, start, buffer, compact);
break;
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);
break;
case Signature.C_BOOLEAN:
buffer.append(BOOLEAN);
break;
case Signature.C_BYTE:
buffer.append(BYTE);
break;
case Signature.C_CHAR:
buffer.append(CHAR);
break;
case Signature.C_DOUBLE:
buffer.append(DOUBLE);
break;
case Signature.C_FLOAT:
buffer.append(FLOAT);
break;
case Signature.C_INT:
buffer.append(INT);
break;
case Signature.C_LONG:
buffer.append(LONG);
break;
case Signature.C_SHORT:
buffer.append(SHORT);
break;
case Signature.C_VOID:
buffer.append(VOID);
break;
}
}
示例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: appendClassTypeSignatureForAnchor
private static int appendClassTypeSignatureForAnchor(
char[] string, int start, StringBuffer buffer) {
// need a minimum 3 chars "Lx;"
if (start >= string.length - 2) {
throw new IllegalArgumentException();
}
// must start in "L" or "Q"
char c = string[start];
if (c != Signature.C_RESOLVED && c != Signature.C_UNRESOLVED) {
throw new IllegalArgumentException();
}
int p = start + 1;
while (true) {
if (p >= string.length) {
throw new IllegalArgumentException();
}
c = string[p];
switch (c) {
case Signature.C_SEMICOLON:
// all done
return p;
case Signature.C_GENERIC_START:
int e = scanGenericEnd(string, p + 1);
// once we hit type arguments there are no more package prefixes
p = e;
break;
case Signature.C_DOT:
buffer.append('.');
break;
case '/':
buffer.append('/');
break;
case Signature.C_DOLLAR:
// once we hit "$" there are no more package prefixes
/**
* Convert '$' in resolved type signatures into '.'. NOTE: This assumes that the type
* signature is an inner type signature. This is true in most cases, but someone can
* define a non-inner type name containing a '$'.
*/
buffer.append('.');
break;
default:
buffer.append(c);
}
p++;
}
}