diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-06-06 19:01:48 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-06-06 19:01:48 +0200 |
commit | 2a19cd56258884e25f26565d7b865cc2ec931b23 (patch) | |
tree | 699ce548bdc6a2cd63b4a4ab448036681bc7a2f8 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | |
parent | 5312d6305530eb14d369d0f4acaf7ca4e278ea72 (diff) | |
download | scala-2a19cd56258884e25f26565d7b865cc2ec931b23.tar.gz scala-2a19cd56258884e25f26565d7b865cc2ec931b23.tar.bz2 scala-2a19cd56258884e25f26565d7b865cc2ec931b23.zip |
SI-2464 Resiliance against missing InnerClass attributes
A classfile in the wild related to Vaadin lacked the InnerClasses
attribute. As such, our class file parser treated a nested enum
class as top-level, which led to a crash when trying to find its
linked module.
More details of the investigation are available in the JIRA comments.
The test introduces a new facility to rewrite classfiles.
This commit turns this situation into a logged warning, rather
than crashing. Code by @paulp, test by yours truly.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index fb927d15d3..1e84c73633 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -588,10 +588,14 @@ abstract class ClassfileParser { // sealed java enums if (jflags.isEnum) { val enumClass = sym.owner.linkedClassOfClass - if (!enumClass.isSealed) - enumClass setFlag (SEALED | ABSTRACT) - - enumClass addChild sym + enumClass match { + case NoSymbol => + devWarning(s"no linked class for java enum $sym in ${sym.owner}. A referencing class file might be missing an InnerClasses entry.") + case linked => + if (!linked.isSealed) + linked setFlag (SEALED | ABSTRACT) + linked addChild sym + } } } } |