Search code examples
javaeclipselombok

Eclipse version 24-6 isn't working with the lombok plugin


I used the lombok.jar installer for eclipse, it modified my eclipse.ini file

-startup
plugins/org.eclipse.equinox.launcher_1.6.800.v20240513-1750.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.1000.v20240507-1834
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_21.0.3.v20240426- 
   1530/jre/bin
-vmargs
-javaagent:C:/Users/me/eclipse/2024-03/lombok.jar
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclientjava
-Dosgi.requiredJavaVersion=21
[email protected]/eclipse-workspace
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Declipse.e4.inject.javax.warning=false
-Dsun.java.command=Eclipse
-Xms256m
-Xmx2048m
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Djava.security.manager=allow

every lombok class is failing to compile because eclipse doesn't know about builders, or getters or setters or constructors I have the lombok.jar in my eclipse base directory.
I run eclipse by double clicking on the eclipse.exe

Here is the simplest example class

@Builder
@AllArgsConstructor
@Data
public class ClientAccount {

    @Size(max = 30)
    private String accountName;

    @Size(max = 50)
    private String accountReference;

    @NotNull
    @Size(max = 32)
    private String clientId;

    @NotNull
    @Size(max = 64)
    private String clientSecretKey;

    private LocalDateTime keyLastUpdated;
}

the outline view

If I run maven on the command line it generates the correct code (I used a decompiler to see this)

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.LocalDateTime;
import lombok.Generated;

public class ClientAccount {
   @Size(
      max = 30
   )
   private String accountName;
   @Size(
      max = 50
   )
   private String accountReference;
   @NotNull
   @Size(
      max = 32
   )
   private String clientId;
   @NotNull
   @Size(
      max = 64
   )
   private String clientSecretKey;
   private LocalDateTime keyLastUpdated;

   @Generated
   public static com.pancredit.equifax.model.ClientAccount.ClientAccountBuilder builder() {
      return new com.pancredit.equifax.model.ClientAccount.ClientAccountBuilder();
   }

   @Generated
   public ClientAccount(final String accountName, final String accountReference, final String clientId, final String clientSecretKey, final LocalDateTime keyLastUpdated) {
      this.accountName = accountName;
      this.accountReference = accountReference;
      this.clientId = clientId;
      this.clientSecretKey = clientSecretKey;
      this.keyLastUpdated = keyLastUpdated;
   }

   @Generated
   public String getAccountName() {
      return this.accountName;
   }

   @Generated
   public String getAccountReference() {
      return this.accountReference;
   }

   @Generated
   public String getClientId() {
      return this.clientId;
   }

   @Generated
   public String getClientSecretKey() {
      return this.clientSecretKey;
   }

   @Generated
   public LocalDateTime getKeyLastUpdated() {
      return this.keyLastUpdated;
   }

   @Generated
   public void setAccountName(final String accountName) {
      this.accountName = accountName;
   }

   @Generated
   public void setAccountReference(final String accountReference) {
      this.accountReference = accountReference;
   }

   @Generated
   public void setClientId(final String clientId) {
      this.clientId = clientId;
   }

   @Generated
   public void setClientSecretKey(final String clientSecretKey) {
      this.clientSecretKey = clientSecretKey;
   }

   @Generated
   public void setKeyLastUpdated(final LocalDateTime keyLastUpdated) {
      this.keyLastUpdated = keyLastUpdated;
   }

I have annotations turned on in the project annotations turned on

but where ever it is used I get the compilation errors

The method getClientId() is undefined for the type ClientAccount line 43 Java Problem
or
The method builder() is undefined for the type ClientAccount line 12 Java Problem

Edit I have just updated to lombok version 1.18.34, and it is now appearing, in the about box, but I am still getting errors, anywhere that is trying to use these generated methods


Solution

  • The current release of lombok is v1.18.34. You should install it; we fixed a few things that sound sufficiently like what you're running into.

    If you've done that and you still see the errors, make sure you run a project clean all. Or close and re-open all projects.