Skip to content

Commit 1cd8cf3

Browse files
committed
Stop using depcreated Class#newInstance
1 parent c58495d commit 1cd8cf3

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/config/Settings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ object Settings {
132132
case (BooleanTag, _) =>
133133
update(true, args)
134134
case (OptionTag, _) =>
135-
update(Some(propertyClass.get.newInstance), args)
135+
update(Some(propertyClass.get.getConstructor().newInstance()), args)
136136
case (ListTag, _) =>
137137
if (argRest.isEmpty) missingArg
138138
else update((argRest split ",").toList, args)

compiler/src/dotty/tools/dotc/plugins/Plugin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ object Plugin {
177177
/** Instantiate a plugin class, given the class and
178178
* the compiler it is to be used in.
179179
*/
180-
def instantiate(clazz: AnyClass): Plugin = clazz.newInstance.asInstanceOf[Plugin]
180+
def instantiate(clazz: AnyClass): Plugin = clazz.getConstructor().newInstance().asInstanceOf[Plugin]
181181
}
182182

183183
class PluginLoadException(val path: String, message: String, cause: Exception) extends Exception(message, cause) {

compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class QuoteDriver extends Driver {
3636

3737
val clazz = classLoader.loadClass(driver.outputClassName.toString)
3838
val method = clazz.getMethod("apply")
39-
val instance = clazz.newInstance()
39+
val instance = clazz.getConstructor().newInstance()
4040

4141
method.invoke(instance).asInstanceOf[T]
4242
}

compiler/src/dotty/tools/dotc/transform/Splicer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ object Splicer {
125125
} else {
126126
// nested object in an object
127127
val clazz = loadClass(sym.fullNameSeparated(FlatName))
128-
(clazz, clazz.newInstance().asInstanceOf[Object])
128+
(clazz, clazz.getConstructor().newInstance().asInstanceOf[Object])
129129
}
130130
}
131131

0 commit comments

Comments
 (0)