int j = ntype.FullName.lastIndexOf('.'); String n = (j < 0 ? ntype.FullName : ntype.FullName.substring(j + 1)) .replace('+', '#'); Name classname = Name.fromString(n).toTypeName(); Name aliasname = Name.fromString(ntype.Name).toTypeName();
Name classname = Name.fromString(ntype.Name).toTypeName();
    protected String doComplete(Symbol root) {	clazz = root;	clazz.owner().initialize(); //???	if (make == null)	    make = new JavaTypeCreator(global.definitions);	clazz.flags = translateAttributes(type);	Type[] ifaces = type.getInterfaces();	scalac.symtab.Type[] baseTypes = new scalac.symtab.Type[ifaces.length+1];	baseTypes[0] = type.BaseType() != null ? getCLRType(type.BaseType())            :  (type.IsInterface() ? make.objectType() : make.anyType());	for (int i = 0; i < ifaces.length; i++)	    baseTypes[i + 1] = getCLRType(ifaces[i]);	members = new Scope();	statics = new Scope();        scalac.symtab.Type clazzInfo =            scalac.symtab.Type.compoundType(baseTypes, members, clazz);	clazz.setInfo(clazzInfo);        Symbol staticsModule = clazz.linkedModule();	staticsClass = staticsModule.moduleClass();        assert staticsClass.isModuleClass(): Debug.show(staticsClass);        scalac.symtab.Type staticsInfo = scalac.symtab.Type.compoundType            (scalac.symtab.Type.EMPTY_ARRAY, statics, staticsClass);        staticsClass.setInfo(staticsInfo);        staticsModule.setInfo(make.classType(staticsClass));        clazzType = make.classType(clazz);	// import nested types	Type[] nestedTypes = type.getNestedTypes();	for (int i = 0; i < nestedTypes.length; i++) {	    Type ntype = nestedTypes[i];	    if (ntype.IsNestedPrivate() || ntype.IsNestedAssembly()		|| ntype.IsNestedFamANDAssem())		continue;	    int j = ntype.FullName.lastIndexOf('.');	    String n = (j < 0 ? ntype.FullName : ntype.FullName.substring(j + 1))		.replace('+', '#');	    Name classname = Name.fromString(n).toTypeName();	    Name aliasname = Name.fromString(ntype.Name).toTypeName();	    // put the class at the level of its outermost class	    // the owner of a class is always its most specific package	    CLRClassParser loader = new CLRClassParser(global, ntype);            SymbolOrigin origin = SymbolOrigin.CLRAssembly(ntype.Assembly());	    Symbol nclazz = clazz.owner().newLoadedClass                (JAVA, classname, loader, null, origin);	    clrTypes.map(nclazz, ntype);	    // create an alias in the module of the outer class	    Symbol alias = staticsClass.newTypeAlias(Position.NOPOS,                translateAttributes(ntype), aliasname, make.classType(nclazz));	    statics.enterNoHide(alias);	}	FieldInfo[] fields = type.getFields();	for (int i = 0; i < fields.length; i++) {	    if (fields[i].IsPrivate() || fields[i].IsAssembly()		|| fields[i].IsFamilyAndAssembly())		continue;	    int mods = translateAttributes(fields[i]);	    Name name = Name.fromString(fields[i].Name);	    scalac.symtab.Type fieldType = getCLRType(fields[i].FieldType);	    if (fields[i].IsLiteral() && !fields[i].FieldType.IsEnum())		fieldType = make.constantType(                    getConstant(fieldType.symbol(), fields[i].getValue()));	    Symbol owner = fields[i].IsStatic() ? staticsClass : clazz;	    Symbol field = owner.newField(Position.NOPOS, mods, name);            parseMeta(field, fields[i], fieldType);	    (fields[i].IsStatic() ? statics : members).enterOrOverload(field);	    clrTypes.map(field, fields[i]);	}	Set methodsSet = new HashSet(Arrays.asList(type.getMethods()));	PropertyInfo[] props = type.getProperties();	for (int i = 0; i < props.length; i++) {	    scalac.symtab.Type proptype = getCLSType(props[i].PropertyType);	    if (proptype == null)		continue;	    MethodInfo getter = props[i].GetGetMethod(true);	    MethodInfo setter = props[i].GetSetMethod(true);	    if (getter == null || getter.IsPrivate() ||		getter.IsAssembly() || getter.IsFamilyAndAssembly())		continue;	    assert props[i].PropertyType == getter.ReturnType;	    Name n;	    Symbol method;	    scalac.symtab.Type mtype;	    ParameterInfo[] gparams = getter.GetParameters();	    if (gparams.length == 0) {		n = Name.fromString(props[i].Name);		mtype =		    scalac.symtab.Type.PolyType(Symbol.EMPTY_ARRAY, proptype);	    } else {		n = Names.apply;		mtype = methodType(getter, getter.ReturnType);	    }	    Symbol owner = getter.IsStatic() ? staticsClass : clazz;	    int mods = translateAttributes(getter);	    method = owner.newMethod(Position.NOPOS, mods, n);	    setParamOwners(mtype, method);	    method.setInfo(mtype);	    (getter.IsStatic() ? statics : members).enterOrOverload(method);	    clrTypes.map(method, getter);	    assert methodsSet.contains(getter) : "" + getter;	    methodsSet.remove(getter);	    if (setter == null || setter.IsPrivate() ||		setter.IsAssembly() || setter.IsFamilyAndAssembly())		continue;	    ParameterInfo[] sparams = setter.GetParameters();	    assert getter.IsStatic() == setter.IsStatic();	    assert setter.ReturnType == clrTypes.VOID;	    assert sparams.length == gparams.length + 1 : "" + getter + "; " + setter;	    if (gparams.length == 0)		n = Name.fromString(n.toString() + Names._EQ);	    else n = Names.update;	    mods = translateAttributes(setter);	    method = owner.newMethod(Position.NOPOS, mods, n);	    mtype = methodType(setter, global.definitions.UNIT_TYPE());	    setParamOwners(mtype, method);	    method.setInfo(mtype);	    (setter.IsStatic() ? statics : members).enterOrOverload(method);	    clrTypes.map(method, setter);	    assert methodsSet.contains(setter) : "" + setter;	    methodsSet.remove(setter);	}	for (Iterator i = methodsSet.iterator(); i.hasNext(); ) {	    MethodInfo method = (MethodInfo)i.next();	    if ((clrTypes.getSymbol(method) != null) || method.IsPrivate()		|| method.IsAssembly() || method.IsFamilyAndAssembly())		continue;	    createMethod(method);	}	// for enumerations introduce comparison and bitwise logical operations;	// the backend should recognize and replace them with comparison or	// bitwise logical operations on the primitive underlying type	if (type.IsEnum()) {	    scalac.symtab.Type[] argTypes = new scalac.symtab.Type[] {clazzType};	    int mods = Modifiers.JAVA | Modifiers.FINAL;	    for (int i = 0; i < ENUM_CMP_NAMES.length; i++) {		scalac.symtab.Type enumCmpType =		    make.methodType(argTypes,				    global.definitions.boolean_TYPE(),				    scalac.symtab.Type.EMPTY_ARRAY);		Symbol enumCmp = clazz.newMethod		    (Position.NOPOS, mods, ENUM_CMP_NAMES[i]);		setParamOwners(enumCmpType, enumCmp);		enumCmp.setInfo(enumCmpType);		members.enterOrOverload(enumCmp);	    }	    for (int i = 0; i < ENUM_BIT_LOG_NAMES.length; i++) {		scalac.symtab.Type enumBitLogType = make.methodType		    (argTypes, clazzType, scalac.symtab.Type.EMPTY_ARRAY);		Symbol enumBitLog = clazz.newMethod		    (Position.NOPOS, mods, ENUM_BIT_LOG_NAMES[i]);		setParamOwners(enumBitLogType, enumBitLog);		enumBitLog.setInfo(enumBitLogType);		members.enterOrOverload(enumBitLog);	    }	}	ConstructorInfo[] constrs = type.getConstructors();	for (int i = 0; i < constrs.length; i++) {	    if (constrs[i].IsStatic() || constrs[i].IsPrivate()		|| constrs[i].IsAssembly() || constrs[i].IsFamilyAndAssembly())		continue;	    createConstructor(constrs[i]);	}	Symbol constr = clazz.primaryConstructor();	if (!constr.isInitialized()) {	    constr.setInfo(scalac.symtab.Type.MethodType				(Symbol.EMPTY_ARRAY, clazzType));	    if ((clazz.flags & Modifiers.INTERFACE) == 0)		constr.flags |= Modifiers.PRIVATE;	}        parseMeta(clazz, type, clazzInfo);	return type + " from assembly " + type.Assembly();    }