-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider provided immutable classes for generic fields #104
Comments
Yup, I think that's a fair assessment. I know it's not the same assertion, but this might be a workaround in the meantime:
I'm not sure if the generic type information is available to the |
Thanks for the workaround :) This is not urgent for us, it's more a nice-to-have. |
Given a class with a generic type parameter T, where T is guaranted to be an instance of U. If the class has a final field of type T and U has been guaranteed to be immutable, then the class will also be considered immutable. This implementation modifies the "allowing" matcher only. It uses reflection to determine if the field type being assigned had previously been specified immutable. Addresses: MutabilityDetector#104
Given a class with a generic type parameter T, where T is guaranted to be an instance of U. If the class has a final field of type T and U has been guaranteed to be immutable, then the class will also be considered immutable. This implementation modifies the "allowing" matcher only. It uses reflection to determine if the field type being assigned had previously been specified immutable. Addresses: #104
This adds a field in `FieldLocation` to capture its type. Downstream `MutableReasonDetail` Matchers can leverage that to decide whether or not a violation is valid. This is an optimisation to PR MutabilityDetector#144 which uses Reflection to accomplish the same thing. Addresses: MutabilityDetector#104
This addresses code review feedback in MutabilityDetector#145. Addresses: MutabilityDetector#104
This adds null checks to the `FieldLocation` constructor and fixes the scenarios in which null was being provided. Addresses: MutabilityDetector#104
This adds null checks to the `FieldLocation` constructor and fixes the scenarios in which null was being provided. Addresses: #104
When I have declared some class as immutable, I would expect that a class having a field of a generic subtype of this class is also considered as immutable.
But this does not work. The following test fails:
The text was updated successfully, but these errors were encountered: