[Rev 01] RFR: 6617: Make return value its own element

Jessye Coleman-Shapiro github.com+29706926+jessyec-s at openjdk.java.net
Thu Dec 5 19:20:51 UTC 2019


On Thu, 5 Dec 2019 18:02:05 GMT, Marcus Hirt <hirt at openjdk.org> wrote:

> On Thu, 5 Dec 2019 16:41:41 GMT, Jessye Coleman-Shapiro <github.com+29706926+jessyec-s at openjdk.org> wrote:
> 
>> The pull request has been updated with additional changes.
>> 
>> ----------------
>> 
>> Added commits:
>>  - 92964d31: Remove unnecessary returnValue param in createField(..)
>> 
>> Changes:
>>   - all: https://git.openjdk.java.net/jmc/pull/6/files
>>   - new: https://git.openjdk.java.net/jmc/pull/6/files/368cc573..92964d31
>> 
>> Webrevs:
>>  - full: https://webrevs.openjdk.java.net/jmc/6/webrev.01
>>  - incr: https://webrevs.openjdk.java.net/jmc/6/webrev.00-01
>> 
>>   Issue: https://bugs.openjdk.java.net/browse/JMC-6617
>>   Stats: 6 lines in 2 files changed: 2 ins; 0 del; 4 mod
>>   Patch: https://git.openjdk.java.net/jmc/pull/6.diff
>>   Fetch: git fetch https://git.openjdk.java.net/jmc pull/6/head:pull/6
> 
> core/org.openjdk.jmc.agent/src/main/java/org/openjdk/jmc/agent/impl/DefaultTransformRegistry.java line 155:
> 
>> 154: 		Method method = null;
>> 155: 		ReturnValue[] returnValue = new ReturnValue[1];
>> 156: 		while (streamReader.hasNext()) {
> 
> Having an array of 1 seems unnecessary here. Wouldn't just having a reference to the ReturnValue be cleaner?

I made an array as a wrapper so I do not lose the reference of the ReturnValue object created inside the callee function.  The reference to the newly created object gets lost if I pass in a ReturnValue reference that initially is set to null.

I could create an empty ReturnValue object and then pass it into the parseMethod function, where the object's fields can be set, instead of allocating an array of size 1 ?

PR: https://git.openjdk.java.net/jmc/pull/6


More information about the jmc-dev mailing list