spring-native icon indicating copy to clipboard operation
spring-native copied to clipboard

aot seems to ignore @MethodHint with primitive type parameter

Open lambliesdown opened this issue 2 years ago • 0 comments

While trying to track down an issue with the HttpComponentsClientHttpRequestFactory I found the following. I have a @NativeHint similar to the ClientHttpRequestFactoryHints.

@NativeHint(types = { @TypeHint(types = org.springframework.http.client.HttpComponentsClientHttpRequestFactory.class, methods = { @MethodHint(name = "setConnectTimeout", parameterTypes = int.class), @MethodHint(name = "setReadTimeout", parameterTypes = int.class), @MethodHint(name = "setHttpClient", parameterTypes = HttpClient.class), @MethodHint(name = "setBufferRequestBody", parameterTypes = boolean.class), }) })

Running 'gradle generateAot' on this generates { "name": "org.springframework.http.client.HttpComponentsClientHttpRequestFactory", "allDeclaredConstructors": true, "methods": [ { "name": "setHttpClient", "parameterTypes": [ "org.apache.http.client.HttpClient" ] } ] }

If you specify a non-primitive type parameter, the method shows up.

The @NativeHint in ClientHttpRequestFactoryHints generates { "name": "org.springframework.http.client.HttpComponentsClientHttpRequestFactory", "condition": { "typeReachable": "org.apache.http.client.HttpClient" }, "allDeclaredConstructors": true },

lambliesdown avatar May 18 '22 11:05 lambliesdown