本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.TypeBinding.readableName方法的典型用法代码示例。如果您正苦于以下问题:Java TypeBinding.readableName方法的具体用法?Java TypeBinding.readableName怎么用?Java TypeBinding.readableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.TypeBinding
的用法示例。
在下文中一共展示了TypeBinding.readableName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: failIfContainsAnnotation
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
private static void failIfContainsAnnotation(TypeBinding parent, Binding[] bindings) throws DelegateRecursion {
if (bindings == null) return;
for (Binding b : bindings) {
AnnotationBinding[] anns = null;
if (b instanceof MethodBinding) anns = ((MethodBinding) b).getAnnotations();
if (b instanceof FieldBinding) anns = ((FieldBinding) b).getAnnotations();
// anns = b.getAnnotations() would make a heck of a lot more sense, but that is a late addition to ecj, so would cause NoSuchMethodErrors! Don't use that!
if (anns == null) continue;
for (AnnotationBinding ann : anns) {
char[][] name = null;
try {
name = ann.getAnnotationType().compoundName;
} catch (Exception ignore) {}
if (name == null || name.length < 2 || name.length > 3) continue;
if (!Arrays.equals(STRING_LOMBOK, name[0])) continue;
if (!Arrays.equals(STRING_DELEGATE, name[name.length - 1])) continue;
if (name.length == 3 && !Arrays.equals(STRING_EXPERIMENTAL, name[1])) continue;
throw new DelegateRecursion(parent.readableName(), b.readableName());
}
}
}
示例2: invalidOperator
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void invalidOperator(BinaryExpression expression, TypeBinding leftType, TypeBinding rightType) {
String leftName = new String(leftType.readableName());
String rightName = new String(rightType.readableName());
String leftShortName = new String(leftType.shortReadableName());
String rightShortName = new String(rightType.shortReadableName());
if (leftShortName.equals(rightShortName)){
leftShortName = leftName;
rightShortName = rightName;
}
this.handle(
IProblem.InvalidOperator,
new String[] {
expression.operatorToString(),
leftName + ", " + rightName}, //$NON-NLS-1$
new String[] {
expression.operatorToString(),
leftShortName + ", " + rightShortName}, //$NON-NLS-1$
expression.sourceStart,
expression.sourceEnd);
}
示例3: operatorOnlyValidOnNumericType
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void operatorOnlyValidOnNumericType(CompoundAssignment assignment, TypeBinding leftType, TypeBinding rightType) {
String leftName = new String(leftType.readableName());
String rightName = new String(rightType.readableName());
String leftShortName = new String(leftType.shortReadableName());
String rightShortName = new String(rightType.shortReadableName());
if (leftShortName.equals(rightShortName)){
leftShortName = leftName;
rightShortName = rightName;
}
this.handle(
IProblem.TypeMismatch,
new String[] {leftName, rightName },
new String[] {leftShortName, rightShortName },
assignment.sourceStart,
assignment.sourceEnd);
}
示例4: notCompatibleTypesError
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void notCompatibleTypesError(InstanceOfExpression expression, TypeBinding leftType, TypeBinding rightType) {
String leftName = new String(leftType.readableName());
String rightName = new String(rightType.readableName());
String leftShortName = new String(leftType.shortReadableName());
String rightShortName = new String(rightType.shortReadableName());
if (leftShortName.equals(rightShortName)){
leftShortName = leftName;
rightShortName = rightName;
}
this.handle(
IProblem.IncompatibleTypesInConditionalOperator,
new String[] {leftName, rightName },
new String[] {leftShortName, rightShortName },
expression.sourceStart,
expression.sourceEnd);
}
示例5: notCompatibleTypesErrorInForeach
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void notCompatibleTypesErrorInForeach(Expression expression, TypeBinding leftType, TypeBinding rightType) {
String leftName = new String(leftType.readableName());
String rightName = new String(rightType.readableName());
String leftShortName = new String(leftType.shortReadableName());
String rightShortName = new String(rightType.shortReadableName());
if (leftShortName.equals(rightShortName)){
leftShortName = leftName;
rightShortName = rightName;
}
this.handle(
IProblem.IncompatibleTypesInForeach,
new String[] {leftName, rightName },
new String[] {leftShortName, rightShortName },
expression.sourceStart,
expression.sourceEnd);
}
示例6: typeCastError
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void typeCastError(CastExpression expression, TypeBinding leftType, TypeBinding rightType) {
String leftName = new String(leftType.readableName());
String rightName = new String(rightType.readableName());
String leftShortName = new String(leftType.shortReadableName());
String rightShortName = new String(rightType.shortReadableName());
if (leftShortName.equals(rightShortName)){
leftShortName = leftName;
rightShortName = rightName;
}
this.handle(
IProblem.IllegalCast,
new String[] { rightName, leftName },
new String[] { rightShortName, leftShortName },
expression.sourceStart,
expression.sourceEnd);
}
示例7: cannotExtendEnum
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void cannotExtendEnum(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
String name = new String(type.sourceName());
String superTypeFullName = new String(superTypeBinding.readableName());
String superTypeShortName = new String(superTypeBinding.shortReadableName());
if (superTypeShortName.equals(name)) superTypeShortName = superTypeFullName;
this.handle(
IProblem.CannotExtendEnum,
new String[] {superTypeFullName, name},
new String[] {superTypeShortName, name},
superclass.sourceStart,
superclass.sourceEnd);
}
示例8: lambdaParameterTypeMismatched
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void lambdaParameterTypeMismatched(Argument argument, TypeReference type, TypeBinding expectedParameterType) {
String name = new String(argument.name);
String expectedTypeFullName = new String(expectedParameterType.readableName());
String expectedTypeShortName = new String(expectedParameterType.shortReadableName());
this.handle(
expectedParameterType.isTypeVariable() ? IProblem.IncompatibleLambdaParameterType : IProblem.lambdaParameterTypeMismatched,
new String[] { name, expectedTypeFullName },
new String[] { name, expectedTypeShortName },
type.sourceStart,
type.sourceEnd);
}
示例9: classExtendFinalClass
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void classExtendFinalClass(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
String name = new String(type.sourceName());
String superTypeFullName = new String(superTypeBinding.readableName());
String superTypeShortName = new String(superTypeBinding.shortReadableName());
if (superTypeShortName.equals(name)) superTypeShortName = superTypeFullName;
this.handle(
IProblem.ClassExtendFinalClass,
new String[] {superTypeFullName, name},
new String[] {superTypeShortName, name},
superclass.sourceStart,
superclass.sourceEnd);
}
示例10: constantOutOfRange
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void constantOutOfRange(Literal literal, TypeBinding literalType) {
String[] arguments = new String[] {new String(literalType.readableName()), new String(literal.source())};
this.handle(
IProblem.NumericValueOutOfRange,
arguments,
arguments,
literal.sourceStart,
literal.sourceEnd);
}
示例11: illegalAnnotationForBaseType
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void illegalAnnotationForBaseType(Annotation annotation, TypeBinding type)
{
String[] args = new String[] {
new String(annotation.resolvedType.shortReadableName()),
new String(type.readableName())
};
this.handle(IProblem.IllegalAnnotationForBaseType,
args,
args,
annotation.sourceStart,
annotation.sourceEnd);
}
示例12: superTypeCannotUseWildcard
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void superTypeCannotUseWildcard(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
String name = new String(type.sourceName());
String superTypeFullName = new String(superTypeBinding.readableName());
String superTypeShortName = new String(superTypeBinding.shortReadableName());
if (superTypeShortName.equals(name)) superTypeShortName = superTypeFullName;
this.handle(
IProblem.SuperTypeUsingWildcard,
new String[] {superTypeFullName, name},
new String[] {superTypeShortName, name},
superclass.sourceStart,
superclass.sourceEnd);
}
示例13: typeMismatchError
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
public void typeMismatchError(TypeBinding actualType, TypeBinding expectedType, ASTNode location, ASTNode expectingLocation) {
if (this.options.sourceLevel < ClassFileConstants.JDK1_5) { // don't expose type variable names, complain on erased types
if (actualType instanceof TypeVariableBinding)
actualType = actualType.erasure();
if (expectedType instanceof TypeVariableBinding)
expectedType = expectedType.erasure();
}
if (actualType != null && (actualType.tagBits & TagBits.HasMissingType) != 0) { // improve secondary error
if (location instanceof Annotation) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=376977
return; // Already reported, don't report a secondary error
}
this.handle(
IProblem.UndefinedType,
new String[] {new String(actualType.leafComponentType().readableName())},
new String[] {new String(actualType.leafComponentType().shortReadableName())},
location.sourceStart,
location.sourceEnd);
return;
}
if (expectingLocation != null && (expectedType.tagBits & TagBits.HasMissingType) != 0) { // improve secondary error
this.handle(
IProblem.UndefinedType,
new String[] {new String(expectedType.leafComponentType().readableName())},
new String[] {new String(expectedType.leafComponentType().shortReadableName())},
expectingLocation.sourceStart,
expectingLocation.sourceEnd);
return;
}
char[] actualShortReadableName = actualType.shortReadableName();
char[] expectedShortReadableName = expectedType.shortReadableName();
char[] actualReadableName = actualType.readableName();
char[] expectedReadableName = expectedType.readableName();
if (CharOperation.equals(actualShortReadableName, expectedShortReadableName)) {
if (CharOperation.equals(actualReadableName, expectedReadableName)) {
// if full type names are equal, assume the incompatibility is due to mismatching null annotations:
actualReadableName = actualType.nullAnnotatedReadableName(this.options, false);
expectedReadableName = expectedType.nullAnnotatedReadableName(this.options, false);
actualShortReadableName = actualType.nullAnnotatedReadableName(this.options, true);
expectedShortReadableName = expectedType.nullAnnotatedReadableName(this.options, true);
} else {
actualShortReadableName = actualReadableName;
expectedShortReadableName = expectedReadableName;
}
}
this.handle(
expectingLocation instanceof ReturnStatement ? IProblem.ReturnTypeMismatch : IProblem.TypeMismatch,
new String[] {new String(actualReadableName), new String(expectedReadableName)},
new String[] {new String(actualShortReadableName), new String(expectedShortReadableName)},
location.sourceStart,
location.sourceEnd);
}