Skip to content

Commit 3aea776

Browse files
committed
Invalidate symbols for artifact classfiles, refactor classfile parser
No longer run the classfile parser on Scala generated classfiles that don't have a Scala signature (module classes, inner classes, etc). Various cleanups in the classfile parser, minimize the work performed on Scala classfiles. Before, the attributes section was parsed twice: once to find the ScalaSig attribute, the second time to find the ScalaSignature in the RuntimeVisibleAnnotations. Now everything happens in the first iteration. Also fixes a bug in the backend: classes ending in `$` did not get a ScalaSignature by mistake. They were filtered out by the name-based test that is supposed to identify module classes.
1 parent e216e0e commit 3aea776

File tree

6 files changed

+272
-236
lines changed

6 files changed

+272
-236
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
501501
*/
502502
def getAnnotPickle(jclassName: String, sym: Symbol): Option[AnnotationInfo] = {
503503
currentRun.symData get sym match {
504-
case Some(pickle) if !nme.isModuleName(newTermName(jclassName)) =>
504+
case Some(pickle) if !sym.isModuleClass => // pickles for module classes are in the companion / mirror class
505505
val scalaAnnot = {
506506
val sigBytes = ScalaSigBytes(pickle.bytes.take(pickle.writeIndex))
507507
AnnotationInfo(sigBytes.sigAnnot, Nil, (nme.bytes, sigBytes) :: Nil)

0 commit comments

Comments
 (0)