Aladdin - Scala Bugtracking
[#303] project: compiler priority: low category: bug
submitter assigned to status date submitted
Matthias Philippe fixed 2004-03-02 21:00:50.0
subject Semantics of Definitions.getClass
code
==== file A.scala ====
package bug;
class A {
  def foo: B = new B;
}
==== file B.scala ====
package bug;
class B;
==== file C.scala ====
object C {
  val x = new bug.A().foo;
}
what happened
First compile A.scala and B.scala. Then remove the file bug/B.class and run scalac with file C.scala. Now you wi\
ll get the following message:
Exception in thread "main" java.lang.AssertionError: no class 'bug.B'
        at scalac.symtab.Definitions.getClass(Definitions.java:657)
        at scalac.symtab.classfile.JavaTypeCreator.classType(JavaTypeCreator.java:93)
        at scalac.symtab.classfile.Signatures.sigToType(Signatures.java:82)
        at scalac.symtab.classfile.Signatures.sigToType(Signatures.java:98)
        at scalac.symtab.classfile.Signatures.sigToType(Signatures.java:54)
        at scalac.symtab.classfile.ClassfileParser.readType(ClassfileParser.java:177)
        at scalac.symtab.classfile.ClassfileParser.parseMethod(ClassfileParser.java:206)
        at scalac.symtab.classfile.ClassfileParser.parse(ClassfileParser.java:115)
        at scalac.symtab.classfile.ClassParser.doComplete(ClassParser.java:34)
        at scalac.symtab.classfile.MetadataParser.complete(MetadataParser.java:34)
        at scalac.symtab.classfile.ClassParser$StaticsParser.complete(ClassParser.java:64)
        at scalac.symtab.Symbol.info(Symbol.java:830)
 ...
what expected The method Definitions.getClass should never throw an exception. Instead, when a class is not found, it should create a dummy/error symbol with the requested name. Using this symbol in the compilation should then provoke a real compiler error message without throwing an exception.
[back to overview]
Changes of this bug report
Philippe  edited on  2004-03-24 13:57:08.0

The latest partial rewrite/redesign of class loading and name resolution changed the crash into the following error message:

error: class file '/tmp/classes/bug/A.class': could not find class bug.B
one error found