3

Possible Duplicate:
Which debugging tool can list strings internalized?

I would like to find all interned strings, any methods to do that?

Community
  • 1
  • 1
user705414
  • 20,472
  • 39
  • 112
  • 155

2 Answers2

0

AFAIK, Even if you do a heap dump you cannot see this. I suspect its assumed you don't need to know this.

You can assume that all the Strings of loaded class have been interned, but it won't show you String which have been manually interned.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
0

Basically "no", but according to the javadoc of public native String intern():

All literal strings and string-valued constant expressions are interned. String literals are defined in ยง3.10.5 of the Java Language Specification.

So you could parse your own source code to determine what should be interned. Of course, this wouldn't count those String manually interned.

Bohemian
  • 412,405
  • 93
  • 575
  • 722