OpenMods / OpenPeripheral

https://openmods.info
MIT License
67 stars 25 forks source link

No way to force primitive in ReflectionHelper #132

Closed scottydelicious closed 10 years ago

scottydelicious commented 10 years ago

I am implementing IPeripheralAdapter and using ReflectionHelper to call a method in a tile entity. The tile entity expects a raw boolean primitive, but before calling the method, ReflectionHelper converts the boolean into a Boolean Object and the method call in the entity fails.

Is there a way I can force ReflectionHelper to send the primitive instead of an Object, or should I implement the java reflection manually myself?

boq commented 10 years ago

ReflectionHelper tries to determine method argument types from supplied values. This is impossible in three cases. ReflectionHelper contains static helper methods that allow to supply additional type data: