changeset 14026:6f6e9fc90ba2

8141553: [macosx] JDK fails to build with Xcode 7 on 10.11 Reviewed-by: aniyogi, ddehaven, cbensen
author serb
date Fri, 26 Feb 2016 18:51:44 +0300
parents dc4974b4210f
children 9e1ed9bb68e0
files src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m
diffstat 3 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Thu Feb 25 10:22:22 2016 +0530
+++ b/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/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Thu Feb 25 10:22:22 2016 +0530
+++ b/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/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m	Thu Feb 25 10:22:22 2016 +0530
+++ b/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;
 }
 
 /*