mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8012656: cache frequently used name strings for DocImpl classes
Reviewed-by: darcy
This commit is contained in:
parent
66dde86ad0
commit
3c7d12fc05
4 changed files with 54 additions and 14 deletions
|
@ -341,8 +341,13 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
* </pre>
|
||||
*/
|
||||
public String name() {
|
||||
return getClassName(tsym, false);
|
||||
if (name == null) {
|
||||
name = getClassName(tsym, false);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Return the qualified class name as a String.
|
||||
|
@ -354,8 +359,13 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
* </pre>
|
||||
*/
|
||||
public String qualifiedName() {
|
||||
return getClassName(tsym, true);
|
||||
if (qualifiedName == null) {
|
||||
qualifiedName = getClassName(tsym, true);
|
||||
}
|
||||
return qualifiedName;
|
||||
}
|
||||
|
||||
private String qualifiedName;
|
||||
|
||||
/**
|
||||
* Return unqualified name of type excluding any dimension information.
|
||||
|
@ -380,8 +390,13 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
|||
* Return the simple name of this type.
|
||||
*/
|
||||
public String simpleTypeName() {
|
||||
return tsym.name.toString();
|
||||
if (simpleTypeName == null) {
|
||||
simpleTypeName = tsym.name.toString();
|
||||
}
|
||||
return simpleTypeName;
|
||||
}
|
||||
|
||||
private String simpleTypeName;
|
||||
|
||||
/**
|
||||
* Return the qualified name and any type parameters.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
|
@ -252,12 +252,22 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
|
|||
}
|
||||
|
||||
public String name() {
|
||||
return sym.name.toString();
|
||||
if (name == null) {
|
||||
name = sym.name.toString();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
public String qualifiedName() {
|
||||
return sym.enclClass().getQualifiedName() + "." + name();
|
||||
if (qualifiedName == null) }
|
||||
qualifiedName = sym.enclClass().getQualifiedName() + "." + name();
|
||||
}
|
||||
return qualifiedName;
|
||||
}
|
||||
|
||||
private String qualifiedName;
|
||||
|
||||
/**
|
||||
* Return the source position of the entity, or null if
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
|
@ -203,12 +203,22 @@ public class MethodDocImpl
|
|||
|
||||
|
||||
public String name() {
|
||||
return sym.name.toString();
|
||||
if (name == null) {
|
||||
name = sym.name.toString();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
public String qualifiedName() {
|
||||
return sym.enclClass().getQualifiedName() + "." + sym.name;
|
||||
if (qualifiedName == null) {
|
||||
qualifiedName = sym.enclClass().getQualifiedName() + "." + sym.name;
|
||||
}
|
||||
return qualifiedName;
|
||||
}
|
||||
|
||||
private String qualifiedName;
|
||||
|
||||
/**
|
||||
* Returns a string representation of this method. Includes the
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
|
@ -334,11 +334,16 @@ public class PackageDocImpl extends DocImpl implements PackageDoc {
|
|||
* Get package name.
|
||||
*/
|
||||
public String qualifiedName() {
|
||||
if (qualifiedName == null) {
|
||||
Name fullname = sym.getQualifiedName();
|
||||
// Some bogus tests depend on the interned "" being returned.
|
||||
// See 6457276.
|
||||
return fullname.isEmpty() ? "" : fullname.toString();
|
||||
qualifiedName = fullname.isEmpty() ? "" : fullname.toString();
|
||||
}
|
||||
return qualifiedName;
|
||||
}
|
||||
|
||||
private String qualifiedName;
|
||||
|
||||
/**
|
||||
* set doc path for an unzipped directory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue