[Regression: 1.16.8] Delombok issue with for loop and @Getter field #1076

Closed
lucidfox opened this Issue Apr 6, 2016 · 3 comments

Projects

None yet

2 participants

@lucidfox
lucidfox commented Apr 6, 2016

The attached file fails to properly delombok with 1.16.8. 1.16.6 works correctly.

import java.util.List;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import lombok.val;

public class DelombokLoopError {
    @Getter
    private String internalStuff;

    public void doStuff(final List<String> stuff) {
        int endIndex;

        for (endIndex = stuff.size() - 1; endIndex >= 0; endIndex--) {

        }
    }
}

1.16.6 result (correct):

// Generated by delombok at Wed Apr 06 21:47:16 NOVT 2016

import java.util.List;
import lombok.Setter;
import lombok.val;

public class DelombokLoopError {

    private String internalStuff;

    public void doStuff(final List<String> stuff) {
        int endIndex;
        for (endIndex = stuff.size() - 1; endIndex >= 0; endIndex--) {
        }
    }

    @java.lang.SuppressWarnings("all")
    @javax.annotation.Generated("lombok")
    public String getInternalStuff() {
        return this.internalStuff;
    }
}

1.16.8 result (incorrect):

// Generated by delombok at Wed Apr 06 21:46:51 NOVT 2016

import java.util.List;
import lombok.Setter;
import lombok.val;

public class DelombokLoopError {
    private String internalStuff;

    public void doStuff(final List<String> stuff) {
        int endIndex;
        for (endIndex = stuff.size() - 1;
; endIndex >= 0; endIndex--) {
        }
    }

    @java.lang.SuppressWarnings("all")
    @javax.annotation.Generated("lombok")
    public String getInternalStuff() {
        return this.internalStuff;
    }
}

Note the double semicolon in the for loop, which makes the code fail to compile.

Without the @Getter field internalStuff, the code delomboks correctly. The mere existence of any kind of @Getter field seems to produce this behavior.

DelombokLoopError.java.txt

@lucidfox

Still not fixed in 1.16.10.

@rspilker rspilker added a commit that referenced this issue Jul 19, 2016
@rspilker rspilker Fix for issue #1076 fa2ff14
@rspilker
Collaborator

It is fixed now. Can you try out the edge release and tell us if it fixes your problem?

@rspilker rspilker added the parked label Jul 19, 2016
@lucidfox

Seems fixed for me. Thank you!

@rspilker rspilker closed this Jul 22, 2016
@rspilker rspilker removed the parked label Oct 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment