@@ -1338,7 +1338,8 @@ \section{Variables}
1338
1338
1339
1339
\LMHash{}%
1340
1340
A \Error{compile-time error} occurs if a static variable has a
1341
- non-nullable type and no initializing expression,
1341
+ no initializing expression and a type which is not nullable
1342
+ (\ref{typeNullability}),
1342
1343
unless the variable declaration has
1343
1344
the modifier \LATE{} or \EXTERNAL.
1344
1345
@@ -1650,7 +1651,7 @@ \subsection{Evaluation of Implicit Variable Getters}
1650
1651
\Case{Static variable}
1651
1652
If $d$ declares a static variable
1652
1653
(\commentary{that is, a library variable or a class variable}),
1653
- the implicit getter method of \id{} executes as follows:
1654
+ the implicitly induced getter of \id{} executes as follows:
1654
1655
1655
1656
\begin{itemize}
1656
1657
\item \emph{Non-constant variable with an initializer.}
@@ -1659,14 +1660,14 @@ \subsection{Evaluation of Implicit Variable Getters}
1659
1660
\code{\STATIC?\,\,\LATE?\,\,\FINAL\,\,\id{} = $e$;}, or
1660
1661
\code{\STATIC?\,\,\LATE?\,\,\FINAL?\,\,$T$\,\,\id{} = $e$;}.
1661
1662
1662
- The first invocation of the implicit getter of \id{}
1663
+ The first invocation of the implicitly induced getter of \id{}
1663
1664
will evaluate $e$ to an object $o$, store $o$ in \id{},
1664
1665
and evaluate to $o$;
1665
1666
if the evaluation of $e$ throws,
1666
1667
the invocation of the getter throws the same object and stack trace,
1667
- and the next invocation of the implicit getter of \id{}
1668
+ and the next invocation of the getter of \id{}
1668
1669
is considered to be the first invocation.
1669
- A non-first invocation of the implicit getter of \id{} evaluates to
1670
+ A non-first invocation of the getter of \id{} evaluates to
1670
1671
the object stored in \id.
1671
1672
1672
1673
If \id{} has an implicitly induced setter,
@@ -1683,15 +1684,41 @@ \subsection{Evaluation of Implicit Variable Getters}
1683
1684
If $d$ is of one of the forms
1684
1685
\code{\STATIC?\,\,\LATE?\,\,\CONST{} $v$ = $e$;} or
1685
1686
\code{\STATIC?\,\,\LATE?\,\,\CONST{} $T$ $v$ = $e$;}.
1686
- the result of the getter is the value of the constant expression $e$.
1687
+ the result of the executing the implicitly induced getter is
1688
+ the value of the constant expression $e$.
1687
1689
\commentary{%
1688
1690
Note that a constant expression cannot depend on itself,
1689
1691
so no cyclic references can occur.%
1690
1692
}
1691
1693
\item \emph{Variable without an initializer.}
1694
+ Consider the case where $d$ has one of the forms
1695
+ \code{\STATIC?\,\,\VAR\,\,\id;} or
1696
+ \code{\STATIC?\,\,$T$\,\,\id;}.
1697
+ The result of executing the implicitly induced getter of \id{} is
1698
+ the object stored in \id.
1699
+
1700
+ \commentary{%
1701
+ This may be the initial value, that is, the null object
1702
+ (the typed variant is an error unless $T$ is nullable).
1703
+ Note that forms like \code{\FINAL\,\,\id;} and
1704
+ \code{\FINAL\,\,$T$\,\,\id;} are irrelevant here:
1705
+ They are syntax errors at the top level,
1706
+ and instance variables were specified earlier in this section.
1707
+ The forms \code{\STATIC\,\,\FINAL\,\,\id;} and
1708
+ \code{\STATIC\,\,\FINAL\,\,$T$\,\,\id;}
1709
+ are syntax errors as well.%
1710
+ }
1692
1711
1693
- The result of executing the getter method is the object stored in $v$.
1694
- \commentary{This may be the initial value, that is, the null object.}
1712
+ Consider the situation where $d$ has one of the forms
1713
+ \code{\STATIC?\,\,\LATE\,\,\VAR\,\,\id;},
1714
+ \code{\STATIC?\,\,\LATE\,\,\FINAL\,\,\id;}, or
1715
+ \code{\STATIC?\,\,\LATE\,\,\FINAL?\,\,$T$\,\,\id;}.
1716
+ The result of the execution of the implicitly induced getter of \id{}
1717
+ is the object stored in \id{} if the corresponding implicitly induced setter
1718
+ has been executed.
1719
+ \commentary{Note that this setter cannot throw during the first execution.}
1720
+ Otherwise, if said setter has not been executed,
1721
+ the execution of the getter throws.
1695
1722
\end{itemize}
1696
1723
1697
1724
@@ -23527,6 +23554,8 @@ \subsubsection{Local variables and inference}
23527
23554
23528
23555
\subsubsection{Expression typing}
23529
23556
23557
+ !!!TODO!!!
23558
+
23530
23559
It is permitted to invoke or tear-off a method, setter, getter, or operator that
23531
23560
is defined on \code{Object} on potentially nullable type. The type used for static
23532
23561
analysis of such an invocation or tear-off shall be the type declared on the
0 commit comments