raphw / raphw/byte-buddy

Feature request: customize some details about static fields used to store references

Open
#927 1 comment 0 reactions 1 assignee View on GitHub

@raphw is already working on this.

Since Sep 17, 2020.

enhancement
Dominant language
Java
Stars
6.9k
Forks
855
PR merge metrics
No merged PRs in 30d

Description

Hello; thanks for a great product. I know from personal experience how hard it is to run an open source project and this one is just fantastic. Thanks for all the time you put into it.

I had a request for what I hope is a small feature. Currently, there is a nice little feature of MethodCall where you can specify that it should be supplied with existing object references. I confess that this works like magic for me (I haven't dug into the code to see how it is accomplished, and I'm not sure how it differs from the with(Object...) call…)!

The references, it turns out, are stored in static fields inside the generated class (I was surprised to note these fields are not final…). That of course makes sense.

The fields used to store these references are named something like this: methodCall$4BJ1aAKz. I think that the name is generated via a constant prefix and RandomString#make().

While I can see that I could probably somehow supply my own ArgumentLoader machinery to customize this, it would be nice if there were an easy way in the API/DSL to specify how these reference-storing static fields should be named and decorated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.