-
Notifications
You must be signed in to change notification settings - Fork 203
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
RqWithHeaders is not immutable #646
Comments
@yegor256 please do something about this issue |
@yegor256 ok, but what about "immutable"? |
@2686747 immutability doesn't mean that return values are always the same. immutable doesn't mean constant. see http://www.yegor256.com/2014/12/22/immutable-objects-not-dumb.html |
@yegor256 good point, but now you have to leave this link everywhere in project's javadocs, because we have Java and wiki. And all is clear here: state doesn't change. And sorry, but when i call print(smth) - i don't expect than print will change this something and i talk not just about immutable now. We're using decorators in each line practically - do i have to check all of them for print(smth)? And i didn't start with a thread-safety yet. |
@2686747 but |
@yegor256 I understand completely but why i have to worry about implementation of some object? I don't see InputStream, i see Request which is marked as immutable and thread-safe. And of course i expect it won't change after some external method execution, especially such harmless as |
@2686747 you just misunderstand what "immutable and thread-safe" means. you think they mean "constant", while it's not true. the problem is in your understanding, not in our texts :) |
@2686747 yeah, I read that dude, a few times :) check this out: http://www.yegor256.com/2014/12/09/immutable-object-state-and-behavior.html |
@2686747 we're dealing with a mutable InputStream here, that's why we inevitably have that side effect. we can't get rid of it, without breaking the entire idea of mutable input streams in Java. blame Java, not us :) |
RqWithHeaders changes after new RqPrint(rqWithHeaders).print(); This test will not pass.
The text was updated successfully, but these errors were encountered: