File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
compiler/src/dotty/tools/dotc/typer
tests/explicit-nulls/unsafe-common/unsafe-java-call Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3688,7 +3688,7 @@ class Typer extends Namer
3688
3688
// if unsafeNulls is enabled, try to strip nulls from Java function calls
3689
3689
if Nullables .unsafeNullsEnabled then
3690
3690
tree match
3691
- case _ : Apply if tree.symbol.is(JavaDefined ) =>
3691
+ case _ : Apply | _ : Select if tree.symbol.is(JavaDefined ) =>
3692
3692
wtp match
3693
3693
case OrNull (wtp1) => return readapt(tree.cast(wtp1))
3694
3694
case _ =>
Original file line number Diff line number Diff line change @@ -10,4 +10,8 @@ public int f2() {
10
10
public <T > T g1 () {
11
11
return null ;
12
12
}
13
+ }
14
+
15
+ class J2 <T > {
16
+ public T x = null ;
13
17
}
Original file line number Diff line number Diff line change @@ -30,4 +30,8 @@ def clo1[T]: T = j.g1[T]() // error
30
30
31
31
def clo2 [T <: AnyRef ]: T = j.g1[T | Null ]() // error
32
32
33
- def clo3 [T >: Null <: AnyRef | Null ]: T = j.g1[T ]()
33
+ def clo3 [T >: Null <: AnyRef | Null ]: T = j.g1[T ]()
34
+
35
+ def testJ2 [T ]: T =
36
+ val j2 : J2 [T ] = new J2
37
+ j2.x // error
You can’t perform that action at this time.
0 commit comments