RFR: 8229186: Improve error messages for TestStringIntrinsics failures [v3]

Igor Ignatyev iignatyev at openjdk.java.net
Wed Sep 30 16:37:28 UTC 2020


On Wed, 30 Sep 2020 14:27:52 GMT, Evgeny Nikitin <enikitin at openjdk.org> wrote:

> The other method, `invokeAndCheck` is different. It can call, for example, `String.concat("abc", "def")` and expect the
> String "abcdef" as result. It does really need to be generic.
although I still don't see them as really being that much different, I'm fine w/ keeping them as-is.


> `invokeAndCompareArrays` / `ArrayDiff` compares two huge arrays and present a nice short _slice_ in the difference
> area. The short slice is possible because we do a limited task - compare arrays. `invokeAndCheck` , on the other hand,
> can have as parameters the `utf16`, a string of 10K symbols. Do we really need a 10K string as output in our log?

I think we do, as people tend to first look at exception's messages and only then look thru other logs, so having
relative information in the exception is always a good thing. should 10K symbols become a problem (this though would
also mean that you can't print the compared values w/  `Format.asLiteral`), we can revisit this.

> 
> > you don't need `ArrayCodec::of(Object array)` anymore, do you?
> 
> Unfortunately, it is used in the ArrayCodec.format (which is used in TestStringIntrinsics.java) - to make it possible
> to call it with everything and not swamp the code with overloads.

hm, I somehow missed that usage, but you don't need to repeat to the same switch over a component type in
`ArrayDiff::of`, do you?

-------------

PR: https://git.openjdk.java.net/jdk/pull/112


More information about the core-libs-dev mailing list