File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/java.base/macosx/native/libjava Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -236,11 +236,16 @@ void setOSNameAndVersion(java_props_t *sprops) {
236
236
237
237
char * osVersionCStr = NULL ;
238
238
// Mac OS 10.9 includes the [NSProcessInfo operatingSystemVersion] function,
239
- // but it's not in the 10.9 SDK. So, call it via objc_msgSend_stret .
239
+ // but it's not in the 10.9 SDK. So, call it via NSInvocation .
240
240
if ([[NSProcessInfo processInfo ] respondsToSelector :@selector (operatingSystemVersion )]) {
241
- OSVerStruct (* procInfoFn )(id rec , SEL sel ) = (OSVerStruct (* )(id , SEL ))objc_msgSend_stret ;
242
- OSVerStruct osVer = procInfoFn ([NSProcessInfo processInfo ],
243
- @selector (operatingSystemVersion ));
241
+ OSVerStruct osVer ;
242
+ NSMethodSignature * sig = [[NSProcessInfo processInfo ] methodSignatureForSelector :
243
+ @selector (operatingSystemVersion )];
244
+ NSInvocation * invoke = [NSInvocation invocationWithMethodSignature :sig ];
245
+ invoke .selector = @selector (operatingSystemVersion );
246
+ [invoke invokeWithTarget :[NSProcessInfo processInfo ]];
247
+ [invoke getReturnValue :& osVer ];
248
+
244
249
NSString * nsVerStr ;
245
250
if (osVer .patchVersion == 0 ) { // Omit trailing ".0"
246
251
nsVerStr = [NSString stringWithFormat :@"%ld.%ld" ,
You can’t perform that action at this time.
0 commit comments