File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
compiler/src/dotty/tools/dotc/typer
tests/explicit-nulls/pos/annotaions-args Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -905,8 +905,9 @@ class Typer extends Namer
905905 * of annotation defined as `@interface Annot { int[] value() }`
906906 * We assume that calling `typedNamedArg` in context of Java implies that we are dealing
907907 * with annotation contructor, as named arguments are not allowed anywhere else in Java.
908+ * Under explicit nulls, the pt could be nullable. We need to strip `Null` type first.
908909 */
909- val arg1 = pt match {
910+ val arg1 = pt.stripNull match {
910911 case AppliedType (a, typ :: Nil ) if ctx.isJava && a.isRef(defn.ArrayClass ) =>
911912 tryAlternatively { typed(tree.arg, pt) } {
912913 val elemTp = untpd.TypedSplice (TypeTree (typ))
Original file line number Diff line number Diff line change 1+ public class JAnnots {
2+ @ SuppressWarnings ("unused" )
3+ public void f1 () {}
4+
5+ @ SuppressWarnings ({"unused" })
6+ public void f2 () {}
7+ }
Original file line number Diff line number Diff line change 1+ class SAnnots {
2+ @ SuppressWarnings (Array (" unused" ))
3+ def f () = {}
4+ }
You can’t perform that action at this time.
0 commit comments