8140723: Remove source code conditionalized on JAVASE_EMBEDDED
authordholmes
Tue, 26 Jul 2016 23:52:29 -0400
changeset 40192 64c0b3d47afb
parent 40191 5a91f84138ed
child 40194 7b26e83709cd
8140723: Remove source code conditionalized on JAVASE_EMBEDDED Reviewed-by: psandoz, alanb, alexsch
jdk/make/lib/Awt2dLibraries.gmk
jdk/src/java.base/share/classes/java/lang/VersionProps.java.template
jdk/src/java.base/unix/native/libjava/java_props_md.c
jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
jdk/src/java.desktop/unix/native/libjawt/jawt.c
jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java
--- a/jdk/make/lib/Awt2dLibraries.gmk	Tue Jul 26 16:18:24 2016 -0700
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Tue Jul 26 23:52:29 2016 -0400
@@ -350,8 +350,6 @@
       BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
       # initializing a declared 'extern'
       BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
-      # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED)
-      BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w
    endif
 
     $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
--- a/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template	Tue Jul 26 16:18:24 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template	Tue Jul 26 23:52:29 2016 -0400
@@ -166,10 +166,6 @@
 
         ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
 
-        if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
-            // embedded builds report headless state
-            ps.print(", headless");
-        }
         ps.println(')');
 
         /* Third line: JVM information. */
--- a/jdk/src/java.base/unix/native/libjava/java_props_md.c	Tue Jul 26 16:18:24 2016 -0700
+++ b/jdk/src/java.base/unix/native/libjava/java_props_md.c	Tue Jul 26 23:52:29 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -68,11 +68,6 @@
 #endif
 #endif /* !_ALLBSD_SOURCE */
 
-#ifdef JAVASE_EMBEDDED
-#include <dlfcn.h>
-#include <sys/stat.h>
-#endif
-
 /* Take an array of string pairs (map of key->value) and a string (key).
  * Examine each pair in the map to see if the first string (key) matches the
  * string.  If so, store the second string of the pair (value) in the value and
@@ -350,36 +345,6 @@
     return 1;
 }
 
-#ifdef JAVASE_EMBEDDED
-/* Determine the default embedded toolkit based on whether libawt_xawt
- * exists in the JRE. This can still be overridden by -Dawt.toolkit=XXX
- */
-static char* getEmbeddedToolkit() {
-    Dl_info dlinfo;
-    char buf[MAXPATHLEN];
-    int32_t len;
-    char *p;
-    struct stat statbuf;
-
-    /* Get address of this library and the directory containing it. */
-    dladdr((void *)getEmbeddedToolkit, &dlinfo);
-    realpath((char *)dlinfo.dli_fname, buf);
-    len = strlen(buf);
-    p = strrchr(buf, '/');
-    /* Default AWT Toolkit on Linux and Solaris is XAWT (libawt_xawt.so). */
-    strncpy(p, "/libawt_xawt.so", MAXPATHLEN-len-1);
-    /* Check if it exists */
-    if (stat(buf, &statbuf) == -1 && errno == ENOENT) {
-        /* No - this is a reduced-headless-jre so use special HToolkit */
-        return "sun.awt.HToolkit";
-    }
-    else {
-        /* Yes - this is a headful JRE so fallback to SE defaults */
-        return NULL;
-    }
-}
-#endif
-
 /* This function gets called very early, before VM_CALLS are setup.
  * Do not use any of the VM_CALLS entries!!!
  */
@@ -424,10 +389,6 @@
     sprops.awt_headless = isInAquaSession() ? NULL : "true";
 #else
     sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
-#ifdef JAVASE_EMBEDDED
-    sprops.awt_toolkit = getEmbeddedToolkit();
-    if (sprops.awt_toolkit == NULL) // default as below
-#endif
     sprops.awt_toolkit = "sun.awt.X11.XToolkit";
 #endif
 
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Tue Jul 26 16:18:24 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Tue Jul 26 23:52:29 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -122,11 +122,7 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout
   (JNIEnv *env, jclass clazz)
 {
-#ifndef JAVASE_EMBEDDED
     return (jlong) 2000;
-#else
-    return (jlong) 10000;
-#endif
 }
 
 /*
@@ -369,12 +365,7 @@
 #define AWT_READPIPE            (awt_pipe_fds[0])
 #define AWT_WRITEPIPE           (awt_pipe_fds[1])
 
-#ifdef JAVASE_EMBEDDED
-  #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) /* milliseconds */
-#else
-  #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
-#endif
-
+#define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
 #define DEF_AWT_FLUSH_TIMEOUT ((uint32_t)100) /* milliseconds */
 #define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */
 
@@ -391,11 +382,7 @@
 
 // Static fields
 
-#ifdef JAVASE_EMBEDDED
-  static int          awt_poll_alg = AWT_POLL_AGING_FAST;
-#else
-  static int          awt_poll_alg = AWT_POLL_AGING_SLOW;
-#endif
+static int          awt_poll_alg = AWT_POLL_AGING_SLOW;
 
 static uint32_t AWT_FLUSH_TIMEOUT  =  DEF_AWT_FLUSH_TIMEOUT; /* milliseconds */
 static uint32_t AWT_MAX_POLL_TIMEOUT = DEF_AWT_MAX_POLL_TIMEOUT; /* milliseconds */
--- a/jdk/src/java.desktop/unix/native/libjawt/jawt.c	Tue Jul 26 16:18:24 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libjawt/jawt.c	Tue Jul 26 23:52:29 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -39,10 +39,6 @@
  */
 JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
 {
-#if defined(JAVASE_EMBEDDED) && defined(HEADLESS)
-    /* there are no AWT libs available at all */
-    return JNI_FALSE;
-#else
     if (awt == NULL) {
         return JNI_FALSE;
     }
@@ -62,5 +58,4 @@
     }
 
     return JNI_TRUE;
-#endif
 }
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java	Tue Jul 26 16:18:24 2016 -0700
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java	Tue Jul 26 23:52:29 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -58,10 +58,6 @@
         return vmName.endsWith(" Minimal VM");
     }
 
-    public static boolean isEmbedded() {
-        return vmName.contains("Embedded");
-    }
-
     public static boolean isTieredSupported() {
         return compiler.contains("Tiered Compilers");
     }