diff --git a/js/js.translator/src/org/jetbrains/k2js/translate/declaration/ClassDeclarationTranslator.java b/js/js.translator/src/org/jetbrains/k2js/translate/declaration/ClassDeclarationTranslator.java index bd58a268a8a..8a09990a7c9 100644 --- a/js/js.translator/src/org/jetbrains/k2js/translate/declaration/ClassDeclarationTranslator.java +++ b/js/js.translator/src/org/jetbrains/k2js/translate/declaration/ClassDeclarationTranslator.java @@ -20,8 +20,6 @@ import com.google.dart.compiler.backend.js.ast.*; import com.intellij.openapi.util.Pair; import com.intellij.util.SmartList; import gnu.trove.THashMap; -import gnu.trove.TLinkableAdaptor; -import gnu.trove.TLinkedList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; @@ -50,9 +48,9 @@ public final class ClassDeclarationTranslator extends AbstractTranslator { private final LabelGenerator localLabelGenerator = new LabelGenerator('c'); @NotNull - private final THashMap openClassDescriptorToItem = new THashMap(); + private final THashMap openClassDescriptorToItem = new THashMap(); - private final TLinkedList openList = new TLinkedList(); + private final LinkedList openList = new LinkedList(); private final List> finalList = new ArrayList>(); @NotNull @@ -77,7 +75,7 @@ public final class ClassDeclarationTranslator extends AbstractTranslator { @Override @Nullable public JsNameRef get(ClassDescriptor descriptor, ClassDescriptor referencedDescriptor) { - FinalListItem item = openClassDescriptorToItem.get(descriptor); + OpenClassInfo item = openClassDescriptorToItem.get(descriptor); // class declared in library if (item == null) { return null; @@ -87,12 +85,12 @@ public final class ClassDeclarationTranslator extends AbstractTranslator { } } - private static class FinalListItem extends TLinkableAdaptor { + private static class OpenClassInfo { private final JetClass declaration; private final JsNameRef label; private final JsNameRef qualifiedLabel; - private FinalListItem(JetClass declaration, JsNameRef label, JsNameRef qualifiedLabel) { + private OpenClassInfo(JetClass declaration, JsNameRef label, JsNameRef qualifiedLabel) { this.declaration = declaration; this.label = label; this.qualifiedLabel = qualifiedLabel; @@ -124,18 +122,18 @@ public final class ClassDeclarationTranslator extends AbstractTranslator { private void generateOpenClassDeclarations(@NotNull List vars, @NotNull List propertyInitializers) { // first pass: set up list order - LinkedList sortedOpenClasses = - (LinkedList) DFS.topologicalOrder(openList, new DFS.Neighbors() { + LinkedList sortedOpenClasses = + (LinkedList) DFS.topologicalOrder(openList, new DFS.Neighbors() { @NotNull @Override - public Iterable getNeighbors(FinalListItem current) { - LinkedList parents = new LinkedList(); + public Iterable getNeighbors(OpenClassInfo current) { + LinkedList parents = new LinkedList(); ClassDescriptor classDescriptor = getClassDescriptor(context().bindingContext(), current.declaration); Collection superTypes = classDescriptor.getTypeConstructor().getSupertypes(); for (JetType type : superTypes) { ClassDescriptor descriptor = getClassDescriptorForType(type); - FinalListItem item = openClassDescriptorToItem.get(descriptor); + OpenClassInfo item = openClassDescriptorToItem.get(descriptor); if (item == null) { continue; } @@ -150,9 +148,9 @@ public final class ClassDeclarationTranslator extends AbstractTranslator { assert sortedOpenClasses.size() == openList.size(); // second pass: generate - Iterator it = sortedOpenClasses.descendingIterator(); + Iterator it = sortedOpenClasses.descendingIterator(); while (it.hasNext()) { - FinalListItem item = it.next(); + OpenClassInfo item = it.next(); JsExpression translatedDeclaration = translateClassDeclaration(item.declaration, classDescriptorToLabel, context()); generate(item, propertyInitializers, translatedDeclaration, vars); } @@ -162,7 +160,7 @@ public final class ClassDeclarationTranslator extends AbstractTranslator { ClassAliasingMap aliasingMap = new ClassAliasingMap() { @Override public JsNameRef get(ClassDescriptor descriptor, ClassDescriptor referencedDescriptor) { - FinalListItem item = openClassDescriptorToItem.get(descriptor); + OpenClassInfo item = openClassDescriptorToItem.get(descriptor); return item == null ? null : item.qualifiedLabel; } }; @@ -172,7 +170,7 @@ public final class ClassDeclarationTranslator extends AbstractTranslator { } } - private static void generate(@NotNull FinalListItem item, + private static void generate(@NotNull OpenClassInfo item, @NotNull List propertyInitializers, @NotNull JsExpression definition, @NotNull List vars) { @@ -201,7 +199,8 @@ public final class ClassDeclarationTranslator extends AbstractTranslator { else { String label = localLabelGenerator.generate(); JsNameRef labelRef = dummyFunction.getScope().declareName(label).makeRef(); - FinalListItem item = new FinalListItem((JetClass) declaration, labelRef, new JsNameRef(labelRef.getIdent(), declarationsObjectRef)); + OpenClassInfo + item = new OpenClassInfo((JetClass) declaration, labelRef, new JsNameRef(labelRef.getIdent(), declarationsObjectRef)); openList.add(item); openClassDescriptorToItem.put(descriptor, item);