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 @@ -3749,7 +3749,7 @@ class Typer extends Namer
3749
3749
// if unsafeNulls is enabled, try to strip nulls from Java function calls
3750
3750
if Nullables .unsafeNullsEnabled then
3751
3751
tree match
3752
- case _ : Apply if tree.symbol.is(JavaDefined ) =>
3752
+ case _ : Apply | _ : Select if tree.symbol.is(JavaDefined ) =>
3753
3753
wtp match
3754
3754
case OrNull (wtp1) => return readapt(tree.cast(wtp1))
3755
3755
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