Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1935,11 +1935,6 @@ class Definitions {
TypeOps.nestedPairs(tparams.map(_.typeRef)) :: parents.tail
}

/** If it is BoxedUnit, remove `java.io.Serializable` from `parents`. */
def adjustForBoxedUnit(cls: ClassSymbol, parents: List[Type]): List[Type] =
if (isBoxedUnitClass(cls)) parents.filter(_.typeSymbol != JavaSerializableClass)
else parents

private val HasProblematicGetClass: Set[Name] = Set(
tpnme.AnyVal, tpnme.Byte, tpnme.Short, tpnme.Char, tpnme.Int, tpnme.Long, tpnme.Float, tpnme.Double,
tpnme.Unit, tpnme.Boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ object Scala2Unpickler {
// If from Scala 2, adjust for tuple classes; if not, it's from Java, and adjust for BoxedUnit
val normalizedParents =
if (fromScala2) defn.adjustForTuple(cls, tparams, parents1)
else defn.adjustForBoxedUnit(cls, parents1)
else parents1
for (tparam <- tparams) {
val tsym = decls.lookup(tparam.name)
if (tsym.exists) tsym.setFlag(TypeParam)
Expand Down
8 changes: 3 additions & 5 deletions compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1749,11 +1749,9 @@ class Namer { typer: Typer =>
denot.info = tempInfo.nn

val parentTypes = defn.adjustForTuple(cls, cls.typeParams,
defn.adjustForBoxedUnit(cls,
addUsingTraits:
val isJava = ctx.isJava
ensureFirstIsClass(cls, parents.map(checkedParentType(_, isJava)))
)
addUsingTraits:
val isJava = ctx.isJava
ensureFirstIsClass(cls, parents.map(checkedParentType(_, isJava)))
)
typr.println(i"completing $denot, parents = $parents%, %, parentTypes = $parentTypes%, %")

Expand Down
6 changes: 1 addition & 5 deletions library/src/scala/runtime/BoxedUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@

package scala.runtime;


public final class BoxedUnit implements java.io.Serializable {
private static final long serialVersionUID = 8405543498931817370L;
public final class BoxedUnit {

public final static BoxedUnit UNIT = new BoxedUnit();

public final static Class<Void> TYPE = java.lang.Void.TYPE;

private Object readResolve() { return UNIT; }

private BoxedUnit() { }

Expand Down
Loading