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?
50
u/maethor Nov 05 '22
i am missing some much needed helper methods on standard types.
Then create a small library of static methods and helper classes. The likelihood of you getting the helper methods you want in the standard library is virtually nonexistent.
-59
u/Cell-i-Zenit Nov 05 '22
alot of people already told me this, so you didnt really added anything to the discussion.
You also missed my original question: How is the process of proposing something like this?
32
u/maethor Nov 05 '22
alot of people already told me this, so you didnt really added anything to the discussion.
It's difficult to add something to a completely pointless discussion.
How is the process of proposing something like this?
-44
u/Cell-i-Zenit Nov 06 '22 edited Nov 06 '22
It's difficult to add something to a completely pointless discussion.
Wow why so arrogant? Who decides what is pointless or not?
Why is my question "how to enhance the JDK" so pointless?
7
u/maethor Nov 06 '22
Wow why so arrogant?
I could ask the exact same question to you.
Why is my question "how to enhance the JDK" so pointless?
Because there's a difference between "how is the JDK enhanced" and "how do I get some extra methods that I really want added in to the standard libraries ". The first would have been educational, the other completely pointless as it is not going to happen (there's a reason why projects like the Apache Commons and Google Guava exist).
-6
u/Cell-i-Zenit Nov 06 '22
I could ask the exact same question to you.
I was just asking questions here, but iam met with so much hostility... Please point me to the place where iam arrogant, because right now all i see are questions by me, which are met with so much hostility
Because there's a difference between "how is the JDK enhanced" and "how do I get some extra methods that I really want added in to the standard libraries ".
I even wrote in the original post that i dont want to discuss the changes as they are EXAMPLES.
What is so hard to understand here:
Please dont discuss these EXAMPLE changes, but i want to do something liek this, please tell me how i propose changes to the JDK.
Proceeds to discuss the changes anyway...
Because there's a difference between "how is the JDK enhanced" and "how do I get some extra methods that I really want added in to the standard libraries ".
And since you decided that my question is pointless, you are not answering my actual question, but instead just tell me something which 3 people already did before
5
u/maethor Nov 06 '22
Please point me to the place where iam arrogant
All of your comments that are getting downvoted. But if you would like a particular example
you didnt really added anything to the discussion.
And it's far from being the only example.
I even wrote in the original post that i dont want to discuss the changes as they are EXAMPLES.
It doesn't matter if you provided examples or not, because your question was "how do I get the changes I want added" and the simple answer is you don't. Java and OpenJDK aren't "normal" open source projects where the developers are hanging out on Discord and happily accepting pull requests. It has a long established bureaucracy dominated by the wishes of one corporation. Random people popping up and making changes to the platform just doesn't happen.
-2
u/Cell-i-Zenit Nov 06 '22
It doesn't matter if you provided examples or not, because your question was "how do I get the changes I want added" and the simple answer is you don't. Java and OpenJDK aren't "normal" open source projects where the developers are hanging out on Discord and happily accepting pull requests. It has a long established bureaucracy dominated by the wishes of one corporation. Random people popping up and making changes to the platform just doesn't happen.
That is exactly why i asked for the process. It isclear for me that i cannot just open a PR and it will be accepted.
-2
u/Cell-i-Zenit Nov 06 '22
i give you this point
you didnt really added anything to the discussion.
but what is with this?
Just a bunch of questions on the workflow
or here:
just me understanding the process
or here:
just questions
and here:
just questions
4
u/maethor Nov 06 '22
I think your overall reaction to mailing lists just put people's backs up, to be honest.
Though I'm not sure why people were even recommending that you join - if you think you're getting a hostile reaction here then you are probably not going to have a good time on a mailing list that is not all that interested in your opinion.
1
u/Cell-i-Zenit Nov 06 '22
I think your overall reaction to mailing lists just put people's backs up, to be honest.
Because i never worked with them and wanted to understand how they work. Sorry that i ask questions about the process and i dont want to bother anyone
if you think you're getting a hostile reaction here then you are probably not going to have a good time on a mailing list that is not all that interested in your opinion.
I honestly dont expect that when i send a mail to the mailing list, that:
some people try to dig up my github profile and reject my proposal with the argument "your github is bad, please leave this list"
they say "you have a spelling error in your email, we will reject your mail because you are a noob"
I dont know you, so you should leave
Dont even understand the proposal and say "please just leave, this is not your cup of tea KID"
I kind of expect that they will reject my proposal based on actual objective values and not because they dont like how i ask questions
→ More replies (0)
33
u/Godworrior Nov 05 '22
For most library changes, the best place to start is to mail to [email protected] Here you can find out if people find your suggestion a good idea.
If you want to submit a patch, you will first have to sign the OCA (Oracle Contributor Agreement): https://oca.opensource.oracle.com/
And, then create a PR for the JDK repo here: https://github.com/openjdk/jdk
You will also need a sponsor for the PR to guide you through the process, and create a bug database ticket. Probably best to ask on the mailing list as well if someone wants to sponsor the patch before creating the PR.
There's also a wiki for contributing, but it is pretty outdated, so take everything there with a grain of salt: https://openjdk.org/contribute/
-29
u/Cell-i-Zenit Nov 05 '22
Thanks for your answer.
Why do you need a sponsor for something like this? I would write the code myself and for free.
Also is this really only done via Mail list? How can i imagine this process? I write a mail saying "hey guys, i want to do XXX", and then i get 20 emails, all saying "yeah i like this change" and in between i get like 100 mails for other completely different things?
Is there not something like a discord server or a forum, where a focused discussions about such changes can actually happen?
13
u/Worth_Trust_3825 Nov 05 '22
Is there not something like a discord server or a forum, where a focused discussions about such changes can actually happen?
The mailing list is already linked.
-19
u/Cell-i-Zenit Nov 05 '22
Yes, but is this all? How can any focussed discussion happen via a mailing list if there are multiple proposals?
Should i just write a mail there with a probl. badly formatted/formulated idea and bother all the other1000 devs to read it?
How is the decision done? Can i expect that after a proposal i get like 50 mails back, who all say various things? How is a decision made that something goes further?
23
u/Godworrior Nov 05 '22 edited Nov 05 '22
Discussions are grouped into mail threads. Someone will reply to that thread directly, which will include you as a recipient, so you get the email. You will not receive any of the other emails to the list unless you subscribe to it (or unless people add you as a recipient directly).
You won't be bothering a 1000 devs. People who are not interested in your proposal can just ignore/filter out the email.
It's very unlikely that you will get 50 replies back. More likely 1 or 2 people will reply back to you, and then others will see it's already covered and continue on with other things. (or, if nobody likes the suggestion, maybe nobody will reply).
If there is a positive response to the proposal, you can ask if someone would be interested in sponsoring a patch from you. Once someone says yes, you can make a PR on github and then link to it from the email thread (and vice-versa).
A sponsor is someone who has the "Committer" role (or above) on the jdk project (https://openjdk.org/census#jdk). A sponsor is needed to create a bug database ticket and eventually integrate the patch if it is accepted during the review process.
I suggest having a look at some of the emails on the list to see how this process normally goes. e.g. this one is a good example: https://mail.openjdk.org/pipermail/core-libs-dev/2022-September/094849.html (note that you have to switch to the October 2022 archive to continue reading beyond the first 3 mails. The web interface for this isn't great unfortunately)
-3
u/Cell-i-Zenit Nov 06 '22 edited Nov 06 '22
Again thanks for your answer.
I honestly never worked with "old school" mail lists so this process is completely new to me (as you can see by my questions).
and then others will see it's already covered and continue on with other things. (or, if nobody likes the suggestion, maybe nobody will reply).
If they send a mail to me, how can other people see what they wrote? Will this not result in multiple people writing the same thing to me?
you can ask if someone would be interested in sponsoring a patch from you.
What does sponsoring mean in this context?
9
3
u/mauganra_it Nov 06 '22
What does sponsoring mean in this context?
It was explained in the next paragraph. Tldr: somebody who interacts with the OpenJDK bureaucracy for you and reviews your contribution, since you are not a core committer.
9
u/GuyWithLag Nov 06 '22
Why do you need a sponsor for something like this? I would write the code myself and for free.
Because _you_ are not thinking of the support needed and the effect your changes will have to the next 20 years of the JDK, and neither is anyone in this discussion. Imagine if every student know-it-all added willy-nilly code to the JDK.
I would instead direct you to Kotlin and its extension methods; while they can be overused, the blast radius is just your own projects.
4
u/Cell-i-Zenit Nov 06 '22
Because you are not thinking of the support needed
That is exactly why i asked here. I wanted to understand the process. But in the end my questions were only answered by a handful of people and the rest bashed my idea/bashed me as a person for no reason lol.
Imagine if every student know-it-all added willy-nilly code to the JDK.
I cannot imagine this, because we have the proposal process. This is such a stupid thing to say. If this student know-it-all has a good idea it doesnt matter if its a student or mr java himself.
Or is there a Code review process where the devs ask you how long you are in the java ecosystem and only if you are >20 years your proposal will be looked at?
4
u/GuyWithLag Nov 06 '22
Hmm... I do realize that I came through as gatekeeping. But... in a sense, good engineering is as much about what to put is as what to leave out. If you've see the various JCPs, they do list alternatives considered, and why they're not in the JCP.
If this student know-it-all has a good idea it doesnt matter if its a student or mr java himself.
Here's the issue though - I/You/They may have brilliant ideas, but _they will not be useful for most Java engineers_, and the JDK is a Platform that will be used by hundreds of thousands, and changes that are made now may prevent changes to happen in the future (think nullability, or generic erasure, or the contortions that we had to go through to be able to add default implementations to interface methods).
This is why the changes to `switch` are taking so long to materialize, and why Loom is just now coming out of experimental, to give some examples.
Now, the process has been explained elsewhere, but I don't think you realize how much work that is going to end up being - for the same reasons as above.
0
u/Cell-i-Zenit Nov 06 '22
I/You/They may have brilliant ideas, but they will not be useful for most Java engineers, and the JDK is a Platform that will be used by hundreds of thousands
But then its not a good idea. Again. If the idea is good and everyone can benefit from it. Then it doesnt matter who writes the idea.
Now, the process has been explained elsewhere, but I don't think you realize how much work that is going to end up being - for the same reasons as above.
You dont know what i want to do... Actually the changes below are my proposal:
public interface Comparable<T> { int compareTo(T var1); default boolean isGreaterThan(T obj){ return compareTo(obj) > 0; } default boolean isSmallerThan(T obj){ return compareTo(obj) < 0; } default boolean isSmallerOrEqualThan(T obj){ return compareTo(obj) <= 0; } default boolean isGreaterOrEqualThan(T obj){ return compareTo(obj) >= 0; } }
they are additive.
They do not change existing code.
They improve readability.
They are not adding any complexity
They are easily tested
Can you point me to the "much more work then you expect thing"? Except for writing some tests for this i dont see any work except going through the paperworks
6
u/s888marks Nov 06 '22
This sort of thing has been proposed before. See JDK-6321015 and JDK-8241056.
Even though I've left JDK-8241056 open for now, I'm skeptical that something like it is worthwhile to put into the JDK. I jotted down some notes about alternatives in the bug report. I'm skeptical of those too; but maybe something will eventually pop up that's really good. On the other hand, maybe not.
A few other points to consider.
• Adding methods to a widely implemented interface such as
Comparableruns the risk of name clashes with implementing classes. We need to minimize that risk.• You seem to be assuming that such methods improve readability. Consider:
if (a.compareTo(b) >= 0) ... if (a.isGreaterThanOrEqualTo(b)) ...Even though it's more English-like, the second line is longer and more verbose. People are constantly complaining about Java's verbosity, so this seems like a step in the wrong direction. In the first line, the
>=is right there, and there is nothing unreadable about it.The point here is that the value is in the eye of the beholder. This might add value from your perspective, but that doesn't imply that it helps the millions of other Java programmers out there.
• This does in fact add compexity. The
Comparablemethod goes from one method to five (or seven) methods. Sure, they're trivial, but there's more bulk that somebody needs to specify and test, and there's more bulk that clients need to read and understand.• Equality is missing. Your proposal doesn't include them so that there is no confusion with
Object.equals. That's one approach, I suppose. But it also means that code that has complex comparison logic has a mixture of the different idioms. For example,if (a.isLessThan(b) && a.compareTo(c) != 0) ...This proposal introduces a new idiom, but programmers still need to understand and use the old idiom or even mix them, so the new idiom isn't really buying all that much.
Summary: I am overall quite skeptical of how much net value would be added by this proposal and similar ones.
2
u/Cell-i-Zenit Nov 06 '22
thanks for you answer. The problem is i actually only wanted to understand the process of proposing a change.
But the people here really only discussed the changes itself.
Naming etc is still not ideal, but this is something which can be easily discussed later.
I mean we could even strip this down to "isSmallerOrEquals" etc.
Summary: I am overall quite skeptical of how much net value would be added by this proposal and similar ones.
I understand this totally. I can understand your arguments and it was the most probable answer. "It doesnt fit the java style" is a good argument. But the answers here were pretty hostile in general
3
u/GuyWithLag Nov 06 '22
But then its not a good idea. Again. If the idea is good and everyone can benefit from it. Then it doesnt matter who writes the idea.
But the ability to know "that" comes with experience.
In any case, I really do think that you would be better served by Kotlin w. extension methods.
For me, the example you gave doesn't make sense to add to the JVM:
It doesn't add anything besides some sugar.
It's not necessarily more readable.
But hey, this is Reddit; feel free to submit a new JCP.
2
u/Cell-i-Zenit Nov 06 '22
It doesn't add anything besides some sugar.
Yes thats true. But why do we have .toList() if its just sugar?
It's not necessarily more readable.
I dont understand this argument.
obj1.compareTo(obj2) > 0vs
obj.isGreaterThan(obj2)the answer is pretty obv which is more readable.
In any case, I really do think that you would be better served by Kotlin w. extension methods.
Still a bad argument "other languages to this already, please switch your language".
Why cant we have any improvements to java?
But the ability to know "that" comes with experience.
Yes and the reviewers have this experience.
1
u/GuyWithLag Nov 06 '22
Yes thats true. But why do we have .toList() if its just sugar?
Because it's not - the specific implementation can optimize that to a `return this`.
1
1
u/lbalazscs Nov 06 '22
IMHO adding operator overloading to the language for <, <=, >, >= when they are used with Comparable objects would make them even more readable...
1
u/Cell-i-Zenit Nov 06 '22
yes i agree but this is a supe controversal change and i honestly want to start with something a little bit more simpler
3
u/oxmyxbela Nov 05 '22
Don’t worry about sponsors for now. Just sign up to the mailing list and discuss your proposal there. If there is a consensus to proceed, people will help you with the rest of the process.
-6
u/Cell-i-Zenit Nov 05 '22
I want to understand the process a bit better, so why do we need to have a sponsor?
If there is a consensus to proceed
How is this decided?
2
u/kiteboarderni Nov 06 '22
Based on your github your code would likely be shit. So some random trying to contribute to the jdk is a very bad idea.
1
u/Cell-i-Zenit Nov 06 '22
What do you mean?
Did you really checked my post history for my github, then looked briefly at the first project and judged me based on the code i write in my freetime instead of the code i write while on job?
2
u/kiteboarderni Nov 06 '22
Yes it took all of about 15 seconds. Which looks to be a considerable amount of time more than the research you put into your original question.
5
u/Cell-i-Zenit Nov 06 '22
Ok since you are a super pro. Can you give me feedback on my github? Which project did you look at? Why do you think its shit? Can you give me pointer on how to improve it?
I mean since it only took you 15 seconds to checkout the quality of my work, maybe you can spend 5 minutes on explaining why you think that way
21
u/DasBrain Nov 05 '22
The way to write your example currently is
BigDecimal.ZERO.compareTo(BigDecimal.ZERO) > 0
BigDecimal.ZERO.compareTo(BigDecimal.ZERO) <= 0IMHO, the methods you suggested are not really needed.
The way add something is to discuss the changes on the appropriate mailing list, maybe even provide a simple patch (with tests) to show the changes.
But the bar for new APIs is high - while it is easy to add new methods, it is hard to near impossible to remove them later.
7
u/iwek7 Nov 05 '22
Current way of doing this is sadly not really readable, op example expresses intent much better and is way less bug prone. Since comparing big decimals is very common usecase I'd argue that there is benefit in providing simpler api for this.
3
u/Cell-i-Zenit Nov 06 '22
i really wonder why everyone is against such a thing. In Java 16, we even got "toList()", which kind of goes into the same direction of "helper methods".
-2
u/iwek7 Nov 06 '22
I remember when I started using kotlin at to my shock every list operation I could ever want was already implemented in standard lib. Such a pleasure to use this api. On the other hand pure java fans will for some reason treasure clunkiness of java and insist that every feature that would make language simpler complicates api while in fact current api is super complicated. I guess people who liked simple to use languages abandoned java long time ago.
I hope you decide to go through trouble of making proposal and post update to this thread. Good luck.
-10
u/Cell-i-Zenit Nov 05 '22
I dont want to discuss these changes as they are just an example
But as you still started to discussing them, let me tell you something:
I know that i can use compareTo, but in a code with pretty heavy business logic and hundreds of lines of code, all comparing bigdecimals left and right, something like compareTo is super hard to read.
I would personally prefer something like
BigDecimal.Zero < BigDecimal.TENbut i figured something like
BigDecimal.ZERO.isGreaterThen(BigDecimal.ZERO)is easier to implement as we just need this to be added to the standard lib and dont need any changes to the compiler.
appropriate mailing list
Where can i find this mailing list?
maybe even provide a simple patch (with tests) to show the changes
Should i really just start implementing this and then send a proposal via mail? It would be wasted time if it gets rejected.
15
u/FirstAd9893 Nov 05 '22
What you really want is operator overloading, which isn't going to happen. Adding "convenience" methods like this just increases the complexity of the API without providing any corresponding value. Your request will be rejected instantly.
-5
u/Cell-i-Zenit Nov 05 '22 edited Nov 05 '22
What you really want is operator overloading, which isn't going to happen.
What i really want is to know how the process looks like and not that my proposed idea is bad/will be rejected.
I dont want to discuss these changes as they are just an example
I even wrote it in the original text, that i dont want to discuss these changes.
5
u/FirstAd9893 Nov 05 '22
What is the specific example feature that you want to add? Perhaps you can add that into the question, and then you'll get feedback regarding your feature before you ask for it to be added to the API. If all you're asking is something like, "hypothetically how can I enhance JDK?" then that's pretty vague. This is where to start: https://openjdk.org/jeps/1
-5
u/Cell-i-Zenit Nov 05 '22
If all you're asking is something like, "hypothetically how can I enhance JDK?"
That was exactly my intention with this post
What is the specific example feature that you want to add? Perhaps you can add that into the question, and then you'll get feedback regarding your feature before you ask for it to be added to the API.
If iam honest, i dont want to actually discuss proposals here as most of the time everything gets shut down without any reasoning.
Best example for me is the "Lombok is bad"!!!! mentality and that people are glad that in the future lombok will not be supported anymore because of compiler changes. Overall the openness to change is pretty low in the java community and especially here on reddit.
6
u/FirstAd9893 Nov 05 '22
If you feel the openness to change is pretty low, then why do you think you would have any more success with an official proposal? If you have a good idea that you'd like to discuss (on another thread), then even negative feedback might help you refine the feature until you have a solid proposal.
0
u/Cell-i-Zenit Nov 05 '22
i think the openness is higher in the email list directly, because that is the actual place to propose these changes.
then even negative feedback might help you refine the feature until you have a solid proposal.
The feedback is not helpful if everyone is just saying "we dont need X, because you can do Y instead". Yes obv i can just do everything a little bit differently, but by this argument we can just stop improving on anything.
To make this a little bit more concrete, i think a change to the Comparable interface would be pretty nice:
public interface Comparable<T> { int compareTo(T var1); default boolean isGreaterThan(T obj){ return compareTo(obj) > 0; } default boolean isSmallerThan(T obj){ return compareTo(obj) < 0; } default boolean isSmallerOrEqualThan(T obj){ return compareTo(obj) <= 0; } default boolean isGreaterOrEqualThan(T obj){ return compareTo(obj) >= 0; } }This would improve the object comparison by a big margin, but as the people already said in this thread that since we already have compareTo, this change will be rejected anyway.
Quite sad actually.
4
u/FirstAd9893 Nov 06 '22
For the sake of completeness, you'd also want to add the
==0and!=0cases. But this might add confusion with respect to the equals method, which isn't required to behave the same as the compareTo method.I also think the long method names (although descriptive) would only serve to highlight the issues with Java's lack of operator overloading. Unfortunately, that's never going to happen, in part because the
==operator must always be an identity comparison for compatibility. It's too late to add a===operator and force everyone to switch over to using it.2
u/Cell-i-Zenit Nov 06 '22
Yes naming can still be discussed ofc. We could think about isBigger, isBiggerThan, isGreater, isGreaterThan etc.
But this might add confusion with respect to the equals method, which isn't required to behave the same as the compareTo method.
yes exactly thats why i dont have included them
7
u/overachiever Nov 06 '22
You say improve but all I see is bloat
3
u/Cell-i-Zenit Nov 06 '22
you cant tell me that you prefer something like this:
if(obj1.compareTo(obj2) <= 0){ }over something like
if(obj1.isGreaterThan(obj2)){ }naming can still be discussed ofc, like isGreater vs isGreaterThan vs isBigger or whatever.
→ More replies (0)2
u/jivedudebe Nov 06 '22
This won't make it a functional interface anymore and prohibit the use in lambdas.
2
u/Cell-i-Zenit Nov 06 '22 edited Nov 06 '22
Comparable is not a functional interface
EDIT: and even if it would, if you provide the additional method as default methods, then you can still have it as a functional interface.
You can check this by yourself: java.util.function.Function is a functional interface and has alot of default methods
→ More replies (0)2
u/UnGauchoCualquiera Nov 06 '22
Adding methods to an interface is a breaking change, specially to a widely used interface like Comparable.
Adding something to the JDK is not a light process (for many reasons) and adding something that could just as easily be added to a util lib is very unlikely to be ever be added.
You might be better served by adding those helper methods to a helper lib like apache commons.
1
u/Cell-i-Zenit Nov 06 '22
Adding methods to an interface is a breaking change, specially to a widely used interface like Comparable.
It is not a breaking change if the changes are default methods...
→ More replies (0)8
u/DasBrain Nov 05 '22
Where can i find this mailing list?
https://mail.openjdk.org/mailman/listinfo
Should i really just start implementing this and then send a proposal via mail? It would be wasted time if it gets rejected.
Well, if the proposal is rejected, yes, you would have wasted your time.
But as I already said: The bar is quite high. A better point for a new API would probably to show why it is needed.
If you can easily work around it - it might not meet the bar.
16
u/whyNadorp Nov 06 '22
this is as hard as getting some changes to the linux kernel. or playing in the nba after a couple of months of playing basketball. you can’t pop up out of the blue and change an interface without knowing all the context. also trivial spelling errors in the method names like “then” instead of “than” will instantly label you as a noob that has no idea what he’s doing. and can’t google how to do it. just forget it, it’s not your cup of tea.
3
u/Cell-i-Zenit Nov 06 '22 edited Nov 06 '22
wow why so mean? Just because i have a then/than spelling error iam stupid and cannot provide any value to the java ecosystem?
EDIT: i hate that the discussion now evolves around my grammer/spellings, but its funny that you critize my spelling and you cant even bother to capitalize a word when you finish a sentence
13
u/whyNadorp Nov 06 '22
everybody is telling you more or less politely that maybe sometimes is better to listen than to talk. but whatever, do as you like. btw it’s grammar, not “grammer” 🤦♂️
1
u/Cell-i-Zenit Nov 06 '22
I dont understand what you are telling me.
maybe sometimes is better to listen than to talk
Tell me what i did wrong.
I wanted to know how i can make a proposal to the JDK. Nothing more or less. Do you think that this is unreasonable for me?
7
6
Nov 06 '22 edited Nov 06 '22
JDK should only be extended by experienced professionals that have proven their skills. Not just by any random student that wants to see his name in the javadoc.
-2
u/Cell-i-Zenit Nov 06 '22
why do you think iam just a student?
Also why do you think the years of experience make any difference in the actual code that gets pushed to main repo? You know there is a code review process, so if the devs are happy, it doesnt matter who wrote it.
2
Nov 06 '22 edited Nov 06 '22
Because of your proposed change in BigDecimal which is totaly unnecessary. Instead of adding a helper method you could create a general way for every developer to add arbitary methods to objects like objective c does with categories. That is a worthy addition for jdk imo.
Because years of exp. matter everywhere im software industry. Why should the Open JDK Project and oracle make exceptions for jdk? Its used by thousands of companies also big tech companies like ibm red hat and sap contribute in development. Do you think they would allow someone unknown contribute to the code? Apply and prove your skills. OpenJDK site explains how to contribute. This reddit discussion will lead you nowhere
2
u/AndrewHaley13 Nov 08 '22
We definitely do allow people we don't know to contribute. And I think this discussion has been interesting. To the original poster: come and talk to people on the lists. Maybe think about back porting fixes from current JDK development to older versions.
-4
u/Cell-i-Zenit Nov 06 '22
Because of your proposed change in BigDecimal which is totaly unnecessary.
So you assume that iam a student because my change is unnecessary? Ok sherlock
I never propopsed any changes to the bigdecimal class. I wanted to make my intention clear so everyone can guide me to the correct place. I even wrote "Please dont discuss these changes as they are EXAMPLES", but everyone just thinks i would propose something like this...
If you want my actual proposal it is this change to the comparable interface:
public interface Comparable<T> { int compareTo(T var1); default boolean isGreaterThan(T obj){ return compareTo(obj) > 0; } default boolean isSmallerThan(T obj){ return compareTo(obj) < 0; } default boolean isSmallerOrEqualThan(T obj){ return compareTo(obj) <= 0; } default boolean isGreaterOrEqualThan(T obj){ return compareTo(obj) >= 0; } }Because years of exp. matter everywhere im software industry.
The good thing is that this exp. is only needed on the reviewer side. As long as the code is good and the 10000 years experts are happy with it, it doesnt matter if it got written by a monkey or by a student.
Why should the Open JDK Project and oracle make exceptions for jdk?
I never asked for exceptions. I wanted to understand the process
Do you think they would allow someone unknown contribute to the code?
Why not? If the proposal is good and everyone agrees with it. Why gatekeep so hard?
Apply and prove your skills.
I will, but apparently since iam a student my proposal will be rejected anyway. Iam unknown as you said it.
2
21
u/DataDecay Nov 05 '22 edited Nov 05 '22
Iv not done this myself, but if you go to the oca site you can sign up for multiple projects
21
u/chabala Nov 06 '22
Folks have already informed you of the proper channels for proposing a change, so I'll just mention the backdoor process, which I'd call 'the Joda-Time technique':
You make an independent library which fills a need, and is so wildly popular and better than the standard library equivalent that they decide to 'adopt' your solution.
It doesn't happen very often.
4
u/DataDecay Nov 06 '22
A very interesting case indeed, I try to refactor any legacy
java.util.dateandjava.util.calendarI come across in reverence of this.1
u/dallasjava Nov 07 '22
It also helps that JDK foundation of java.util.Date and java.util.Calendar were not very good to create the need for joda time.
1
1
10
u/karianna Nov 05 '22
See openjdk.org and the link to the contributing guide. It’s very much a start the discussion in the mailing list first kind of place 🙂
3
u/asciimo71 Nov 05 '22
Java cannot extend existing objects with new methods like other languages can do (Javascript, Swift, ObjC, …) You can only extend by inheritance, but many internal framework classes are marked final and are not inheritable.
6
u/oldshensheep Nov 06 '22
Have you heard about https://github.com/manifold-systems/manifold
1
u/asciimo71 Nov 06 '22
Wow, that‘s almost it’s own language. A lot of groovy and lombok on speed. You know how it behaves with quarkus and graalvm or spring?
0
3
u/SDIDSA Nov 06 '22
it seems like the proposed change was removed from the post for being irrelevant, but I've seen in the comments it's about helper methods to compare big decimals, and i subjectively think that would be a nice addition, I've seen similar methods in the javafx api (NumberExpressionBase.greaterThan, it's not the exact same case but it's an example of adding utility methods to a class that wraps a numeric value, on which you can't perform usual arithmetic operations using symbols so you do it through a method.
2
1
u/ondrejmalekcz Nov 08 '22
Lombok has extension methods. Did not try bacause I am using Kotlin. https://projectlombok.org/features/experimental/ExtensionMethod
0
14
u/s888marks Nov 06 '22
I'll answer the general question here, and comment on specific details of the proposal in the appropriate subthread.
Probably the best reference to how to contribute to OpenJDK is the Developer's Guide. This is still a work-in-progress but it's reasonably complete and up-to-date. (Others have linked to a "How to Contribute" page which is quite old and should probably be merged into the Developer's Guide.)
Most discussions occur on mailing lists. For changes to the core libraries, core-libs-dev is the right mailing list to use.
When something reaches the point of having a code review, lots of discussion takes place in GitHub pull requests. Comments on PRs are mirrored to relevant mailing lists.
On the general topic of adding library APIs: we usually try to add APIs only when they add a new semantic abstraction, improve an existing abstraction, or enable some performance optimization that isn't otherwise possible. Only in rare cases do we add pure convenience APIs, that is, APIs that do something that client code could do itself straightforwardly (if possibly more verbosely). The problem with convenience APIs is that there are many, many such APIs that could be added. Having them would undoubtedly make certain programs more concise, but they make the libraries more cluttered, harder to understand, and more costly to maintain.
There are also a lot of non-obvious costs to adding things to the JDK (not just convenience APIs). Even if somebody were to show up with complete code and tests, there's still lots of work to be done. Specifications need to be written; often, writing the specification is harder than writing the actual code. Also, code and tests are run continuously by CI systems operated by several different organizations. Anything non-trivial will probably fail at some point, which means that somebody will need to track it down and diagnose it. And of course there are bugs and security vulnerabilities that need to be handled.
It may be helpful to think of things this way: anything added to the JDK needs to be maintained in perpetuity by somebody else. Therefore, proposals need to meet some threshold of added value before they're considered seriously.