Skip to content

Commit 328c7cb

Browse files
committed
I was redundant
1 parent 47fb3ef commit 328c7cb

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

http-generator-core/src/main/java/io/avaje/http/generator/core/UType.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ static UType parse(TypeMirror type) {
4040
default String param0() {
4141
return null;
4242
}
43-
/**
44-
* Return all types associated with this Utype.
45-
*/
46-
default List<String> allTypes() {
47-
return List.of();
48-
}
4943

5044
/**
5145
* Return the second generic parameter.
@@ -112,7 +106,7 @@ public String full() {
112106

113107
@Override
114108
public Set<String> importTypes() {
115-
return Collections.singleton(rawType);
109+
return rawType.startsWith("java.lang.") ? Set.of() : Collections.singleton(rawType);
116110
}
117111

118112
@Override
@@ -130,10 +124,6 @@ public String mainType() {
130124
return rawType;
131125
}
132126

133-
@Override
134-
public List<String> allTypes() {
135-
return List.of(rawType);
136-
}
137127
}
138128

139129
/**
@@ -212,11 +202,6 @@ public String mainType() {
212202
return allTypes.isEmpty() ? null : allTypes.get(0);
213203
}
214204

215-
@Override
216-
public List<String> allTypes() {
217-
return allTypes;
218-
}
219-
220205
@Override
221206
public String param0() {
222207
return allTypes.size() < 2 ? null : allTypes.get(1);

http-generator-javalin/src/main/java/io/avaje/http/generator/javalin/ControllerWriter.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.avaje.http.generator.javalin;
22

33
import java.io.IOException;
4-
import java.util.List;
54
import java.util.Map;
5+
import java.util.Set;
66

77
import io.avaje.http.generator.core.BaseControllerWriter;
88
import io.avaje.http.generator.core.Constants;
@@ -32,9 +32,8 @@ class ControllerWriter extends BaseControllerWriter {
3232
reader.addImportType("io.avaje.jsonb.Types");
3333
this.jsonTypes = JsonBUtil.jsonTypes(reader);
3434
jsonTypes.values().stream()
35-
.map(UType::allTypes)
36-
.flatMap(List::stream)
37-
.filter(s -> !s.contains("java.lang"))
35+
.map(UType::importTypes)
36+
.flatMap(Set::stream)
3837
.forEach(reader::addImportType);
3938
} else {
4039
this.jsonTypes = Map.of();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.io.IOException;
66
import java.util.List;
77
import java.util.Map;
8+
import java.util.Set;
89

910
/**
1011
* Write Helidon specific web route adapter (a Helidon Service).
@@ -24,9 +25,8 @@ class ControllerWriter extends BaseControllerWriter {
2425
reader.addImportType("io.avaje.jsonb.Types");
2526
this.jsonTypes = JsonBUtil.jsonTypes(reader);
2627
jsonTypes.values().stream()
27-
.map(UType::allTypes)
28-
.flatMap(List::stream)
29-
.filter(s -> !s.contains("java.lang"))
28+
.map(UType::importTypes)
29+
.flatMap(Set::stream)
3030
.forEach(reader::addImportType);
3131
} else {
3232
this.jsonTypes = Map.of();

0 commit comments

Comments
 (0)