Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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:

497590249_2019-06-10-TestMod3ContainerCapabilityUpdateMessage-Explicittypeargumentscanbeinferred.PNG.a9ebf92ed01a28e8fc034e479b4deefc.PNG

 

Does anyone know what would cause this mismatch, or if there's a way to avoid the explicit type arguments here?

Edited by Choonster

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.