Skip to content

Commit 87bc91a

Browse files
authored
Merge pull request #3764 from Rawi01/update-index
Update annotation value index
2 parents c8d6152 + 5caea32 commit 87bc91a

File tree

40 files changed

+102
-78
lines changed

40 files changed

+102
-78
lines changed

src/core/lombok/core/AnnotationValues.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2009-2022 The Project Lombok Authors.
2+
* Copyright (C) 2009-2024 The Project Lombok Authors.
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -182,6 +182,7 @@ public List<String> getAsStringList(String methodName) {
182182
"I can't make sense of this annotation value. Try using a fully qualified literal.", idx);
183183
}
184184
out.add((String) result);
185+
idx++;
185186
}
186187

187188
return Collections.unmodifiableList(out);

test/core/src/lombok/CompilerMessageMatcher.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2012-2013 The Project Lombok Authors.
2+
* Copyright (C) 2012-2024 The Project Lombok Authors.
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -36,6 +36,7 @@
3636
public class CompilerMessageMatcher {
3737
/** Line Number (starting at 1) */
3838
private final List<Integer> lineNumbers = new ArrayList<Integer>();
39+
private final List<Long> positions = new ArrayList<Long>();
3940
private final List<List<String>> messages = new ArrayList<List<String>>();
4041
private boolean optional;
4142

@@ -48,14 +49,17 @@ public boolean isOptional() {
4849
public static CompilerMessageMatcher asCompilerMessageMatcher(CompilerMessage message) {
4950
CompilerMessageMatcher cmm = new CompilerMessageMatcher();
5051
cmm.lineNumbers.add((int) message.getLine());
52+
cmm.positions.add(message.getPosition());
5153
cmm.messages.add(Arrays.asList(message.getMessage().split("\\s+")));
5254
return cmm;
5355
}
5456

5557
@Override public String toString() {
5658
StringBuilder out = new StringBuilder();
5759
for (int i = 0; i < lineNumbers.size(); i++) {
58-
out.append(lineNumbers.get(i)).append(" ");
60+
out.append(lineNumbers.get(i));
61+
if (positions.get(i) != null) out.append(":").append(positions.get(i));
62+
out.append(" ");
5963
for (String part : messages.get(i)) out.append(part).append(" ");
6064
if (out.length() > 0) out.setLength(out.length() - 1);
6165
out.append(" |||| ");
@@ -67,8 +71,8 @@ public static CompilerMessageMatcher asCompilerMessageMatcher(CompilerMessage me
6771
public boolean matches(CompilerMessage message) {
6872
outer:
6973
for (int i = 0; i < lineNumbers.size(); i++) {
70-
//Allow an off-by-1 in line numbers; when running tests that sometimes happens for as yet unknown reasons.
71-
if (message.getLine() != lineNumbers.get(i) && message.getLine() -1 != lineNumbers.get(i)) continue;
74+
if (message.getLine() != lineNumbers.get(i)) continue;
75+
if (positions.get(i) != null && !positions.get(i).equals(message.getPosition())) continue;
7276
for (String token : messages.get(i)) {
7377
if (!message.getMessage().contains(token)) continue outer;
7478
}
@@ -88,7 +92,7 @@ public static List<CompilerMessageMatcher> readAll(InputStream rawIn) throws IOE
8892
return out;
8993
}
9094

91-
private static final Pattern PATTERN = Pattern.compile("^(-?\\d+) (.*)$");
95+
private static final Pattern PATTERN = Pattern.compile("^(-?\\d+)(?::(\\d+))? (.*)$");
9296

9397
private static CompilerMessageMatcher read(String line) {
9498
line = line.trim();
@@ -108,7 +112,8 @@ private static CompilerMessageMatcher read(String line) {
108112
Matcher m = PATTERN.matcher(part);
109113
if (!m.matches()) throw new IllegalArgumentException("Typo in test file: " + line);
110114
cmm.lineNumbers.add(Integer.parseInt(m.group(1)));
111-
cmm.messages.add(Arrays.asList(m.group(2).split("\\s+")));
115+
cmm.positions.add(m.group(2) != null ? Long.parseLong(m.group(2)) : null);
116+
cmm.messages.add(Arrays.asList(m.group(3).split("\\s+")));
112117
}
113118

114119
return cmm;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// skip-compare-contents
2+
@lombok.EqualsAndHashCode(of={"x", Const.A})
3+
final class EqualsAndHashCodeErrorOf {
4+
int x;
5+
}
6+
7+
@lombok.EqualsAndHashCode(exclude={"x", Const.A})
8+
final class EqualsAndHashCodeErrorExclude {
9+
int x;
10+
}
11+
12+
class Const {
13+
static final String A = "A";
14+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4 Use of @Delegate is flagged according to lombok configuration.
1+
5 Use of @Delegate is flagged according to lombok configuration.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
6 @Delegate is legal only on instance fields or no-argument instance methods.
2-
10 @Delegate is legal only on instance fields or no-argument instance methods.
1+
7 @Delegate is legal only on instance fields or no-argument instance methods.
2+
11 @Delegate is legal only on instance fields or no-argument instance methods.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4 @Delegate does not support recursion (delegating to a type that itself has @Delegate members). Member "inner" is @Delegate in type "DelegateRecursionCenter"
1+
5 @Delegate does not support recursion (delegating to a type that itself has @Delegate members). Member "inner" is @Delegate in type "DelegateRecursionCenter"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2:60 You must use constant literals in lombok annotations; they cannot be references to (static) fields.
2+
7:160 You must use constant literals in lombok annotations; they cannot be references to (static) fields.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
1 This field does not exist.
2-
6 This field does not exist, or would have been excluded anyway.
1+
2 This field does not exist.
2+
7 This field does not exist, or would have been excluded anyway.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9 reference to ambiguous is ambiguous both method <T,R>ambiguous(T,java.util.function.Function<T,R>) in ExtensionMethodAmbiguousFunctional.Extensions and method <T>ambiguous(T,java.util.function.Consumer<T>) in ExtensionMethodAmbiguousFunctional.Extensions match
1+
10 reference to ambiguous is ambiguous both method <T,R>ambiguous(T,java.util.function.Function<T,R>) in ExtensionMethodAmbiguousFunctional.Extensions and method <T>ambiguous(T,java.util.function.Consumer<T>) in ExtensionMethodAmbiguousFunctional.Extensions match
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1 @JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson.
1+
2 @JsonDeserialize already exists on class. Either delete @JsonDeserialize, or remove @Jacksonized and manually configure Jackson.

0 commit comments

Comments
 (0)