Skip to content

Commit e60dcbb

Browse files
committed
Remove more .nn
1 parent 1c19710 commit e60dcbb

33 files changed

+56
-71
lines changed

compiler/src/dotty/tools/backend/jvm/ClassfileWriters.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import BTypes.InternalName
1818
import scala.util.chaining.*
1919
import dotty.tools.io.JarArchive
2020

21-
import scala.language.unsafeNulls
22-
2321
/** !!! This file is now copied in `dotty.tools.io.FileWriters` in a more general way that does not rely upon
2422
* `PostProcessorFrontendAccess`, this should probably be changed to wrap that class instead.
2523
*
@@ -54,11 +52,11 @@ class ClassfileWriters(frontendAccess: PostProcessorFrontendAccess) {
5452
def close(): Unit
5553

5654
protected def classRelativePath(className: InternalName, suffix: String = ".class"): String =
57-
className.replace('.', '/').nn + suffix
55+
className.replace('.', '/') + suffix
5856
}
5957

6058
object ClassfileWriter {
61-
private def getDirectory(dir: String): Path = Paths.get(dir).nn
59+
private def getDirectory(dir: String): Path = Paths.get(dir)
6260

6361
def apply(): ClassfileWriter = {
6462
val jarManifestMainClass: Option[String] = compilerSettings.mainClass.orElse {
@@ -137,7 +135,7 @@ class ClassfileWriters(frontendAccess: PostProcessorFrontendAccess) {
137135
new JarEntryWriter(jarFile, jarManifestMainClass, jarCompressionLevel)
138136
}
139137
else if (file.isVirtual) new VirtualFileWriter(file)
140-
else if (file.isDirectory) new DirEntryWriter(file.file.toPath.nn)
138+
else if (file.isDirectory) new DirEntryWriter(file.file.toPath)
141139
else throw new IllegalStateException(s"don't know how to handle an output of $file [${file.getClass}]")
142140
}
143141

@@ -151,7 +149,7 @@ class ClassfileWriters(frontendAccess: PostProcessorFrontendAccess) {
151149
val jarWriter: JarOutputStream = {
152150
import scala.util.Properties.*
153151
val manifest = new Manifest
154-
val attrs = manifest.getMainAttributes.nn
152+
val attrs = manifest.getMainAttributes
155153
attrs.put(MANIFEST_VERSION, "1.0")
156154
attrs.put(ScalaCompilerVersion, versionNumberString)
157155
mainClass.foreach(c => attrs.put(MAIN_CLASS, c))
@@ -184,7 +182,7 @@ class ClassfileWriters(frontendAccess: PostProcessorFrontendAccess) {
184182
// important detail here, even on Windows, Zinc expects the separator within the jar
185183
// to be the system default, (even if in the actual jar file the entry always uses '/').
186184
// see https://github.com/sbt/zinc/blob/dcddc1f9cfe542d738582c43f4840e17c053ce81/internal/compiler-bridge/src/main/scala/xsbt/JarUtils.scala#L47
187-
val pathInJar =
185+
val pathInJar =
188186
if File.separatorChar == '/' then relativePath
189187
else relativePath.replace('/', File.separatorChar)
190188
PlainFile.toPlainFile(Paths.get(s"${file.absolutePath}!$pathInJar"))
@@ -293,5 +291,5 @@ class ClassfileWriters(frontendAccess: PostProcessorFrontendAccess) {
293291
}
294292

295293
/** Can't output a file due to the state of the file system. */
296-
class FileConflictException(msg: String, cause: Throwable = null) extends IOException(msg, cause)
294+
class FileConflictException(msg: String, cause: Throwable | Null = null) extends IOException(msg, cause)
297295
}

compiler/src/dotty/tools/dotc/Driver.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Driver {
3838
finish(compiler, run)
3939
catch
4040
case ex: FatalError =>
41-
report.error(ex.getMessage.nn) // signals that we should fail compilation.
41+
report.error(ex.getMessage) // signals that we should fail compilation.
4242
case ex: Throwable if ctx.usedBestEffortTasty =>
4343
report.bestEffortError(ex, "Some best-effort tasty files were not able to be read.")
4444
throw ex
@@ -117,7 +117,7 @@ class Driver {
117117
.distinct
118118
val ctx1 = ctx.fresh
119119
val fullClassPath =
120-
(newEntries :+ ctx.settings.classpath.value).mkString(java.io.File.pathSeparator.nn)
120+
(newEntries :+ ctx.settings.classpath.value).mkString(java.io.File.pathSeparator)
121121
ctx1.setSetting(ctx1.settings.classpath, fullClassPath)
122122
else ctx
123123

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ class CheckCaptures extends Recheck, SymTransformer:
963963
trace.force(i"rechecking $tree with pt = $pt", recheckr, show = true):
964964
super.recheck(tree, pt)
965965
catch case ex: NoCommonRoot =>
966-
report.error(ex.getMessage.nn)
966+
report.error(ex.getMessage)
967967
tree.tpe
968968
finally curEnv = saved
969969
if tree.isTerm then

compiler/src/dotty/tools/dotc/classpath/ClassPathFactory.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ClassPathFactory {
6767
for
6868
file <- files
6969
a <- ClassPath.expandManifestPath(file.absolutePath)
70-
path = java.nio.file.Paths.get(a.toURI()).nn
70+
path = java.nio.file.Paths.get(a.toURI())
7171
if Files.exists(path)
7272
yield
7373
newClassPath(AbstractFile.getFile(path))

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ object CommandLineParser:
118118
Nil
119119
else
120120
def stripComment(s: String) = s.indexOf('#') match { case -1 => s case i => s.substring(0, i) }
121-
val lines = Files.readAllLines(path).nn
122-
val params = lines.asScala.map(stripComment).filter(!_.nn.isEmpty).mkString(" ")
121+
val lines = Files.readAllLines(path)
122+
val params = lines.asScala.map(stripComment).filter(!_.isEmpty).mkString(" ")
123123
tokenize(params)
124124

125125
class ParseException(msg: String) extends RuntimeException(msg)

compiler/src/dotty/tools/dotc/core/Comments.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 core
44

5-
import scala.language.unsafeNulls
6-
75
import ast.{ untpd, tpd }
86
import Symbols.*, Contexts.*
97
import util.{SourceFile, ReadOnlyMap}

compiler/src/dotty/tools/dotc/core/Decorators.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object Decorators {
5151
if name.length != 0 then name.getChars(0, name.length, chars, s.length)
5252
termName(chars, 0, len)
5353
case name: TypeName => s.concat(name.toTermName)
54-
case _ => termName(s.concat(name.toString).nn)
54+
case _ => termName(s.concat(name.toString))
5555

5656
def indented(width: Int): String =
5757
val padding = " " * width
@@ -289,10 +289,10 @@ object Decorators {
289289
case NonFatal(ex)
290290
if !ctx.settings.YshowPrintErrors.value =>
291291
s"... (cannot display due to ${ex.className} ${ex.getMessage}) ..."
292-
case _ => String.valueOf(x).nn
292+
case _ => String.valueOf(x)
293293

294294
/** Returns the simple class name of `x`. */
295-
def className: String = x.getClass.getSimpleName.nn
295+
def className: String = x.getClass.getSimpleName
296296

297297
extension [T](x: T)
298298
def assertingErrorsReported(using Context): T = {

compiler/src/dotty/tools/dotc/core/NameOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import nme.*
1515
object NameOps {
1616

1717
object compactify {
18-
lazy val md5: MessageDigest = MessageDigest.getInstance("MD5").nn
18+
lazy val md5: MessageDigest = MessageDigest.getInstance("MD5")
1919

2020
inline val CLASSFILE_NAME_CHAR_LIMIT = 240
2121

@@ -43,7 +43,7 @@ object NameOps {
4343
val suffix = s.takeRight(edge)
4444

4545
val cs = s.toArray
46-
val bytes = Codec.toUTF8(CharBuffer.wrap(cs).nn)
46+
val bytes = Codec.toUTF8(CharBuffer.wrap(cs))
4747
md5.update(bytes)
4848
val md5chars = md5.digest().map(b => (b & 0xFF).toHexString).mkString
4949

compiler/src/dotty/tools/dotc/core/TypeErrors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ abstract class TypeError(using creationContext: Context) extends Exception(""):
3232
|| ctx.settings.YdebugCyclic.value
3333

3434
override def fillInStackTrace(): Throwable =
35-
if computeStackTrace then super.fillInStackTrace().nn
35+
if computeStackTrace then super.fillInStackTrace()
3636
else this
3737

3838
/** Convert to message. This takes an additional Context, so that we

compiler/src/dotty/tools/dotc/core/TypeEval.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ object TypeEval:
9494
val result =
9595
try op
9696
catch case e: Throwable =>
97-
throw TypeError(em"${e.getMessage.nn}")
97+
throw TypeError(em"${e.getMessage}")
9898
ConstantType(Constant(result))
9999

100100
def fieldsOf: Option[Type] =

0 commit comments

Comments
 (0)