Skip to content

Commit cf35c83

Browse files
committed
fix for super call not having correct arguments
1 parent 7a7df30 commit cf35c83

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/ASTScriptVisitor.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,10 +1858,19 @@ public boolean visit(SuperFieldAccess node) {
18581858
public boolean visit(SuperMethodInvocation node) {
18591859
IMethodBinding mBinding = node.resolveMethodBinding();
18601860
String name = getJ2SName(node.getName()) + getJ2SParamQualifier(null, mBinding);
1861-
// BH if this is a call to super.clone() and there is no superclass, or the superclass is Object,
1862-
// then we need to invoke Clazz.clone(this) directly instead of calling C$.superClazz.clone()
1863-
buffer.append("clone".equals(name) && getSuperclassName(mBinding.getDeclaringClass()) == null
1864-
? "Clazz.clone(this)" : "C$.superClazz.prototype." + name + ".apply(this, arguments)");
1861+
// BH if this is a call to super.clone() and there is no superclass, or
1862+
// the superclass is Object,
1863+
// then we need to invoke Clazz.clone(this) directly instead of calling
1864+
// C$.superClazz.clone()
1865+
if ("clone".equals(name) && getSuperclassName(mBinding.getDeclaringClass()) == null) {
1866+
buffer.append("Clazz.clone(this)");
1867+
} else {
1868+
buffer.append("C$.superClazz.prototype." + name + ".apply(this, ");
1869+
buffer.append(" [");
1870+
addMethodParameterList(node.arguments(), mBinding, false, null, null);
1871+
buffer.append("])");
1872+
}
1873+
18651874
return false;
18661875
}
18671876

0 commit comments

Comments
 (0)