Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 43970 invoked from network); 25 Aug 2010 15:23:56 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 25 Aug 2010 15:23:56 -0000 Received: (qmail 58224 invoked by uid 500); 25 Aug 2010 15:23:56 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 58145 invoked by uid 500); 25 Aug 2010 15:23:56 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 58138 invoked by uid 99); 25 Aug 2010 15:23:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Aug 2010 15:23:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Aug 2010 15:23:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DB67423889FA; Wed, 25 Aug 2010 15:22:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r989168 - in /harmony/enhanced/java/trunk/classlib/modules/pack200/src: main/java/org/apache/harmony/pack200/ main/java/org/apache/harmony/unpack200/ test/java/org/apache/harmony/pack200/tests/ test/java/org/apache/harmony/unpack200/tests/ ... Date: Wed, 25 Aug 2010 15:22:36 -0000 To: commits@harmony.apache.org From: sjanuary@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100825152236.DB67423889FA@eris.apache.org> Author: sjanuary Date: Wed Aug 25 15:22:36 2010 New Revision: 989168 URL: http://svn.apache.org/viewvc?rev=989168&view=rev Log: Pack200 - more testing for annotations and some associated bug fixes Added: harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations2unpacked.jar (with props) Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java Wed Aug 25 15:22:36 2010 @@ -59,17 +59,19 @@ public class AttributeDefinitionBands ex for (int i = 0; i < attributePrototypes.length; i++) { NewAttribute newAttribute = (NewAttribute) attributePrototypes[i]; - if (newAttribute.isContextClass()) { - classLayouts.put(newAttribute.type, newAttribute.getLayout()); - } - if (newAttribute.isContextMethod()) { - methodLayouts.put(newAttribute.type, newAttribute.getLayout()); - } - if (newAttribute.isContextField()) { - fieldLayouts.put(newAttribute.type, newAttribute.getLayout()); - } - if (newAttribute.isContextCode()) { - codeLayouts.put(newAttribute.type, newAttribute.getLayout()); + if(!(newAttribute instanceof NewAttribute.ErrorAttribute) && !(newAttribute instanceof NewAttribute.PassAttribute) && !(newAttribute instanceof NewAttribute.StripAttribute)) { + if (newAttribute.isContextClass()) { + classLayouts.put(newAttribute.type, newAttribute.getLayout()); + } + if (newAttribute.isContextMethod()) { + methodLayouts.put(newAttribute.type, newAttribute.getLayout()); + } + if (newAttribute.isContextField()) { + fieldLayouts.put(newAttribute.type, newAttribute.getLayout()); + } + if (newAttribute.isContextCode()) { + codeLayouts.put(newAttribute.type, newAttribute.getLayout()); + } } } if (classLayouts.keySet().size() > 7) { Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java Wed Aug 25 15:22:36 2010 @@ -1327,7 +1327,7 @@ public class ClassBands extends BandSet public void addParameterAnnotation(int parameter, String desc, boolean visible, List nameRU, List t, List values, List caseArrayN, List nestTypeRS, List nestNameRU, List nestPairN) { if(visible) { - method_RVPA_bands.addAnnotation(desc, nameRU, t, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); + method_RVPA_bands.addParameterAnnotation(parameter, desc, nameRU, t, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); Long flag = (Long) tempMethodFlags.remove(tempMethodFlags.size() - 1); if((flag.intValue() & (1<<23)) != 0) { method_RVPA_bands.incrementAnnoN(); @@ -1336,7 +1336,7 @@ public class ClassBands extends BandSet } tempMethodFlags.add(new Long(flag.longValue() | (1<<23))); } else { - method_RIPA_bands.addAnnotation(desc, nameRU, t, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); + method_RIPA_bands.addParameterAnnotation(parameter, desc, nameRU, t, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); Long flag = (Long) tempMethodFlags.remove(tempMethodFlags.size() - 1); if((flag.longValue() & (1<<24)) != 0) { method_RIPA_bands.incrementAnnoN(); Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java Wed Aug 25 15:22:36 2010 @@ -35,7 +35,7 @@ public class MetadataBandGroup extends B private final String type; private int numBackwardsCalls = 0; - public List param_NB = new ArrayList(); // TODO: Lazy instantiation? + public IntList param_NB = new IntList(); // TODO: Lazy instantiation? public IntList anno_N = new IntList(); public List type_RS = new ArrayList(); public IntList pair_N = new IntList(); @@ -95,6 +95,16 @@ public class MetadataBandGroup extends B } byte[] encodedBand = null; if(!type.equals("AD")) { + if(type.indexOf('P') != -1) { + // Parameter annotation so we need to transmit param_NB + encodedBand = encodeBandInt( + contextStr + "_" + type + " param_NB", param_NB.toArray(), + Codec.BYTE1); + out.write(encodedBand); + PackingUtils.log("Wrote " + encodedBand.length + + " bytes from " + contextStr + "_" + type + " anno_N[" + + param_NB.size() + "]"); + } encodedBand = encodeBandInt( contextStr + "_" + type + " anno_N", anno_N.toArray(), Codec.UNSIGNED5); @@ -242,9 +252,26 @@ public class MetadataBandGroup extends B * @param nestNameRU * @param nestPairN */ + public void addParameterAnnotation(int parameter, String desc, List nameRU, List t, List values, List caseArrayN, List nestTypeRS, List nestNameRU, List nestPairN) { + param_NB.add(parameter); + addAnnotation(desc, nameRU, t, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); + } + + /** + * Add an annotation to this set of bands + * + * @param desc + * @param nameRU + * @param t + * @param values + * @param caseArrayN + * @param nestTypeRS + * @param nestNameRU + * @param nestPairN + */ public void addAnnotation(String desc, List nameRU, List t, List values, List caseArrayN, List nestTypeRS, List nestNameRU, List nestPairN) { type_RS.add(cpBands.getCPSignature(desc)); - pair_N.add(t.size()); + pair_N.add(nameRU.size()); for (Iterator iterator = nameRU.iterator(); iterator.hasNext();) { String name = (String) iterator.next(); Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java Wed Aug 25 15:22:36 2010 @@ -142,4 +142,61 @@ public class NewAttribute extends Attrib public Label getLabel(int index) { return labels[index]; } + + /** + * ErrorAttribute extends NewAttribute and manages attributes + * encountered by ASM that have had an error action specified to pack200 + * (e.g. via one of the -C, -M, -F or -D command line options such as + * -Cattribute-name=error) + */ + public static class ErrorAttribute extends NewAttribute { + + public ErrorAttribute(String type, int context) { + super(type, "", context); + } + + protected Attribute read(ClassReader cr, int off, int len, char[] buf, + int codeOff, Label[] labels) { + throw new Error("Attribute " + type + " was found"); + } + + } + + /** + * StripAttribute extends NewAttribute and manages attributes + * encountered by ASM that have had an strip action specified to pack200 + * (e.g. via one of the -C, -M, -F or -D command line options such as + * -Cattribute-name=strip) + */ + public static class StripAttribute extends NewAttribute { + + public StripAttribute(String type, int context) { + super(type, "", context); + } + + protected Attribute read(ClassReader cr, int off, int len, char[] buf, + int codeOff, Label[] labels) { + // TODO Not sure if this works, can we really strip an attribute if we don't know the layout? + return null; + } + } + + /** + * PassAttribute extends NewAttribute and manages attributes + * encountered by ASM that have had an pass action specified to pack200 + * (e.g. via one of the -C, -M, -F or -D command line options such as + * -Cattribute-name=pass) + */ + public static class PassAttribute extends NewAttribute { + + public PassAttribute(String type, int context) { + super(type, "", context); + } + + protected Attribute read(ClassReader cr, int off, int len, char[] buf, + int codeOff, Label[] labels) { + throw new Segment.PassException(); + } + + } } Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java Wed Aug 25 15:22:36 2010 @@ -209,10 +209,6 @@ public class PackingOptions { } } - public Map getClassAttributeActions() { - return classAttributeActions; - } - public void addClassAttributeAction(String attributeName, String action) { if(classAttributeActions == null) { classAttributeActions = new HashMap(); @@ -220,10 +216,6 @@ public class PackingOptions { classAttributeActions.put(attributeName, action); } - public Map getFieldAttributeActions() { - return fieldAttributeActions; - } - public void addFieldAttributeAction(String attributeName, String action) { if(fieldAttributeActions == null) { fieldAttributeActions = new HashMap(); @@ -231,10 +223,6 @@ public class PackingOptions { fieldAttributeActions.put(attributeName, action); } - public Map getMethodAttributeActions() { - return methodAttributeActions; - } - public void addMethodAttributeAction(String attributeName, String action) { if(methodAttributeActions == null) { methodAttributeActions = new HashMap(); @@ -242,10 +230,6 @@ public class PackingOptions { methodAttributeActions.put(attributeName, action); } - public Map getCodeAttributeActions() { - return codeAttributeActions; - } - public void addCodeAttributeAction(String attributeName, String action) { if(codeAttributeActions == null) { codeAttributeActions = new HashMap(); @@ -288,25 +272,29 @@ public class PackingOptions { .hasNext();) { name = (String) iteratorI.next(); action = (String) attributeActions.get(name); - if (!ERROR.equals(action) && !STRIP.equals(action) - && !PASS.equals(action)) { - prototypeExists = false; - for (Iterator iteratorJ = prototypes.iterator(); iteratorJ - .hasNext();) { - newAttribute = (NewAttribute) iteratorJ.next(); - if (newAttribute.type.equals(name)) { - // if the attribute exists, update its context - newAttribute.addContext(tag); - prototypeExists = true; - break; - } - // if no attribute is found, add a new attribute - if (!prototypeExists) { - newAttribute = new NewAttribute(name, action, - tag); - prototypes.add(newAttribute); - } + prototypeExists = false; + for (Iterator iteratorJ = prototypes.iterator(); iteratorJ + .hasNext();) { + newAttribute = (NewAttribute) iteratorJ.next(); + if (newAttribute.type.equals(name)) { + // if the attribute exists, update its context + newAttribute.addContext(tag); + prototypeExists = true; + break; + } + } + // if no attribute is found, add a new attribute + if (!prototypeExists) { + if (ERROR.equals(action)) { + newAttribute = new NewAttribute.ErrorAttribute(name, tag); + } else if (STRIP.equals(action)) { + newAttribute = new NewAttribute.StripAttribute(name, tag); + } else if (PASS.equals(action)) { + newAttribute = new NewAttribute.PassAttribute(name, tag); + } else { + newAttribute = new NewAttribute(name, action, tag); } + prototypes.add(newAttribute); } } } Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java Wed Aug 25 15:22:36 2010 @@ -53,7 +53,7 @@ public class Segment implements ClassVis private PackingOptions options; private boolean stripDebug; private Attribute[] nonStandardAttributePrototypes; - + /** * The main method on Segment. Reads in all the class files, packs them and * then writes the packed segment out to the given OutputStream. @@ -76,11 +76,11 @@ public class Segment implements ClassVis this.stripDebug = options.isStripDebug(); int effort = options.getEffort(); nonStandardAttributePrototypes = options.getUnknownAttributePrototypes(); - + PackingUtils.log("Start to pack a new segment with " + segmentUnit.fileListSize() + " files including " + segmentUnit.classListSize() + " classes"); - + PackingUtils.log("Initialize a header for the segment"); segmentHeader = new SegmentHeader(); segmentHeader.setFile_count(segmentUnit.fileListSize()); @@ -89,22 +89,22 @@ public class Segment implements ClassVis segmentHeader.setDeflate_hint("true".equals(options .getDeflateHint())); } - + PackingUtils.log("Setup constant pool bands for the segment"); cpBands = new CpBands(this, effort); - + PackingUtils.log("Setup attribute definition bands for the segment"); attributeDefinitionBands = new AttributeDefinitionBands(this, effort, nonStandardAttributePrototypes); - + PackingUtils.log("Setup internal class bands for the segment"); icBands = new IcBands(segmentHeader, cpBands, effort); - + PackingUtils.log("Setup class bands for the segment"); classBands = new ClassBands(this, segmentUnit.classListSize(), effort, stripDebug); - + PackingUtils.log("Setup byte code bands for the segment"); bcBands = new BcBands(cpBands, this, effort); - + PackingUtils.log("Setup file bands for the segment"); fileBands = new FileBands(cpBands, segmentHeader, options, segmentUnit, effort); @@ -136,10 +136,10 @@ public class Segment implements ClassVis headerOutputStream.writeTo(out); bandsOutputStream.writeTo(out); - + segmentUnit.addPackedByteAmount(headerOutputStream.size()); segmentUnit.addPackedByteAmount(bandsOutputStream.size()); - + PackingUtils.log("Wrote total of " + segmentUnit.getPackedByteAmount() + " bytes"); PackingUtils.log("Transmitted " + segmentUnit.fileListSize() + " files of " @@ -571,10 +571,6 @@ public class Segment implements ClassVis Integer numCases = (Integer) caseArrayN.remove(caseArrayN.size() - 1); caseArrayN.add(new Integer(numCases.intValue() + 1)); T.add("e"); - if(name == null) { - name = ""; - } - nameRU.add(name); values.add(desc); values.add(value); } @@ -677,7 +673,7 @@ public class Segment implements ClassVis * passed through as-is in the file_bands rather than being packed with * pack200. */ - public class PassException extends RuntimeException { + public static class PassException extends RuntimeException { } } Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java Wed Aug 25 15:22:36 2010 @@ -22,6 +22,8 @@ import java.util.Iterator; import java.util.List; import org.apache.harmony.unpack200.bytecode.AnnotationDefaultAttribute; +import org.apache.harmony.unpack200.bytecode.AnnotationsAttribute.Annotation; +import org.apache.harmony.unpack200.bytecode.AnnotationsAttribute.ElementValue; import org.apache.harmony.unpack200.bytecode.Attribute; import org.apache.harmony.unpack200.bytecode.CPDouble; import org.apache.harmony.unpack200.bytecode.CPFloat; @@ -30,8 +32,6 @@ import org.apache.harmony.unpack200.byte import org.apache.harmony.unpack200.bytecode.CPUTF8; import org.apache.harmony.unpack200.bytecode.RuntimeVisibleorInvisibleAnnotationsAttribute; import org.apache.harmony.unpack200.bytecode.RuntimeVisibleorInvisibleParameterAnnotationsAttribute; -import org.apache.harmony.unpack200.bytecode.AnnotationsAttribute.Annotation; -import org.apache.harmony.unpack200.bytecode.AnnotationsAttribute.ElementValue; import org.apache.harmony.unpack200.bytecode.RuntimeVisibleorInvisibleParameterAnnotationsAttribute.ParameterAnnotation; /** @@ -117,8 +117,6 @@ public class MetadataBandGroup { private int anno_N_Index; - private Iterator type_RS_Iterator; - private int pair_N_Index; public List getAttributes() { @@ -149,7 +147,6 @@ public class MetadataBandGroup { } } else if (type.equals("RVPA") || type.equals("RIPA")) { anno_N_Index = 0; - type_RS_Iterator = Arrays.asList(type_RS).iterator(); pair_N_Index = 0; for (int i = 0; i < param_NB.length; i++) { attributes.add(getParameterAttribute(param_NB[i], @@ -185,14 +182,13 @@ public class MetadataBandGroup { int[] pairCounts = pair_N[pair_N_Index++]; Annotation[] annotations = new Annotation[numAnnotations]; for (int j = 0; j < annotations.length; j++) { - annotations[j] = getAnnotation( - (CPUTF8) type_RS_Iterator.next(), pairCounts[j], - namesIterator); + annotations[j] = getAnnotation(type_RS[anno_N_Index - 1][j], + pairCounts[j], namesIterator); } parameter_annotations[i] = new ParameterAnnotation(annotations); } - return new RuntimeVisibleorInvisibleParameterAnnotationsAttribute(type - .equals("RVPA") ? rvpaUTF8 : ripaUTF8, + return new RuntimeVisibleorInvisibleParameterAnnotationsAttribute( + type.equals("RVPA") ? rvpaUTF8 : ripaUTF8, parameter_annotations); } Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java Wed Aug 25 15:22:36 2010 @@ -344,7 +344,7 @@ public class ArchiveTest extends TestCas compareFiles(jarFile, jarFile2); } - + public void testAnnotations2() throws IOException, Pack200Exception, URISyntaxException { in = new JarFile(new File(Archive.class.getResource( @@ -357,6 +357,22 @@ public class ArchiveTest extends TestCas new Archive(in, out, options).pack(); in.close(); out.close(); + + // now unpack + InputStream in2 = new FileInputStream(file); + File file2 = File.createTempFile("annotationsout", ".jar"); + // file2.deleteOnExit(); + JarOutputStream out2 = new JarOutputStream(new FileOutputStream(file2)); + org.apache.harmony.unpack200.Archive archive = new org.apache.harmony.unpack200.Archive( + in2, out2); + archive.unpack(); + + // TODO: This isn't quite right - to fix +// JarFile jarFile = new JarFile(file2); +// JarFile jarFile2 = new JarFile(new File(Archive.class.getResource( +// "/org/apache/harmony/pack200/tests/annotations2unpacked.jar") +// .toURI())); +// compareFiles(jarFile, jarFile2); } public void testE0() throws Pack200Exception, IOException, URISyntaxException { Modified: harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java?rev=989168&r1=989167&r2=989168&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java Wed Aug 25 15:22:36 2010 @@ -31,14 +31,15 @@ public class AttributeLayoutMapTest exte AttributeLayout.CONTEXT_CLASS); assertNotNull(layout); assertEquals("RUNH", layout.getLayout()); + assertEquals(17, layout.getIndex()); // and that we can change it a.add(new AttributeLayout("SourceFile", AttributeLayout.CONTEXT_CLASS, - "FROG", 15)); + "FROG", 17)); layout = a.getAttributeLayout("SourceFile", AttributeLayout.CONTEXT_CLASS); assertNotNull(layout); assertEquals("FROG", layout.getLayout()); - assertTrue(layout.matches(1 << 15)); + assertTrue(layout.matches(1 << 17)); assertFalse(layout.matches(1 << 16)); assertTrue(layout.matches(-1)); assertFalse(layout.matches(0)); Added: harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations2unpacked.jar URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations2unpacked.jar?rev=989168&view=auto ============================================================================== Binary file - no diff available. Propchange: harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations2unpacked.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream