jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java
Print this page
@@ -52,10 +52,11 @@
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+import java.util.Objects;
/**
* @author Jacek Ambroziak
* @author Santiago Pericas-Geertsen
* @author Morten Jorgensen
@@ -154,12 +155,19 @@
public JavaType(Class type, int distance){
this.type = type;
this.distance = distance;
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(this.type);
+ }
+
+ @Override
public boolean equals(Object query){
- return query.equals(type);
+ return query != null && query.equals(type);
}
}
/**
* Defines 2 conversion tables:
@@ -275,10 +283,11 @@
public String getName() {
return(_fname.toString());
}
+ @Override
public void setParser(Parser parser) {
super.setParser(parser);
if (_arguments != null) {
final int n = _arguments.size();
for (int i = 0; i < n; i++) {
@@ -317,10 +326,11 @@
/**
* Type check a function call. Since different type conversions apply,
* type checking is different for standard and external (Java) functions.
*/
+ @Override
public Type typeCheck(SymbolTable stable)
throws TypeCheckError
{
if (_type != null) return _type;
@@ -678,10 +688,11 @@
/**
* Compile the function call and treat as an expression
* Update true/false-lists.
*/
+ @Override
public void translateDesynthesized(ClassGenerator classGen,
MethodGenerator methodGen)
{
Type type = Type.Boolean;
if (_chosenMethodType != null)
@@ -698,10 +709,11 @@
/**
* Translate a function call. The compiled code will leave the function's
* return value on the JVM's stack.
*/
+ @Override
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final int n = argumentCount();
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing();
@@ -855,10 +867,11 @@
_type.translateFrom(classGen, methodGen,
_chosenMethod.getReturnType());
}
}
+ @Override
public String toString() {
return "funcall(" + _fname + ", " + _arguments + ')';
}
public boolean isStandard() {
@@ -1067,11 +1080,11 @@
* Note: dashes only appear in middle of an EXSLT function or element name.
*/
protected static String replaceDash(String name)
{
char dash = '-';
- StringBuffer buff = new StringBuffer("");
+ final StringBuilder buff = new StringBuilder("");
for (int i = 0; i < name.length(); i++) {
if (i > 0 && name.charAt(i-1) == dash)
buff.append(Character.toUpperCase(name.charAt(i)));
else if (name.charAt(i) != dash)
buff.append(name.charAt(i));