Skip to content

Commit 7c3a882

Browse files
committed
// BH 2020.07.04 -- 3.2.9.v1m fix for X.super.y() in anonymous class
1 parent 89cb592 commit 7c3a882

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

sources/net.sf.j2s.core/src/net/sf/j2s/core/CorePlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class CorePlugin extends Plugin {
3131
// j2sApplet.js and also (Bob only) update.bat, update-clean.bat
3232

3333

34+
// BH 2020.07.04 -- 3.2.9.v1m fix for X.super.y() in anonymous class
3435
// BH 2020.06.22 -- 3.2.9.v1k fix for varargs not proper qualified arrays
3536
// BH 2020.06.17 -- 3.2.9-v1j fix for functional interface this::privateMethod
3637
// BH 2020.05.01 -- 3.2.9-v1i fix for nested lambda methods

sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135

136136
// TODO: superclass inheritance for JAXB XmlAccessorType
137137

138+
//BH 2020.07.04 -- 3.2.9.v1m fix for X.super.y() in anonymous class
138139
//BH 2020.06.22 -- 3.2.9.v1k fix for varargs not proper qualified arrays
139140
//BH 2020.06.17 -- 3.2.9-v1j fix for functional interface this::privateMethod
140141
//BH 2020.05.01 -- 3.2.9-v1i fix for nested lambda methods
@@ -1754,12 +1755,17 @@ public boolean visit(SuperMethodInvocation node) {
17541755
buffer.append("Clazz.clone(this)");
17551756
return false;
17561757
}
1758+
String myThis = "this";
1759+
17571760
if (isQualified) {
17581761
node.getQualifier().accept(this);
1762+
if (class_isAnonymousOrLocal) {
1763+
myThis = getSyntheticReference(mBinding.getDeclaringClass().getQualifiedName());
1764+
}
17591765
} else {
1760-
buffer.append("C$.superclazz");
1766+
buffer.append("C$");
17611767
}
1762-
buffer.append(".prototype." + finalMethodNameWith$Params + ".apply(this, [");
1768+
buffer.append(".superclazz.prototype." + finalMethodNameWith$Params + ".apply(" + myThis + ", [");
17631769
addMethodParameterList(node.arguments(), mBinding, null, null, METHOD_NOTSPECIAL);
17641770
buffer.append("])");
17651771

0 commit comments

Comments
 (0)