Skip to content

Commit fda1250

Browse files
IDoCodingStuffssmarter
authored andcommitted
Remove -Xmax-classfile-name; hard-code to 240, like Scala 2.13.0-RC1 (#5872)
#5812 is still open since the limit is not respected in the backend.
1 parent 0a5349d commit fda1250

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ object NameOps {
1313
object compactify {
1414
lazy val md5: MessageDigest = MessageDigest.getInstance("MD5")
1515

16+
final val CLASSFILE_NAME_CHAR_LIMIT = 240
17+
1618
/** COMPACTIFY
1719
*
1820
* The hashed name has the form (prefix + marker + md5 + marker + suffix), where
@@ -25,10 +27,11 @@ object NameOps {
2527
*
2628
* (+6 for ".class"). MaxNameLength can therefore be computed as follows:
2729
*/
28-
def apply(s: String)(implicit ctx: Context): String = {
30+
def apply(s: String): String = {
2931
val marker = "$$$$"
30-
val limit: Int = ctx.settings.XmaxClassfileName.value
31-
val MaxNameLength = (limit - 6) min 2 * (limit - 6 - 2 * marker.length - 32)
32+
33+
val MaxNameLength = (CLASSFILE_NAME_CHAR_LIMIT - 6) min
34+
2 * (CLASSFILE_NAME_CHAR_LIMIT - 6 - 2 * marker.length - 32)
3235

3336
def toMD5(s: String, edge: Int): String = {
3437
val prefix = s take edge

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,3 @@ TaskKey[Unit]("output-empty") := {
33
val classes = (outputDirectory ** "*.class").get
44
if (classes.nonEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else ()
55
}
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")

tests/pending/run/t8199.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ object Test extends dotty.runtime.LegacyApp {
3939
checkClassName(c.getName)
4040
}
4141
def checkClassName(name: String): Unit = {
42-
val defaultMaxClassFileLength = 255
42+
val defaultMaxClassFileLength = 240
4343
assert((name + ".class").length <= defaultMaxClassFileLength, name)
4444
}
4545
def checkCallerImplClassName(): Unit = {

0 commit comments

Comments
 (0)