Skip to content

Commit 51fb84b

Browse files
committed
APT: fix random bug on JDK 11 related to annotation and defalts value 2nd try
1 parent e27c470 commit 51fb84b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

modules/jooby-apt/src/main/java/io/jooby/apt/JoobyProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public class JoobyProcessor extends AbstractProcessor {
4949
private ProcessingEnvironment processingEnv;
5050

5151
/**
52-
* Controller {
52+
* Route Data.
53+
* {
5354
* HTTP_METHOD: [method1, ..., methodN]
5455
* }
5556
*/

modules/jooby-apt/src/main/java/io/jooby/internal/apt/asm/RouteAttributesWriter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,10 @@ private Map<String, Object> annotationMap(List<? extends AnnotationMirror> annot
151151
? annotation.getAnnotationType().asElement().getSimpleName().toString()
152152
: root;
153153
// Set all values and then override with present values (fix for JDK 11+)
154-
result.putAll(toMap(elements
155-
.getElementValuesWithDefaults(annotation), prefix));
156-
result.putAll(toMap(annotation.getElementValues(), prefix));
154+
toMap(annotation.getElementValues(), prefix)
155+
.forEach(result::put);
156+
toMap(elements.getElementValuesWithDefaults(annotation), prefix)
157+
.forEach(result::putIfAbsent);
157158
}
158159
return result;
159160
}

0 commit comments

Comments
 (0)