jakarta-bcel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r617862 - in /jakarta/bcel/trunk/src: main/java/org/apache/bcel/ main/java/org/apache/bcel/classfile/ test/java/org/apache/bcel/visitors/
Date Sat, 02 Feb 2008 19:18:18 GMT
Author: tcurdt
Date: Sat Feb  2 11:18:16 2008
New Revision: 617862

URL: http://svn.apache.org/viewvc?rev=617862&view=rev
Log:
applied patch for java6 from mcmartin@gmail.com

http://issues.apache.org/bugzilla/show_bug.cgi?id=41548



Modified:
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/Constants.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EmptyVisitor.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Visitor.java
    jakarta/bcel/trunk/src/test/java/org/apache/bcel/visitors/CounterVisitor.java

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/Constants.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/Constants.java?rev=617862&r1=617861&r2=617862&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/Constants.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/Constants.java Sat Feb  2 11:18:16 2008
@@ -739,8 +739,9 @@
   public static final byte ATTR_ANNOTATION_DEFAULT                      = 16;
   public static final byte ATTR_LOCAL_VARIABLE_TYPE_TABLE               = 17;
   public static final byte ATTR_ENCLOSING_METHOD                      	= 18;
+  public static final byte ATTR_STACK_MAP_TABLE                         = 19;
 
-  public static final short KNOWN_ATTRIBUTES = 19;
+  public static final short KNOWN_ATTRIBUTES = 20;
 
   // TOFO: FIXXXXX
   public static final String[] ATTRIBUTE_NAMES = {
@@ -750,7 +751,7 @@
     "PMGClass", "Signature", "StackMap", 
     "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations",
     "RuntimeVisibleParameterAnnotations", "RuntimeInvisibleParameterAnnotations",
-    "AnnotationDefault", "LocalVariableTypeTable", "EnclosingMethod"
+    "AnnotationDefault", "LocalVariableTypeTable", "EnclosingMethod", "StackMapTable"
   };
 
   /** Constants used in the StackMap attribute.
@@ -769,4 +770,25 @@
     "Bogus", "Integer", "Float", "Double", "Long",
     "Null", "InitObject", "Object", "NewObject" 
   };
+  
+  /** Constants used to identify StackMapEntry types.
+   * 
+   * For those types which can specify a range, the 
+   * constant names the lowest value.
+   */
+  public static final int SAME_FRAME = 0; 
+  public static final int SAME_LOCALS_1_STACK_ITEM_FRAME = 64; 
+  public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED = 247; 
+  public static final int CHOP_FRAME = 248; 
+  public static final int SAME_FRAME_EXTENDED = 251; 
+  public static final int APPEND_FRAME = 252; 
+  public static final int FULL_FRAME = 255; 
+  
+  /** Constants that define the maximum value of 
+   * those constants which store ranges. */
+  
+  public static final int SAME_FRAME_MAX = 63;
+  public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_MAX = 127;
+  public static final int CHOP_FRAME_MAX = 250;
+  public static final int APPEND_FRAME_MAX = 254;
 }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java?rev=617862&r1=617861&r2=617862&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java Sat Feb  2 11:18:16
2008
@@ -209,6 +209,8 @@
 					constant_pool);
 		case Constants.ATTR_ENCLOSING_METHOD:
 			return new EnclosingMethod(name_index, length, file, constant_pool);
+		case Constants.ATTR_STACK_MAP_TABLE:
+			return new StackMapTable(name_index, length, file, constant_pool);
 		default: // Never reached
 			throw new IllegalStateException("Ooops! default case reached.");
 		}

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java?rev=617862&r1=617861&r2=617862&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/DescendingVisitor.java Sat
Feb  2 11:18:16 2008
@@ -242,6 +242,25 @@
 		stack.pop();
 	}
 
+	public void visitStackMapTable(StackMapTable table)
+	{
+		stack.push(table);
+		table.accept(visitor);
+		StackMapTableEntry[] vars = table.getStackMapTable();
+		for (int i = 0; i < vars.length; i++)
+		{
+			vars[i].accept(this);
+		}
+		stack.pop();
+	}
+
+	public void visitStackMapTableEntry(StackMapTableEntry var)
+	{
+		stack.push(var);
+		var.accept(visitor);
+		stack.pop();
+	}
+
 	public void visitLocalVariable(LocalVariable var)
 	{
 		stack.push(var);

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EmptyVisitor.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EmptyVisitor.java?rev=617862&r1=617861&r2=617862&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EmptyVisitor.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/EmptyVisitor.java Sat Feb 
2 11:18:16 2008
@@ -173,6 +173,14 @@
 	{
 	}
 
+	public void visitStackMapTable(StackMapTable obj)
+	{
+	}
+
+	public void visitStackMapTableEntry(StackMapTableEntry obj)
+	{
+	}
+
 	public void visitEnclosingMethod(EnclosingMethod obj)
 	{
 	}

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Visitor.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Visitor.java?rev=617862&r1=617861&r2=617862&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Visitor.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Visitor.java Sat Feb  2 11:18:16
2008
@@ -90,6 +90,10 @@
 
 	public void visitStackMapEntry(StackMapEntry obj);
 
+	public void visitStackMapTable(StackMapTable obj);
+
+	public void visitStackMapTableEntry(StackMapTableEntry obj);
+
 	public void visitAnnotation(Annotations obj);
 
 	public void visitParameterAnnotation(ParameterAnnotations obj);

Modified: jakarta/bcel/trunk/src/test/java/org/apache/bcel/visitors/CounterVisitor.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/test/java/org/apache/bcel/visitors/CounterVisitor.java?rev=617862&r1=617861&r2=617862&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/test/java/org/apache/bcel/visitors/CounterVisitor.java (original)
+++ jakarta/bcel/trunk/src/test/java/org/apache/bcel/visitors/CounterVisitor.java Sat Feb
 2 11:18:16 2008
@@ -36,6 +36,8 @@
 import org.apache.bcel.classfile.SourceFile;
 import org.apache.bcel.classfile.StackMap;
 import org.apache.bcel.classfile.StackMapEntry;
+import org.apache.bcel.classfile.StackMapTable;
+import org.apache.bcel.classfile.StackMapTableEntry;
 import org.apache.bcel.classfile.Synthetic;
 import org.apache.bcel.classfile.Unknown;
 import org.apache.bcel.classfile.Visitor;
@@ -118,6 +120,11 @@
 
 	public int annotationCount = 0;
 
+	public int stackMapTableCount = 0;
+
+	public int stackMapTableEntryCount = 0;
+	
+
 	public void visitAnnotation(Annotations obj)
 	{
 		annotationCount++;
@@ -306,5 +313,13 @@
 	public void visitUnknown(Unknown obj)
 	{
 		unknownCount++;
+	}
+
+	public void visitStackMapTable(StackMapTable obj) {
+		stackMapTableCount++;
+	}
+
+	public void visitStackMapTableEntry(StackMapTableEntry obj) {
+		stackMapTableEntryCount++;
 	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


Mime
View raw message