IntelliJ complains without the cast, but there are other options for supression.