'Custom accessor for record's generic component

Is it possible to create a record with a custom accessor for a generic component? I get a compilation when I try:

java: invalid accessor method in record SearchResult
  (return type of accessor method results() must match the type of record component results)

Here's the code:

public record SearchResult<T>(String nextPageId, List<T> results) {

    public SearchResult {
        requireNonNull(nextPageId);
    }

    public List<T> results() {
        return unmodifiableList(results);
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source