本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.isAnonymousType方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceBinding.isAnonymousType方法的具体用法?Java ReferenceBinding.isAnonymousType怎么用?Java ReferenceBinding.isAnonymousType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
的用法示例。
在下文中一共展示了ReferenceBinding.isAnonymousType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNestingKind
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
public NestingKind getNestingKind() {
ReferenceBinding refBinding = (ReferenceBinding)_binding;
if (refBinding.isAnonymousType()) {
return NestingKind.ANONYMOUS;
} else if (refBinding.isLocalType()) {
return NestingKind.LOCAL;
} else if (refBinding.isMemberType()) {
return NestingKind.MEMBER;
}
return NestingKind.TOP_LEVEL;
}
示例2: isAnonymous
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public boolean isAnonymous() {
if (isClass() || isInterface() || isEnum()) {
ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
return referenceBinding.isAnonymousType();
}
return false;
}
示例3: invalidEnclosingType
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public void invalidEnclosingType(Expression expression, TypeBinding type, ReferenceBinding enclosingType) {
if (enclosingType.isAnonymousType()) enclosingType = enclosingType.superclass();
if (enclosingType.sourceName != null && enclosingType.sourceName.length == 0) return;
int flag = IProblem.UndefinedType; // default
switch (type.problemId()) {
case ProblemReasons.NotFound : // 1
flag = IProblem.UndefinedType;
break;
case ProblemReasons.NotVisible : // 2
flag = IProblem.NotVisibleType;
break;
case ProblemReasons.Ambiguous : // 3
flag = IProblem.AmbiguousType;
break;
case ProblemReasons.InternalNameProvided :
flag = IProblem.InternalTypeNameProvided;
break;
case ProblemReasons.NoError : // 0
default :
needImplementation(expression); // want to fail to see why we were here...
break;
}
this.handle(
flag,
new String[] {new String(enclosingType.readableName()) + "." + new String(type.readableName())}, //$NON-NLS-1$
new String[] {new String(enclosingType.shortReadableName()) + "." + new String(type.shortReadableName())}, //$NON-NLS-1$
expression.sourceStart,
expression.sourceEnd);
}
示例4: generateInnerClassAttribute
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private int generateInnerClassAttribute(int numberOfInnerClasses, ReferenceBinding[] innerClasses) {
int localContentsOffset = this.contentsOffset;
// Generate the inner class attribute
int exSize = 8 * numberOfInnerClasses + 8;
if (exSize + localContentsOffset >= this.contents.length) {
resizeContents(exSize);
}
// Now we now the size of the attribute and the number of entries
// attribute name
int attributeNameIndex =
this.constantPool.literalIndex(AttributeNamesConstants.InnerClassName);
this.contents[localContentsOffset++] = (byte) (attributeNameIndex >> 8);
this.contents[localContentsOffset++] = (byte) attributeNameIndex;
int value = (numberOfInnerClasses << 3) + 2;
this.contents[localContentsOffset++] = (byte) (value >> 24);
this.contents[localContentsOffset++] = (byte) (value >> 16);
this.contents[localContentsOffset++] = (byte) (value >> 8);
this.contents[localContentsOffset++] = (byte) value;
this.contents[localContentsOffset++] = (byte) (numberOfInnerClasses >> 8);
this.contents[localContentsOffset++] = (byte) numberOfInnerClasses;
for (int i = 0; i < numberOfInnerClasses; i++) {
ReferenceBinding innerClass = innerClasses[i];
int accessFlags = innerClass.getAccessFlags();
int innerClassIndex = this.constantPool.literalIndexForType(innerClass.constantPoolName());
// inner class index
this.contents[localContentsOffset++] = (byte) (innerClassIndex >> 8);
this.contents[localContentsOffset++] = (byte) innerClassIndex;
// outer class index: anonymous and local have no outer class index
if (innerClass.isMemberType()) {
// member or member of local
int outerClassIndex = this.constantPool.literalIndexForType(innerClass.enclosingType().constantPoolName());
this.contents[localContentsOffset++] = (byte) (outerClassIndex >> 8);
this.contents[localContentsOffset++] = (byte) outerClassIndex;
} else {
// equals to 0 if the innerClass is not a member type
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = 0;
}
// name index
if (!innerClass.isAnonymousType()) {
int nameIndex = this.constantPool.literalIndex(innerClass.sourceName());
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
this.contents[localContentsOffset++] = (byte) nameIndex;
} else {
// equals to 0 if the innerClass is an anonymous type
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = 0;
}
// access flag
if (innerClass.isAnonymousType()) {
accessFlags &= ~ClassFileConstants.AccFinal;
} else if (innerClass.isMemberType() && innerClass.isInterface()) {
accessFlags |= ClassFileConstants.AccStatic; // implicitely static
}
this.contents[localContentsOffset++] = (byte) (accessFlags >> 8);
this.contents[localContentsOffset++] = (byte) accessFlags;
}
this.contentsOffset = localContentsOffset;
return 1;
}