Skip to content

Commit 9811e61

Browse files
Initial changes with references to MaxClassFileLength and variants replaced with MaxNameLength and variants hardcoded to 240
1 parent 732f7e2 commit 9811e61

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class ScalaSettings extends Settings.SettingGroup {
6464
val Xhelp: Setting[Boolean] = BooleanSetting("-X", "Print a synopsis of advanced options.")
6565
val XnoForwarders: Setting[Boolean] = BooleanSetting("-Xno-forwarders", "Do not generate static forwarders in mirror classes.")
6666
val XmaxInlines: Setting[Int] = IntSetting("-Xmax-inlines", "Maximal number of successive inlines", 32)
67-
val XmaxClassfileName: Setting[Int] = IntSetting("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, 72 to 255)
6867
val Xmigration: Setting[ScalaVersion] = VersionSetting("-Xmigration", "Warn about constructs whose behavior may have changed since version.")
6968
val Xprint: Setting[List[String]] = PhasesSetting("-Xprint", "Print out program after")
7069
val XprintTypes: Setting[Boolean] = BooleanSetting("-Xprint-types", "Print tree types (debugging option).")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object NameOps {
2727
*/
2828
def apply(s: String)(implicit ctx: Context): String = {
2929
val marker = "$$$$"
30-
val limit: Int = ctx.settings.XmaxClassfileName.value
30+
final val LIMIT: Int = 240
3131
val MaxNameLength = (limit - 6) min 2 * (limit - 6 - 2 * marker.length - 32)
3232

3333
def toMD5(s: String, edge: Int): String = {

sbt-dotty/sbt-test/source-dependencies/compactify/build.sbt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@ TaskKey[Unit]("output-empty") := {
22
val outputDirectory = (classDirectory in Compile).value
33
val classes = (outputDirectory ** "*.class").get
44
if (classes.nonEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else ()
5-
}
6-
7-
// apparently Travis CI stopped allowing long file names
8-
// it fails with the default setting of 255 characters so
9-
// we have to set lower limit ourselves
10-
scalacOptions ++= Seq("-Xmax-classfile-name", "240")
5+
}

tests/pending/run/t8199.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ object Test extends dotty.runtime.LegacyApp {
3939
checkClassName(c.getName)
4040
}
4141
def checkClassName(name: String): Unit = {
42-
val defaultMaxClassFileLength = 255
43-
assert((name + ".class").length <= defaultMaxClassFileLength, name)
42+
final val MaxSuffixLength = 7 // "$.class".length + 1 // potential module class suffix and file extension
43+
final val MaxNameLength = 240 - MaxSuffixLength
44+
45+
assert((name + ".class").length <= defaultMaxNameLength, name)
4446
}
4547
def checkCallerImplClassName(): Unit = {
4648
val name = Thread.currentThread.getStackTrace.apply(2).getClassName

0 commit comments

Comments
 (0)