Closed
Description
In the following example:
final int x = 3;
class A {
int x = 3;
}
class B extends A {
void test() {
x = 4;
}
}
The specification requires that the reference to x
resolve to the top level definition of x
, for which no setter is defined, and hence should be a static error.
Evaluation of an assignment $a$ of the form \code{$v$ = $e$}
proceeds as follows:
%% TODO(eernst): $d$ is defined ambiguously: both getter & setter may exist.
Let $d$ be the innermost declaration whose name is $v$ or \code{$v$=}, if it exists.
It is a compile-time error if $d$ denotes
a prefix object, type declaration, or function declaration.
The CFE resolves this correctly, so there is an inconsistency between the tools. See this comment for more discussion.
See also: