mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 18:15:55 +00:00
Eclipse/JavacHandlerUtil.injectField(...) inserts the new fields after the enum constants.
Also the new fields are ordered in the same way the method injectField() gets invoked.
This commit is contained in:
1 parent
fb4d2a45d2
commit
0d75d56fce
9 files changed
+281
-10
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import java.util.logging.Level;
|
||||
import lombok.extern.java.Log;
|
||||
import lombok.Synchronized;
|
||||
|
||||
@Log
|
||||
enum InjectField1 {
|
||||
A,
|
||||
B;
|
||||
|
||||
private static final String LOG_MESSAGE = "static initializer";
|
||||
|
||||
private String fieldA;
|
||||
|
||||
static {
|
||||
log.log(Level.FINE, LOG_MESSAGE);
|
||||
}
|
||||
|
||||
private String fieldB;
|
||||
|
||||
@Synchronized
|
||||
void generateLockField() {
|
||||
System.out.println("lock field");
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
static void generateStaticLockField() {
|
||||
System.out.println("static lock field");
|
||||
}
|
||||
}
|
||||
|
||||
@Log
|
||||
class InjectField2 {
|
||||
private static final String LOG_MESSAGE = "static initializer";
|
||||
|
||||
static {
|
||||
log.log(Level.FINE, LOG_MESSAGE);
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
void generateLockField() {
|
||||
System.out.println("lock field");
|
||||
}
|
||||
}
|
||||
|
||||
@Log
|
||||
class InjectField3 {
|
||||
static {
|
||||
log.log(Level.FINE, "static initializer");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user