peichhorn / lombok-pg

Collection of lombok extensions
http://peichhorn.github.com/lombok-pg/
Other
326 stars 44 forks source link

@Builder needs to respect @Accessor #113

Closed ribrewguy closed 11 years ago

ribrewguy commented 11 years ago

My company has a specific naming convention for member variables. @Accessor has helped greatly in producing correctly named getters, but the @Builder produces ugly methods. It would be great if @Builder removed the prefix specified by the @Accessor annotation.

peichhorn commented 11 years ago

Sure thing

ribrewguy commented 11 years ago

Thanks for the speedy attention to this issue!

peichhorn commented 11 years ago

Now @Accessors works perfectly with @Builder in both ecj and javac. Even the features @EnumId, @LazyGetter, @BoundSetter and @FluentSetter work with @Accessors in nearly all cases. There are still some scenarios where the use of @Accessors fails though. For example using @EnumId, @NoArgsConstructor and @Accessors together does not work as expected.

To fix this, I need to change how lombok is removing the annotations and import statements in javac. I'll leave this issue open until then.

peichhorn commented 11 years ago

Done

ribrewguy commented 11 years ago

You rock!

ribrewguy commented 11 years ago

Is there a snapshot available? I don't see since 0.11.1.

peichhorn commented 11 years ago

There is a new 0.11.3 release available on maven central, link

But this feature is not yet in the release, I have to deploy a new snapshot. The snapshots are removed automatically once a proper release has been published, so all 0.11.3 snapshots are gone.

ribrewguy commented 11 years ago

Right. So I am wondering if you will be releasing any 0.11.4 snaps.

peichhorn commented 11 years ago

0.11.4-SNAPSHOT can be found here: link

EDIT Sorry the snapshot is not available yet, since I get Bad Request errors when deploying the artifact.. I need to investigate this once I get home from work. EDIT 2 Now the snapshot is available..

ribrewguy commented 11 years ago

Thanks! Was this issue addressed in this snapshot? I do not see the expected behavior.

peichhorn commented 11 years ago

It should be working with the snapshot. For example, this works for me:

import lombok.Builder;
import lombok.Getter;
import lombok.experimental.Accessors;

public class BuilderResetExample {

    @Accessors(prefix="m_")
    @Builder
    @Getter
    public static class Person {
        private final String m_firstname;
        private final String m_name;
        private int m_age;
    }

    public static void main(String[] args) {
        Person.person().firstname("Chuck").name("Norris").age(72).build();
    }
}

If I've missed anything please let me know.