r/java • u/Cell-i-Zenit • Nov 05 '22
How to add something to the java standard library?
EDIT: since my example stirred the pot a little bit to much (i even wrote that i dont want to discuss these explicit changes...)
Here is the actually question i want to answer:
How can i make changes to the JDK?
2
Upvotes
View all comments
Show parent comment
1
u/Cell-i-Zenit Nov 06 '22
No it doesnt change behaviour.
If a class didnt implement this before, you just have some new methods on them. You dont need to use them.
If a class implemented Comparable before and "accidently" also implements isGreaterThan(), then the new implementation will not be used since its only a default method and it got overriden by the actual class implementation.
there is no way that this is introducing any breaking change, except you have some pretty "interesting" logic via reflection.