You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2017/08/30 19:22:35 UTC

svn commit: r1806724 - in /commons/proper/bcel/trunk/src: changes/changes.xml main/java/org/apache/bcel/classfile/Attribute.java

Author: britter
Date: Wed Aug 30 19:22:35 2017
New Revision: 1806724

URL: http://svn.apache.org/viewvc?rev=1806724&view=rev
Log:
BCEL-283: Support for StackMap should be different from StackMapTable. Thanks to Mark Roberts

Modified:
    commons/proper/bcel/trunk/src/changes/changes.xml
    commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java

Modified: commons/proper/bcel/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/changes/changes.xml?rev=1806724&r1=1806723&r2=1806724&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/bcel/trunk/src/changes/changes.xml [utf-8] Wed Aug 30 19:22:35 2017
@@ -63,6 +63,7 @@ The <action> type attribute can be add,u
 
   <body>
     <release version="6.1" date="tba" description="tba">
+      <action issue="BCEL-283" type="fix" dev="britter" due-to="Mark Roberts">Support for StackMap should be different from StackMapTable</action>
       <action issue="BCEL-289" type="fix" dev="kinow">Crash when parsing constructor of inner classes with parameters annotated</action>
       <action issue="BCEL-276" type="fix" dev="britter" due-to="Sam Yoon">LocalVariableTypeTable is not updated.</action>
       <action issue="BCEL-277" type="fix" dev="britter" due-to="Sam Yoon">Resolving the String representation of a constant throws NoSuchElementException in case of CONSTANT_NameAndType constant.</action>

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java?rev=1806724&r1=1806723&r2=1806724&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/bcel/classfile/Attribute.java Wed Aug 30 19:22:35 2017
@@ -235,7 +235,10 @@ public abstract class Attribute implemen
             case Const.ATTR_SIGNATURE:
                 return new Signature(name_index, length, file, constant_pool);
             case Const.ATTR_STACK_MAP:
-                return new StackMap(name_index, length, file, constant_pool);
+                // old style stack map: unneeded for JDK5 and below;
+                // illegal(?) for JDK6 and above.  So just delete with a warning.
+                System.err.println("Warning: Obsolete StackMap attribute ignored.");
+                return new Unknown(name_index, length, file, constant_pool);
             case Const.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
                 return new RuntimeVisibleAnnotations(name_index, length, file, constant_pool);
             case Const.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS:
@@ -251,6 +254,8 @@ public abstract class Attribute implemen
             case Const.ATTR_ENCLOSING_METHOD:
                 return new EnclosingMethod(name_index, length, file, constant_pool);
             case Const.ATTR_STACK_MAP_TABLE:
+                // read new style stack map: StackMapTable.  The rest of the code
+                // calls this a StackMap for historical reasons.
                 return new StackMap(name_index, length, file, constant_pool);
             case Const.ATTR_BOOTSTRAP_METHODS:
                 return new BootstrapMethods(name_index, length, file, constant_pool);