src/share/classes/java/lang/Class.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/classes/java/lang/Class.java Fri Sep 5 15:02:48 2014
--- new/src/share/classes/java/lang/Class.java Fri Sep 5 15:02:45 2014
*** 1,7 ****
--- 1,7 ----
/*
! * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 128,142 ****
--- 128,146 ----
static {
registerNatives();
}
/*
* Constructor. Only the Java Virtual Machine creates Class
* objects.
*/
private Class() {}
+ * Private constructor. Only the Java Virtual Machine creates Class objects.
+ * This constructor is not used and prevents the default constructor being
+ * generated.
+ */
+ 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
* string "class" or "interface", followed by a space, and then by the
* fully qualified name of the class in the format returned by
*** 675,686 ****
--- 679,692 ----
}
return cl;
}
// 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
* type variables declared by the generic declaration represented by this
* {@code GenericDeclaration} object, in declaration order. Returns an
src/share/classes/java/lang/Class.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File