harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r636402 - in /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200: ClassBands.java Segment.java bytecode/Attribute.java bytecode/SourceFileAttribute.java
Date Wed, 12 Mar 2008 16:24:46 GMT
Author: sjanuary
Date: Wed Mar 12 09:24:44 2008
New Revision: 636402

URL: http://svn.apache.org/viewvc?rev=636402&view=rev
Log:
Apply patch for HARMONY-5594 ([classlib][pack200] Deprecated classes don't have Deprecated
attribute)

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java?rev=636402&r1=636401&r2=636402&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
Wed Mar 12 09:24:44 2008
@@ -1189,6 +1189,10 @@
         return numBackwardsCalls;
     }
 
+    public ArrayList[] getClassAttributes() {
+        return classAttributes;
+    }
+
     public int[] getClassFieldCount() {
         return classFieldCount;
     }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java?rev=636402&r1=636401&r2=636402&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
Wed Mar 12 09:24:44 2008
@@ -144,6 +144,28 @@
 		} else {
 			classFile.attributes = new Attribute[] {};
 		}
+		
+		// If we see any class attributes, add them to the class's attributes that will
+		// be written out. Keep SourceFileAttributes out since we just
+		// did them above. (One of the computations for SourceFileAttribute
+		// may be redundant.)
+	    ArrayList classAttributes = classBands.getClassAttributes()[classNum];
+	    ArrayList classAttributesWithoutSourceFileAttribute = new ArrayList();
+	    for(int index=0; index < classAttributes.size(); index++) {
+	        Attribute attrib = (Attribute)classAttributes.get(index);
+	        if(!attrib.isSourceFileAttribute()) {
+	            classAttributesWithoutSourceFileAttribute.add(attrib);
+	        }
+	    }
+        Attribute[] originalAttributes = classFile.attributes;
+        classFile.attributes = new Attribute[originalAttributes.length + classAttributesWithoutSourceFileAttribute.size()];
+        System.arraycopy(originalAttributes, 0, classFile.attributes, 0, originalAttributes.length);
       
+	    for(int index=0; index < classAttributesWithoutSourceFileAttribute.size(); index++)
{
+	        Attribute attrib = ((Attribute)classAttributesWithoutSourceFileAttribute.get(index));
+	        cp.add(attrib);
+	        classFile.attributes[originalAttributes.length + index] = attrib;
+	    }
+
 		// this/superclass
 		ClassFileEntry cfThis = cp.add(cpBands.cpClassValue(fullName));
 		ClassFileEntry cfSuper = cp.add(cpBands.cpClassValue(classBands.getClassSuper()[classNum]));

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java?rev=636402&r1=636401&r2=636402&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/Attribute.java
Wed Mar 12 09:24:44 2008
@@ -83,6 +83,17 @@
         return false;
     }
 
+    /**
+     * Answer true if the receiver is a source file attribute
+     * (which gets special handling when the class is built);
+     * otherwise answer false.
+     *
+     * @return boolean source file attribute
+     */
+    public boolean isSourceFileAttribute() {
+        return false;
+    }
+
     public int hashCode() {
         final int PRIME = 31;
         int result = 1;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java?rev=636402&r1=636401&r2=636402&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java
Wed Mar 12 09:24:44 2008
@@ -48,6 +48,13 @@
 		return true;
 	}
 
+    /* (non-Javadoc)
+     * @see org.apache.harmony.pack200.bytecode.Attribute#isSourceFileAttribute()
+     */
+    public boolean isSourceFileAttribute() {
+        return true;
+    }
+
 	protected int getLength() {
 		return 2;
 	}



Mime
View raw message