[
https://issues.apache.org/jira/browse/BCEL-202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14604258#comment-14604258
]
Kaspar-David Buss commented on BCEL-202:
----------------------------------------
Ah, that makes sense. In any case, just adding
int number_of_locals = (types_of_locals == null) ? 0 : types_of_locals.length;
and similar for number_of_stack_items to the beginning of those two methods
seems to work just fine.
Thank you so much for this .diff, by the way, it absolutely saved my Bachelor's
thesis. I did notice, though, that the StackMapTable's "length" attribute is
not recalculated based on the StackMapTableEntry instances contained within, so
you have to manually set the StackMapTable's length before dumping it.
That seems like a thing that BCEL should do automatically, but at least I now
have the tools to correctly do that myself by using the getEntryByteSize()
method.
> StackMapTableEntry.copy() needs to be deep; Improved support for StackMaps
> --------------------------------------------------------------------------
>
> Key: BCEL-202
> URL: https://issues.apache.org/jira/browse/BCEL-202
> Project: Commons BCEL
> Issue Type: Bug
> Reporter: Mark Roberts
> Attachments: stackmap.diff
>
>
> There are several ways a user can modify a Java class file that should cause
> BCEL to update the StackMaps automatically. Unfortunately, it does not.
> These additional methods at least allow users to take care of these issues
> for themselves.
> The patch also fixes a bug - StackMapTableEntry.copy() needs to be a deep
> copy to prevent StackMapTypes from being reused.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)