private Pair<Scope, Scope> getSyntheticScopeMapping(Type ctype) {
        if (ctype.tag != CLASS) {
            return erroneousMapping;
        }

        Pair<Scope, Scope> mapping =
                new Pair<Scope, Scope>(ctype.tsym.members(), new Scope(ctype.tsym));

        //for each constructor in the original scope, create a synthetic constructor
        //whose return type is the type of the class in which the constructor is
        //declared, and insert it into the new scope.
        for (Scope.Entry e = mapping.fst.lookup(names.init);
                e.scope != null;
                e = e.next()) {
            Type synthRestype = new ClassType(ctype.getEnclosingType(),
                        ctype.tsym.type.getTypeArguments(),
                        ctype.tsym);
            MethodSymbol synhConstr = new MethodSymbol(e.sym.flags(),
                    names.init,
                    types.createMethodTypeWithReturn(e.sym.type, synthRestype),
                    e.sym.owner);
            mapping.snd.enter(synhConstr);
        }
        return mapping;
    }