Ticket #2528081 (closed enhancement)


Opened: 01/7/11
Last modified: 12/12/12
Status: closed
Type: enhancement
Resolution: wontfix


Adam Moore
Target Release:
Summary: ScriptOrFnScope identifiers and hints properties should be sorted

In the class ScriptOrFnScope, the two properties 'identifiers' and 'hints' should be sorted. Currently, they are just Hashtables, which means their order is not guaranteed.

Later in the code, when javascript identifiers are being obfuscated, the order of the identifiers for a scope are not guaranteed. Therefore, when we make sure our javascript has been correctly
minified and obfuscated, it's possible that the obfuscation can change between two builds (which has happened a few times for us over the months/years).

Suggested fix:

file: ScriptOrFnScope
line: 18

private Hashtable identifiers = new Hashtable()

private SortedMap<String,JavaScriptIdentifier> identifiers = new TreeMap();

and then later on in the same file, in method private ArrayList getUsedSymbols() { .. } :

Enumeration elements = identifiers.elements();
Iterator iterator = identifiers.keySet().iterator();

JavaScriptIdentifier identifier = (JavaScriptIdentifier) elements.nextElement();

for(String key : identifiers.keySet())

JavaScriptIdentifier identifier = identifiers.get(key);

and I think I had to change the code (in that same file) in one more place.

Anyways, you guys are pro at this stuff, so i'm not going to tell you what to do in the code. I'm not a Java programmer, so I'm not really sure if a TreeMap is the right solution.

But it would be so so so helpful if this enhancement could be implimented into the main code base.


Type: enhancement Observed in Version: 2.4.2
Component: YUICompressor Severity: S3 (normal)
Assigned To: Adam Moore Target Release:
Location: Priority:
Tags: Relates To:
Browsers: N/A
Test Information:

Change History

Jenny Donnelly

YUI Developer

Posted: 12/12/12
  • resolution changed to wontfix
  • status changed from new to closed

Thank you for your bug report. We are deprecating YUI Compressor in favor of yuglify. Please see our announcement for more information: http://www.yuiblog.com/blog/2012/10/16/state-of-yui-compressor/. We will consider migrating these legacy tickets to GitHub if there are community maintainers willing to step up and own them.