Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0475c5d

Browse files
committed
Remove useless call to registerModuleExports in the JUnit plugin.
The call has been useless since f7e4cf7, when we transitioned from using exports to `@EnableReflectiveInstantiation` for the JUnit bootstrapper objects. We also deprecate the hook, which, although "documented", was not well-specified and was there only for the JUnit plugin.
1 parent 63477d0 commit 0475c5d

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

compiler/src/main/scala/org/scalajs/core/compiler/ScalaJSPlugin.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ class ScalaJSPlugin(val global: Global) extends NscPlugin {
5959
}
6060

6161
/** Checks and registers module exports on the symbol.
62-
* This bridge allows other plugins (such as ScalaJSJUnitPlugin) to register
63-
* new modules for export between jsinterop and jscode phases. It is meant to
64-
* be accessed using reflection. The calling code still must insert the
65-
* `@JSExport` annotation to the module.
62+
*
63+
* This bridge allows other plugins to register new modules for export
64+
* between jsinterop and jscode phases. It is meant to be accessed using
65+
* reflection. The calling code still must insert the `@JSExport` annotation
66+
* to the module.
6667
*/
68+
@deprecated("Might be removed at any time, use at your own risk.", "0.6.24")
6769
def registerModuleExports(sym: Symbol): Unit =
6870
PrepInteropComponent.registerModuleExports(sym)
6971

junit-plugin/src/main/scala/org/scalajs/junit/plugin/ScalaJSJUnitPlugin.scala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,6 @@ class ScalaJSJUnitPlugin(val global: Global) extends NscPlugin {
8787

8888
val description: String = "Makes JUnit test classes invokable in Scala.js"
8989

90-
// `ScalaJSPlugin` instance reference. Only `registerModuleExports` is accessible.
91-
private lazy val scalaJSPlugin = {
92-
type ScalaJSPlugin = NscPlugin {
93-
def registerModuleExports(sym: ScalaJSJUnitPluginComponent.global.Symbol): Unit
94-
}
95-
global.plugins.collectFirst {
96-
case pl if pl.getClass.getName == "org.scalajs.core.compiler.ScalaJSPlugin" =>
97-
pl.asInstanceOf[ScalaJSPlugin]
98-
}.getOrElse {
99-
throw new Exception(
100-
"The Scala.js JUnit plugin only works with the Scala.js plugin enabled.")
101-
}
102-
}
103-
10490
object ScalaJSJUnitPluginComponent
10591
extends plugins.PluginComponent with transform.Transform with Compat210Component {
10692

@@ -238,7 +224,6 @@ class ScalaJSJUnitPlugin(val global: Global) extends NscPlugin {
238224
ClassInfoType(newParentsInfo, decls, bootSym.info.typeSymbol)
239225
}
240226
bootSym.setInfo(newClazzInfo)
241-
scalaJSPlugin.registerModuleExports(bootSym)
242227
bootClazz.setSymbol(bootSym)
243228

244229
currentRun.symSource(bootSym) = clazz.symbol.sourceFile

0 commit comments

Comments
 (0)