Symbol sym = tree.symbol(); Symbol newSym = sym.overridingSymbol(parents[0]); if (newSym != Symbol.NONE) return gen.Select(tree.pos, gen.Super(tree.pos, newSym.owner()), newSym); else return super.transform(tree);
Tree qualifier = ((Tree.Select)tree).qualifier; qualifier = gen.Super(qualifier.pos, clasz); Symbol symbol = tree.symbol().overridingSymbol(parents[0]); assert symbol != Symbol.NONE: Debug.show(tree.symbol()); return gen.Select(tree.pos, qualifier, symbol);
    private void inlineMixinMembers(Scope symbols, Template mixin, int fstPos) {        // The map names is used to implement an all or nothing        // strategy for overloaded symbols.        Map/*<Name,Name>*/ names = new HashMap();        for (SymbolIterator i = symbols.iterator(true); i.hasNext();) {            Symbol member = i.next();            Name name = (Name)names.get(member.name);            boolean shadowed = name == null &&                members.lookup(member.name) != Symbol.NONE;            Symbol clone = cloner.cloneSymbol(member, shadowed);            if (name != null)                clone.name = name;            else                names.put(member.name, clone.name);            if (clone.name != member.name) clone.flags &= ~Modifiers.OVERRIDE;            clone.setType(clone.type().cloneTypeNoSubst(cloner));            members.enterOrOverload(clone);        }        // We need two loops because members may appear in their types.        for (SymbolIterator i = symbols.iterator(true); i.hasNext();) {            Symbol member = map.lookupSymbol(i.next());            if (member == null) continue;            member.setType(map.applyParams(member.type()));        }        cloner.owners.put(mixin.symbol(), template.symbol());        final Set clones = new HashSet();        TreeSymbolCloner mixinSymbolCloner = new TreeSymbolCloner(cloner) {            public Symbol cloneSymbol(Symbol symbol) {                Symbol clone = super.cloneSymbol(symbol);                clones.add(clone);                return clone;            }        };        TreeCloner mixinTreeCloner = new TreeCloner(global, map) {            public Tree transform(Tree tree) {                switch (tree) {                case New(Template template):                    assert template.parents.length == 1 : tree;                    assert template.body.length == 0 : tree;                    Tree apply = template.parents[0];                    switch (apply) {                    case Apply(Tree clasz, Tree[] args):                        args = transform(args);                        apply = gen.Apply(apply.pos, clasz, args);                        return gen.New(tree.pos, apply);                    default:                        throw Debug.abort("illegal case", tree);                    }                case Select(Super(_, _), _):                    Symbol sym = tree.symbol();                    Symbol newSym = sym.overridingSymbol(parents[0]);                    if (newSym != Symbol.NONE)                        return gen.Select(tree.pos,                                          gen.Super(tree.pos, newSym.owner()),                                          newSym);                    else                        return super.transform(tree);                default:                    return super.transform(tree);                }            }        };        int pos = 0;        for (int i = 0; i < mixin.body.length; i++) {            Tree tree = mixin.body[i];            // Inline local code and members whose symbol has been cloned.            if (!tree.definesSymbol() ||                map.lookupSymbol(tree.symbol()) != null) {                mixinSymbolCloner.traverse(tree);                for (Iterator j = clones.iterator(); j.hasNext();) {                    Symbol clone = (Symbol)j.next();                    clone.setType(map.apply(clone.type()));                }                clones.clear();                body.add(fstPos + pos, mixinTreeCloner.transform(tree));                ++pos;            }        }    }