Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b718fbf

Browse filesBrowse files
committed
[fixes #3327] Inject fields after generated record fields
1 parent 75c9a9d commit b718fbf
Copy full SHA for b718fbf

File tree

Expand file treeCollapse file tree

4 files changed

+14
-7
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+14
-7
lines changed

‎src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java

Copy file name to clipboardExpand all lines: src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,7 @@ public static EclipseNode injectField(EclipseNode type, FieldDeclaration field)
19981998
int index = 0;
19991999
for (; index < size; index++) {
20002000
FieldDeclaration f = newArray[index];
2001-
if (isEnumConstant(f) || isGenerated(f)) continue;
2001+
if (isEnumConstant(f) || isGenerated(f) || isRecordField(f)) continue;
20022002
break;
20032003
}
20042004
System.arraycopy(newArray, index, newArray, index + 1, size - index);
@@ -2760,6 +2760,13 @@ public static boolean isRecordField(EclipseNode fieldNode) {
27602760
return fieldNode.getKind() == Kind.FIELD && (((FieldDeclaration) fieldNode.get()).modifiers & AccRecord) != 0;
27612761
}
27622762

2763+
/**
2764+
* Returns {@code true} If the provided node is a field declaration, and represents a field in a {@code record} declaration.
2765+
*/
2766+
public static boolean isRecordField(FieldDeclaration fieldDeclaration) {
2767+
return (fieldDeclaration.modifiers & AccRecord) != 0;
2768+
}
2769+
27632770
/**
27642771
* Returns {@code true) if the provided node is a type declaration <em>and</em> is <strong>not</strong> of any kind indicated by the flags (the intent is to pass flags usch as `ClassFileConstants.AccEnum`).
27652772
*/

‎test/transform/resource/after-ecj/LoggerFloggerRecord.java

Copy file name to clipboardExpand all lines: test/transform/resource/after-ecj/LoggerFloggerRecord.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// version 19:
22
import lombok.extern.flogger.Flogger;
33
class LoggerFloggerRecord {
4-
public @Flogger record Inner(com log) {
5-
private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
4+
public @Flogger record Inner(String x) {
65
/* Implicit */ private final String x;
6+
private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
77
<clinit>() {
88
}
99
public Inner(String x) {

‎test/transform/resource/after-ecj/LoggerSlf4jOnRecord.java

Copy file name to clipboardExpand all lines: test/transform/resource/after-ecj/LoggerSlf4jOnRecord.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// version 14:
22
import lombok.extern.slf4j.Slf4j;
3-
public @Slf4j record LoggerSlf4jOnRecord(org log, String a) {
4-
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jOnRecord.class);
3+
public @Slf4j record LoggerSlf4jOnRecord(String a, String b) {
54
/* Implicit */ private final String a;
65
/* Implicit */ private final String b;
6+
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jOnRecord.class);
77
<clinit>() {
88
}
99
public LoggerSlf4jOnRecord(String a, String b) {

‎test/transform/resource/after-ecj/SynchronizedInRecord.java

Copy file name to clipboardExpand all lines: test/transform/resource/after-ecj/SynchronizedInRecord.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import lombok.Synchronized;
2-
public record SynchronizedInRecord(java $lock, String a) {
3-
private final java.lang.Object $lock = new java.lang.Object[0];
2+
public record SynchronizedInRecord(String a, String b) {
43
/* Implicit */ private final String a;
54
/* Implicit */ private final String b;
5+
private final java.lang.Object $lock = new java.lang.Object[0];
66
public SynchronizedInRecord(String a, String b) {
77
super();
88
.a = a;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.