vigna / fastutil

fastutil extends the Java™ Collections Framework by providing type-specific maps, sets, lists and queues.
Apache License 2.0
1.8k stars 197 forks source link

[Feature Request] Have an optional tripwire bit to detect Boxing/Unboxing #192

Open techsy730 opened 3 years ago

techsy730 commented 3 years ago

OpenJDK has a nifty feature where if you set the org.openjdk.java.util.stream.tripwire system property to "true", then warnings will be logged if a boxing/unboxing method is called that has a primitive equivalent. For example, calling next() instead of nextInt(), or giving an Object based consumer instead of an IntConsumer to a forEach. See https://docs.oracle.com/javase/8/docs/api/java/util/PrimitiveIterator.html for where it is described.

Perhaps fastutil can have a similar sort of flag to help developers expose cases where they are boxing/unboxing when they weren't expecting it.

techsy730 commented 3 years ago

Low priority as we have such methods @Deprecated