Skip to content

Commit 526cd58

Browse files
committed
Nima - Fix for InputStream use with Jsonb present
1 parent 2932882 commit 526cd58

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

http-generator-nima/src/main/java/io/avaje/http/generator/helidon/nima/ControllerWriter.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.avaje.http.generator.helidon.nima;
22

33
import static io.avaje.http.generator.core.ProcessingContext.diAnnotation;
4+
import static io.avaje.http.generator.core.ProcessingContext.isAssignable2Interface;
45

56
import java.io.IOException;
67
import java.util.List;
@@ -106,8 +107,10 @@ private void writeClassStart() {
106107
}
107108

108109
for (final UType type : jsonTypes.values()) {
109-
final var typeString = PrimitiveUtil.wrap(type.shortType()).replace(",", ", ");
110-
writer.append(" private final JsonType<%s> %sJsonType;", typeString, type.shortName()).eol();
110+
if (!isInputStream(type.full())) {
111+
final var typeString = PrimitiveUtil.wrap(type.shortType()).replace(",", ", ");
112+
writer.append(" private final JsonType<%s> %sJsonType;", typeString, type.shortName()).eol();
113+
}
111114
}
112115
writer.eol();
113116

@@ -133,9 +136,15 @@ private void writeClassStart() {
133136

134137
if (useJsonB) {
135138
for (final UType type : jsonTypes.values()) {
136-
JsonBUtil.writeJsonbType(type, writer);
139+
if (!isInputStream(type.full())) {
140+
JsonBUtil.writeJsonbType(type, writer);
141+
}
137142
}
138143
}
139144
writer.append(" }").eol().eol();
140145
}
146+
147+
private boolean isInputStream(String type) {
148+
return isAssignable2Interface(type.toString(), "java.io.InputStream");
149+
}
141150
}

0 commit comments

Comments
 (0)