In the following diagnostic, the symbol List.of exists (it's a method), but it's used in a context where a class is required (after `new`).
The compiler just reports 'cannot find symbol' as the initial diagnostic. The details show that it's searching for a class named 'of' (in 'symbol: class of').
It would perhaps be more clear for the diagnostic to mention that a symbol List.of exists, but that a class is required in this context.
class T {
List<?> xs = new List.of();
}
javac T.java
cT.java:3: error: cannot find symbol
List<?> xs = new List.of();
^
symbol: class of
location: interface List
1 error
The compiler just reports 'cannot find symbol' as the initial diagnostic. The details show that it's searching for a class named 'of' (in 'symbol: class of').
It would perhaps be more clear for the diagnostic to mention that a symbol List.of exists, but that a class is required in this context.
class T {
List<?> xs = new List.of();
}
javac T.java
cT.java:3: error: cannot find symbol
List<?> xs = new List.of();
^
symbol: class of
location: interface List
1 error