Choonster Posted June 10, 2019 Posted June 10, 2019 (edited) In TestMod3, I have a series of packets for updating item capability data in Containers. Because they all operate in similar ways, they all extend a generic base class and their static encode/decode/handle methods all call corresponding generic static methods in the base class. I've run into a strange issue with the decode methods where IDEA can infer the type arguments and doesn't want me to explicitly specify them, but the compiler can't infer the type arguments and generates a compilation error. You can see an example of a decode method without explicit type arguments here, which generates this compilation error: TestMod3_1.13.2\src\main\java\choonster\testmod3\network\capability\fluidhandler\MessageBulkUpdateContainerFluidTanks.java:49: error: incompatible types: cannot infer type-variable(s) HANDLER,DATA,MESSAGE return MessageBulkUpdateContainerCapability.decode( ^ (argument mismatch; cannot infer functional interface descriptor for MessageFactory<HANDLER,FluidTankInfo,MESSAGE>) where HANDLER,DATA,MESSAGE are type-variables: HANDLER extends Object declared in method <HANDLER,DATA,MESSAGE>decode(PacketBuffer,CapabilityDataDecoder<DATA>,MessageFactory<HANDLER,DATA,MESSAGE>) DATA extends Object declared in method <HANDLER,DATA,MESSAGE>decode(PacketBuffer,CapabilityDataDecoder<DATA>,MessageFactory<HANDLER,DATA,MESSAGE>) MESSAGE extends MessageBulkUpdateContainerCapability<HANDLER,DATA> declared in method <HANDLER,DATA,MESSAGE>decode(PacketBuffer,CapabilityDataDecoder<DATA>,MessageFactory<HANDLER,DATA,MESSAGE>) However, adding the explicit type arguments (like this) causes IDEA to recommend removing them, as shown in this screenshot: Does anyone know what would cause this mismatch, or if there's a way to avoid the explicit type arguments here? Edited June 10, 2019 by Choonster Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.