< prev index next >

src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java

Print this page




1134         //code_bands.doneDisbursing(); // still need to read code attrs
1135         //class_bands.doneDisbursing(); // still need to read code attrs
1136         return classes;
1137     }
1138 
1139     private int getOutputIndex(Entry e) {
1140         // Output CPs do not contain signatures.
1141         assert(e.tag != CONSTANT_Signature);
1142         int k = pkg.cp.untypedIndexOf(e);
1143         // In the output ordering, input signatures can serve
1144         // in place of Utf8s.
1145         if (k >= 0)
1146             return k;
1147         if (e.tag == CONSTANT_Utf8) {
1148             Entry se = utf8Signatures.get(e);
1149             return pkg.cp.untypedIndexOf(se);
1150         }
1151         return -1;
1152     }
1153 
1154     Comparator<Entry> entryOutputOrder = new Comparator<Entry>() {
1155         public int compare(Entry e0, Entry e1) {
1156             int k0 = getOutputIndex(e0);
1157             int k1 = getOutputIndex(e1);
1158             if (k0 >= 0 && k1 >= 0)
1159                 // If both have keys, use the keys.
1160                 return k0 - k1;
1161             if (k0 == k1)
1162                 // If neither have keys, use their native tags & spellings.
1163                 return e0.compareTo(e1);
1164             // Otherwise, the guy with the key comes first.
1165             return (k0 >= 0)? 0-1: 1-0;
1166         }
1167     };
1168 
1169     void reconstructClass(Class cls) {
1170         if (verbose > 1)  Utils.log.fine("reconstruct "+cls);
1171 
1172         // check for local .ClassFile.version
1173         Attribute retroVersion = cls.getAttribute(attrClassFileVersion);
1174         if (retroVersion != null) {




1134         //code_bands.doneDisbursing(); // still need to read code attrs
1135         //class_bands.doneDisbursing(); // still need to read code attrs
1136         return classes;
1137     }
1138 
1139     private int getOutputIndex(Entry e) {
1140         // Output CPs do not contain signatures.
1141         assert(e.tag != CONSTANT_Signature);
1142         int k = pkg.cp.untypedIndexOf(e);
1143         // In the output ordering, input signatures can serve
1144         // in place of Utf8s.
1145         if (k >= 0)
1146             return k;
1147         if (e.tag == CONSTANT_Utf8) {
1148             Entry se = utf8Signatures.get(e);
1149             return pkg.cp.untypedIndexOf(se);
1150         }
1151         return -1;
1152     }
1153 
1154     Comparator<Entry> entryOutputOrder = new Comparator<>() {
1155         public int compare(Entry e0, Entry e1) {
1156             int k0 = getOutputIndex(e0);
1157             int k1 = getOutputIndex(e1);
1158             if (k0 >= 0 && k1 >= 0)
1159                 // If both have keys, use the keys.
1160                 return k0 - k1;
1161             if (k0 == k1)
1162                 // If neither have keys, use their native tags & spellings.
1163                 return e0.compareTo(e1);
1164             // Otherwise, the guy with the key comes first.
1165             return (k0 >= 0)? 0-1: 1-0;
1166         }
1167     };
1168 
1169     void reconstructClass(Class cls) {
1170         if (verbose > 1)  Utils.log.fine("reconstruct "+cls);
1171 
1172         // check for local .ClassFile.version
1173         Attribute retroVersion = cls.getAttribute(attrClassFileVersion);
1174         if (retroVersion != null) {


< prev index next >