-
Notifications
You must be signed in to change notification settings - Fork 381
Better error message for Collectors.toMap #10188
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
Conversation
user/super/com/google/gwt/emul/java/util/stream/Collectors.java
Outdated
Show resolved
Hide resolved
user/super/com/google/gwt/emul/java/util/stream/Collectors.java
Outdated
Show resolved
Hide resolved
user/super/com/google/gwt/emul/java/util/stream/Collectors.java
Outdated
Show resolved
Hide resolved
niloc132
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, thanks for taking the extra steps here. I think we can get better, but I don't think its worth doing now - and the fixes touch a lot more of the class (and besides, they are going back to the first impl that we did for this class).
I did some compiled size testing. My methodology:
- set
test.argsinuser/build.xmlto-ea -sourceLevel auto -setProperty compiler.useSourceMaps=trueso that we avoid using emulated stack traces, and get more realistic JS output - run all CollectorsTest impls by making a single CollectorsSuite
package com.google.gwt.emultest.java17; import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ com.google.gwt.emultest.java8.util.stream.CollectorsTest.class, com.google.gwt.emultest.java9.util.stream.CollectorsTest.class, com.google.gwt.emultest.java10.util.stream.CollectorsTest.class, com.google.gwt.emultest.java17.util.stream.CollectorsTest.class, }) public class CollectorsSuite { }
- Run just that suite in prod mode in the
user/dir:ant test.web.htmlunit '-Dgwt.junit.testcase.includes=**/CollectorsSuite.class' - Check the compiled size, with something like
ls -al ../build/out/user/test/web-htmlunit/www/com.google.gwt.emultest.EmulSuite.JUnit/*.cache.js
HEAD, plus your test change (with two failing tests), currently d67edbb: 153033
latest commit in this PR, currently 07617ec, merged up to latest main: 153339
306 bytes over 150kb isn't bad, and probably not entirely driven by lambdas (additional null checks, etc). Percentage wise, its not great - but this will not scale, it'll be the max size increase that this change can cause over a full app, since its not like an app would load multiple copies of Collectors. Generally this is all keeping with the work done this release to improve emulation, so I'd vote worth it, and we can focus more on improved compiled size next release.
|
Quick draft - harms readability IMHO, but improves size, down to
|
Fixes #9495 by changing the error message.