return returnValue;
}
public TypeInfo validate(String classTypeOrVariableName) throws SPLException
{
TypeInfo typeInfo = new TypeInfoImpl();
_classType = classTypeOrVariableName;
// ensure symbol table is populated
_populateSymbolTable(_classType);
// xiping's addition to support Java overloading, 06/19/09
// start
Object obj = null;
try {
obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + _identifier);
} catch(SPLException splex) {
try
{
obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + getAccessorMethodName(_identifier, "get"));
}
catch(SPLException splex1)
{
try
{
obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + getAccessorMethodName(_identifier, "is"));
}
catch(SPLException splex2)
{
throw new SPLException(
Messages
.getString(
"SPL_SYMBOL_DOES_NOT_EXIST_EXCEPTION_MSG",
new Object[] { classTypeOrVariableName + "."
+ _identifier }));
}
}
}
Symbol sym = null;
if (obj instanceof Vector) { // MethodSymbol
Collection c = (Collection) obj;
for (Iterator it = c.iterator(); it.hasNext();) {
sym = (Symbol) it.next();
List aList = ((MethodSymbol)sym).getArgumentList();
if (aList.size() != _paramList.size()) {
continue;
}
boolean typeNotEqual = false;
for (int i = 0; i < aList.size(); i++) {
Expression exp = (Expression)_paramList.get(i);
Argument arg = (Argument)aList.get(i);
TypeInfo expDataType = exp.getType();
TypeInfo argDataType = arg.getType();
// if (expDataType.getIsArray() != argDataType.getIsArray() ||
// expDataType.getType() != argDataType.getType()) {
if (expDataType.getType() != argDataType.getType()) {
typeNotEqual = true;
break;
}
}
if (typeNotEqual) {
continue;
}
break;
}
} else { // PropertySymbol
sym = (Symbol) obj;
}
if(_isMethod)
{
if(sym instanceof MethodSymbol)
{
typeInfo = _validateActualParameters(sym,classTypeOrVariableName);
}
else
{
throw new SPLException("Symbol " + _identifier + "is not a method");
}
}
else
{
TypeInfo tp = sym.getType();
boolean isArray = sym.isArray();
if(_arrExp != null) // expression is like A.b[2] which means
{ // the result is not an array
isArray = false;
}
String resultClass = null;
if(TypeResolver.isReference(tp))
{
resultClass = sym.getReferenceTypeName();
typeInfo.setReferenceTypeName(resultClass);
typeInfo.setType(tp.getType());
typeInfo.setIsArray(isArray);
}
else
{
typeInfo.setType(tp.getType());
typeInfo.setIsArray(isArray);
}
}