Comments (6)
Hi David, your aproach is correct. If it throws a NullPointerException, you found a bug. ByteBuddy should never do this. I will test it later and might ask for a more detailed description. Expect a bugfix realease at the end of next week.
For creating a root interface, you would subclass Object and define the modifier to represent an interface, on the byte code level, interfaces are represenred as Object subclasses. I will add a specific DSL element for that.
Thanks for using Byte Buddy and for your feedback. I am working on additional documentation and hope to make Byte Buddy easier in the future.
from byte-buddy.
Interfaces do not add the super flag which, until now, were always added to subclasses, including interfaces. Also, the default implementations of ConstructorStrategy
did not consider the possibility of interfaces where the super classes are considered null
. Both was fixed.
from byte-buddy.
Byte Buddy 0.5.2 is released and it fixes the bug you found. Note that interface methods must be public. Also, implementations are only allowed on from Java 8.
from byte-buddy.
Could you explain the last bit "Also, implementations are only allowed on from Java 8." ?
For various reasons I need to stay on Java 7 for a while more.
from byte-buddy.
I mean a default method implementation. When you define an interface method, it needs to be abstract as long as the byte code version is not 52 (Java 8) where you can optionally provide an implementation (also for static methods).
from byte-buddy.
Ah yes of course ! Cant create bytecode for a JVM version thats compatible with the running one.
Just tried the new code, works perfect !
Took a few mistakes (mine) to get it right ... (missed at first that the function(Type...) could take no args) and then copy pasted the wrong code and put a field instead of a method.
But got it right!
Thank you !
Future request ... (way future) ... validate builder operations as they occur
as well as during make() /load(). By the time it gets to load the message has less
context so is harder to track down - both by the exception itself and by the stack track.
In this case my mistake caused an 'incompatible change' ... yes. which one ?
considering I had only 1 it wasnt too hard , but catching that I'd added a field
to an interface during the build process would be more useful - and slower :( :)
from byte-buddy.
Related Issues (20)
- Can ByteBuddy make a non-static field be final? HOT 1
- seems that namedOneOf isn't working as expected HOT 1
- Release missing of version 1.14.15 HOT 1
- java.lang.NoSuchMethodError when using the agent for method instrumentation HOT 2
- Cannot invoke public constructor HOT 5
- ByteBuddyAgent, Java 21 - A Java agent has been loaded dynamically HOT 2
- include method does not exist for Method Delegation approach HOT 6
- Having trouble delegating added instance method to static method HOT 2
- Setting value in constructor aliases collections HOT 5
- Is it possible to lazily instantiate AllArguments?
- install transformer takes too long time HOT 3
- Example that could be used in documentation HOT 6
- Issues attaching to Solaris Hotspot on Solaris 10 and 11. HOT 1
- How to generate multi-level generic code ? HOT 2
- java.lang.IllegalAccessError HOT 15
- InjectionStrategy.UsingUnsafe.OfFactory HOT 1
- java.lang.IncompatibleClassChangeError: Interface method reference: java.util.stream.Sink.begin(J)V HOT 1
- defineField not working well HOT 1
- JDK class enhancements HOT 3
- ByteBuddy is incompatible with CDS due to the Java 6 baseline HOT 4
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.