--- a/jdk/src/share/classes/java/lang/Class.java Fri Jun 20 10:10:27 2014 -0700
+++ b/jdk/src/share/classes/java/lang/Class.java Tue Jun 24 11:23:34 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2014, 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
@@ -130,11 +130,15 @@
}
/*
- * Constructor. Only the Java Virtual Machine creates Class
- * objects.
+ * Private constructor. Only the Java Virtual Machine creates Class objects.
+ * This constructor is not used and prevents the default constructor being
+ * generated.
*/
- private Class() {}
-
+ private Class(ClassLoader loader) {
+ // Initialize final field for classLoader. The initialization value of non-null
+ // prevents future JIT optimizations from assuming this final field is null.
+ classLoader = loader;
+ }
/**
* Converts the object to a string. The string representation is the
@@ -677,8 +681,10 @@
}
// Package-private to allow ClassLoader access
- native ClassLoader getClassLoader0();
-
+ ClassLoader getClassLoader0() { return classLoader; }
+
+ // Initialized in JVM not by private constructor
+ private final ClassLoader classLoader;
/**
* Returns an array of {@code TypeVariable} objects that represent the