本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg.CONSTRUCTOR_NOT_FOUND属性的典型用法代码示例。如果您正苦于以下问题:Java ErrorMsg.CONSTRUCTOR_NOT_FOUND属性的具体用法?Java ErrorMsg.CONSTRUCTOR_NOT_FOUND怎么用?Java ErrorMsg.CONSTRUCTOR_NOT_FOUND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg
的用法示例。
在下文中一共展示了ErrorMsg.CONSTRUCTOR_NOT_FOUND属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typeCheckConstructor
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));
}
示例2: typeCheckConstructor
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));
}