How does Scala know the difference between "def foo" and "def foo()"?
scala
Solution
In the .class file, there is a class file attribute called `ScalaSig`, which contains all of the extra information needed by Scala. It's not really readable by humans, but it is there:
$ javap -verbose Foo.class
const #195 = Asciz ScalaSig;
const #196 = Asciz Lscala/reflect/ScalaSignature;;
const #197 = Asciz bytes;
const #198 = Asciz ^F^A!3A!^A^B^A^S\t\tb)^[7f^Y^Vtw\r^^5DQ^V^\7.^Z:^K^E\r!^
Q^A^B4jY^VT!!^B^D^B^UM^\^W\r\1tifdWMC^A^H^....
See also How is the Scala signature stored? and scala.reflect.ScalaSignature, which isn't very interesting :-)
Problem
I know about the usage difference between empty-parameter and parameterless methods in scala, and my question pertains to the class file generated. When I look at these two classes in javap, they look exactly the same: ``` class Foo { def bar() = 123; } class Foo { def bar = 123; } ``` But when I look at them in scalap, they accurately reflect the parameter lists. Where in the class file is scalac making this distinction known?