Comments (7)
This choice was made as the order in which the interfaces are declared is exposed via the reflection API. Because of this, it may affect code that uses reflection. Requiring lists should reflect this consequence.
Let me however think about it, I might adapt a different signature.
from byte-buddy.
If a List
is passed as the argument to ByteBuddy#makeInterface(Collection)
, any iteration done inside the method will still be performed in the List
order. So, since the method (and everything that it calls) only uses size()
& iterator()
, a (Collection)
method will behave equivalently for a List
argument as a (List)
method.
The JavaDoc doesn't specify that the super interfaces will be declared in the order of their occurrence in the List
, and it doesn't say how duplicates are handled (I would assume that an interface will be declared in the order of its first occurrence in the List
). The same would hold true if you change the signature to (Collection c)
, and just specify that an interface will be declared in the order of it first occurrence in c.iterator()
, which, for List
, is obviously exactly the same as the order in the List
itself.
If I, as the caller, don't care about the order of the interface declarations (or if I care about the order, but just want to specify it via some other Collection
, like a SortedSet
), why should makeInterface(...)
care?
from byte-buddy.
I have adopted your suggestion with some additional validation of the input which was meaningful for lists that can (illegally) contain duplicates even though it would not be allowed. I adapted this throughout all of Byte Buddy's API where it appeared meaningful, i.e. where the order of arguments does not always have a meaning. I will soon push an updated version. Thanks for your input.
from byte-buddy.
Thanks for updating the API so quickly.
One additional makeInterface
method might be useful.
Right now, you have:
makeInterface(Collection<? extends TypeDescription> typeDescriptions)
It would be simpler for a caller who just has Collection<Class<?>>
to be able to call:
makeInterfaceFromClassCollection(Collection<Class<?>> classColl)
You can probably come up with a better name than makeInterfaceFromClassCollection
; I just had to pic something that was different from makeInterface
to avoid a duplicate method signature due to type erasure.
from byte-buddy.
You are right. Initially, I did not want to do it because I wanted to avoid polluting the API with additional method names. However, I will now add overloaded methods based on Iterable
:
makeInterface(Iterable<? extends Class<?>> types)
from byte-buddy.
The changes are now in place.
from byte-buddy.
Thanks.
from byte-buddy.
Related Issues (20)
- How to apply Byte Buddy plugin placed under /src/test? HOT 13
- I am sorry, this is a question about java bytecode HOT 5
- Not able to intercept methods of java.net.HttpURLConnection class in Java 17 HOT 1
- Strange interaction with method implementations for methods from composite interfaces HOT 1
- Replace Method Code HOT 3
- Can I replace the new byte[] in the onTransformation method? HOT 1
- I want to use bytebuddy to advice java.time.LocalDateTime HOT 3
- BUG: instrumentation error HOT 3
- No classes have been predefined during the image build to load from bytecodes at runtime HOT 8
- Verify Error on Byte Buddy generated class HOT 1
- Question: copy class hierarchy in an environment without Java Agent HOT 1
- Can 'private final method' in 'public final class' be redefined? HOT 4
- Method matchers works by chance HOT 2
- Why does ClassNotFoundException appear in Interceptor when running in SpringBoot? HOT 1
- Compilation error after adding lombok to classpath HOT 1
- why is the byte-buudy AgentBuilder source code so long ? HOT 2
- Invalid module descriptor of byte-buddy `jar` when `JAVA_HOME` is set to version 21 HOT 16
- matched class wasn't transformered and the issue appears just twice, and i didn't reproducing the issue HOT 10
- Fail to read property due to `IllegalArgumentException` when using it on withX methods HOT 4
- Improve diagnostics/troubleshooting features for agent installation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from byte-buddy.