Skip to content

Commit 14c6331

Browse files
authored
Remove some unnecessary unsafeNulls imports (#23338)
2 parents 96de70c + 6842e83 commit 14c6331

26 files changed

+4
-57
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package dotty.tools.dotc
22
package config
33

4-
import scala.language.unsafeNulls
5-
64
import Settings.*
75
import core.Contexts.*
86
import printing.Highlighting

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package dotty.tools
22
package dotc
33
package config
44

5-
import scala.language.unsafeNulls
6-
75
import WrappedProperties.AccessControl
86
import io.{ClassPath, Directory, Path}
97
import classpath.{AggregateClassPath, ClassPathFactory, JrtClassPath}

compiler/src/dotty/tools/dotc/core/classfile/ReusableDataReader.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package dotc
33
package core
44
package classfile
55

6-
import scala.language.unsafeNulls
7-
86
import java.io.{DataInputStream, InputStream}
97
import java.nio.{BufferUnderflowException, ByteBuffer}
108

compiler/src/dotty/tools/dotc/core/tasty/BestEffortTastyWriter.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package dotty.tools.dotc
22
package core
33
package tasty
44

5-
import scala.language.unsafeNulls
65
import java.nio.file.{Path as JPath, Files as JFiles}
76
import java.nio.channels.ClosedByInterruptException
87
import java.io.DataOutputStream

compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package dotty.tools.dotc
22
package core.tasty
33

4-
import scala.language.unsafeNulls
5-
64
import core.Comments.Comment
75
import util.Spans.Span
86
import util.HashMap

compiler/src/dotty/tools/dotc/core/tasty/TastyPickler.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package dotc
33
package core
44
package tasty
55

6-
import scala.language.unsafeNulls
7-
86
import dotty.tools.tasty.{TastyBuffer, TastyFormat, TastyHash}
97
import dotty.tools.tasty.besteffort.BestEffortTastyFormat
108
import TastyFormat.*

compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package core
33
package tasty
44

55
import java.util.UUID
6-
import scala.language.unsafeNulls
7-
86
import dotty.tools.tasty.{TastyFormat, TastyVersion, TastyBuffer, TastyReader, TastyHeaderUnpickler, UnpicklerConfig}
97
import dotty.tools.tasty.besteffort.{BestEffortTastyHeader, BestEffortTastyHeaderUnpickler}
108

compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package dotty.tools.dotc
22
package decompiler
33

4-
import scala.language.unsafeNulls
5-
64
import java.io.{OutputStream, PrintStream}
75
import java.nio.charset.StandardCharsets
86

@@ -26,8 +24,8 @@ class DecompilationPrinter extends Phase {
2624
if (ctx.settings.outputDir.isDefault) printToOutput(System.out)
2725
else {
2826
val outputDir = ctx.settings.outputDir.value
29-
var os: OutputStream = null
30-
var ps: PrintStream = null
27+
var os: OutputStream|Null = null
28+
var ps: PrintStream|Null = null
3129
try {
3230
os = File(outputDir.fileNamed("decompiled.scala").path)(Codec.UTF8).outputStream(append = true)
3331
ps = new PrintStream(os, /* autoFlush = */ false, StandardCharsets.UTF_8.name)

compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package dotty.tools
22
package dotc
33
package decompiler
44

5-
import scala.language.unsafeNulls
6-
75
import dotty.tools.dotc.core.Contexts.*
86
import dotty.tools.dotc.core.*
97
import dotty.tools.dotc.core.tasty.TastyHTMLPrinter

compiler/src/dotty/tools/dotc/fromtasty/Debug.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package dotty.tools
22
package dotc
33
package fromtasty
44

5-
import scala.language.unsafeNulls
6-
75
import scala.util.control.NonFatal
86

97
import dotty.tools.io.Directory

compiler/src/dotty/tools/dotc/fromtasty/TASTYRun.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package dotty.tools
22
package dotc
33
package fromtasty
44

5-
import scala.language.unsafeNulls
6-
75
import io.{JarArchive, AbstractFile, Path, FileExtension}
86
import core.Contexts.*
97
import core.Decorators.em

compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package dotty.tools.dotc
22
package fromtasty
33

4-
import scala.language.unsafeNulls
5-
64
import dotty.tools.dotc.core.tasty.TastyClassName
75
import dotty.tools.dotc.core.StdNames.nme.EMPTY_PACKAGE
86
import dotty.tools.io.AbstractFile

compiler/src/dotty/tools/dotc/interactive/Interactive.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package dotty.tools
22
package dotc
33
package interactive
44

5-
import scala.language.unsafeNulls
6-
75
import scala.collection.*
86

97
import ast.{NavigateAST, Trees, tpd, untpd}

compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package dotty.tools.dotc
22
package printing
33

4-
import scala.language.unsafeNulls
5-
64
import dotty.tools.dotc.ast.untpd
75
import dotty.tools.dotc.core.Contexts.*
86
import dotty.tools.dotc.core.StdNames.*

compiler/src/dotty/tools/dotc/profile/ChromeTrace.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
package dotty.tools.dotc.profile
1515

16-
import scala.language.unsafeNulls
17-
1816
import java.io.Closeable
1917
import java.lang.management.ManagementFactory
2018
import java.nio.file.{Files, Path}

compiler/src/dotty/tools/dotc/profile/Profiler.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package dotty.tools.dotc.profile
22

33
import scala.annotation.*
4-
import scala.language.unsafeNulls
5-
64
import java.io.{FileWriter, PrintWriter}
75
import java.nio.file.Paths
86
import java.lang.management.{ManagementFactory, GarbageCollectorMXBean, RuntimeMXBean, MemoryMXBean, ClassLoadingMXBean, CompilationMXBean}

compiler/src/dotty/tools/dotc/profile/ThreadPoolFactory.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package dotty.tools.dotc.profile
22

3-
import scala.language.unsafeNulls
4-
53
import java.util.concurrent.ThreadPoolExecutor.AbortPolicy
64
import java.util.concurrent.*
75
import java.util.concurrent.atomic.AtomicInteger

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package dotty.tools.dotc.quoted
22

3-
import scala.language.unsafeNulls
4-
53
import java.util.Base64
64
import java.nio.charset.StandardCharsets.UTF_8
75

compiler/src/dotty/tools/dotc/reporting/Diagnostic.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package dotty.tools
22
package dotc
33
package reporting
44

5-
import scala.language.unsafeNulls
6-
75
import dotty.tools.dotc.config.Settings.Setting
86
import dotty.tools.dotc.core.Contexts.*
97
import dotty.tools.dotc.interfaces.Diagnostic.{ERROR, INFO, WARNING}

compiler/src/dotty/tools/dotc/reporting/Message.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import config.SourceVersion
1111
import cc.CaptureSet
1212
import cc.Capabilities.*
1313

14-
import scala.language.unsafeNulls
1514
import scala.annotation.threadUnsafe
1615

1716
/** ## Tips for error message generation
@@ -177,7 +176,7 @@ object Message:
177176
case sym: Symbol =>
178177
val info =
179178
if (ctx.gadt.contains(sym))
180-
sym.info & ctx.gadt.fullBounds(sym)
179+
sym.info & ctx.gadt.fullBounds(sym).nn
181180
else
182181
sym.info
183182
s"is a ${ctx.printer.kindString(sym)}${sym.showExtendedLocation}${addendum("bounds", info)}"
@@ -267,7 +266,7 @@ object Message:
267266
case _ =>
268267
super.funMiddleText(isContextual, isPure, refs)
269268

270-
override def toTextMethodAsFunction(info: Type, isPure: Boolean, refs: GeneralCaptureSet): Text =
269+
override def toTextMethodAsFunction(info: Type, isPure: Boolean, refs: GeneralCaptureSet | Null): Text =
271270
info match
272271
case info: LambdaType =>
273272
seen.openLambda(info)

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ extends SyntaxMsg(RepeatedModifierID) {
542542
}
543543

544544
override def actions(using Context) =
545-
import scala.language.unsafeNulls
546545
List(
547546
CodeAction(title = s"""Remove repeated modifier: "$modifier"""",
548547
description = None,
@@ -887,7 +886,6 @@ extends Message(PatternMatchExhaustivityID) {
887886
|"""
888887

889888
override def actions(using Context) =
890-
import scala.language.unsafeNulls
891889
val endPos = tree.cases.lastOption.map(_.endPos)
892890
.getOrElse(tree.selector.endPos)
893891
val startColumn = tree.cases.lastOption
@@ -910,7 +908,6 @@ extends Message(PatternMatchExhaustivityID) {
910908

911909

912910
private def indent(text:String, margin: Int): String = {
913-
import scala.language.unsafeNulls
914911
" " * margin + text
915912
}
916913
}
@@ -1991,7 +1988,6 @@ class OnlyFunctionsCanBeFollowedByUnderscore(tp: Type, tree: untpd.PostfixOp)(us
19911988
|To convert to a function value, you need to explicitly write ${hl("() => x")}"""
19921989

19931990
override def actions(using Context) =
1994-
import scala.language.unsafeNulls
19951991
val untpd.PostfixOp(qual, Ident(nme.WILDCARD)) = tree: @unchecked
19961992
List(
19971993
CodeAction(title = "Rewrite to function value",
@@ -2021,7 +2017,6 @@ class MissingEmptyArgumentList(method: String, tree: tpd.Tree)(using Context)
20212017
}
20222018

20232019
override def actions(using Context) =
2024-
import scala.language.unsafeNulls
20252020
List(
20262021
CodeAction(title = "Insert ()",
20272022
description = None,

compiler/src/dotty/tools/dotc/reporting/trace.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package dotty.tools
22
package dotc
33
package reporting
44

5-
import scala.language.unsafeNulls
6-
75
import core.*, Contexts.*, Decorators.*
86
import config.*
97
import printing.Formatting.*

compiler/src/dotty/tools/dotc/sbt/ShowAPI.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
package dotty.tools.dotc
1010
package sbt
1111

12-
import scala.language.unsafeNulls
13-
1412
import xsbti.api.*
1513

1614
import scala.util.Try

compiler/src/dotty/tools/scripting/Main.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package dotty.tools.scripting
22

3-
import scala.language.unsafeNulls
4-
53
import java.io.File
64
import java.nio.file.{Path, Paths}
75
import dotty.tools.dotc.config.Properties.isWin

compiler/src/dotty/tools/scripting/StringDriver.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package dotty.tools.scripting
22

3-
import scala.language.unsafeNulls
4-
53
import java.nio.file.{ Files, Paths, Path }
64

75
import dotty.tools.dotc.Driver

compiler/src/dotty/tools/scripting/Util.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package dotty.tools.scripting
22

3-
import scala.language.unsafeNulls
4-
53
import java.nio.file.{ Path }
64
import java.io.File
75
import java.net.{ URLClassLoader }

0 commit comments

Comments
 (0)