This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
this is jdk issue 4834881 - they felt that this rfe really applied to an ide like netbeans and asked me to file it as rfe - I'm not sure if nb already does this. A DESCRIPTION OF THE REQUEST : Maintaining resource bundle properties files can often be a tediou s task. Over time, a properties file can become filled with strin gs that are no longer used. Currently, the only way to fix this i s to manually go through the list of strings in the properties fil e and ensure that each string is actually being used in a java fil e somewhere. JUSTIFICATION : Increases efficiency of I18n tasks, since unused strings don't nee d to be translated. EXPECTED VERSUS ACTUAL BEHAVIOR : It would be nice if support was built into the compiler to optiona lly verify the contents of properties files and display a message for each string that is missing or not used. I don't think it's possible to determine this with 100% accuracy, since the keys can be determined at runtime. However, most of the time developers use string literals as keys, so it might be possi ble to develop something useful.
We already have Test internatinalization wizard (the name was suggested by HIE) that use some heuristics to detect missing keys for given Java source. It's even more complicated to automaticaly detect non-referenced strings. The problem is how to define non-referenced. E.g. if you look over NetBeans codebase you can find that properties are used to localize XML documents. They ate also used to localize manifests. They are also used to localize editor token names. None of above examples has pairing line containing direct reference to key in a Java source. Properties file is secondary structure that does no know its primary referees and cannot be reliably used in key garbage decision process. It would be possible for keys annotated by referencing file(s). On the other hand it's real problem and we could address it by action that would provide hints leaving final action/key_removal on user's decision.
Yes, I guess some tool offering candidates for removal might be possible and useful.