Skip to content

Commit b73b1ab

Browse files
committed
chore: do not patch BoxedUnit anymore
1 parent 68396ca commit b73b1ab

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,11 +1935,6 @@ class Definitions {
19351935
TypeOps.nestedPairs(tparams.map(_.typeRef)) :: parents.tail
19361936
}
19371937

1938-
/** If it is BoxedUnit, remove `java.io.Serializable` from `parents`. */
1939-
def adjustForBoxedUnit(cls: ClassSymbol, parents: List[Type]): List[Type] =
1940-
if (isBoxedUnitClass(cls)) parents.filter(_.typeSymbol != JavaSerializableClass)
1941-
else parents
1942-
19431938
private val HasProblematicGetClass: Set[Name] = Set(
19441939
tpnme.AnyVal, tpnme.Byte, tpnme.Short, tpnme.Char, tpnme.Int, tpnme.Long, tpnme.Float, tpnme.Double,
19451940
tpnme.Unit, tpnme.Boolean)

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ object Scala2Unpickler {
106106
// If from Scala 2, adjust for tuple classes; if not, it's from Java, and adjust for BoxedUnit
107107
val normalizedParents =
108108
if (fromScala2) defn.adjustForTuple(cls, tparams, parents1)
109-
else defn.adjustForBoxedUnit(cls, parents1)
109+
else parents1
110110
for (tparam <- tparams) {
111111
val tsym = decls.lookup(tparam.name)
112112
if (tsym.exists) tsym.setFlag(TypeParam)

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,11 +1749,9 @@ class Namer { typer: Typer =>
17491749
denot.info = tempInfo.nn
17501750

17511751
val parentTypes = defn.adjustForTuple(cls, cls.typeParams,
1752-
defn.adjustForBoxedUnit(cls,
1753-
addUsingTraits:
1754-
val isJava = ctx.isJava
1755-
ensureFirstIsClass(cls, parents.map(checkedParentType(_, isJava)))
1756-
)
1752+
addUsingTraits:
1753+
val isJava = ctx.isJava
1754+
ensureFirstIsClass(cls, parents.map(checkedParentType(_, isJava)))
17571755
)
17581756
typr.println(i"completing $denot, parents = $parents%, %, parentTypes = $parentTypes%, %")
17591757

library/src/scala/runtime/BoxedUnit.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@
1212

1313
package scala.runtime;
1414

15-
16-
public final class BoxedUnit implements java.io.Serializable {
17-
private static final long serialVersionUID = 8405543498931817370L;
15+
public final class BoxedUnit {
1816

1917
public final static BoxedUnit UNIT = new BoxedUnit();
2018

2119
public final static Class<Void> TYPE = java.lang.Void.TYPE;
22-
23-
private Object readResolve() { return UNIT; }
2420

2521
private BoxedUnit() { }
2622

0 commit comments

Comments
 (0)