kawamuray / wasmtime-java

Java or JVM-language binding for Wasmtime
Apache License 2.0
127 stars 29 forks source link

Make externs into mutable collection before filtering #28

Closed dsyer closed 2 years ago

dsyer commented 2 years ago

Arrays.asList() is immutable so there is an error at runtime if we don't do this.

I also added a TODO highlighting another possible bug: the type of some externs shows up as UNKNOWN.

kawamuray commented 2 years ago

Ugh. That's my dumb mistake, thanks for catching. So it throws an exception only if actual removal of an element occurs, not every time removeIf is called. That's why the current test couldn't catch it.

The UNKNOWN type has been added by recent commit to use it when this impl doesn't support the type yet, as I thought it's better to return it rather than crushing error silently, with logs, or failing entire method: https://github.com/kawamuray/wasmtime-java/commit/f2f154650c1db8ef2373fb9c19ed5c88b82cc0a2#diff-e6d22ba1a2b7064e4a879659552e6813c77785b21866a5f6f2c20ff00402773cR82

kawamuray commented 2 years ago

LGTM, thanks.