8141553: [macosx] JDK fails to build with Xcode 7 on 10.11
authorserb
Fri, 26 Feb 2016 18:51:44 +0300
changeset 36462 dee5ee6606e2
parent 36461 a66465d5a442
child 36463 7b49ca364570
8141553: [macosx] JDK fails to build with Xcode 7 on 10.11 Reviewed-by: aniyogi, ddehaven, cbensen
jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
jdk/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Thu Feb 25 10:22:22 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Fri Feb 26 18:51:44 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -624,7 +624,8 @@
 {
     NSString *selectedText = [self accessibleSelectedText];
     NSAttributedString *styledText = [[NSAttributedString alloc] initWithString:selectedText];
-    NSData *rtfdData = [styledText RTFDFromRange:NSMakeRange(0, [styledText length]) documentAttributes:nil];
+    NSData *rtfdData = [styledText RTFDFromRange:NSMakeRange(0, [styledText length])
+                              documentAttributes:@{NSDocumentTypeDocumentAttribute: NSRTFTextDocumentType}];
     [styledText release];
     return rtfdData;
 }
@@ -681,7 +682,7 @@
     if ([[pboard types] containsObject:NSRTFDPboardType])
     {
         NSData *rtfdData = [pboard dataForType:NSRTFDPboardType];
-        NSAttributedString *styledText = [[NSAttributedString alloc] initWithRTFD:rtfdData documentAttributes:nil];
+        NSAttributedString *styledText = [[NSAttributedString alloc] initWithRTFD:rtfdData documentAttributes:NULL];
         NSString *text = [styledText string];
         [styledText release];
 
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Thu Feb 25 10:22:22 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Fri Feb 26 18:51:44 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -743,9 +743,10 @@
 JNIEXPORT jint JNICALL DEF_JNI_OnLoad(JavaVM *vm, void *reserved) {
     OSXAPP_SetJavaVM(vm);
 
-    // We need to let Foundation know that this is a multithreaded application, if it isn't already.
+    // We need to let Foundation know that this is a multithreaded application,
+    // if it isn't already.
     if (![NSThread isMultiThreaded]) {
-        [NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
+        [[[[NSThread alloc] init] autorelease] start];
     }
 
     return JNI_VERSION_1_4;
--- a/jdk/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m	Thu Feb 25 10:22:22 2016 +0530
+++ b/jdk/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m	Fri Feb 26 18:51:44 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,25 +213,23 @@
  */
 
 JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1moveToTrash
-(JNIEnv *env, jclass clz, jstring url)
+(JNIEnv *env, jclass clz, jstring fileName)
 {
-        __block jboolean returnValue = JNI_FALSE;
+    __block BOOL returnValue = NO;
 JNF_COCOA_ENTER(env);
 
-    NSString *path = JNFNormalizedNSStringForPath(env, url);
+    NSString * path = JNFNormalizedNSStringForPath(env, fileName);
+    NSURL *url = [NSURL fileURLWithPath:path];
     [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
-        NSInteger res = 0;
-        [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation
-                                                     source:[path stringByDeletingLastPathComponent]
-                                                destination:nil
-                                                      files:[NSArray arrayWithObject:[path lastPathComponent]]
-                                                        tag:&res];
-        returnValue = (res == 0);
+
+        returnValue  = [[NSFileManager defaultManager] trashItemAtURL:url
+                                                     resultingItemURL:nil
+                                                                error:nil];
     }];
 
 JNF_COCOA_EXIT(env);
 
-        return returnValue;
+        return returnValue ? JNI_TRUE: JNI_FALSE;
 }
 
 /*