summaryrefslogtreecommitdiff
path: root/sources/scalac
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac')
-rw-r--r--sources/scalac/symtab/Definitions.java16
-rw-r--r--sources/scalac/symtab/Modifiers.java4
-rw-r--r--sources/scalac/symtab/Symbol.java190
-rw-r--r--sources/scalac/symtab/SymbolLoader.java33
-rw-r--r--sources/scalac/symtab/classfile/AttributeParser.java2
-rw-r--r--sources/scalac/symtab/classfile/CLRClassParser.java5
-rw-r--r--sources/scalac/symtab/classfile/ClassfileParser.java12
-rw-r--r--sources/scalac/symtab/classfile/UnPickle.java20
8 files changed, 166 insertions, 116 deletions
diff --git a/sources/scalac/symtab/Definitions.java b/sources/scalac/symtab/Definitions.java
index f7380c4647..31a69e40be 100644
--- a/sources/scalac/symtab/Definitions.java
+++ b/sources/scalac/symtab/Definitions.java
@@ -484,56 +484,56 @@ public class Definitions {
private Symbol RTT_DOUBLE;
public Symbol RTT_DOUBLE() {
if (RTT_DOUBLE == null)
- RTT_DOUBLE = loadTerm(TYPE_CLASS.dualClass(), Names.Double);
+ RTT_DOUBLE = loadTerm(TYPE_CLASS.linkedModule().moduleClass(), Names.Double);
return RTT_DOUBLE;
}
private Symbol RTT_FLOAT;
public Symbol RTT_FLOAT() {
if (RTT_FLOAT == null)
- RTT_FLOAT = loadTerm(TYPE_CLASS.dualClass(), Names.Float);
+ RTT_FLOAT = loadTerm(TYPE_CLASS.linkedModule().moduleClass(), Names.Float);
return RTT_FLOAT;
}
private Symbol RTT_LONG;
public Symbol RTT_LONG() {
if (RTT_LONG == null)
- RTT_LONG = loadTerm(TYPE_CLASS.dualClass(), Names.Long);
+ RTT_LONG = loadTerm(TYPE_CLASS.linkedModule().moduleClass(), Names.Long);
return RTT_LONG;
}
private Symbol RTT_INT;
public Symbol RTT_INT() {
if (RTT_INT == null)
- RTT_INT = loadTerm(TYPE_CLASS.dualClass(), Names.Int);
+ RTT_INT = loadTerm(TYPE_CLASS.linkedModule().moduleClass(), Names.Int);
return RTT_INT;
}
private Symbol RTT_SHORT;
public Symbol RTT_SHORT() {
if (RTT_SHORT == null)
- RTT_SHORT = loadTerm(TYPE_CLASS.dualClass(), Names.Short);
+ RTT_SHORT = loadTerm(TYPE_CLASS.linkedModule().moduleClass(), Names.Short);
return RTT_SHORT;
}
private Symbol RTT_CHAR;
public Symbol RTT_CHAR() {
if (RTT_CHAR == null)
- RTT_CHAR = loadTerm(TYPE_CLASS.dualClass(), Names.Char);
+ RTT_CHAR = loadTerm(TYPE_CLASS.linkedModule().moduleClass(), Names.Char);
return RTT_CHAR;
}
private Symbol RTT_BYTE;
public Symbol RTT_BYTE() {
if (RTT_BYTE == null)
- RTT_BYTE = loadTerm(TYPE_CLASS.dualClass(), Names.Byte);
+ RTT_BYTE = loadTerm(TYPE_CLASS.linkedModule().moduleClass(), Names.Byte);
return RTT_BYTE;
}
private Symbol RTT_BOOLEAN;
public Symbol RTT_BOOLEAN() {
if (RTT_BOOLEAN == null)
- RTT_BOOLEAN = loadTerm(TYPE_CLASS.dualClass(), Names.Boolean);
+ RTT_BOOLEAN = loadTerm(TYPE_CLASS.linkedModule().moduleClass(), Names.Boolean);
return RTT_BOOLEAN;
}
diff --git a/sources/scalac/symtab/Modifiers.java b/sources/scalac/symtab/Modifiers.java
index dd6a6167ed..4190a6c66f 100644
--- a/sources/scalac/symtab/Modifiers.java
+++ b/sources/scalac/symtab/Modifiers.java
@@ -66,8 +66,8 @@ public interface Modifiers {
int ACCESSFLAGS = PRIVATE | PROTECTED;
int VARIANCES = COVARIANT | CONTRAVARIANT;
int CONSTRFLAGS = CASE | JAVA;
- /** Module-class flags inherited by their module */
- int CLASS2MODULEFLAGS = ACCESSFLAGS | DEPRECATED | JAVA | PACKAGE;
+ /** Module flags inherited by their module-class */
+ int MODULE2CLASSFLAGS = ACCESSFLAGS | DEPRECATED | JAVA | PACKAGE;
public static class Helper {
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index bbfd7c0301..4a2a4a4c1a 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -184,8 +184,7 @@ public abstract class Symbol implements Modifiers, Kinds {
/** Creates a new module owned by this symbol. */
public final Symbol newModule(int pos, int flags, Name name) {
- ClassSymbol clasz = newModuleClass(pos, flags, name.toTypeName());
- return clasz.module();
+ return newTerm(pos, flags | MODUL | FINAL | STABLE, name, 0);
}
/**
@@ -258,37 +257,32 @@ public abstract class Symbol implements Modifiers, Kinds {
/** Creates a new class owned by this symbol. */
public final ClassSymbol newClass(int pos, int flags, Name name) {
- return newClass(pos, flags, name, 0, NONE);
- }
-
- /** Creates a new module class owned by this symbol. */
- public final ClassSymbol newModuleClass(int pos, int flags, Name name) {
- return newModuleClass(pos, flags, name, 0, NONE);
+ return newClass(pos, flags, name, 0);
}
/** Creates a new anonymous class owned by this symbol. */
public final ClassSymbol newAnonymousClass(int pos, Name name) {
assert isTerm(): Debug.show(this);
- return newClass(pos, 0, name, IS_ANONYMOUS, NONE);
+ return newClass(pos, 0, name, IS_ANONYMOUS);
}
/**
- * Creates a new class with a dual module class, both owned by
- * this symbol, initializes them with the loader and enters the
- * class and the module in the scope if it's non-null.
+ * Creates a new class with a linked module, both owned by this
+ * symbol, initializes them with the loader and enters the class
+ * and the module in the scope if it's non-null.
*/
public final ClassSymbol newLoadedClass(int flags, Name name,
SymbolLoader loader, Scope scope)
{
assert isPackageClass(): Debug.show(this);
assert loader != null: Debug.show(this) + " - " + name;
- ClassSymbol clasz = newClass(Position.NOPOS, flags, name, 0, null);
+ ClassSymbol clasz = new LinkedClassSymbol(name, this, flags);
clasz.setInfo(loader);
clasz.allConstructors().setInfo(loader);
- clasz.dualClass().setInfo(loader);
- clasz.dualClass().module().setInfo(loader);
+ clasz.linkedModule().setInfo(loader);
+ clasz.linkedModule().moduleClass().setInfo(loader);
if (scope != null) scope.enterNoHide(clasz);
- if (scope != null) scope.enterNoHide(clasz.dualClass().module());
+ if (scope != null) scope.enterNoHide(clasz.linkedModule());
return clasz;
}
@@ -297,7 +291,7 @@ public abstract class Symbol implements Modifiers, Kinds {
* it with an error type.
*/
public ClassSymbol newErrorClass(Name name) {
- ClassSymbol symbol = newClass(pos, SYNTHETIC, name, IS_ERROR, NONE);
+ ClassSymbol symbol = newClass(pos, SYNTHETIC, name, IS_ERROR);
Scope scope = new ErrorScope(this);
symbol.setInfo(Type.compoundType(Type.EMPTY_ARRAY, scope, this));
symbol.allConstructors().setInfo(Type.ErrorType);
@@ -320,22 +314,8 @@ public abstract class Symbol implements Modifiers, Kinds {
}
/** Creates a new class owned by this symbol. */
- final ClassSymbol newClass(int pos, int flags, Name name, int attrs,
- Symbol dual)
- {
- return new ClassSymbol(pos, name, this, flags, attrs, dual);
- }
-
- /** Creates a new module class owned by this symbol. */
- final ClassSymbol newModuleClass(int pos, int flags, Name name, int attrs,
- Symbol dual)
- {
- flags |= MODUL | FINAL | SYNTHETIC;
- ClassSymbol clasz = newClass(pos, flags, name, attrs, dual);
- clasz.primaryConstructor().flags |= PRIVATE;
- clasz.primaryConstructor().setInfo(
- Type.MethodType(Symbol.EMPTY_ARRAY, clasz.typeConstructor()));
- return clasz;
+ final ClassSymbol newClass(int pos, int flags, Name name, int attrs) {
+ return new ClassSymbol(pos, name, this, flags, attrs);
}
/** Creates a new compound class owned by this symbol. */
@@ -344,7 +324,7 @@ public abstract class Symbol implements Modifiers, Kinds {
Name name = Names.COMPOUND_NAME.toTypeName();
int flags = ABSTRACT | SYNTHETIC;
int attrs = IS_COMPOUND;
- ClassSymbol clasz = newClass(pos, flags, name, attrs, NONE);
+ ClassSymbol clasz = newClass(pos, flags, name, attrs);
clasz.setInfo(info);
clasz.primaryConstructor().setInfo(
Type.MethodType(Symbol.EMPTY_ARRAY, clasz.typeConstructor()));
@@ -914,8 +894,17 @@ public abstract class Symbol implements Modifiers, Kinds {
return NONE;
}
- /** Get dual class */
- public Symbol dualClass() {
+ /**
+ * Returns the linked class if there is one and NONE otherwise.
+ */
+ public Symbol linkedClass() {
+ return NONE;
+ }
+
+ /**
+ * Returns the linked module if there is one and NONE otherwise.
+ */
+ public Symbol linkedModule() {
return NONE;
}
@@ -1268,7 +1257,7 @@ public abstract class Symbol implements Modifiers, Kinds {
/** Get static prefix. */
public final Type staticPrefix() {
- assert isStaticOwner(): Debug.show(this);
+ assert isStaticOwner(): Debug.show(this) + " - " + isTerm() + " - " + isModuleClass() + " - " + owner().isStaticOwner() + " - " + isJava();
Global global = Global.instance;
if (global.PHASE.EXPLICITOUTER.id() < global.currentPhase.id)
return Type.NoPrefix;
@@ -1572,7 +1561,7 @@ public abstract class Symbol implements Modifiers, Kinds {
/** A class for term symbols
*/
-final class TermSymbol extends Symbol {
+class TermSymbol extends Symbol {
/**
* The module class if this is a module, the constructed class if
@@ -1583,8 +1572,15 @@ final class TermSymbol extends Symbol {
/** Constructor */
TermSymbol(int pos, Name name, Symbol owner, int flags, int attrs, Symbol clasz) {
super(VAL, pos, name, owner, flags, attrs);
- this.clasz = clasz;
+ this.clasz = clasz == null && isModule() ? newModuleClass() : clasz;
+ if (isModule()) setType(this.clasz.typeConstructor());
assert name.isTermName(): Debug.show(this);
+ assert (isModule() || isConstructor()) == (this.clasz != null): this;
+ }
+
+ /** Creates the module class associated to this module. */
+ ClassSymbol newModuleClass() {
+ return new ClassSymbol(this);
}
/** Is this symbol an instance initializer? */
@@ -1620,6 +1616,32 @@ final class TermSymbol extends Symbol {
}
+final class LinkedModuleSymbol extends TermSymbol {
+
+ /** The linked class */
+ private final LinkedClassSymbol clasz;
+
+ /** Inistializes this instance. */
+ LinkedModuleSymbol(LinkedClassSymbol clasz) {
+ super(clasz.pos, clasz.name.toTermName(), clasz.owner(),
+ (clasz.flags & JAVA) | MODUL | FINAL | STABLE, 0, null);
+ this.clasz = clasz;
+ }
+
+ final ClassSymbol newModuleClass() {
+ return new LinkedModuleClassSymbol(this);
+ }
+
+ public Symbol linkedClass() {
+ return clasz;
+ }
+
+ public Symbol linkedModule() {
+ return this;
+ }
+
+}
+
/** A base class for all type symbols.
* It has AliasTypeSymbol, AbsTypeSymbol, ClassSymbol as subclasses.
*/
@@ -1815,14 +1837,7 @@ final class AbsTypeSymbol extends TypeSymbol {
}
/** A class for class symbols. */
-public final class ClassSymbol extends TypeSymbol {
-
- /**
- * The dual class of this class or NONE. The dual class is:
- * - the corresponding module class if this is a value class
- * - the corresponding value class if this is a module class
- */
- private final Symbol dual;
+public class ClassSymbol extends TypeSymbol {
/** The module belonging to the class or NONE. */
private final Symbol module;
@@ -1840,14 +1855,29 @@ public final class ClassSymbol extends TypeSymbol {
private final Symbol rebindSym;
/** Initializes this instance. */
- ClassSymbol(int pos, Name name, Symbol owner, int flags, int attrs, Symbol dual) {
+ private ClassSymbol(int pos, Name name, Symbol owner, int flags, int attrs, Symbol module) {
super(CLASS, pos, name, owner, flags, attrs);
this.rebindSym = owner.newTypeAlias(pos, 0, Names.ALIAS(this));
Type rebindType = new ClassAliasLazyType();
this.rebindSym.setInfo(rebindType);
this.rebindSym.primaryConstructor().setInfo(rebindType);
- this.module = isModuleClass() ? newModule() : NONE;
- this.dual = dual == null ? newModuleClass() : dual;
+ this.module = module;
+ assert isModuleClass() == !module.isNone(): Debug.show(this);
+ }
+
+ /** Initializes this instance. */
+ ClassSymbol(int pos, Name name, Symbol owner, int flags, int attrs) {
+ this(pos, name, owner, flags, attrs, Symbol.NONE);
+ }
+
+ /** Initializes this instance. */
+ ClassSymbol(TermSymbol module) {
+ this(module.pos, module.name.toTypeName(), module.owner(),
+ (module.flags & MODULE2CLASSFLAGS) | MODUL | FINAL | SYNTHETIC, 0,
+ module);
+ primaryConstructor().flags |= PRIVATE;
+ primaryConstructor().setInfo(
+ Type.MethodType(Symbol.EMPTY_ARRAY, typeConstructor()));
}
private class ClassAliasLazyType extends Type.LazyType {
@@ -1885,33 +1915,12 @@ public final class ClassSymbol extends TypeSymbol {
return newTerm(pos, SYNTHETIC, Names.this_, IS_THISTYPE);
}
- /** Creates the module associated to this module class. */
- final Symbol newModule() {
- assert isModuleClass(): Debug.show(this);
- int flags = (this.flags & CLASS2MODULEFLAGS) | MODUL | FINAL | STABLE;
- Name name = this.name.toTermName();
- Symbol module = new TermSymbol(pos, name, owner(), flags, 0, this);
- module.setType(typeConstructor());
- return module;
- }
-
- /** Creates the dual module class associated to this class. */
- final ClassSymbol newModuleClass() {
- assert !isModuleClass(): Debug.show(this);
- return owner().newModuleClass(pos, flags, name, 0, this);
- }
-
/** Get module */
public Symbol module() {
assert !isRoot(): this + ".module()";
return module;
}
- /** Get dual class */
- public Symbol dualClass() {
- return dual;
- }
-
public Type thisType() {
Global global = Global.instance;
if (global.currentPhase.id > global.PHASE.ERASURE.id()) return type();
@@ -1977,6 +1986,45 @@ public final class ClassSymbol extends TypeSymbol {
}
+final class LinkedClassSymbol extends ClassSymbol {
+
+ /** The linked module */
+ private final LinkedModuleSymbol module;
+
+ /** Initializes this instance. */
+ LinkedClassSymbol(Name name, Symbol owner, int flags) {
+ super(Position.NOPOS, name, owner, flags, 0);
+ this.module = new LinkedModuleSymbol(this);
+ }
+
+ public Symbol linkedClass() {
+ return this;
+ }
+
+ public Symbol linkedModule() {
+ return module;
+ }
+
+}
+
+final class LinkedModuleClassSymbol extends ClassSymbol {
+
+ /** Initializes this instance. */
+ LinkedModuleClassSymbol(LinkedModuleSymbol module) {
+ super(module);
+ }
+
+ public Symbol linkedClass() {
+ return linkedModule().linkedClass();
+ }
+
+ public Symbol linkedModule() {
+ return module();
+ }
+
+}
+
+
/** The class of Symbol.NONE
*/
final class NoSymbol extends Symbol {
diff --git a/sources/scalac/symtab/SymbolLoader.java b/sources/scalac/symtab/SymbolLoader.java
index cb3907dbca..3a4c1464eb 100644
--- a/sources/scalac/symtab/SymbolLoader.java
+++ b/sources/scalac/symtab/SymbolLoader.java
@@ -49,16 +49,15 @@ public abstract class SymbolLoader extends Type.LazyType {
* - the main class of the constructed class, if it's a
* constructor,
* - the main class of the module class, if it's a module,
- * - the dual class, if it's a dual module class,
- * - itself if it's a non-dual class or a non-module class,
+ * - the linked class, if it's a linked module class,
+ * - itself if it's a non-linked class or a non-module class,
* - undefined otherwise.
*
* The related symbols of a class include:
* - the class itself,
* - its constructor (symbol returned by allConstructors()),
- * - its module, if it has one,
- * - the related symbols of its dual class, if it's dual
- * non-module class.
+ * - its linked module, if it has one,
+ * - the related symbols of its linked module class, if it has one
*/
public final void complete(Symbol symbol) {
Symbol clasz = getMainClass(symbol);
@@ -70,7 +69,7 @@ public abstract class SymbolLoader extends Type.LazyType {
global.currentPhase = phase;
long end = System.currentTimeMillis();
global.operation("loaded " + source + " in " + (end-start) + "ms");
- checkValidity(clasz, source, symbol);
+ checkValidity(clasz, source);
} catch (IOException exception) {
if (global.debug) exception.printStackTrace();
String error = "error while loading " + symbol;
@@ -100,24 +99,24 @@ public abstract class SymbolLoader extends Type.LazyType {
return getMainClass(symbol.constructorClass());
if (symbol.isModule())
return getMainClass(symbol.moduleClass());
+ if (symbol.isModuleClass() && !symbol.linkedClass().isNone())
+ return symbol.linkedClass();
assert symbol.isClassType(): Debug.show(symbol);
- if (!symbol.isModuleClass()) return symbol;
- return symbol.dualClass().isNone() ? symbol : symbol.dualClass();
+ return symbol;
}
/**
* Checks that at least the class or its dual class have been
* initialized and signals an error otherwise.
*/
- private void checkValidity(Symbol clasz, String source, Symbol s) {
+ private void checkValidity(Symbol clasz, String source) {
if (clasz.rawInfo() != this) return;
String what;
- if (clasz.dualClass().isNone()) {
- what = "does not define " + clasz;
+ if (clasz.linkedClass().isNone()) {
+ what = "does not define " + clasz.linkedModule();
} else {
- if (clasz.dualClass().rawInfo() != this) return;
- Symbol module = clasz.dualClass().module();
- what = "defines neither " + clasz + " nor " + module;
+ if (clasz.linkedModule().moduleClass().rawInfo() != this) return;
+ what = "defines neither " + clasz + " nor " + clasz.linkedModule();
}
global.error(source + " " + what);
}
@@ -129,8 +128,10 @@ public abstract class SymbolLoader extends Type.LazyType {
private void initializeAll(Symbol clasz) {
initializeOne(clasz);
initializeOne(clasz.allConstructors());
- if (clasz.isModuleClass()) initializeOne(clasz.module());
- else if (!clasz.dualClass().isNone()) initializeAll(clasz.dualClass());
+ if (clasz.isModuleClass()) initializeOne(clasz.linkedModule());
+ Symbol module = clasz.linkedModule();
+ if (!module.isNone() && module.moduleClass() != clasz)
+ initializeAll(module.moduleClass());
}
/** Initializes the symbol if its info is this instance. */
diff --git a/sources/scalac/symtab/classfile/AttributeParser.java b/sources/scalac/symtab/classfile/AttributeParser.java
index 903d8e5805..05a7354725 100644
--- a/sources/scalac/symtab/classfile/AttributeParser.java
+++ b/sources/scalac/symtab/classfile/AttributeParser.java
@@ -125,7 +125,7 @@ public class AttributeParser implements ClassfileConstants {
if ((flags & JAVA_ACC_STATIC) == 0) return;
if ((flags & (JAVA_ACC_PUBLIC | JAVA_ACC_PROTECTED)) == 0) return;
if (pool.getClass(outer) != sym) return;
- Symbol alias = sym.dualClass().newTypeAlias(
+ Symbol alias = sym.linkedModule().moduleClass().newTypeAlias(
Position.NOPOS,
0,
pool.getName(name).toTypeName(),
diff --git a/sources/scalac/symtab/classfile/CLRClassParser.java b/sources/scalac/symtab/classfile/CLRClassParser.java
index 5c8135729e..7c7f2f1376 100644
--- a/sources/scalac/symtab/classfile/CLRClassParser.java
+++ b/sources/scalac/symtab/classfile/CLRClassParser.java
@@ -72,12 +72,13 @@ public class CLRClassParser extends SymbolLoader {
scalac.symtab.Type classInfo =
scalac.symtab.Type.compoundType(baseTypes, members, clazz);
clazz.setInfo(classInfo);
- Symbol staticsClass = clazz.dualClass();
+ Symbol staticsModule = clazz.linkedModule();
+ Symbol 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);
- staticsClass.module().setInfo(make.classType(staticsClass));
+ staticsModule.setInfo(make.classType(staticsClass));
scalac.symtab.Type ctype = make.classType(clazz);
// import nested types
diff --git a/sources/scalac/symtab/classfile/ClassfileParser.java b/sources/scalac/symtab/classfile/ClassfileParser.java
index 4d1ae22e9f..c4eaab9e5c 100644
--- a/sources/scalac/symtab/classfile/ClassfileParser.java
+++ b/sources/scalac/symtab/classfile/ClassfileParser.java
@@ -44,6 +44,7 @@ public class ClassfileParser implements ClassfileConstants {
protected final Global global;
protected final AbstractFileReader in;
protected final Symbol c;
+ protected final Symbol m;
protected final Type ctype;
protected final JavaTypeFactory make;
protected final ConstantPool pool;
@@ -56,6 +57,7 @@ public class ClassfileParser implements ClassfileConstants {
this.global = global;
this.in = in;
this.c = c;
+ this.m = c.linkedModule();
this.ctype = make.classType(c);
this.make = make;
this.pool = pool;
@@ -113,11 +115,11 @@ public class ClassfileParser implements ClassfileConstants {
Type classInfo = Type.compoundType(basetpes, locals, c);
c.setInfo(classInfo);
// set info of statics class
- Symbol staticsClass = c.dualClass();
+ Symbol staticsClass = m.moduleClass();
assert staticsClass.isModuleClass(): Debug.show(staticsClass);
Type staticsInfo = Type.compoundType(Type.EMPTY_ARRAY, statics, staticsClass);
staticsClass.setInfo(staticsInfo);
- staticsClass.module().setInfo(make.classType(staticsClass));
+ m.setInfo(make.classType(staticsClass));
basetpes[0] = supertpe;
for (int i = 1; i < basetpes.length; i++)
basetpes[i] = readClassType(in.nextChar());
@@ -138,8 +140,8 @@ public class ClassfileParser implements ClassfileConstants {
attrib.readAttributes(c, classInfo, CLASS_ATTR);
//System.out.println("dynamic class: " + c);
//System.out.println("statics class: " + staticsClass);
- //System.out.println("module: " + c.module());
- //System.out.println("modules class: " + c.module().type().symbol());
+ //System.out.println("module: " + m);
+ //System.out.println("modules class: " + m.type().symbol());
}
}
@@ -237,7 +239,7 @@ public class ClassfileParser implements ClassfileConstants {
/** return the owner of a member with given java flags
*/
private Symbol getOwner(int jflags) {
- return (jflags & JAVA_ACC_STATIC) != 0 ? c.dualClass() : c;
+ return (jflags & JAVA_ACC_STATIC) != 0 ? m.moduleClass() : c;
}
/** return the scope of a member with given java flags
diff --git a/sources/scalac/symtab/classfile/UnPickle.java b/sources/scalac/symtab/classfile/UnPickle.java
index ba27cbbf60..5f6997b7a3 100644
--- a/sources/scalac/symtab/classfile/UnPickle.java
+++ b/sources/scalac/symtab/classfile/UnPickle.java
@@ -55,16 +55,10 @@ public class UnPickle implements Kinds, Modifiers, EntryTags, TypeTags {
private UnPickle(Global global, byte[] data, Symbol root) {
this.global = global;
- if (root.isConstructor()) {
- this.classroot = root.constructorClass();
- this.moduleroot = classroot.dualClass().module();
- } else if (root.isType()) {
- this.classroot = root;
- this.moduleroot = classroot.dualClass().module();
- } else {
- this.moduleroot = root;
- this.classroot = root.owner().lookup(root.name.toTypeName());
- }
+ this.classroot = root.linkedClass();
+ this.moduleroot = root.linkedModule();
+ assert !classroot.isNone(): Debug.show(root);
+ assert !moduleroot.isNone(): Debug.show(root);
if (root != moduleroot && moduleroot.isModule()) {
moduleroot.moduleClass().setInfo(Type.NoType);
}
@@ -267,9 +261,13 @@ public class UnPickle implements Kinds, Modifiers, EntryTags, TypeTags {
if (global.debug) global.log("overwriting " + clr);
entries[n] = sym = clr;
sym.flags = flags;
- } else {
+ } else if ((flags & MODUL) == 0) {
entries[n] = sym = owner.newClass(
Position.NOPOS, flags, name);
+ } else {
+ entries[n] = sym = owner.newModule(
+ Position.NOPOS, flags, name.toTermName())
+ .moduleClass();
}
sym.setInfo(getType(inforef, sym));
sym.setTypeOfThis(readTypeRef(sym));