garydgregory commented on code in PR #177:
URL: https://github.com/apache/commons-bcel/pull/177#discussion_r1034692847


##########
src/test/resources/StackMapExample2.java:
##########
@@ -0,0 +1,8 @@
+public class StackMapExample2 {
+

Review Comment:
   Javadoc what this tests.



##########
src/main/java/org/apache/bcel/classfile/StackMap.java:
##########
@@ -135,7 +135,7 @@ public StackMapEntry[] getStackMap() {
     public void setStackMap(final StackMapEntry[] table) {
         this.table = table != null ? table : StackMapEntry.EMPTY_ARRAY;
         int len = 2; // Length of 'number_of_entries' field prior to the array 
of stack maps
-        for (final StackMapEntry element : this.table) {
+        for (final StackMapEntry element : table) {

Review Comment:
   This creates an NPE.



##########
src/main/java/org/apache/bcel/classfile/StackMapType.java:
##########
@@ -29,9 +29,9 @@
  * @see StackMap
  * @see Const
  */
-public final class StackMapType implements Cloneable {
+public final class StackMapType implements Node, Cloneable {
 
-    public static final StackMapType[] EMPTY_ARRAY = {}; // must be public 
because BCELifier code generator writes calls to it
+    static final StackMapType[] EMPTY_ARRAY = {}; // package visibility as 
BCELifier code generator writes calls to constructor translating null to 
EMPTY_ARRAY

Review Comment:
   You can't make something public, not public, this will break BC, you can't 
tell now because we are in the middle of a release.



##########
src/main/java/org/apache/bcel/classfile/Code.java:
##########
@@ -247,6 +247,20 @@ public LineNumberTable getLineNumberTable() {
         return null;
     }
 
+    /**
+     * Finds the first attribute of {@link StackMap} instance.
+     * @return StackMap of Code, if it has one, else null.
+     * @since 6.7.1
+     */
+    public StackMap getStackMap() {

Review Comment:
   Should this be called getFirstStackMap()?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to