< prev index next >

src/java.base/share/native/libjava/System.c

Print this page
rev 48343 : imported patch JDK-8173382-classfile-version


  97         r = (*env)->CallObjectMethod(env, props, removeID, jkey); \
  98         if ((*env)->ExceptionOccurred(env)) return NULL;          \
  99         (*env)->DeleteLocalRef(env, jkey);                        \
 100         (*env)->DeleteLocalRef(env, r);                           \
 101     } else ((void) 0)
 102 #define GETPROP(props, key, jret)                                     \
 103     if (1) {                                                          \
 104         jstring jkey = JNU_NewStringPlatform(env, key);               \
 105         if (jkey == NULL) return NULL;                                \
 106         jret = (*env)->CallObjectMethod(env, props, getPropID, jkey); \
 107         if ((*env)->ExceptionOccurred(env)) return NULL;              \
 108         (*env)->DeleteLocalRef(env, jkey);                            \
 109     } else ((void) 0)
 110 
 111 #ifndef VENDOR /* Third party may overwrite this. */
 112 #define VENDOR "Oracle Corporation"
 113 #define VENDOR_URL "http://java.oracle.com/"
 114 #define VENDOR_URL_BUG "http://bugreport.java.com/bugreport/"
 115 #endif
 116 
 117 #define JAVA_MAX_SUPPORTED_VERSION 54
 118 #define JAVA_MAX_SUPPORTED_MINOR_VERSION 0
 119 
 120 #ifdef JAVA_SPECIFICATION_VENDOR /* Third party may NOT overwrite this. */
 121   #error "ERROR: No override of JAVA_SPECIFICATION_VENDOR is allowed"
 122 #else
 123   #define JAVA_SPECIFICATION_VENDOR "Oracle Corporation"
 124 #endif
 125 
 126 static int fmtdefault; // boolean value
 127 jobject fillI18nProps(JNIEnv *env, jobject props, char *baseKey,
 128                       char *platformDispVal, char *platformFmtVal,
 129                       jmethodID putID, jmethodID getPropID) {
 130     jstring jVMBaseVal = NULL;
 131 
 132     GETPROP(props, baseKey, jVMBaseVal);
 133     if (jVMBaseVal) {
 134         // user specified the base property.  there's nothing to do here.
 135         (*env)->DeleteLocalRef(env, jVMBaseVal);
 136     } else {
 137         char buf[64];
 138         jstring jVMVal = NULL;
 139         const char *baseVal = "";


 202     CHECK_NULL_RETURN(removeID, NULL);
 203 
 204     getPropID = (*env)->GetMethodID(env,
 205                                     (*env)->GetObjectClass(env, props),
 206                                     "getProperty",
 207             "(Ljava/lang/String;)Ljava/lang/String;");
 208     CHECK_NULL_RETURN(getPropID, NULL);
 209 
 210     PUTPROP(props, "java.specification.version",
 211             VERSION_SPECIFICATION);
 212     PUTPROP(props, "java.specification.name",
 213             "Java Platform API Specification");
 214     PUTPROP(props, "java.specification.vendor",
 215             JAVA_SPECIFICATION_VENDOR);
 216 
 217     PUTPROP(props, "java.version", VERSION_SHORT);
 218     PUTPROP(props, "java.vendor", VENDOR);
 219     PUTPROP(props, "java.vendor.url", VENDOR_URL);
 220     PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
 221 
 222     jio_snprintf(buf, sizeof(buf), "%d.%d", JAVA_MAX_SUPPORTED_VERSION,
 223                                             JAVA_MAX_SUPPORTED_MINOR_VERSION);
 224     PUTPROP(props, "java.class.version", buf);
 225 
 226     if (sprops->awt_toolkit) {
 227         PUTPROP(props, "awt.toolkit", sprops->awt_toolkit);
 228     }
 229 #ifdef MACOSX
 230     if (sprops->awt_headless) {
 231         PUTPROP(props, "java.awt.headless", sprops->awt_headless);
 232     }
 233 #endif
 234 
 235     /* os properties */
 236     PUTPROP(props, "os.name", sprops->os_name);
 237     PUTPROP(props, "os.version", sprops->os_version);
 238     PUTPROP(props, "os.arch", sprops->os_arch);
 239 
 240 #ifdef JDK_ARCH_ABI_PROP_NAME
 241     PUTPROP(props, "sun.arch.abi", sprops->sun_arch_abi);
 242 #endif
 243 




  97         r = (*env)->CallObjectMethod(env, props, removeID, jkey); \
  98         if ((*env)->ExceptionOccurred(env)) return NULL;          \
  99         (*env)->DeleteLocalRef(env, jkey);                        \
 100         (*env)->DeleteLocalRef(env, r);                           \
 101     } else ((void) 0)
 102 #define GETPROP(props, key, jret)                                     \
 103     if (1) {                                                          \
 104         jstring jkey = JNU_NewStringPlatform(env, key);               \
 105         if (jkey == NULL) return NULL;                                \
 106         jret = (*env)->CallObjectMethod(env, props, getPropID, jkey); \
 107         if ((*env)->ExceptionOccurred(env)) return NULL;              \
 108         (*env)->DeleteLocalRef(env, jkey);                            \
 109     } else ((void) 0)
 110 
 111 #ifndef VENDOR /* Third party may overwrite this. */
 112 #define VENDOR "Oracle Corporation"
 113 #define VENDOR_URL "http://java.oracle.com/"
 114 #define VENDOR_URL_BUG "http://bugreport.java.com/bugreport/"
 115 #endif
 116 



 117 #ifdef JAVA_SPECIFICATION_VENDOR /* Third party may NOT overwrite this. */
 118   #error "ERROR: No override of JAVA_SPECIFICATION_VENDOR is allowed"
 119 #else
 120   #define JAVA_SPECIFICATION_VENDOR "Oracle Corporation"
 121 #endif
 122 
 123 static int fmtdefault; // boolean value
 124 jobject fillI18nProps(JNIEnv *env, jobject props, char *baseKey,
 125                       char *platformDispVal, char *platformFmtVal,
 126                       jmethodID putID, jmethodID getPropID) {
 127     jstring jVMBaseVal = NULL;
 128 
 129     GETPROP(props, baseKey, jVMBaseVal);
 130     if (jVMBaseVal) {
 131         // user specified the base property.  there's nothing to do here.
 132         (*env)->DeleteLocalRef(env, jVMBaseVal);
 133     } else {
 134         char buf[64];
 135         jstring jVMVal = NULL;
 136         const char *baseVal = "";


 199     CHECK_NULL_RETURN(removeID, NULL);
 200 
 201     getPropID = (*env)->GetMethodID(env,
 202                                     (*env)->GetObjectClass(env, props),
 203                                     "getProperty",
 204             "(Ljava/lang/String;)Ljava/lang/String;");
 205     CHECK_NULL_RETURN(getPropID, NULL);
 206 
 207     PUTPROP(props, "java.specification.version",
 208             VERSION_SPECIFICATION);
 209     PUTPROP(props, "java.specification.name",
 210             "Java Platform API Specification");
 211     PUTPROP(props, "java.specification.vendor",
 212             JAVA_SPECIFICATION_VENDOR);
 213 
 214     PUTPROP(props, "java.version", VERSION_SHORT);
 215     PUTPROP(props, "java.vendor", VENDOR);
 216     PUTPROP(props, "java.vendor.url", VENDOR_URL);
 217     PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
 218 
 219     jio_snprintf(buf, sizeof(buf), "%d.%d", JVM_CLASSFILE_MAJOR_VERSION,
 220                                             JVM_CLASSFILE_MINOR_VERSION);
 221     PUTPROP(props, "java.class.version", buf);
 222 
 223     if (sprops->awt_toolkit) {
 224         PUTPROP(props, "awt.toolkit", sprops->awt_toolkit);
 225     }
 226 #ifdef MACOSX
 227     if (sprops->awt_headless) {
 228         PUTPROP(props, "java.awt.headless", sprops->awt_headless);
 229     }
 230 #endif
 231 
 232     /* os properties */
 233     PUTPROP(props, "os.name", sprops->os_name);
 234     PUTPROP(props, "os.version", sprops->os_version);
 235     PUTPROP(props, "os.arch", sprops->os_arch);
 236 
 237 #ifdef JDK_ARCH_ABI_PROP_NAME
 238     PUTPROP(props, "sun.arch.abi", sprops->sun_arch_abi);
 239 #endif
 240 


< prev index next >