Aladdin - Scala Bugtracking
[#1046] project: compiler priority: low category: bug
submitter assigned to status date submitted
Adriaan Iulian won't fix 2007-04-16 13:38:25.0
subject ClassFormatError due to method names that aren't encoded
code
// file: pending/run/exoticnames.scala
// this is a run-test because the compiler should emit bytecode that'll pass the JVM's verifier
object Test extends Application {
  def `(` = error("bla")
  def `.` = error("bla")
  def `)` = error("bla")
  def `,` = error("bla")
}
what happened
Exception in thread "main" java.lang.ClassFormatError: Illegal method name "." in class Test
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
...
what expected either the compiler refuses these method definitions, or scala.tools.nsc.util.NameTransformer handles them -- the latter is easy enough to do, I think
[back to overview]
Changes of this bug report
Adriaan  edited on  2007-04-17 09:05:17.0
Martin  edited on  2007-04-17 16:39:44.0
I think backquoted identifiers should *never* be encoded. The spec already says that host systems may impose restrictions on what's legal. The problem is that host systems don't agree, so the compiler can't check. Maybe emit a warning? But when? I reassigned to Iulian because he knows more than most others about Java virtual machine idents.