mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8216302: StackTraceElement::fill_in can use cached Class.name
Reviewed-by: coleenp, dholmes, mchung
This commit is contained in:
parent
79c92eadc3
commit
f44e59355c
8 changed files with 140 additions and 31 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2019, 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
|
||||
|
@ -795,14 +795,13 @@ public final class Class<T> implements java.io.Serializable,
|
|||
*/
|
||||
public String getName() {
|
||||
String name = this.name;
|
||||
if (name == null)
|
||||
this.name = name = getName0();
|
||||
return name;
|
||||
return name != null ? name : initClassName();
|
||||
}
|
||||
|
||||
// cache the name to reduce the number of calls into the VM
|
||||
// Cache the name to reduce the number of calls into the VM.
|
||||
// This field would be set by VM itself during initClassName call.
|
||||
private transient String name;
|
||||
private native String getName0();
|
||||
private native String initClassName();
|
||||
|
||||
/**
|
||||
* Returns the class loader for the class. Some implementations may use
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue