Skip to content

Commit

Permalink
avoid deprecated Class.newInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Oct 15, 2024
1 parent 7399c14 commit f339521
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ class Launch private[xsbt] (
entryPoint.asSubclass(AppMainClass)
def newMain(): xsbti.AppMain = {
if (ServerApplication.isServerApplication(entryPoint)) ServerApplication(this)
else if (AppMainClass.isAssignableFrom(entryPoint)) mainClass.newInstance
else if (AppMainClass.isAssignableFrom(entryPoint)) mainClass.getDeclaredConstructor().newInstance()
else if (PlainApplication.isPlainApplication(entryPoint)) PlainApplication(entryPoint)
else
throw new IncompatibleClassChangeError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ServerApplication private (provider: xsbti.AppProvider) extends xsbti.AppM
import ServerApplication._

override def run(configuration: xsbti.AppConfiguration): xsbti.MainResult = {
val serverMain = provider.entryPoint.asSubclass(ServerMainClass).newInstance
val serverMain = provider.entryPoint.asSubclass(ServerMainClass).getDeclaredConstructor().newInstance()
val server = serverMain.start(configuration)
Console.err.println(s"${SERVER_SYNCH_TEXT}${server.uri}")
server.awaitTermination()
Expand Down

0 comments on commit f339521

Please sign in to comment.