Skip to content

Commit 5aaa9c8

Browse files
authored
Merge pull request #5731 from panacekcz/fix-5690
Fix assertion error in #5690
2 parents 5547a0b + 922943b commit 5aaa9c8

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ class ClassfileParser(
661661
val constr = ctx.newSymbol(
662662
owner = classRoot.symbol,
663663
name = nme.CONSTRUCTOR,
664-
flags = Flags.Synthetic | Flags.JavaDefined,
664+
flags = Flags.Synthetic | Flags.JavaDefined | Flags.Method,
665665
info = constrType
666666
).entered
667667
for ((attr, i) <- attrs.zipWithIndex)

tests/pending/neg/i5690.scala

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// instantiating java annotations should not be allowed
2+
// (would fail at runtime with java.lang.InstantiationError)
3+
// see tests/pos/i5690.scala
4+
object AnnotInst{
5+
def main(a: Array[String]) = {
6+
new java.lang.annotation.Inherited // error
7+
}
8+
}

tests/pos/i5690.scala

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO: this should be a compilation error
2+
// program fails at runtime with java.lang.InstantiationError
3+
// see tests/pending/neg/i5690.scala
4+
object AnnotInst{
5+
def main(a: Array[String]) = {
6+
new java.lang.annotation.Inherited
7+
}
8+
}

0 commit comments

Comments
 (0)