I want to define a coordinate system which "rotates" an existing coordinate system (say, Google Mercator). Please see the following question on GIS StackExchange:
This can be done using the FITTED_CS CRS:
Unfortunately, GeoTools fails with the class cast exception.
The reason is that when the inverse transformation is created in ProjectiveTransform, it is always ProjectiveTransform:
There is a createInverse(...) method, which is overridden by subclasses, but it is not called in inverse(). This is why I get a class cast exception here although the class does override the createInverse(...) method here.
The fix is trivial: use createInverse(matrix) instead of new ProjectiveTransform(matrix).
I'll provide a pull request.