Invalidate symbols for artifact classfiles, refactor classfile parser#5952
Invalidate symbols for artifact classfiles, refactor classfile parser#5952lrytz merged 3 commits intoscala:2.13.xfrom
Conversation
Added in ced7214, no longer needed since ICodeReader is gone.
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.
This abstraction was not necessary, it was just dealing with encoding the signature. This is now handled more directly.
retronym
left a comment
There was a problem hiding this comment.
Such an improvement! LGTM.
We should consider backporting the "no scala sig for classes ending in '$'" fix, if it is a regression.
|
Good point, I'll submit a backport for this fix. Jardiff (lib+reflect+comp) looks good: When compiling the compiler, a number of scala-artifact-classfiles are being completed. They fall in two categories. When completed, they are now unlinked and marked non-existing:
I'll leave the fix in place. In general, when a new class symbol is created synthetically with a name that matches a classfile that already exists on the classpath, it's probably a good idea to unlink the existing symbol (by completing it) and its companionModule/companionModuleClass. |
This is similar to scala/scala#5952, we do not need to parse artifact classfiles (that is, classfiles produced by scalac or dotty that do not contain pickling information), so we discard them as soon as possible. This fixes various IDE crashes when trying to complete packages such as "scala."
This is similar to scala/scala#5952, we do not need to parse artifact classfiles (that is, classfiles produced by scalac or dotty that do not contain pickling information), so we discard them as soon as possible. This fixes various IDE crashes when trying to complete packages such as "scala."
This is similar to scala/scala#5952, we do not need to parse artifact classfiles (that is, classfiles produced by scalac or dotty that do not contain pickling information), so we discard them as soon as possible. This fixes various IDE crashes when trying to complete packages such as "scala."
This is similar to scala/scala#5952, we do not need to parse artifact classfiles (that is, classfiles produced by scalac or dotty that do not contain pickling information), so we discard them as soon as possible. This fixes various IDE crashes when trying to complete packages such as "scala."
This is similar to scala/scala#5952, we do not need to parse artifact classfiles (that is, classfiles produced by scalac or dotty that do not contain pickling information), so we discard them as soon as possible. This fixes various IDE crashes when trying to complete packages such as "scala."
This is similar to scala/scala#5952, we do not need to parse artifact classfiles (that is, classfiles produced by scalac or dotty that do not contain pickling information), so we discard them as soon as possible. This fixes various IDE crashes when trying to complete packages such as "scala."
This is similar to scala/scala#5952, we do not need to parse artifact classfiles (that is, classfiles produced by scalac or dotty that do not contain pickling information), so we discard them as soon as possible. This fixes various IDE crashes when trying to complete packages such as "scala."
|
I've seen some code in the wild that is broken by this change.
|
|
Ah, as in |
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 aScalaSignature by mistake. They were filtered out by the name-based
test that is supposed to identify module classes.
Also cleans up an unnecessary abstraction in the representation of
ScalaSignature annotations.