mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-14 23:09:22 +00:00
remove useless line for default erased methods
This commit is contained in:
parent
197108f96c
commit
13a46751b9
@ -1537,7 +1537,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
|
|||||||
defaultMethods = new HashSet<>();
|
defaultMethods = new HashSet<>();
|
||||||
Util.findDefaultMethodsInType(defaultMethods, context, classdecl.sym);
|
Util.findDefaultMethodsInType(defaultMethods, context, classdecl.sym);
|
||||||
|
|
||||||
if (Util.isSourceElement(classdecl.sym.getSuperclass().tsym) && !isMappedOrErasedType(classdecl.sym.getSuperclass().tsym)) {
|
if (!defaultMethods.isEmpty() && Util.isSourceElement(classdecl.sym.getSuperclass().tsym) && !isMappedOrErasedType(classdecl.sym.getSuperclass().tsym)) {
|
||||||
HashSet<Entry<JCClassDecl, JCMethodDecl>> superClassDefaultMethods = new HashSet<>();
|
HashSet<Entry<JCClassDecl, JCMethodDecl>> superClassDefaultMethods = new HashSet<>();
|
||||||
Util.findDefaultMethodsInType(superClassDefaultMethods, context, (ClassSymbol)classdecl.sym.getSuperclass().tsym);;
|
Util.findDefaultMethodsInType(superClassDefaultMethods, context, (ClassSymbol)classdecl.sym.getSuperclass().tsym);;
|
||||||
defaultMethods.removeAll(superClassDefaultMethods);
|
defaultMethods.removeAll(superClassDefaultMethods);
|
||||||
@ -1742,7 +1742,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (JCTree def : defs) {
|
for (JCTree def : defs) {
|
||||||
if (injectedDefaultMethods.contains(def)) {
|
if (injectedDefaultMethods.contains(def)) {
|
||||||
JCMethodDecl defaultMethod = (JCMethodDecl) def;
|
JCMethodDecl defaultMethod = (JCMethodDecl) def;
|
||||||
@ -1769,8 +1769,12 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
|
|||||||
printIndent()
|
printIndent()
|
||||||
.print("/* Default method injected from " + defaultMethod.sym.getEnclosingElement() + " */")
|
.print("/* Default method injected from " + defaultMethod.sym.getEnclosingElement() + " */")
|
||||||
.println();
|
.println();
|
||||||
|
printIndent();
|
||||||
|
}
|
||||||
|
print(defaultMethod);
|
||||||
|
if (!context.hasAnnotationType(defaultMethod.sym, JSweetConfig.ANNOTATION_ERASED)) {
|
||||||
|
println();
|
||||||
}
|
}
|
||||||
printIndent().print(defaultMethod).println();
|
|
||||||
getAdapter().typeVariablesToErase.removeAll(((ClassSymbol) s.getEnclosingElement()).getTypeParameters());
|
getAdapter().typeVariablesToErase.removeAll(((ClassSymbol) s.getEnclosingElement()).getTypeParameters());
|
||||||
getScope().defaultMethodScope = false;
|
getScope().defaultMethodScope = false;
|
||||||
continue;
|
continue;
|
||||||
@ -1808,6 +1812,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
|
|||||||
printIndent();
|
printIndent();
|
||||||
}
|
}
|
||||||
int pos = getCurrentPosition();
|
int pos = getCurrentPosition();
|
||||||
|
|
||||||
print(def);
|
print(def);
|
||||||
|
|
||||||
if (getScope().enumScope && JCTree.Tag.VARDEF == def.getTag() && getScope().enumString) {
|
if (getScope().enumScope && JCTree.Tag.VARDEF == def.getTag() && getScope().enumString) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user