Spot the bug in the raw List

from Generics
Java 25 LTS intermediate 4 min 1 issue to find

Find why this program compiles with warnings but throws `ClassCastException` when it reads the name.

Java
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<String> names = new ArrayList<>();
        List raw = names;
        raw.add(42);
        System.out.println(names.getFirst().length());
    }
}
Open in playground
Report an error