Commit dd644f1
authored
Fix Java's handling of mime type text when type is primitive (#9007)
Fixes an edge case in Java's generator when handling `BinaryData` ->
primitive type conversion where it would default to
`BinaryData.toString()`. This failed for primitive types as a `String`
doesn't implicitly cast to `boolean`, `byte`, `int`, `long`, `float`,
`double`, or `char`.
This is fixed by checking the raw return type for being `!isNullable()`
(only primitives return true for this) and wrapping the
`BinaryData.toString()` logic with `String` -> primitive conversion
calls (`Long.parseLong(String)`, `Byte.parseByte(String)`, etc).
Updated `response.tsp` to include new routes to test this change.1 parent 7c6c412 commit dd644f1
File tree
9 files changed
+1171
-23
lines changed- packages/http-client-java/generator
- http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template
- http-client-generator-test
- src/main
- java/tsptest/response
- implementation
- resources/META-INF
- tsp
9 files changed
+1171
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
151 | | - | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
158 | 163 | | |
159 | 164 | | |
160 | | - | |
161 | | - | |
| 165 | + | |
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
167 | | - | |
168 | | - | |
169 | | - | |
| 171 | + | |
| 172 | + | |
170 | 173 | | |
171 | 174 | | |
172 | 175 | | |
173 | | - | |
| 176 | + | |
174 | 177 | | |
175 | 178 | | |
176 | 179 | | |
177 | | - | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| |||
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
188 | | - | |
189 | | - | |
| 191 | + | |
| 192 | + | |
190 | 193 | | |
191 | | - | |
192 | 194 | | |
193 | | - | |
194 | 195 | | |
195 | 196 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
6 | 14 | | |
7 | 15 | | |
8 | 16 | | |
| |||
337 | 345 | | |
338 | 346 | | |
339 | 347 | | |
340 | | - | |
341 | | - | |
342 | | - | |
| 348 | + | |
343 | 349 | | |
344 | 350 | | |
345 | 351 | | |
| |||
923 | 929 | | |
924 | 930 | | |
925 | 931 | | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
926 | 960 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
212 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
| |||
232 | 238 | | |
233 | 239 | | |
234 | 240 | | |
235 | | - | |
236 | | - | |
237 | | - | |
| 241 | + | |
| 242 | + | |
238 | 243 | | |
239 | | - | |
| 244 | + | |
240 | 245 | | |
241 | 246 | | |
242 | 247 | | |
| |||
0 commit comments