< prev index next >
src/java.base/share/classes/com/sun/java/util/jar/pack/PackageWriter.java
Print this page
*** 827,837 ****
void collectAttributeLayouts() {
maxFlags = new int[ATTR_CONTEXT_LIMIT];
allLayouts = new FixedList<>(ATTR_CONTEXT_LIMIT);
for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
! allLayouts.set(i, new HashMap<Attribute.Layout, int[]>());
}
// Collect maxFlags and allLayouts.
for (Class cls : pkg.classes) {
visitAttributeLayoutsIn(ATTR_CONTEXT_CLASS, cls);
for (Class.Field f : cls.getFields()) {
--- 827,837 ----
void collectAttributeLayouts() {
maxFlags = new int[ATTR_CONTEXT_LIMIT];
allLayouts = new FixedList<>(ATTR_CONTEXT_LIMIT);
for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
! allLayouts.set(i, new HashMap<>());
}
// Collect maxFlags and allLayouts.
for (Class cls : pkg.classes) {
visitAttributeLayoutsIn(ATTR_CONTEXT_CLASS, cls);
for (Class.Field f : cls.getFields()) {
*** 890,900 ****
new Map.Entry[defMap.size()];
defMap.entrySet().toArray(layoutsAndCounts);
// Sort by count, most frequent first.
// Predefs. participate in this sort, though it does not matter.
Arrays.sort(layoutsAndCounts,
! new Comparator<Map.Entry<Attribute.Layout, int[]>>() {
public int compare(Map.Entry<Attribute.Layout, int[]> e0,
Map.Entry<Attribute.Layout, int[]> e1) {
// Primary sort key is count, reversed.
int r = -(e0.getValue()[0] - e1.getValue()[0]);
if (r != 0) return r;
--- 890,900 ----
new Map.Entry[defMap.size()];
defMap.entrySet().toArray(layoutsAndCounts);
// Sort by count, most frequent first.
// Predefs. participate in this sort, though it does not matter.
Arrays.sort(layoutsAndCounts,
! new Comparator<>() {
public int compare(Map.Entry<Attribute.Layout, int[]> e0,
Map.Entry<Attribute.Layout, int[]> e1) {
// Primary sort key is count, reversed.
int r = -(e0.getValue()[0] - e1.getValue()[0]);
if (r != 0) return r;
*** 1008,1018 ****
}
// Sort the new attr defs into some "natural" order.
int numAttrDefs = defList.size();
Object[][] defs = new Object[numAttrDefs][];
defList.toArray(defs);
! Arrays.sort(defs, new Comparator<Object[]>() {
public int compare(Object[] a0, Object[] a1) {
// Primary sort key is attr def header.
@SuppressWarnings("unchecked")
int r = ((Comparable)a0[0]).compareTo(a1[0]);
if (r != 0) return r;
--- 1008,1018 ----
}
// Sort the new attr defs into some "natural" order.
int numAttrDefs = defList.size();
Object[][] defs = new Object[numAttrDefs][];
defList.toArray(defs);
! Arrays.sort(defs, new Comparator<>() {
public int compare(Object[] a0, Object[] a1) {
// Primary sort key is attr def header.
@SuppressWarnings("unchecked")
int r = ((Comparable)a0[0]).compareTo(a1[0]);
if (r != 0) return r;
< prev index next >