diff --git a/compiler/src/dotty/tools/dotc/config/CliCommand.scala b/compiler/src/dotty/tools/dotc/config/CliCommand.scala index a0edb2b8cded..53fb21cc9299 100644 --- a/compiler/src/dotty/tools/dotc/config/CliCommand.scala +++ b/compiler/src/dotty/tools/dotc/config/CliCommand.scala @@ -1,8 +1,6 @@ package dotty.tools.dotc package config -import scala.language.unsafeNulls - import Settings.* import core.Contexts.* import printing.Highlighting diff --git a/compiler/src/dotty/tools/dotc/config/PathResolver.scala b/compiler/src/dotty/tools/dotc/config/PathResolver.scala index 67be0e3587cb..68960d5134ba 100644 --- a/compiler/src/dotty/tools/dotc/config/PathResolver.scala +++ b/compiler/src/dotty/tools/dotc/config/PathResolver.scala @@ -2,8 +2,6 @@ package dotty.tools package dotc package config -import scala.language.unsafeNulls - import WrappedProperties.AccessControl import io.{ClassPath, Directory, Path} import classpath.{AggregateClassPath, ClassPathFactory, JrtClassPath} diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ReusableDataReader.scala b/compiler/src/dotty/tools/dotc/core/classfile/ReusableDataReader.scala index e9bb7337c948..35716feb7a42 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ReusableDataReader.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ReusableDataReader.scala @@ -3,8 +3,6 @@ package dotc package core package classfile -import scala.language.unsafeNulls - import java.io.{DataInputStream, InputStream} import java.nio.{BufferUnderflowException, ByteBuffer} diff --git a/compiler/src/dotty/tools/dotc/core/tasty/BestEffortTastyWriter.scala b/compiler/src/dotty/tools/dotc/core/tasty/BestEffortTastyWriter.scala index 13a6a274ed96..a027da8a8a29 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/BestEffortTastyWriter.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/BestEffortTastyWriter.scala @@ -2,7 +2,6 @@ package dotty.tools.dotc package core package tasty -import scala.language.unsafeNulls import java.nio.file.{Path as JPath, Files as JFiles} import java.nio.channels.ClosedByInterruptException import java.io.DataOutputStream diff --git a/compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala index d3b5c647b9c5..42c572f0a50e 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala @@ -1,8 +1,6 @@ package dotty.tools.dotc package core.tasty -import scala.language.unsafeNulls - import core.Comments.Comment import util.Spans.Span import util.HashMap diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyPickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyPickler.scala index e35ed5bb2466..6fc397efea5a 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyPickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyPickler.scala @@ -3,8 +3,6 @@ package dotc package core package tasty -import scala.language.unsafeNulls - import dotty.tools.tasty.{TastyBuffer, TastyFormat, TastyHash} import dotty.tools.tasty.besteffort.BestEffortTastyFormat import TastyFormat.* diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala index f034f03298b1..6ce27b8b77af 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala @@ -3,8 +3,6 @@ package core package tasty import java.util.UUID -import scala.language.unsafeNulls - import dotty.tools.tasty.{TastyFormat, TastyVersion, TastyBuffer, TastyReader, TastyHeaderUnpickler, UnpicklerConfig} import dotty.tools.tasty.besteffort.{BestEffortTastyHeader, BestEffortTastyHeaderUnpickler} diff --git a/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala b/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala index 16e7cc9c7adc..6fe6d4ec22f7 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala @@ -1,8 +1,6 @@ package dotty.tools.dotc package decompiler -import scala.language.unsafeNulls - import java.io.{OutputStream, PrintStream} import java.nio.charset.StandardCharsets @@ -26,8 +24,8 @@ class DecompilationPrinter extends Phase { if (ctx.settings.outputDir.isDefault) printToOutput(System.out) else { val outputDir = ctx.settings.outputDir.value - var os: OutputStream = null - var ps: PrintStream = null + var os: OutputStream|Null = null + var ps: PrintStream|Null = null try { os = File(outputDir.fileNamed("decompiled.scala").path)(Codec.UTF8).outputStream(append = true) ps = new PrintStream(os, /* autoFlush = */ false, StandardCharsets.UTF_8.name) diff --git a/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala b/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala index 18c5ceb5f346..29acc58c09f4 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala @@ -2,8 +2,6 @@ package dotty.tools package dotc package decompiler -import scala.language.unsafeNulls - import dotty.tools.dotc.core.Contexts.* import dotty.tools.dotc.core.* import dotty.tools.dotc.core.tasty.TastyHTMLPrinter diff --git a/compiler/src/dotty/tools/dotc/fromtasty/Debug.scala b/compiler/src/dotty/tools/dotc/fromtasty/Debug.scala index 2e6b699b4e36..336d424e545d 100644 --- a/compiler/src/dotty/tools/dotc/fromtasty/Debug.scala +++ b/compiler/src/dotty/tools/dotc/fromtasty/Debug.scala @@ -2,8 +2,6 @@ package dotty.tools package dotc package fromtasty -import scala.language.unsafeNulls - import scala.util.control.NonFatal import dotty.tools.io.Directory diff --git a/compiler/src/dotty/tools/dotc/fromtasty/TASTYRun.scala b/compiler/src/dotty/tools/dotc/fromtasty/TASTYRun.scala index d01f60571601..4ed586e23249 100644 --- a/compiler/src/dotty/tools/dotc/fromtasty/TASTYRun.scala +++ b/compiler/src/dotty/tools/dotc/fromtasty/TASTYRun.scala @@ -2,8 +2,6 @@ package dotty.tools package dotc package fromtasty -import scala.language.unsafeNulls - import io.{JarArchive, AbstractFile, Path, FileExtension} import core.Contexts.* import core.Decorators.em diff --git a/compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala b/compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala index b1277accc621..33f2bb2c5e84 100644 --- a/compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala +++ b/compiler/src/dotty/tools/dotc/fromtasty/TastyFileUtil.scala @@ -1,8 +1,6 @@ package dotty.tools.dotc package fromtasty -import scala.language.unsafeNulls - import dotty.tools.dotc.core.tasty.TastyClassName import dotty.tools.dotc.core.StdNames.nme.EMPTY_PACKAGE import dotty.tools.io.AbstractFile diff --git a/compiler/src/dotty/tools/dotc/interactive/Interactive.scala b/compiler/src/dotty/tools/dotc/interactive/Interactive.scala index 973fc2f3d79d..ff73761ad688 100644 --- a/compiler/src/dotty/tools/dotc/interactive/Interactive.scala +++ b/compiler/src/dotty/tools/dotc/interactive/Interactive.scala @@ -2,8 +2,6 @@ package dotty.tools package dotc package interactive -import scala.language.unsafeNulls - import scala.collection.* import ast.{NavigateAST, Trees, tpd, untpd} diff --git a/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala b/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala index ce925e336b53..ea58cff357c1 100644 --- a/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala +++ b/compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala @@ -1,8 +1,6 @@ package dotty.tools.dotc package printing -import scala.language.unsafeNulls - import dotty.tools.dotc.ast.untpd import dotty.tools.dotc.core.Contexts.* import dotty.tools.dotc.core.StdNames.* diff --git a/compiler/src/dotty/tools/dotc/profile/ChromeTrace.scala b/compiler/src/dotty/tools/dotc/profile/ChromeTrace.scala index 4950f439640f..8ee81c94f735 100644 --- a/compiler/src/dotty/tools/dotc/profile/ChromeTrace.scala +++ b/compiler/src/dotty/tools/dotc/profile/ChromeTrace.scala @@ -13,8 +13,6 @@ package dotty.tools.dotc.profile -import scala.language.unsafeNulls - import java.io.Closeable import java.lang.management.ManagementFactory import java.nio.file.{Files, Path} diff --git a/compiler/src/dotty/tools/dotc/profile/Profiler.scala b/compiler/src/dotty/tools/dotc/profile/Profiler.scala index ab3e73468385..192226d6a883 100644 --- a/compiler/src/dotty/tools/dotc/profile/Profiler.scala +++ b/compiler/src/dotty/tools/dotc/profile/Profiler.scala @@ -1,8 +1,6 @@ package dotty.tools.dotc.profile import scala.annotation.* -import scala.language.unsafeNulls - import java.io.{FileWriter, PrintWriter} import java.nio.file.Paths import java.lang.management.{ManagementFactory, GarbageCollectorMXBean, RuntimeMXBean, MemoryMXBean, ClassLoadingMXBean, CompilationMXBean} diff --git a/compiler/src/dotty/tools/dotc/profile/ThreadPoolFactory.scala b/compiler/src/dotty/tools/dotc/profile/ThreadPoolFactory.scala index 1a81153b9b08..d07a38c37485 100644 --- a/compiler/src/dotty/tools/dotc/profile/ThreadPoolFactory.scala +++ b/compiler/src/dotty/tools/dotc/profile/ThreadPoolFactory.scala @@ -1,7 +1,5 @@ package dotty.tools.dotc.profile -import scala.language.unsafeNulls - import java.util.concurrent.ThreadPoolExecutor.AbortPolicy import java.util.concurrent.* import java.util.concurrent.atomic.AtomicInteger diff --git a/compiler/src/dotty/tools/dotc/quoted/TastyString.scala b/compiler/src/dotty/tools/dotc/quoted/TastyString.scala index 369e646e883e..528414654969 100644 --- a/compiler/src/dotty/tools/dotc/quoted/TastyString.scala +++ b/compiler/src/dotty/tools/dotc/quoted/TastyString.scala @@ -1,7 +1,5 @@ package dotty.tools.dotc.quoted -import scala.language.unsafeNulls - import java.util.Base64 import java.nio.charset.StandardCharsets.UTF_8 diff --git a/compiler/src/dotty/tools/dotc/reporting/Diagnostic.scala b/compiler/src/dotty/tools/dotc/reporting/Diagnostic.scala index 20be33716831..30a9b8f60cf8 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Diagnostic.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Diagnostic.scala @@ -2,8 +2,6 @@ package dotty.tools package dotc package reporting -import scala.language.unsafeNulls - import dotty.tools.dotc.config.Settings.Setting import dotty.tools.dotc.core.Contexts.* import dotty.tools.dotc.interfaces.Diagnostic.{ERROR, INFO, WARNING} diff --git a/compiler/src/dotty/tools/dotc/reporting/Message.scala b/compiler/src/dotty/tools/dotc/reporting/Message.scala index 1e313ca749d3..de0d9fdd7131 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Message.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Message.scala @@ -11,7 +11,6 @@ import config.SourceVersion import cc.CaptureSet import cc.Capabilities.* -import scala.language.unsafeNulls import scala.annotation.threadUnsafe /** ## Tips for error message generation @@ -177,7 +176,7 @@ object Message: case sym: Symbol => val info = if (ctx.gadt.contains(sym)) - sym.info & ctx.gadt.fullBounds(sym) + sym.info & ctx.gadt.fullBounds(sym).nn else sym.info s"is a ${ctx.printer.kindString(sym)}${sym.showExtendedLocation}${addendum("bounds", info)}" @@ -267,7 +266,7 @@ object Message: case _ => super.funMiddleText(isContextual, isPure, refs) - override def toTextMethodAsFunction(info: Type, isPure: Boolean, refs: GeneralCaptureSet): Text = + override def toTextMethodAsFunction(info: Type, isPure: Boolean, refs: GeneralCaptureSet | Null): Text = info match case info: LambdaType => seen.openLambda(info) diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index 44b97790c849..442147f99150 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -542,7 +542,6 @@ extends SyntaxMsg(RepeatedModifierID) { } override def actions(using Context) = - import scala.language.unsafeNulls List( CodeAction(title = s"""Remove repeated modifier: "$modifier"""", description = None, @@ -887,7 +886,6 @@ extends Message(PatternMatchExhaustivityID) { |""" override def actions(using Context) = - import scala.language.unsafeNulls val endPos = tree.cases.lastOption.map(_.endPos) .getOrElse(tree.selector.endPos) val startColumn = tree.cases.lastOption @@ -910,7 +908,6 @@ extends Message(PatternMatchExhaustivityID) { private def indent(text:String, margin: Int): String = { - import scala.language.unsafeNulls " " * margin + text } } @@ -1991,7 +1988,6 @@ class OnlyFunctionsCanBeFollowedByUnderscore(tp: Type, tree: untpd.PostfixOp)(us |To convert to a function value, you need to explicitly write ${hl("() => x")}""" override def actions(using Context) = - import scala.language.unsafeNulls val untpd.PostfixOp(qual, Ident(nme.WILDCARD)) = tree: @unchecked List( CodeAction(title = "Rewrite to function value", @@ -2021,7 +2017,6 @@ class MissingEmptyArgumentList(method: String, tree: tpd.Tree)(using Context) } override def actions(using Context) = - import scala.language.unsafeNulls List( CodeAction(title = "Insert ()", description = None, diff --git a/compiler/src/dotty/tools/dotc/reporting/trace.scala b/compiler/src/dotty/tools/dotc/reporting/trace.scala index 7f05cffb422a..c557a6e4544c 100644 --- a/compiler/src/dotty/tools/dotc/reporting/trace.scala +++ b/compiler/src/dotty/tools/dotc/reporting/trace.scala @@ -2,8 +2,6 @@ package dotty.tools package dotc package reporting -import scala.language.unsafeNulls - import core.*, Contexts.*, Decorators.* import config.* import printing.Formatting.* diff --git a/compiler/src/dotty/tools/dotc/sbt/ShowAPI.scala b/compiler/src/dotty/tools/dotc/sbt/ShowAPI.scala index 61baebbe9517..a16c135deef7 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ShowAPI.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ShowAPI.scala @@ -9,8 +9,6 @@ package dotty.tools.dotc package sbt -import scala.language.unsafeNulls - import xsbti.api.* import scala.util.Try diff --git a/compiler/src/dotty/tools/scripting/Main.scala b/compiler/src/dotty/tools/scripting/Main.scala index 0b954cb79b26..16e2fe35e6f1 100755 --- a/compiler/src/dotty/tools/scripting/Main.scala +++ b/compiler/src/dotty/tools/scripting/Main.scala @@ -1,7 +1,5 @@ package dotty.tools.scripting -import scala.language.unsafeNulls - import java.io.File import java.nio.file.{Path, Paths} import dotty.tools.dotc.config.Properties.isWin diff --git a/compiler/src/dotty/tools/scripting/StringDriver.scala b/compiler/src/dotty/tools/scripting/StringDriver.scala index eccd8445c87d..6d4fac719be2 100755 --- a/compiler/src/dotty/tools/scripting/StringDriver.scala +++ b/compiler/src/dotty/tools/scripting/StringDriver.scala @@ -1,7 +1,5 @@ package dotty.tools.scripting -import scala.language.unsafeNulls - import java.nio.file.{ Files, Paths, Path } import dotty.tools.dotc.Driver diff --git a/compiler/src/dotty/tools/scripting/Util.scala b/compiler/src/dotty/tools/scripting/Util.scala index fbbeb13ca13c..99af967143d3 100755 --- a/compiler/src/dotty/tools/scripting/Util.scala +++ b/compiler/src/dotty/tools/scripting/Util.scala @@ -1,7 +1,5 @@ package dotty.tools.scripting -import scala.language.unsafeNulls - import java.nio.file.{ Path } import java.io.File import java.net.{ URLClassLoader }