本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType类的典型用法代码示例。如果您正苦于以下问题:Java ObjectType类的具体用法?Java ObjectType怎么用?Java ObjectType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectType类属于com.sun.org.apache.xalan.internal.xsltc.compiler.util包,在下文中一共展示了ObjectType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: typeCheck
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType; //导入依赖的package包/类
/**
* Type-checks the parameter. The parameter type is determined by the
* 'select' expression (if present) or is a result tree if the parameter
* element has a body and no 'select' expression.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
if (_select != null) {
_type = _select.typeCheck(stable);
if (_type instanceof ReferenceType == false && !(_type instanceof ObjectType)) {
_select = new CastExpr(_select, Type.Reference);
}
}
else if (hasContents()) {
typeCheckContents(stable);
}
_type = Type.Reference;
// This element has no type (the parameter does, but the parameter
// element itself does not).
return Type.Void;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Param.java
示例2: typeCheck
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType; //导入依赖的package包/类
/**
* Type check the two parameters for this function
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
// Check that the function was passed exactly two arguments
if (argumentCount() != 2) {
throw new TypeCheckError(new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
getName(), this));
}
// The first argument must be a literal String
Expression exp = argument(0);
if (exp instanceof LiteralExpr) {
_className = ((LiteralExpr) exp).getValue();
_type = Type.newObjectType(_className);
}
else {
throw new TypeCheckError(new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
getName(), this));
}
// Second argument must be of type reference or object
_right = argument(1);
Type tright = _right.typeCheck(stable);
if (tright != Type.Reference &&
tright instanceof ObjectType == false)
{
throw new TypeCheckError(new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
tright, _type, this));
}
return _type;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:CastCall.java
示例3: typeCheckConstructor
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType; //导入依赖的package包/类
public Type typeCheckConstructor(SymbolTable stable) throws TypeCheckError{
final Vector constructors = findConstructors();
if (constructors == null) {
// Constructor not found in this class
throw new TypeCheckError(ErrorMsg.CONSTRUCTOR_NOT_FOUND,
_className);
}
final int nConstructors = constructors.size();
final int nArgs = _arguments.size();
final Vector argsType = typeCheckArgs(stable);
// Try all constructors
int bestConstrDistance = Integer.MAX_VALUE;
_type = null; // reset
for (int j, i = 0; i < nConstructors; i++) {
// Check if all parameters to this constructor can be converted
final Constructor constructor =
(Constructor)constructors.elementAt(i);
final Class[] paramTypes = constructor.getParameterTypes();
Class extType = null;
int currConstrDistance = 0;
for (j = 0; j < nArgs; j++) {
// Convert from internal (translet) type to external (Java) type
extType = paramTypes[j];
final Type intType = (Type)argsType.elementAt(j);
Object match = _internal2Java.maps(intType, extType);
if (match != null) {
currConstrDistance += ((JavaType)match).distance;
}
else if (intType instanceof ObjectType) {
ObjectType objectType = (ObjectType)intType;
if (objectType.getJavaClass() == extType)
continue;
else if (extType.isAssignableFrom(objectType.getJavaClass()))
currConstrDistance += 1;
else {
currConstrDistance = Integer.MAX_VALUE;
break;
}
}
else {
// no mapping available
currConstrDistance = Integer.MAX_VALUE;
break;
}
}
if (j == nArgs && currConstrDistance < bestConstrDistance ) {
_chosenConstructor = constructor;
_isExtConstructor = true;
bestConstrDistance = currConstrDistance;
_type = (_clazz != null) ? Type.newObjectType(_clazz)
: Type.newObjectType(_className);
}
}
if (_type != null) {
return _type;
}
throw new TypeCheckError(ErrorMsg.ARGUMENT_CONVERSION_ERR, getMethodSignature(argsType));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:67,代码来源:FunctionCall.java
示例4: typeCheckConstructor
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType; //导入依赖的package包/类
public Type typeCheckConstructor(SymbolTable stable) throws TypeCheckError{
final Vector constructors = findConstructors();
if (constructors == null) {
// Constructor not found in this class
throw new TypeCheckError(ErrorMsg.CONSTRUCTOR_NOT_FOUND,
_className);
}
final int nConstructors = constructors.size();
final int nArgs = _arguments.size();
final Vector argsType = typeCheckArgs(stable);
// Try all constructors
int bestConstrDistance = Integer.MAX_VALUE;
_type = null; // reset
for (int j, i = 0; i < nConstructors; i++) {
// Check if all parameters to this constructor can be converted
final Constructor constructor =
(Constructor)constructors.elementAt(i);
final Class[] paramTypes = constructor.getParameterTypes();
Class<?> extType;
int currConstrDistance = 0;
for (j = 0; j < nArgs; j++) {
// Convert from internal (translet) type to external (Java) type
extType = paramTypes[j];
final Type intType = (Type)argsType.elementAt(j);
JavaType match = _internal2Java.maps(intType, new JavaType(extType, 0));
if (match != null) {
currConstrDistance += match.distance;
}
else if (intType instanceof ObjectType) {
ObjectType objectType = (ObjectType)intType;
if (objectType.getJavaClass() == extType)
continue;
else if (extType.isAssignableFrom(objectType.getJavaClass()))
currConstrDistance += 1;
else {
currConstrDistance = Integer.MAX_VALUE;
break;
}
}
else {
// no mapping available
currConstrDistance = Integer.MAX_VALUE;
break;
}
}
if (j == nArgs && currConstrDistance < bestConstrDistance ) {
_chosenConstructor = constructor;
_isExtConstructor = true;
bestConstrDistance = currConstrDistance;
_type = (_clazz != null) ? Type.newObjectType(_clazz)
: Type.newObjectType(_className);
}
}
if (_type != null) {
return _type;
}
throw new TypeCheckError(ErrorMsg.ARGUMENT_CONVERSION_ERR, getMethodSignature(argsType));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:67,代码来源:FunctionCall.java
注:本文中的com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论