Elektrine lite

← Feed

@ndw@toot.wales

2026-09-03 07:28 UTC

I've painted myself into an unfamiliar corner in Java. I have, in my left hand, a variable (the returned value from a function). It has the type "Fx". I would like to pass it to another function that takes an argument of type "Fx". But no. Type erasure biting me, I suppose, but like I said, an unfamiliar corner. Can I get out of tis without walking across the wet paint and starting over?

Replies (1)

  • @ujay68@mastodon.world 2026-09-03 08:09

    @ndw@toot.wales Unless you build a library API that will be used widely (as you may well be doing), my experience is that it’s often easiest to avoid the ? standalone wildcard and use Object instead. That said, I guess it’s an interaction with a place where T is already bound differently. Hard to say without context.

    Open ##4610348