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

40 files changed

+102
-78
lines changed

src/core/lombok/core/AnnotationValues.java

+2-1
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

+11-6
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;
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+
}
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.
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.
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"
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.
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.
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
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.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5 @Locked is legal only on methods in classes and enums.
1+
6 @Locked is legal only on methods in classes and enums.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22 @NonNull is meaningless on a primitive.
1+
23 @NonNull is meaningless on a primitive.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
9 Use of @Getter(onMethod=...) is flagged according to lombok configuration.
2-
10 Use of @Setter(onMethod=...) is flagged according to lombok configuration.
3-
10 Use of @Setter(onParam=...) is flagged according to lombok configuration.
4-
11 Use of @NoArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
5-
12 Use of @AllArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
6-
18 Use of @RequiredArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
1+
10 Use of @Getter(onMethod=...) is flagged according to lombok configuration.
2+
11 Use of @Setter(onMethod=...) is flagged according to lombok configuration.
3+
11 Use of @Setter(onParam=...) is flagged according to lombok configuration.
4+
12 Use of @NoArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
5+
13 Use of @AllArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
6+
19 Use of @RequiredArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5 @Synchronized is legal only on methods in classes and enums.
1+
6 @Synchronized is legal only on methods in classes and enums.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
6 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
2-
10 'val' is not compatible with array initializer expressions. Use the full form (new int[] { ... } instead of just { ... })
1+
7 Cannot use 'val' here because initializer expression does not have a representable type: Type cannot be resolved
2+
11 'val' is not compatible with array initializer expressions. Use the full form (new int[] { ... } instead of just { ... })
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7 'val' is not allowed in old-style for loops
1+
8 'val' is not allowed in old-style for loops
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6 'var' is not allowed in old-style for loops if there is more than 1 initializer
1+
7 'var' is not allowed in old-style for loops if there is more than 1 initializer
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5 variable initializer is 'null'
1+
6 variable initializer is 'null'
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6 Use of var is flagged according to lombok configuration
1+
7 Use of var is flagged according to lombok configuration.
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.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
1 The type Delegate is deprecated
2-
6 The type Delegate is deprecated
1+
2 The type Delegate is deprecated
2+
7 The type Delegate is deprecated
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.
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"
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.
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.
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.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
15 Dead code
2-
22 @NonNull is meaningless on a primitive.
3-
28 Dead code
1+
16 Dead code
2+
23 @NonNull is meaningless on a primitive.
3+
29 Dead code
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7 @NonNull is meaningless on a primitive.
1+
8 @NonNull is meaningless on a primitive.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
9 Use of @Getter(onMethod=...) is flagged according to lombok configuration.
2-
10 Use of @Setter(onMethod=...) is flagged according to lombok configuration.
3-
10 Use of @Setter(onParam=...) is flagged according to lombok configuration.
4-
11 Use of @NoArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
5-
12 Use of @AllArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
6-
18 Use of @RequiredArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
1+
10 Use of @Getter(onMethod=...) is flagged according to lombok configuration.
2+
11 Use of @Setter(onMethod=...) is flagged according to lombok configuration.
3+
11 Use of @Setter(onParam=...) is flagged according to lombok configuration.
4+
12 Use of @NoArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
5+
13 Use of @AllArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
6+
19 Use of @RequiredArgsConstructor(onConstructor=...) is flagged according to lombok configuration.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17 The serializable class does not declare a static final serialVersionUID field of type long
1+
18 The serializable class does not declare a static final serialVersionUID field of type long
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
5 NonExistingClass cannot be resolved to a type
21
6 NonExistingClass cannot be resolved to a type
3-
7 The method nonExisitingMethod(Integer) is undefined for the type ValInvalidParameter
4-
8 nonExistingObject cannot be resolved
5-
9 The method nonExistingMethod() is undefined for the type Integer
6-
10 NonExistingClass cannot be resolved to a type
7-
11 The method b2(int, int) in the type ValInvalidParameter is not applicable for the arguments (int)
8-
12 The method a(String) is ambiguous for the type ValInvalidParameter
9-
13 The method a(String) is ambiguous for the type ValInvalidParameter
2+
7 NonExistingClass cannot be resolved to a type
3+
8 The method nonExisitingMethod(Integer) is undefined for the type ValInvalidParameter
4+
9 nonExistingObject cannot be resolved
5+
10 The method nonExistingMethod() is undefined for the type Integer
6+
11 NonExistingClass cannot be resolved to a type
7+
12 The method b2(int, int) in the type ValInvalidParameter is not applicable for the arguments (int)
8+
13 The method a(String) is ambiguous for the type ValInvalidParameter
9+
14 The method a(String) is ambiguous for the type ValInvalidParameter
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
24 Function is a raw type. References to generic type Function<T,R> should be parameterized
2-
25 Function is a raw type. References to generic type Function<T,R> should be parameterized
1+
25 Function is a raw type. References to generic type Function<T,R> should be parameterized
2+
26 Function is a raw type. References to generic type Function<T,R> should be parameterized
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13 List is a raw type. References to generic type List<E> should be parameterized
1+
14 List is a raw type. References to generic type List<E> should be parameterized
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6 'var' is not allowed in old-style for loops if there is more than 1 initializer
1+
7 'var' is not allowed in old-style for loops if there is more than 1 initializer
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
1 The type var is deprecated
2-
7 The type var is deprecated
1+
2 The type var is deprecated
32
8 The type var is deprecated
3+
9 The type var is deprecated
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5 variable initializer is 'null'
1+
6 variable initializer is 'null'
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6 Use of var is flagged according to lombok configuration.
1+
7 Use of var is flagged according to lombok configuration.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
27 cannot find symbol
2-
31 cannot find symbol
1+
28 cannot find symbol method readLock() location: java.util.concurrent.locks.Lock
2+
32 cannot find symbol method readLock() location: java.util.concurrent.locks.Lock
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
33 @NonNull is meaningless on a primitive.
1+
34 @NonNull is meaningless on a primitive.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
3 cannot find symbol
2-
4 cannot find symbol
3-
5 cannot find symbol
4-
6 cannot find symbol
5-
7 cannot find symbol
6-
8 cannot find symbol
7-
9 method b2 in class ValInvalidParameter cannot be applied to given types;
8-
10 reference to a is ambiguous
9-
11 reference to a is ambiguous
1+
4 cannot find symbol symbol: class NonExistingClass location: class ValInvalidParameter
2+
5 cannot find symbol symbol: class NonExistingClass location: class ValInvalidParameter
3+
6 cannot find symbol symbol: method nonExisitingMethod(java.lang.Integer) location: class ValInvalidParameter
4+
7 cannot find symbol symbol: variable nonExistingObject location: class ValInvalidParameter
5+
8 cannot find symbol symbol: method nonExistingMethod() location: class java.lang.Integer
6+
9 cannot find symbol symbol: class NonExistingClass location: class ValInvalidParameter
7+
10 method b2 in class ValInvalidParameter cannot be applied to given types; required: int,int found: int reason: actual and formal argument lists differ in length
8+
11 reference to a is ambiguous both method a(java.lang.String) in ValInvalidParameter and method a(java.lang.Integer) in ValInvalidParameter match
9+
12 reference to a is ambiguous both method a(java.lang.String) in ValInvalidParameter and method a(java.lang.Integer) in ValInvalidParameter match

0 commit comments

Comments
 (0)