summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-02-19 15:19:03 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-02-19 15:19:03 +0100
commit19649d425a761f9d6b91641df92d604f60124d08 (patch)
tree6610064390b343d0bdbfd675c7188d6be86cc521 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parentcc89bd71edfd4c88ca1099891e6c20b77379122a (diff)
downloadscala-19649d425a761f9d6b91641df92d604f60124d08.tar.gz
scala-19649d425a761f9d6b91641df92d604f60124d08.tar.bz2
scala-19649d425a761f9d6b91641df92d604f60124d08.zip
SI-6576 Workaround / diagnostic for IDE NPE.
Seems like this was too optimistic: > // later by lukas: disabled when fixing SI-5975 > // i think it cannot happen anymore - restored the null check - added logging when we set the namer in this attachment, in the hope of spotting a pattern in the wild. We don't have a test case yet; if we did we could most likely have a more principled fix. But this should suffice for 2.10.1.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 341dbfbe1f..7a3ab00578 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -908,6 +908,7 @@ trait Namers extends MethodSynthesis {
// to use. clazz is the ModuleClass. sourceModule works also for classes defined in methods.
val module = clazz.sourceModule
for (cda <- module.attachments.get[ConstructorDefaultsAttachment]) {
+ debuglog(s"Storing the template namer in the ConstructorDefaultsAttachment of ${module.debugLocationString}.")
cda.companionModuleClassNamer = templateNamer
}
val classTp = ClassInfoType(parents, decls, clazz)
@@ -1229,8 +1230,11 @@ trait Namers extends MethodSynthesis {
// module's templateNamer to classAndNamerOfModule
module.attachments.get[ConstructorDefaultsAttachment] match {
// by martin: the null case can happen in IDE; this is really an ugly hack on top of an ugly hack but it seems to work
- // later by lukas: disabled when fixing SI-5975, i think it cannot happen anymore
- case Some(cda) /*if cma.companionModuleClassNamer == null*/ =>
+ case Some(cda) =>
+ if (cda.companionModuleClassNamer == null) {
+ debugwarn(s"SI-6576 The companion module namer for $meth was unexpectedly null")
+ return
+ }
val p = (cda.classWithDefault, cda.companionModuleClassNamer)
moduleNamer = Some(p)
p