< prev index next >
src/java.base/share/classes/java/lang/Class.java
Print this page
@@ -531,12 +531,12 @@
@Deprecated(since="9")
public T newInstance()
throws InstantiationException, IllegalAccessException
{
if (this.isValue()) {
- throw new UnsupportedOperationException("newInstance on a value class "
- + this.getName());
+ throw new IllegalAccessException(
+ "cannot create new instance of value class " + this.getName());
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
checkMemberAccess(sm, Member.PUBLIC, Reflection.getCallerClass(), false);
< prev index next >