Azure / Azure/azure-sdk-for-java
Bug tracking for annotation processor
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 2.2k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 178
Description
Tracking list of bugs found while trying to performance test a library generated with annotation processor:
1. ~~Variable name conflict when creating the `HttpRequest.uri` if there is a method parameter with the name `url`. `String url` is hardcoded as the variable name to use, ran across a case in Storage where the Swagger/TypeSpec defines a method parameter with name `url` which resulted in `String url = url + ...`.~~
2. ~~Handling of adding HTTP headers to `HttpRequest` will add them even if the value is `null`. In `SwaggerMethodParser` in `azure-core` null valued headers were excluded from being added. Worse, the null value will be stringified as "null", which makes any temporary fixes for cleaning more difficult as "null" could be a legitimate value.~~
3. ~~When the network response status code doesn't match what's expected a very basic exception is thrown that loses all information provided by the error response. It is simply `throw new RuntimeException("Unexpected response code: " + responseCode);`, which isn't enough information to troubleshoot. Returning a proper exception needs to be done.~~
4. ~~Storage Blob download has re-introduced a previous bug where `Content-Type` is being inspected before returning the download body, where Storage Blob allows providing metadata about the blob such as a JSON file being `Content-Type: application/json`. We want to explicitly ignore that for Storage Blob, and other APIs that may provide the same functionality, as we don't know how to handle the payload and should be returning a generic stream of bytes for the caller to manage converting to more specific data formats.~~
5. ~~Methods with headers call `HttpHeaderName.fromString` each time when the header name isn't a constant. Annotation processing should be updated to collect all `HttpHeaderName.fromString` calls and convert those into statics on the service interface implementation. Possibly a common constants file shared across all generated interfaces as many services use the same headers in multiple service interfaces.~~
6. URI creation should use `UriBuilder` and remove the need for handling query parameters in a `LinkedHashMap` when collecting them to be handled.
7. Service interface implementations generate with `JsonSerializer` and `XmlSerializer` class level fields even when they aren't used. And a `ClientLogger` static variable as well. Those should be added at the end of code generation after we know they'll be used.
Contributor guide
Assessment
This issue has not been assessed yet.