Meaning of -Xmax-classfile-name option

691 views
Skip to first unread message

Peter Niederwieser

unread,
Nov 13, 2012, 8:23:38 AM11/13/12
to scala-l...@googlegroups.com
What's the exact meaning of the -Xmax-classfile-name compiler option? We got some feedback that this property doesn't work when compiling Scala code with Gradle/Zinc. Upon investigation, I found it to have no effect on class file names of user-declared classes even with plain scalac. So what's the meaning of this property? Does it only have an effect on synthetic classes generated (and referenced) by the compiler?

Cheers,
Peter

Paul Phillips

unread,
Nov 13, 2012, 8:35:06 AM11/13/12
to scala-l...@googlegroups.com


On Tue, Nov 13, 2012 at 5:23 AM, Peter Niederwieser <pnie...@gmail.com> wrote:
Upon investigation, I found it to have no effect on class file names of user-declared classes even with plain scalac. So what's the meaning of this property? Does it only have an effect on synthetic classes generated (and referenced) by the compiler?

What is the definition of "no effect" ? These class names don't look unmolested

class bipppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppy {
  class bipppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppy {
    class bipppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppy {
      class bipppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppy { }
    }
  }
}

% scalac -Xmax-classfile-name 72 -d o3 ./a.scala
% ls -1 o3
bippppppppppp$$$$32875bb281a648bbe0ff676427563a55$$$$ppppppppppppy.class
bippppppppppp$$$$c796cd16149c915149a69574a6ea823$$$$ppppppppppppy.class
bippppppppppp$$$$d71cc47f66954f66ba9597c0540a9$$$$ppppppppppppy.class
bipppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppy.class

Peter Niederwieser

unread,
Nov 13, 2012, 8:44:53 AM11/13/12
to scala-l...@googlegroups.com
On Nov 13, 2012, at 2:35 PM, Paul Phillips <pa...@improving.org> wrote:

On Tue, Nov 13, 2012 at 5:23 AM, Peter Niederwieser <pnie...@gmail.com> wrote:
Upon investigation, I found it to have no effect on class file names of user-declared classes even with plain scalac. So what's the meaning of this property? Does it only have an effect on synthetic classes generated (and referenced) by the compiler?

What is the definition of "no effect" ? These class names don't look unmolested

I don't see any effect on my top-level class whose name is 200 characters long. The class file is named exactly like the class. Are you saying that this only has an effect on nested classes? 

Cheers,
Peter

Paul Phillips

unread,
Nov 13, 2012, 8:59:12 AM11/13/12
to scala-l...@googlegroups.com
On Tue, Nov 13, 2012 at 5:44 AM, Peter Niederwieser <pnie...@gmail.com> wrote:
I don't see any effect on my top-level class whose name is 200 characters long. The class file is named exactly like the class. Are you saying that this only has an effect on nested classes? 

I was just saying it does something. You seem to be observing that it does not shorten top level classes, and I will take your word for it. This does not come as a big surprise to me because renaming top level classes would mean you couldn't use the compilation products with anything which hadn't been compiled at the same time. The feature isn't there to accommodate gigantic top level classes, which you can generally avoid, but gigantic flattened ones, which sometimes you can't.

Peter Niederwieser

unread,
Nov 13, 2012, 9:34:57 AM11/13/12
to scala-l...@googlegroups.com
Thanks, that answers my question. Works just fine with Gradle/Zinc.

Cheers,
Peter
Reply all
Reply to author
Forward
0 new messages