Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ object GenericSignatures {
jsig(info, toplevel = true)
for annot <- sym0.annotations do
annot match
case ThrownException(e) =>
case ThrownException(e) if sym0.is(Method) => // ThrowsSignature is only valid in MethodSignature
builder.append('^')
jsig(e, toplevel = true)
case _ => ()
Expand Down
9 changes: 9 additions & 0 deletions tests/run/throws-annot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ object TL {
def readNoEx(): Int = 0
}

// @throws on class/object/field must be ignored/compiler shouldn't crash.
@throws(classOf[IOException])
class ThrowsOnClass

@throws(classOf[IOException])
object ThrowsOnObject:
@throws(classOf[IOException])
val field: Int = 0

object Test {
def main(args: Array[String]): Unit = {
TestThrows.run(classOf[TestThrows.Foo])
Expand Down
Loading