diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 75e574c152c8..6fb2e758087d 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -64,7 +64,6 @@ class ScalaSettings extends Settings.SettingGroup { val Xhelp: Setting[Boolean] = BooleanSetting("-X", "Print a synopsis of advanced options.") val XnoForwarders: Setting[Boolean] = BooleanSetting("-Xno-forwarders", "Do not generate static forwarders in mirror classes.") val XmaxInlines: Setting[Int] = IntSetting("-Xmax-inlines", "Maximal number of successive inlines", 32) - val XmaxClassfileName: Setting[Int] = IntSetting("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, 72 to 255) val Xmigration: Setting[ScalaVersion] = VersionSetting("-Xmigration", "Warn about constructs whose behavior may have changed since version.") val Xprint: Setting[List[String]] = PhasesSetting("-Xprint", "Print out program after") val XprintTypes: Setting[Boolean] = BooleanSetting("-Xprint-types", "Print tree types (debugging option).") diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala index 7bb897c0d73b..7f26a68687fe 100644 --- a/compiler/src/dotty/tools/dotc/core/NameOps.scala +++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala @@ -13,6 +13,8 @@ object NameOps { object compactify { lazy val md5: MessageDigest = MessageDigest.getInstance("MD5") + final val CLASSFILE_NAME_CHAR_LIMIT = 240 + /** COMPACTIFY * * The hashed name has the form (prefix + marker + md5 + marker + suffix), where @@ -25,10 +27,11 @@ object NameOps { * * (+6 for ".class"). MaxNameLength can therefore be computed as follows: */ - def apply(s: String)(implicit ctx: Context): String = { + def apply(s: String): String = { val marker = "$$$$" - val limit: Int = ctx.settings.XmaxClassfileName.value - val MaxNameLength = (limit - 6) min 2 * (limit - 6 - 2 * marker.length - 32) + + val MaxNameLength = (CLASSFILE_NAME_CHAR_LIMIT - 6) min + 2 * (CLASSFILE_NAME_CHAR_LIMIT - 6 - 2 * marker.length - 32) def toMD5(s: String, edge: Int): String = { val prefix = s take edge diff --git a/sbt-dotty/sbt-test/source-dependencies/compactify/build.sbt b/sbt-dotty/sbt-test/source-dependencies/compactify/build.sbt index 121f59cd756b..e57676a05b38 100644 --- a/sbt-dotty/sbt-test/source-dependencies/compactify/build.sbt +++ b/sbt-dotty/sbt-test/source-dependencies/compactify/build.sbt @@ -3,8 +3,3 @@ TaskKey[Unit]("output-empty") := { val classes = (outputDirectory ** "*.class").get if (classes.nonEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else () } - -// apparently Travis CI stopped allowing long file names -// it fails with the default setting of 255 characters so -// we have to set lower limit ourselves -scalacOptions ++= Seq("-Xmax-classfile-name", "240") diff --git a/tests/pending/run/t8199.scala b/tests/pending/run/t8199.scala index d84f6fc72a54..c96be4287ea1 100644 --- a/tests/pending/run/t8199.scala +++ b/tests/pending/run/t8199.scala @@ -39,7 +39,7 @@ object Test extends dotty.runtime.LegacyApp { checkClassName(c.getName) } def checkClassName(name: String): Unit = { - val defaultMaxClassFileLength = 255 + val defaultMaxClassFileLength = 240 assert((name + ".class").length <= defaultMaxClassFileLength, name) } def checkCallerImplClassName(): Unit = {