Remove Lombok dependency#1604
Conversation
Group 2 (callSuper=false): - MechanicalMachineNetworkElement.java - CoalGeneratorNetworkElement.java - EnergyBatteryNetworkElement.java - TileNetworkElement.java Group 3 (callSuper=true): - AspectVariableFacade.java - DelayVariableFacade.java - OperatorVariableFacade.java - ProxyVariableFacade.java All @DaTa annotations replaced with manual constructors, getters, equals, and hashCode. Group 2 equals/hashCode do NOT call super methods (callSuper=false). Group 3 equals/hashCode DO call super methods (callSuper=true). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…toString() methods Migrated the following classes: - ValueBase - ValueObjectTypeBlock.ValueBlock - ValueObjectTypeEntity.ValueEntity - ValueObjectTypeFluidStack.ValueFluidStack - ValueObjectTypeIngredients.ValueIngredients - ValueObjectTypeItemStack.ValueItemStack - ValueObjectTypeRecipe.ValueRecipe - ValueTypeBoolean.ValueBoolean - ValueTypeDouble.ValueDouble - ValueTypeInteger.ValueInteger - ValueTypeList.ValueList - ValueTypeLong.ValueLong - ValueTypeOperator.ValueOperator - ValueTypeString.ValueString Each class now has a manual toString() method that returns a string in the format 'ClassName(field1=value1, field2=value2, ...)' to match Lombok's @tostring behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit completes the Lombok migration by handling the special cases: Group 6 - @DaTa with @nonnull: - UpdatingAspectVariable: Added null check in setValue() for @nonnull field - LazyAspectVariable: Added getters for @Getter fields Group 7 - @DaTa classes with inner classes: - NetworkElementBase: Removed @DaTa (no fields at top level) - PartHelpers.PartStateHolder: Added equals/hashCode/toString - NetworkDataClient inner classes: Added getters for all fields Group 8 - Special cases: - Cluster: Manually implemented all Collection interface methods (was using @DeleGate) - ItemPart: Added equals/hashCode for @EqualsAndHashCode(callSuper = false) - Operators: Replaced Lombok.sneakyThrow with RuntimeException - NbtHelpers: Removed unused @slf4j annotation All Lombok annotations have been removed and replaced with standard Java. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cies Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR successfully removes the Lombok dependency from the codebase by replacing all Lombok-generated code with manual Java implementations. The changes affect 62 files (61 Java files and 1 Gradle build file) and include:
Changes:
- Replaced
@Data,@Getter,@Setter,@EqualsAndHashCode(callSuper),@ToStringannotations with manual implementations - Replaced
@NonNullwithObjects.requireNonNull()null checks - Replaced
@Delegatewith manual Collection interface delegation - Removed
@Slf4j(logger was not used) - Replaced
Lombok.sneakyThrow()withRuntimeExceptionwrapping - Replaced
@SneakyThrowswith try-catch blocks - Removed Lombok dependencies from build.gradle
Reviewed changes
Copilot reviewed 61 out of 62 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| build.gradle | Removed Lombok compile and annotation processor dependencies |
| MechanicalMachineNetworkElement.java | Added constructor, getter, equals, hashCode methods |
| EnergyBatteryNetworkElement.java | Added constructor, getter, equals, hashCode methods |
| CoalGeneratorNetworkElement.java | Added constructor, getter, equals, hashCode methods |
| Cluster.java | Manually implemented all Collection interface methods (replacing @DeleGate) |
| PartTypePanelVariableDriven.java | Added getters and setters for state fields |
| AspectPropertyTypeInstance.java | Added getters |
| UpdatingAspectVariable.java | Added getters, setter with null check, equals, hashCode, toString |
| LazyAspectVariable.java | Added getters |
| PartTypeBase.java | Added getters |
| PartStateActiveVariableBase.java | Added getters and setters |
| RawPartData.java | Added constructor, getters, equals, hashCode |
| RawObserverData.java | Added constructor, getters, equals, hashCode |
| RawNetworkData.java | Added constructor, getters, equals, hashCode |
| NetworkDataClient.java | Added constructors and getters for inner classes |
| TileNetworkElement.java | Added constructor, getter, equals, hashCode |
| PositionedAddonsNetwork.java | Added getter and setter |
| PartNetwork.java | Added getter and setter |
| NetworkElementBase.java | Removed @DaTa (no fields) |
| EnergyNetwork.java | Added getter and setter |
| ValueTypeRecipeLPElementRecipeSubGui.java | Added getter and setter |
| RenderPattern.java | Added getter |
| ValueTypeRecipeLPElement.java | Added getters and setters |
| ValueTypeLPElementBase.java | Added getter |
| ProxyVariableFacade.java | Added getters, setters, equals (with super call), hashCode (with super) |
| OperatorVariableFacade.java | Added getters, setters, equals (with super call), hashCode (with super) |
| ItemPart.java | Added equals, hashCode |
| DelayVariableFacade.java | Removed annotations (extends ProxyVariableFacade) |
| AspectVariableFacade.java | Added getters, equals (with super call), hashCode (with super) |
| PartHelpers.java | Added constructor, getters, equals, hashCode, toString for PartStateHolder |
| NbtHelpers.java | Removed @slf4j |
| GuiElementValueTypeStringRenderPattern.java | Added getters |
| GuiElementValueTypeString.java | Added getters, setters, equals, hashCode, toString; fixed getDefaultInputBoolean bug |
| GuiElementValueTypeDropdownListRenderPattern.java | Added getters |
| GuiElementValueTypeDropdownList.java | Added getters, setters, equals, hashCode, toString |
| GuiElementValueTypeBooleanRenderPattern.java | Added getters |
| GuiElementValueTypeBoolean.java | Added getters, equals, hashCode, toString; fixed getDefaultInputBoolean bug |
| ValueTypeString.java | Added manual toString for ValueString |
| ValueTypeOperator.java | Added manual toString for ValueOperator |
| ValueTypeLong.java | Added manual toString for ValueLong |
| ValueTypeList.java | Added manual toString for ValueList |
| ValueTypeInteger.java | Added manual toString for ValueInteger |
| ValueTypeDouble.java | Added manual toString for ValueDouble |
| ValueTypeBoolean.java | Added manual toString for ValueBoolean |
| ValueObjectTypeRecipe.java | Added manual toString for ValueRecipe |
| ValueObjectTypeItemStack.java | Added manual toString for ValueItemStack |
| ValueObjectTypeIngredients.java | Added manual toString for ValueIngredients |
| ValueObjectTypeFluidStack.java | Added manual toString for ValueFluidStack |
| ValueObjectTypeEntity.java | Added manual toString for ValueEntity |
| ValueObjectTypeBlock.java | Added manual toString for ValueBlock |
| ValueBase.java | Added manual toString |
| Operators.java | Replaced Lombok.sneakyThrow with RuntimeException wrapping |
| BakedSingleVariableModelProvider.java | Added constructor, getter, equals, hashCode, toString |
| BakedMapVariableModelProvider.java | Added constructor, getter, equals, hashCode, toString |
| WidgetTextFieldDropdown.java | Added getters and setters |
| BlockEntityMultipartTicking.java | Added getters and setters |
| CableRenderState.java | Added constructor, getters, equals, hashCode, toString |
| BlockEntitySqueezer.java | Added getter |
| BlockEntityProxy.java | Added getters and setters |
| BlockEntityMaterializer.java | Added setter |
| BlockEntityDelay.java | Added getters and setters |
| BlockCable.java | Replaced @SneakyThrows with try-catch; added setter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ValueHelpers.validatePredicateOutput(operator, result); | ||
| } catch (EvaluationException e) { | ||
| throw Lombok.sneakyThrow(e); | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
Replacing Lombok.sneakyThrow(e) with throw new RuntimeException(e) changes the exception handling behavior. The original would rethrow the checked EvaluationException as-is (bypassing checked exception rules), while the new code wraps it in a RuntimeException. This means any code catching EvaluationException specifically won't catch this anymore - it will need to catch RuntimeException and unwrap it. Consider whether this behavioral change is acceptable, or if a better solution would be to declare throws EvaluationException on the lambda/method.
There was a problem hiding this comment.
Could you use Helpers.sneakyThrow instead of throwing a RuntimeException?
There was a problem hiding this comment.
Fixed in commit 95d846e. Replaced throw new RuntimeException(e) with return Helpers.sneakyThrow(e) to properly rethrow the exception without wrapping.
| } catch (Exception e) { | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
Similar to the previous sneakyThrow replacement, wrapping the exception in a RuntimeException changes error handling behavior. Code that was catching specific exceptions from the cache's callable will now need to catch and unwrap RuntimeException instead. Consider whether this is the intended behavior or if there's a better alternative.
There was a problem hiding this comment.
Could you use Helpers.sneakyThrow instead of throwing a RuntimeException?
There was a problem hiding this comment.
Fixed in commit 95d846e. Replaced throw new RuntimeException(e) with return Helpers.sneakyThrow(e) to properly rethrow the exception without wrapping.
| } catch (Exception e) { | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
Could you use Helpers.sneakyThrow instead of throwing a RuntimeException?
| ValueHelpers.validatePredicateOutput(operator, result); | ||
| } catch (EvaluationException e) { | ||
| throw Lombok.sneakyThrow(e); | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
Could you use Helpers.sneakyThrow instead of throwing a RuntimeException?
… exception handling Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Lombok Migration - Complete ✅
Summary
Successfully migrated 62 Java files from Lombok to standard Java:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.