Workaround K2 compiler bugs related to generics

This commit is contained in:
DBotThePony 2024-08-25 21:44:31 +07:00
parent 7e3764e466
commit beb09107e3
Signed by: DBot
GPG Key ID: DCC23B5715498507
4 changed files with 11 additions and 8 deletions

View File

@ -15,6 +15,7 @@ import ru.dbotthepony.mc.otm.capability.matter.IReplicationTaskProvider;
import ru.dbotthepony.mc.otm.capability.matter.IPatternStorage;
import ru.dbotthepony.mc.otm.graph.matter.MatterNode;
import ru.dbotthepony.mc.otm.graph.storage.StorageNode;
import ru.dbotthepony.mc.otm.storage.StorageStack;
import javax.annotation.Nonnull;
@ -53,7 +54,9 @@ public class MatteryCapability {
@Nonnull
@NotNull
public static final ItemCapability<IMatteryDrive, Void> CONDENSATION_DRIVE = ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "condensation_drive"), IMatteryDrive.class);
// this weird cast is required because otherwise IMatteryDrive gets incompatible lower-bound due to Java raw generic type
// and K2 compiler chokes and dies due to it
public static final ItemCapability<IMatteryDrive<?>, Void> CONDENSATION_DRIVE = (ItemCapability<IMatteryDrive<?>, Void>) (Object) ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "condensation_drive"), IMatteryDrive.class);
@Nonnull
@NotNull

View File

@ -242,7 +242,7 @@ open class EffectListPanel<out S : Screen> @JvmOverloads constructor(
return false
}
fun onSortedEffectPanels(sorted: List<EffectSquare>) {
fun onSortedEffectPanels(sorted: List<EffectListPanel<*>.EffectSquare>) {
if (sorted.size > (gridHeight * gridWidth) && !scroll.visible) {
scroll.visible = true

View File

@ -253,28 +253,28 @@ open class FramePanel<out S : Screen>(
protected var dragging = false
var closeButton: CloseButton? = null
var closeButton: FramePanel<*>.CloseButton? = null
protected set
var helpButton: HelpButton? = null
var helpButton: FramePanel<*>.HelpButton? = null
protected set
var closeOnEscape = false
fun makeCloseButton(): CloseButton {
fun makeCloseButton(): FramePanel<*>.CloseButton {
if (closeButton == null)
closeButton = CloseButton()
return closeButton!!
}
fun makeHelpButton(): HelpButton {
fun makeHelpButton(): FramePanel<*>.HelpButton {
if (helpButton == null)
helpButton = HelpButton()
return helpButton!!
}
fun makeHelpButton(tooltips: Collection<Component>): HelpButton {
fun makeHelpButton(tooltips: Collection<Component>): FramePanel<*>.HelpButton {
if (helpButton == null) {
helpButton = HelpButton()
helpButton!!.tooltips.addAll(tooltips)

View File

@ -73,7 +73,7 @@ open class FoldableSlotPanel<out S : MatteryScreen<*>, out T : Slot>(
var hoveringSince: SystemTime? = null
protected set
var hoverPanel: HoverPanel? = null
var hoverPanel: FoldableSlotPanel<*, *>.HoverPanel? = null
protected set
override fun onHovered() {