本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.TypeIds.T_void方法的典型用法代码示例。如果您正苦于以下问题:Java TypeIds.T_void方法的具体用法?Java TypeIds.T_void怎么用?Java TypeIds.T_void使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.TypeIds
的用法示例。
在下文中一共展示了TypeIds.T_void方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: returnsExpression
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public void returnsExpression(Expression expression, TypeBinding resultType) {
if (this.original == this) // not in overload resolution context.
return;
if (this.body instanceof Expression) {
this.original.valueCompatible = resultType != null && resultType.id != TypeIds.T_void;
this.original.resultExpressions = new Expression[1];
this.original.resultExpressions[0] = expression;
return; // void compatibility determined via statementExpression()
}
if (expression != null) {
this.original.returnsValue = true;
this.original.voidCompatible = false;
this.original.valueCompatible = !this.original.returnsVoid;
if (resultType != null) {
Expression [] returnExpressions = this.original.resultExpressions;
int resultsLength = returnExpressions.length;
System.arraycopy(returnExpressions, 0, returnExpressions = new Expression[resultsLength + 1], 0, resultsLength);
returnExpressions[resultsLength] = expression;
this.original.resultExpressions = returnExpressions;
}
} else {
this.original.returnsVoid = true;
this.original.valueCompatible = false;
this.original.voidCompatible = !this.original.returnsValue;
}
}
示例2: sIsMoreSpecific
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public boolean sIsMoreSpecific(TypeBinding s, TypeBinding t, Scope scope) {
if (super.sIsMoreSpecific(s, t, scope))
return true;
if (this.exactMethodBinding == null || t.findSuperTypeOriginatingFrom(s) != null)
return false;
s = s.capture(this.enclosingScope, this.sourceEnd);
MethodBinding sSam = s.getSingleAbstractMethod(this.enclosingScope, true);
if (sSam == null || !sSam.isValidBinding())
return false;
TypeBinding r1 = sSam.returnType;
MethodBinding tSam = t.getSingleAbstractMethod(this.enclosingScope, true);
if (tSam == null || !tSam.isValidBinding())
return false;
TypeBinding r2 = tSam.returnType;
if (r2.id == TypeIds.T_void)
return true;
if (r1.id == TypeIds.T_void)
return false;
// r1 <: r2
if (r1.isCompatibleWith(r2, scope))
return true;
return r1.isBaseType() != r2.isBaseType() && r1.isBaseType() == this.exactMethodBinding.returnType.isBaseType();
}
示例3: newTypeMirror
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
/**
* Given a binding of uncertain type, try to create the right sort of TypeMirror for it.
*/
public TypeMirror newTypeMirror(Binding binding) {
switch (binding.kind()) {
case Binding.FIELD:
case Binding.LOCAL:
case Binding.VARIABLE:
// For variables, return the type of the variable
return newTypeMirror(((VariableBinding)binding).type);
case Binding.PACKAGE:
return getNoType(TypeKind.PACKAGE);
case Binding.IMPORT:
throw new UnsupportedOperationException("NYI: import type " + binding.kind()); //$NON-NLS-1$
case Binding.METHOD:
return new ExecutableTypeImpl(_env, (MethodBinding) binding);
case Binding.TYPE:
case Binding.RAW_TYPE:
case Binding.GENERIC_TYPE:
case Binding.PARAMETERIZED_TYPE:
ReferenceBinding referenceBinding = (ReferenceBinding) binding;
if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) {
return getErrorType(referenceBinding);
}
return new DeclaredTypeImpl(_env, (ReferenceBinding)binding);
case Binding.ARRAY_TYPE:
return new ArrayTypeImpl(_env, (ArrayBinding)binding);
case Binding.BASE_TYPE:
BaseTypeBinding btb = (BaseTypeBinding)binding;
switch (btb.id) {
case TypeIds.T_void:
return getNoType(TypeKind.VOID);
case TypeIds.T_null:
return getNullType();
default:
return getPrimitiveType(btb);
}
case Binding.WILDCARD_TYPE:
case Binding.INTERSECTION_TYPE: // TODO compatible, but shouldn't it really be an intersection type?
return new WildcardTypeImpl(_env, (WildcardBinding) binding);
case Binding.TYPE_PARAMETER:
return new TypeVariableImpl(_env, (TypeVariableBinding) binding);
}
return null;
}
示例4: baseTypeReference
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public static final TypeReference baseTypeReference(int baseType, int dim, Annotation [][] dimAnnotations) {
if (dim == 0) {
switch (baseType) {
case (TypeIds.T_void) :
return new SingleTypeReference(TypeBinding.VOID.simpleName, 0);
case (TypeIds.T_boolean) :
return new SingleTypeReference(TypeBinding.BOOLEAN.simpleName, 0);
case (TypeIds.T_char) :
return new SingleTypeReference(TypeBinding.CHAR.simpleName, 0);
case (TypeIds.T_float) :
return new SingleTypeReference(TypeBinding.FLOAT.simpleName, 0);
case (TypeIds.T_double) :
return new SingleTypeReference(TypeBinding.DOUBLE.simpleName, 0);
case (TypeIds.T_byte) :
return new SingleTypeReference(TypeBinding.BYTE.simpleName, 0);
case (TypeIds.T_short) :
return new SingleTypeReference(TypeBinding.SHORT.simpleName, 0);
case (TypeIds.T_int) :
return new SingleTypeReference(TypeBinding.INT.simpleName, 0);
default : //T_long
return new SingleTypeReference(TypeBinding.LONG.simpleName, 0);
}
}
switch (baseType) {
case (TypeIds.T_void) :
return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, dimAnnotations, 0);
case (TypeIds.T_boolean) :
return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, dimAnnotations, 0);
case (TypeIds.T_char) :
return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, dimAnnotations, 0);
case (TypeIds.T_float) :
return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, dimAnnotations, 0);
case (TypeIds.T_double) :
return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, dimAnnotations, 0);
case (TypeIds.T_byte) :
return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, dimAnnotations, 0);
case (TypeIds.T_short) :
return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, dimAnnotations, 0);
case (TypeIds.T_int) :
return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, dimAnnotations, 0);
default : //T_long
return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, dimAnnotations, 0);
}
}
示例5: sIsMoreSpecific
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public boolean sIsMoreSpecific(TypeBinding s, TypeBinding t, Scope skope) {
// 15.12.2.5
if (super.sIsMoreSpecific(s, t, skope))
return true;
if (argumentsTypeElided() || t.findSuperTypeOriginatingFrom(s) != null)
return false;
s = s.capture(this.enclosingScope, this.sourceEnd);
MethodBinding sSam = s.getSingleAbstractMethod(this.enclosingScope, true);
if (sSam == null || !sSam.isValidBinding())
return false;
TypeBinding r1 = sSam.returnType;
MethodBinding tSam = t.getSingleAbstractMethod(this.enclosingScope, true);
if (tSam == null || !tSam.isValidBinding())
return false;
TypeBinding r2 = tSam.returnType;
if (r2.id == TypeIds.T_void)
return true;
if (r1.id == TypeIds.T_void)
return false;
// r1 <: r2
if (r1.isCompatibleWith(r2, skope))
return true;
Expression [] returnExpressions = this.resultExpressions;
int returnExpressionsLength = returnExpressions == null ? 0 : returnExpressions.length;
int i;
// r1 is a primitive type, r2 is a reference type, and each result expression is a standalone expression (15.2) of a primitive type
if (r1.isBaseType() && !r2.isBaseType()) {
for (i = 0; i < returnExpressionsLength; i++) {
if (returnExpressions[i].isPolyExpression() || !returnExpressions[i].resolvedType.isBaseType())
break;
}
if (i == returnExpressionsLength)
return true;
}
if (!r1.isBaseType() && r2.isBaseType()) {
for (i = 0; i < returnExpressionsLength; i++) {
if (returnExpressions[i].resolvedType.isBaseType())
break;
}
if (i == returnExpressionsLength)
return true;
}
if (r1.isFunctionalInterface(this.enclosingScope) && r2.isFunctionalInterface(this.enclosingScope)) {
for (i = 0; i < returnExpressionsLength; i++) {
Expression resultExpression = returnExpressions[i];
if (!resultExpression.sIsMoreSpecific(r1, r2, skope))
break;
}
if (i == returnExpressionsLength)
return true;
}
return false;
}
示例6: replaceWithElementType
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public void replaceWithElementType() {
if (this.constantPoolName[1] == 'L') {
this.constantPoolName = CharOperation.subarray(this.constantPoolName, 2, this.constantPoolName.length - 1);
} else {
this.constantPoolName = CharOperation.subarray(this.constantPoolName, 1, this.constantPoolName.length);
if (this.constantPoolName.length == 1) {
switch(this.constantPoolName[0]) {
case 'I' :
this.id = TypeIds.T_int;
break;
case 'B' :
this.id = TypeIds.T_byte;
break;
case 'S' :
this.id = TypeIds.T_short;
break;
case 'C' :
this.id = TypeIds.T_char;
break;
case 'J' :
this.id = TypeIds.T_long;
break;
case 'F' :
this.id = TypeIds.T_float;
break;
case 'D' :
this.id = TypeIds.T_double;
break;
case 'Z' :
this.id = TypeIds.T_boolean;
break;
case 'N' :
this.id = TypeIds.T_null;
break;
case 'V' :
this.id = TypeIds.T_void;
break;
}
}
}
}
示例7: newTypeMirror
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
/**
* Given a binding of uncertain type, try to create the right sort of TypeMirror for it.
*/
public TypeMirror newTypeMirror(Binding binding) {
switch (binding.kind()) {
case Binding.FIELD:
case Binding.LOCAL:
case Binding.VARIABLE:
// For variables, return the type of the variable
return newTypeMirror(((VariableBinding)binding).type);
case Binding.PACKAGE:
return getNoType(TypeKind.PACKAGE);
case Binding.IMPORT:
throw new UnsupportedOperationException("NYI: import type " + binding.kind()); //$NON-NLS-1$
case Binding.METHOD:
return new ExecutableTypeImpl(_env, (MethodBinding) binding);
case Binding.TYPE:
case Binding.RAW_TYPE:
case Binding.GENERIC_TYPE:
case Binding.PARAMETERIZED_TYPE:
ReferenceBinding referenceBinding = (ReferenceBinding) binding;
if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) {
return getErrorType(referenceBinding);
}
return new DeclaredTypeImpl(_env, (ReferenceBinding)binding);
case Binding.ARRAY_TYPE:
return new ArrayTypeImpl(_env, (ArrayBinding)binding);
case Binding.BASE_TYPE:
BaseTypeBinding btb = (BaseTypeBinding)binding;
switch (btb.id) {
case TypeIds.T_void:
return getNoType(TypeKind.VOID);
case TypeIds.T_null:
return getNullType();
default:
return getPrimitiveType(PrimitiveTypeImpl.getKind((BaseTypeBinding)binding));
}
case Binding.WILDCARD_TYPE:
case Binding.INTERSECTION_TYPE: // TODO compatible, but shouldn't it really be an intersection type?
return new WildcardTypeImpl(_env, (WildcardBinding) binding);
case Binding.TYPE_PARAMETER:
return new TypeVariableImpl(_env, (TypeVariableBinding) binding);
}
return null;
}
示例8: baseTypeReference
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public static final TypeReference baseTypeReference(int baseType, int dim) {
if (dim == 0) {
switch (baseType) {
case (TypeIds.T_void) :
return new SingleTypeReference(TypeBinding.VOID.simpleName, 0);
case (TypeIds.T_boolean) :
return new SingleTypeReference(TypeBinding.BOOLEAN.simpleName, 0);
case (TypeIds.T_char) :
return new SingleTypeReference(TypeBinding.CHAR.simpleName, 0);
case (TypeIds.T_float) :
return new SingleTypeReference(TypeBinding.FLOAT.simpleName, 0);
case (TypeIds.T_double) :
return new SingleTypeReference(TypeBinding.DOUBLE.simpleName, 0);
case (TypeIds.T_byte) :
return new SingleTypeReference(TypeBinding.BYTE.simpleName, 0);
case (TypeIds.T_short) :
return new SingleTypeReference(TypeBinding.SHORT.simpleName, 0);
case (TypeIds.T_int) :
return new SingleTypeReference(TypeBinding.INT.simpleName, 0);
default : //T_long
return new SingleTypeReference(TypeBinding.LONG.simpleName, 0);
}
}
switch (baseType) {
case (TypeIds.T_void) :
return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, 0);
case (TypeIds.T_boolean) :
return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, 0);
case (TypeIds.T_char) :
return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, 0);
case (TypeIds.T_float) :
return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, 0);
case (TypeIds.T_double) :
return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, 0);
case (TypeIds.T_byte) :
return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, 0);
case (TypeIds.T_short) :
return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, 0);
case (TypeIds.T_int) :
return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, 0);
default : //T_long
return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, 0);
}
}