@@ -580,9 +580,6 @@ class ClassfileParser(
580
580
* parameters. For Java annotations we need to fake it by making up the constructor.
581
581
* Note that default getters have type Nothing. That's OK because we need
582
582
* them only to signal that the corresponding parameter is optional.
583
- * If the constructor takes as last parameter an array, it can also accept
584
- * a vararg argument. We solve this by creating two constructors, one with
585
- * an array, the other with a repeated parameter.
586
583
*/
587
584
def addAnnotationConstructor (classInfo : Type , tparams : List [Symbol ] = Nil )(implicit ctx : Context ): Unit = {
588
585
def addDefaultGetter (attr : Symbol , n : Int ) =
@@ -618,13 +615,26 @@ class ClassfileParser(
618
615
}
619
616
620
617
addConstr(paramTypes)
618
+
619
+ // The code below added an extra constructor to annotations where the
620
+ // last parameter of the constructor is an Array[X] for some X, the
621
+ // array was replaced by a vararg argument. Unfortunately this breaks
622
+ // inference when doing:
623
+ // @Annot(Array())
624
+ // The constructor is overloaded so the expected type of `Array()` is
625
+ // WildcardType, and the type parameter of the Array apply method gets
626
+ // instantiated to `Nothing` instead of `X`.
627
+ // I'm leaving this commented out in case we improve inference to make this work.
628
+ // Note that if this is reenabled then JavaParser will also need to be modified
629
+ // to add the extra constructor (this was not implemented before).
630
+ /*
621
631
if (paramTypes.nonEmpty)
622
632
paramTypes.last match {
623
633
case defn.ArrayOf(elemtp) =>
624
634
addConstr(paramTypes.init :+ defn.RepeatedParamType.appliedTo(elemtp))
625
635
case _ =>
626
636
}
627
-
637
+ */
628
638
}
629
639
}
630
640
0 commit comments