You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this behavior might be a "feature" ;) rather than a bug? The behavior arises due to the ANDROID constant field being public. The recipe always generate private static final fields to replace any duplicate literals. If this result in a naming conflict, with another field that either does not share the same value, or is not private static final...Then the recipe will generate a new private static final variable to ensure immutability and proper encapsulation. Hence, if ANDROID were private instead of public, the expected behavior in your example would occur and ANDROID will be directly referenced without creating an additional private variable.
It is still arguably a bug. It is static and the same value. Nothing prevents a future refactor if you want to diverge the value for internal purposes. If there is a public static IMO it should use that. Immutability is the only property required not encapsulation.
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
What did you see instead?
What is the full stack trace of any errors you encountered?
Are you interested in contributing a fix to OpenRewrite?
The text was updated successfully, but these errors were encountered: