Skip to content

Remove Lombok dependency#1604

Merged
rubensworks merged 7 commits intomaster-1.21from
copilot/migrate-away-from-lombok
Feb 19, 2026
Merged

Remove Lombok dependency#1604
rubensworks merged 7 commits intomaster-1.21from
copilot/migrate-away-from-lombok

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 18, 2026

Lombok Migration - Complete ✅

  • Analyze all 61 Java files using Lombok
  • Replace @DaTa annotations with manual getters/setters/equals/hashCode/toString
  • Replace field-level @Getter/@Setter annotations with manual getter/setter methods
  • Replace @EqualsAndHashCode annotations with manual equals/hashCode methods
  • Replace @tostring annotations with manual toString methods
  • Handle @nonnull annotations with null checks in setters
  • Replace @DeleGate with manual Collection interface implementation
  • Remove lombok imports from all files
  • Remove Lombok dependencies from build.gradle
  • Build project successfully (all unit tests pass)
  • Run game tests (all 797 tests pass)
  • Address review feedback: Replace RuntimeException with Helpers.sneakyThrow
  • Final validation complete

Summary

Successfully migrated 62 Java files from Lombok to standard Java:

  • 1,198 insertions, 222 deletions
  • Zero Lombok imports remaining
  • Zero Lombok dependencies in build.gradle
  • All tests passing
  • No breaking API changes
  • Proper exception handling using Helpers.sneakyThrow

💡 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.

Copilot AI and others added 4 commits February 18, 2026 19:10
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>
Copilot AI changed the title [WIP] Remove Lombok usage and update related files Remove Lombok dependency Feb 18, 2026
Copilot AI requested a review from rubensworks February 18, 2026 19:37
@rubensworks rubensworks requested a review from Copilot February 18, 2026 19:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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), @ToString annotations with manual implementations
  • Replaced @NonNull with Objects.requireNonNull() null checks
  • Replaced @Delegate with manual Collection interface delegation
  • Removed @Slf4j (logger was not used)
  • Replaced Lombok.sneakyThrow() with RuntimeException wrapping
  • Replaced @SneakyThrows with 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);
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use Helpers.sneakyThrow instead of throwing a RuntimeException?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 95d846e. Replaced throw new RuntimeException(e) with return Helpers.sneakyThrow(e) to properly rethrow the exception without wrapping.

Comment on lines +328 to +329
} catch (Exception e) {
throw new RuntimeException(e);
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use Helpers.sneakyThrow instead of throwing a RuntimeException?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 95d846e. Replaced throw new RuntimeException(e) with return Helpers.sneakyThrow(e) to properly rethrow the exception without wrapping.

@rubensworks rubensworks marked this pull request as ready for review February 18, 2026 19:48
Comment on lines +328 to +329
} catch (Exception e) {
throw new RuntimeException(e);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use Helpers.sneakyThrow instead of throwing a RuntimeException?

… exception handling

Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
@coveralls
Copy link
Copy Markdown

coveralls commented Feb 19, 2026

Coverage Status

coverage: 52.616% (+0.3%) from 52.363%
when pulling 9e55222 on copilot/migrate-away-from-lombok
into 9a98fce on master-1.21.

@rubensworks rubensworks merged commit 2fd4d78 into master-1.21 Feb 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants