clj-commons / byte-streams

A Rosetta stone for JVM byte representations
417 stars 33 forks source link

Reflection warnings in byte-streams.clj #41

Closed esuomi closed 2 years ago

esuomi commented 3 years ago

As seen with [byte-streams "0.2.4"], using Java 15:

Reflection warning, byte_streams.clj:437:12 - call to method position on java.nio.ByteBuffer can't be resolved (argument types: unknown).
Reflection warning, byte_streams.clj:438:12 - call to method limit can't be resolved (target class is unknown).
Reflection warning, byte_streams.clj:715:19 - call to method limit on java.nio.ByteBuffer can't be resolved (argument types: java.lang.Number).
Reflection warning, byte_streams.clj:718:9 - call to method position on java.nio.ByteBuffer can't be resolved (argument types: java.lang.Number).

Relevant bit(s):

slipset commented 3 years ago

You see this only in Java 15, or with other jdks as well?

acgollapalli commented 3 years ago

Was this resolved in 0.2.5? It looks like type hints have been added to the relevant bits since 0.2.4 was released?

KingMob commented 3 years ago

@acgollapalli I believe it's only partially complete. Not sure if the final line mentioned still needs a type hint or not. PRs welcome if you want to tackle it.

frap commented 3 years ago

I tested this with java 15.0.2 and saw no reflection warnings . So I believe the type hints have fixed it and #L718 doesnt need the type hint. lein test OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.

lein test byte-streams-simple-check {:result true, :num-tests 10000, :seed 1620001271701, :time-elapsed-ms 1804, :test-var "equivalent-comparison"}

lein test byte-streams-test

lein test pushback-stream-test

Ran 8 tests containing 505 assertions. 0 failures, 0 errors.

KingMob commented 3 years ago

Thanks, @frap . @esuomi can you confirm? If so, we can close this.

KingMob commented 2 years ago

I tested with 1.8, 11, 15, and 17, with lein test and at the REPL, and I can't replicate this.