harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r989806 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/ classlib/modules...
Date Thu, 26 Aug 2010 16:22:09 GMT
Author: hindessm
Date: Thu Aug 26 16:22:09 2010
New Revision: 989806

URL: http://svn.apache.org/viewvc?rev=989806&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@989168:

  r989168 | sjanuary | 2010-08-25 16:22:36 +0100 (Wed, 25 Aug 2010) | 1 line
  
  Pack200 - more testing for annotations and some associated bug fixes


Added:
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations2unpacked.jar
      - copied unchanged from r989168, harmony/enhanced/java/trunk/classlib/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/annotations2unpacked.jar
Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
    harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 26 16:22:09 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045
+/harmony/enhanced/java/trunk:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045,989168
 /harmony/enhanced/trunk:476395-929252
 /incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 26 16:22:09 2010
@@ -1,7 +1,7 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045
+/harmony/enhanced/java/trunk/classlib:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045,989168
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
 /incubator/harmony/enhanced/trunk/classlib:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 26 16:22:09 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045,989168
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
 /incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Modified: harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
Thu Aug 26 16:22:09 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/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
Thu Aug 26 16:22:09 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/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
Thu Aug 26 16:22:09 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/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/NewAttribute.java
Thu Aug 26 16:22:09 2010
@@ -142,4 +142,61 @@ public class NewAttribute extends Attrib
     public Label getLabel(int index) {
         return labels[index];
     }
+
+    /**
+     * ErrorAttribute extends <code>NewAttribute</code> 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 <code>NewAttribute</code> 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 <code>NewAttribute</code> 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/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/PackingOptions.java
Thu Aug 26 16:22:09 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/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
Thu Aug 26 16:22:09 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/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java
Thu Aug 26 16:22:09 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/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ArchiveTest.java
Thu Aug 26 16:22:09 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/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java?rev=989806&r1=989805&r2=989806&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/AttributeLayoutMapTest.java
Thu Aug 26 16:22:09 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));

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 26 16:22:09 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045
+/harmony/enhanced/java/trunk/drlvm:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045,989168
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/drlvm:292550-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 26 16:22:09 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045
+/harmony/enhanced/java/trunk/jdktools:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141,986136,986141,986147,986150,986205,986223-986224,986228,986248,986356,986603,986626,987283,987285,987981,988045,989168
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147



Mime
View raw message