Skip to content

Commit 819fdc2

Browse files
committed
Remove compiler dependency on @remote
This was already partially done in 31f9681. This mirror similar changes done by Adriaan Moors in scala#6164
1 parent d3111e3 commit 819fdc2

File tree

4 files changed

+6
-32
lines changed

4 files changed

+6
-32
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@ class BTypesFromSymbols[I <: BackendInterface](val int: I) extends BTypes {
179179
}
180180
}
181181

182-
// legacy, to be removed when the @remote annotation gets removed
183-
final def hasPublicBitSet(flags: Int) = ((flags & asm.Opcodes.ACC_PUBLIC) != 0)
184-
185182
/**
186183
* Return the Java modifiers for the given symbol.
187184
* Java modifiers for classes:

src/compiler/scala/tools/nsc/backend/jvm/BackendInterface.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,6 @@ abstract class BackendInterface extends BackendInterfaceDefinitions {
557557
def isOriginallyStaticOwner: Boolean
558558

559559

560-
def addRemoteRemoteExceptionAnnotation: Unit
561560
def samMethod(): Symbol
562561
}
563562

@@ -722,7 +721,6 @@ abstract class BackendInterfaceDefinitions { self: BackendInterface =>
722721

723722
val ClassfileAnnotationClass: Symbol = requiredClass[scala.annotation.ClassfileAnnotation]
724723
val BoxedNumberClass: Symbol = requiredClass[java.lang.Number]
725-
val RemoteExceptionClass: Symbol = requiredClass[java.rmi.RemoteException]
726724
val ThrowsClass: Symbol = requiredClass[scala.throws[_]]
727725

728726
// Module symbols used in backend

src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
241241

242242
private def mkFlags(args: Int*) = args.foldLeft(0)(_ | _)
243243
private def hasPublicBitSet(flags: Int) = (flags & asm.Opcodes.ACC_PUBLIC) != 0
244-
private def isRemote(s: Symbol) = s hasAnnotation RemoteAttr
245244

246245
/**
247246
* Return the Java modifiers for the given symbol.
@@ -1032,7 +1031,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
10321031
* a method with the same name is defined both in a class and its companion object:
10331032
* method signature is not taken into account.
10341033
*/
1035-
def addForwarders(isRemoteClass: Boolean, jclass: asm.ClassVisitor, jclassName: String, moduleClass: Symbol) {
1034+
def addForwarders(jclass: asm.ClassVisitor, jclassName: String, moduleClass: Symbol) {
10361035
assert(moduleClass.isModuleClass, moduleClass)
10371036
debuglog("Dumping mirror class for object: " + moduleClass)
10381037

@@ -1051,7 +1050,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
10511050
log(s"No forwarder for non-public member $m")
10521051
else {
10531052
debuglog(s"Adding static forwarder for '$m' from $jclassName to '$moduleClass'")
1054-
addForwarder(isRemoteClass, jclass, moduleClass, m)
1053+
addForwarder(jclass, moduleClass, m)
10551054
}
10561055
}
10571056
}
@@ -1190,16 +1189,9 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
11901189
def serialVUID: Option[Long] = clasz.symbol.serialVUID
11911190

11921191
private def getSuperInterfaces(c: IClass): Array[String] = {
1193-
1194-
// Additional interface parents based on annotations and other cues
1195-
def newParentForAttr(ann: AnnotationInfo): Symbol = ann.symbol match {
1196-
case RemoteAttr => RemoteInterfaceClass
1197-
case _ => NoSymbol
1198-
}
1199-
12001192
val ps = c.symbol.info.parents
12011193
val superInterfaces0: List[Symbol] = if(ps.isEmpty) Nil else c.symbol.mixinClasses
1202-
val superInterfaces = existingSymbols(superInterfaces0 ++ c.symbol.annotations.map(newParentForAttr)).distinct
1194+
val superInterfaces = existingSymbols(superInterfaces0).distinct
12031195

12041196
if(superInterfaces.isEmpty) EMPTY_STRING_ARRAY
12051197
else mkArray(erasure.minimizeInterfaces(superInterfaces.map(_.info)).map(t => javaName(t.typeSymbol)))
@@ -1281,7 +1273,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
12811273
}
12821274
if (isCandidateForForwarders) {
12831275
log("Adding static forwarders from '%s' to implementations in '%s'".format(c.symbol, lmoc))
1284-
addForwarders(isRemote(clasz.symbol), jclass, thisName, lmoc.moduleClass)
1276+
addForwarders(false, jclass, thisName, lmoc.moduleClass)
12851277
}
12861278
}
12871279
}
@@ -1372,7 +1364,6 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
13721364

13731365
// TODO needed? for(ann <- m.symbol.annotations) { ann.symbol.initialize }
13741366
val jgensig = getGenericSignature(m.symbol, clasz.symbol)
1375-
addRemoteExceptionAnnot(isRemote(clasz.symbol), hasPublicBitSet(flags), m.symbol)
13761367
val (excs, others) = m.symbol.annotations partition (_.symbol == ThrowsClass)
13771368
val thrownExceptions: List[String] = getExceptions(excs)
13781369

@@ -2793,7 +2784,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
27932784
// typestate: entering mode with valid call sequences:
27942785
// ( visitInnerClass | visitField | visitMethod )* visitEnd
27952786

2796-
addForwarders(isRemote(modsym), mirrorClass, mirrorName, modsym)
2787+
addForwarders(false, mirrorClass, mirrorName, modsym)
27972788

27982789
addInnerClasses(modsym, mirrorClass)
27992790
mirrorClass.visitEnd()

src/compiler/scala/tools/nsc/backend/jvm/ScalacBackendInterface.scala

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,6 @@ class ScalacBackendInterface[G <: Global](val global: G) extends BackendInterfac
554554
})(collection.breakOut)
555555

556556

557-
def addRemoteRemoteExceptionAnnotation: Unit = {
558-
val c = new Constant(RemoteExceptionClass.tpe)
559-
val arg = new Literal(c) setType c.tpe
560-
sym.addAnnotation(appliedType(definitions.ThrowsClass, c.tpe), arg)
561-
}
562-
563557
def linkedClass: Symbol = exitingPickler(sym.linkedClassOfClass) // linkedCoC does not work properly in late phases
564558
def companionModuleMembers: List[Symbol] = {
565559
// phase travel to exitingPickler: this makes sure that memberClassesOf only sees member classes,
@@ -573,14 +567,8 @@ class ScalacBackendInterface[G <: Global](val global: G) extends BackendInterfac
573567
*
574568
*/
575569
def superInterfaces: List[Symbol] = {
576-
577-
// Additional interface parents based on annotations and other cues
578-
def newParentForAnnotation(ann: AnnotationInfo): Symbol =
579-
if (ann.symbol eq RemoteAttr) RemoteInterfaceClass
580-
else NoSymbol
581-
582570
val superInterfaces0: List[Symbol] = sym.mixinClasses
583-
val superInterfaces = existingSymbols(superInterfaces0 ++ sym.annotations.map(newParentForAnnotation)).distinct
571+
val superInterfaces = existingSymbols(superInterfaces0).distinct
584572

585573
assert(!superInterfaces.contains(NoSymbol), s"found NoSymbol among: ${superInterfaces.mkString(", ")}")
586574
assert(superInterfaces.forall(s => s.isInterface || s.isTrait), s"found non-interface among: ${superInterfaces.mkString(", ")}")

0 commit comments

Comments
 (0)