Skip to content

Instantly share code, notes, and snippets.

@ignatov
Created August 28, 2011 18:36
Show Gist options
  • Save ignatov/1177024 to your computer and use it in GitHub Desktop.
Save ignatov/1177024 to your computer and use it in GitHub Desktop.
Cast exception
Index: src/main/scala/scala/tools/colladoc/model/SearchIndex.scala
===================================================================
--- src/main/scala/scala/tools/colladoc/model/SearchIndex.scala (revision d3c359a46cd9902396ec8e3e740edca110137e83)
+++ src/main/scala/scala/tools/colladoc/model/SearchIndex.scala (revision )
@@ -179,12 +179,23 @@
// We could be dealing with a huge list here so it's important that we cons
// as efficiently as possible.
var remainingMembers = members.tail
- additionalMembers.foreach((m)=> {
+
+ object Reflector {
+ def apply[T <: AnyRef](t: T)(implicit m: scala.reflect.Manifest[T]) = "t was " + t.toString + " of class " + t.getClass.getName() + ", erased from " + m.erasure
+ }
+
+ additionalMembers.asInstanceOf[List[MemberEntity]].foreach((v: AnyRef) => {
+ v match {
+ case m: MemberEntity =>
- // Make sure that we do not try to index a member that we have indexed
- // already!
- if (!entityLookup.containsValue(m)) {
- remainingMembers = m :: remainingMembers
- }
+ // Make sure that we do not try to index a member that we have indexed
+ // already!
+ if (!entityLookup.containsValue(m)) {
+ remainingMembers = m :: remainingMembers
+ }
+ case y =>
+ val message = if (y == null) "Null" else Reflector(y)
+ throw new ClassCastException(message)
+ }
})
// Finally, the recursive step, index the remaining members...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment