From andreas.rosdal at gmail.com Fri Nov 18 16:03:58 2022 From: andreas.rosdal at gmail.com (=?UTF-8?Q?Andreas_R=C3=B8sdal?=) Date: Fri, 18 Nov 2022 17:03:58 +0100 Subject: Task for an aspiring JDK contributor Message-ID: Hello! I am an aspiring JDK contributor, having used Java in my work as a developer. I was recently surprised by an Exception thrown when using the java.util.Arrays.asList() method so I would like to propose some improvements to this API. In particular: - When using java.util.Arrays.asList() then AbstractList is throwing UnsupportedOperationException which is not user-friendly or intuitive. - java.util.Arrays.asList() returning a private class called ArrayList, which is not the usual java.util.ArrayList, so it's not user-friendly or intuitive. Since this would be my first contribution to the JDK, and the goal is to complete the contribution with accepted pull request and get the Arrays API improved, what would the first step to making this first improvement to the JDK be? I would also like to share a link to an open source project I've been working on: https://github.com/fciv-net/fciv-net Thank you! Regards, Andreas R. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ethan at mccue.dev Fri Nov 18 16:23:01 2022 From: ethan at mccue.dev (Ethan McCue) Date: Fri, 18 Nov 2022 11:23:01 -0500 Subject: Task for an aspiring JDK contributor In-Reply-To: References: Message-ID: What situation were you encountering the exception? Was it when trying to add to the returned list? If so, that's expected. Arrays.asList only wraps an underlying array, it can't grow it. By that measure List.of() is even more unintuitive because you can't set anything. On Fri, Nov 18, 2022, 11:06 AM Andreas R?sdal wrote: > Hello! > > I am an aspiring JDK contributor, having used Java in my work as a > developer. > > I was recently surprised by an Exception thrown when using the > java.util.Arrays.asList() method > so I would like to propose some improvements to this API. In particular: > - When using java.util.Arrays.asList() then AbstractList is throwing UnsupportedOperationException > which is not user-friendly or intuitive. > - java.util.Arrays.asList() returning a private class called ArrayList, > which is not the usual java.util.ArrayList, so it's not user-friendly or > intuitive. > > Since this would be my first contribution to the JDK, and the goal is to > complete the contribution with accepted pull request and get the Arrays API > improved, what would the first step to making this first improvement to the > JDK be? > > I would also like to share a link to an open source project I've been > working on: > https://github.com/fciv-net/fciv-net > > Thank you! > > Regards, > Andreas R. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.rosdal at gmail.com Fri Nov 18 16:29:01 2022 From: andreas.rosdal at gmail.com (=?UTF-8?Q?Andreas_R=C3=B8sdal?=) Date: Fri, 18 Nov 2022 17:29:01 +0100 Subject: Task for an aspiring JDK contributor In-Reply-To: References: Message-ID: Yes, the exception comes when adding objects to the returned list. So I would like a convenient way to use Arrays to convert an array to a normal modifiable java.util.ArrayList, instead of this AbstractList. On Fri, Nov 18, 2022 at 5:23 PM Ethan McCue wrote: > What situation were you encountering the exception? Was it when trying to > add to the returned list? > > If so, that's expected. Arrays.asList only wraps an underlying array, it > can't grow it. By that measure List.of() is even more unintuitive because > you can't set anything. > > On Fri, Nov 18, 2022, 11:06 AM Andreas R?sdal > wrote: > >> Hello! >> >> I am an aspiring JDK contributor, having used Java in my work as a >> developer. >> >> I was recently surprised by an Exception thrown when using the >> java.util.Arrays.asList() method >> so I would like to propose some improvements to this API. In particular: >> - When using java.util.Arrays.asList() then AbstractList is throwing UnsupportedOperationException >> which is not user-friendly or intuitive. >> - java.util.Arrays.asList() returning a private class called ArrayList, >> which is not the usual java.util.ArrayList, so it's not user-friendly or >> intuitive. >> >> Since this would be my first contribution to the JDK, and the goal is to >> complete the contribution with accepted pull request and get the Arrays API >> improved, what would the first step to making this first improvement to the >> JDK be? >> >> I would also like to share a link to an open source project I've been >> working on: >> https://github.com/fciv-net/fciv-net >> >> Thank you! >> >> Regards, >> Andreas R. >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ethan at mccue.dev Fri Nov 18 16:43:45 2022 From: ethan at mccue.dev (Ethan McCue) Date: Fri, 18 Nov 2022 11:43:45 -0500 Subject: Task for an aspiring JDK contributor In-Reply-To: References: Message-ID: new ArrayList<>(Arrays.asList(theArray)); I'm not intending to be pithy - just this is one of the "known deficiencies" of the collections framework. If you look hard enough you can find some spitballing I did on how to address it in the core-libs mailing list (which would be the place to go for this sort of stuff - cc-ing). The internal class names aren't trivial to fix either because someone somewhere has serialized a java.util.Arrays$ArrayList using ObjectOutputStream and wants to read it back out at some point. Not impossible to address, just tricky. What is the situation where you encountered the internal class name? It could be worth it to make it more clear in whatever that debug scenario is. --- Other than that, to contribute code to the JDK you need to sign the OCA. It will take a bit so you should get that out of the way. On Fri, Nov 18, 2022 at 11:29 AM Andreas R?sdal wrote: > Yes, the exception comes when adding objects to the returned list. So I > would like a convenient way to use Arrays to convert an array to a normal > modifiable java.util.ArrayList, instead of this AbstractList. > > > On Fri, Nov 18, 2022 at 5:23 PM Ethan McCue wrote: > >> What situation were you encountering the exception? Was it when trying to >> add to the returned list? >> >> If so, that's expected. Arrays.asList only wraps an underlying array, it >> can't grow it. By that measure List.of() is even more unintuitive because >> you can't set anything. >> >> On Fri, Nov 18, 2022, 11:06 AM Andreas R?sdal >> wrote: >> >>> Hello! >>> >>> I am an aspiring JDK contributor, having used Java in my work as a >>> developer. >>> >>> I was recently surprised by an Exception thrown when using the >>> java.util.Arrays.asList() method >>> so I would like to propose some improvements to this API. In particular: >>> - When using java.util.Arrays.asList() then AbstractList is throwing UnsupportedOperationException >>> which is not user-friendly or intuitive. >>> - java.util.Arrays.asList() returning a private class called ArrayList, >>> which is not the usual java.util.ArrayList, so it's not user-friendly or >>> intuitive. >>> >>> Since this would be my first contribution to the JDK, and the goal is to >>> complete the contribution with accepted pull request and get the Arrays API >>> improved, what would the first step to making this first improvement to the >>> JDK be? >>> >>> I would also like to share a link to an open source project I've been >>> working on: >>> https://github.com/fciv-net/fciv-net >>> >>> Thank you! >>> >>> Regards, >>> Andreas R. >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.fuchs at oracle.com Fri Nov 18 16:51:09 2022 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 18 Nov 2022 16:51:09 +0000 Subject: Task for an aspiring JDK contributor In-Reply-To: References: Message-ID: Hi Andreas, First of all, congratulations for seeking advice before working on a PR. This is exactly how first contributions should start. Thank you for that! Given the area in which you intended to work however, `core-libs-dev` might have been a better list than `discuss` to start from. With regard to the meat of the issue however, and as noted by Ethan, Arrays.asList() behaves as intended, and changing that would be a major incompatible change, as many users of the API expect the list returned by Arrays.asList to be immutable (and depend on it). It is not possible nor desirable to change that. As for your observation, I believe that: `new ArrayList<>(Arrays.asList(array))` will get you what you want. best regards, -- daniel On 18/11/2022 16:29, Andreas R?sdal wrote: > Yes, the exception comes when adding objects to the returned list. So I > would like a convenient way to use Arrays to convert an array to a > normal modifiable java.util.ArrayList, instead of this AbstractList. > > > On Fri, Nov 18, 2022 at 5:23 PM Ethan McCue > wrote: > > What situation were you encountering the exception? Was it when > trying to add to the returned list? > > If so, that's expected. Arrays.asList only wraps an underlying > array, it can't grow it. By that measure List.of() is even more > unintuitive because you can't set anything. > > On Fri, Nov 18, 2022, 11:06 AM Andreas R?sdal > > wrote: > > Hello! > > I am an aspiring JDK contributor, having used Java in my work as > a developer. > > I was recently surprised by an Exception thrown when using the > java.util.Arrays.asList() method > so I would like to propose some improvements to this API. In > particular: > - When using java.util.Arrays.asList() then AbstractList is > throwing UnsupportedOperationException which is not > user-friendly or intuitive. > - java.util.Arrays.asList() returning a private class called > ArrayList, which is not the usual java.util.ArrayList, so it's > not user-friendly or intuitive. > > Since this would be my first contribution to the JDK, and the > goal is to complete the contribution with accepted pull request > and get the Arrays API improved, what would the first step to > making this first improvement to the JDK be? > > I would also like to share a link to an open source project I've > been working on: > https://github.com/fciv-net/fciv-net > > > Thank you! > > Regards, > Andreas R. > From tanksherman27 at gmail.com Fri Nov 18 18:01:32 2022 From: tanksherman27 at gmail.com (Julian Waters) Date: Sat, 19 Nov 2022 02:01:32 +0800 Subject: Task for an aspiring JDK contributor Message-ID: Hi Andreas, Ignoring the proposed change, you'd first have to be a verified contributor, which requires signing the agreement at https://oca.opensource.oracle.com/ where all you'd need to do is follow the instructions there. I'll put this up front: Be prepared for an atrociously long wait to have the contributor agreement approved, but once you're greenlit you can then proceed with creating a Pull Request against the repository like you'd normally do at https://github.com/openjdk/jdk The JDK has the extra strict requirement that sets it apart from other OpenJDK repositories (for obvious reasons) that Pull Requests must be associated with a corresponding entry at https://bugs.openjdk.org/ which is done by setting the title of the Pull Request to the title of the entry. For example, if the issue you are addressing in your Pull Request is the one at https://bugs.openjdk.org/browse/JDK-8288293, titled "Decouple Compiler used from OS", with the entry number of JDK-8288293, your Pull Request title should be "8288293: Decouple Compiler used from OS", and the integration system (codenamed Skara) will automatically take care of the rest for you and notify reviewers. Do note that it will only do so if the Pull Request is NOT a draft! All you'd need to do then is be patient and listen to the integration system's instructions, and/or any feedback and guidance from reviewers at that point. You can't just create entries in the tracker as you wish- For that you need to apply for the position of Author, which you do by emailing the JDK's Project Lead (Who is Mark Reinhold, as of now) a request for Author in the JDK Project. The requirements for applying for this are actually much less daunting than you might be expecting: Just have 2 already approved and integrated Pull Requests to the JDK, the links to which you must include in your email when requesting for the position. After another very long wait, since Project Leads are typically very busy, you will get several emails to complete your registration as Author, just follow the instructions there once you do get them, after which you will finally be given an Author's account that allows you to create said entries in the tracker. Without the Author position, you'd be limited to only creating Pull Requests for issues others have already opened, and would be unable to open your own Pull Requests for review. (There's also the position of Committer, which you can also attain later on, but that's not relevant now) Now, as an Author myself I could very well help you circumvent that last part until you become an Author yourself, but it's important to note that you should definitely discuss the change you're planning on the relevant mailing list before actually doing so. Is the change you have in mind actually a good idea? I'm not an stdlib developer, so I can't comment on your Array API plans, but from experience I am aware that changes to that particular part of the JDK are subject to exceptionally strict scrutiny (even for an already pretty strict Project such as the JDK), so you should send this idea to core-libs-dev and discuss there first, before you fully commit to having an entry created in the tracker. Let me know if you have any other queries, and good luck in your future endeavours as a JDK Contributor! best regards. Julian -------------- next part -------------- An HTML attachment was scrubbed... URL: From sims.mike at gmail.com Tue Nov 22 05:27:42 2022 From: sims.mike at gmail.com (Mike Sims) Date: Mon, 21 Nov 2022 21:27:42 -0800 Subject: Introduction Message-ID: Hello, My name is Mike Sims, and I've been teaching myself Java for several years now. I got interested in Java after taking some classes when I pursued my bachelor's degree (in CIS, not programming). I have been a Network Engineer by trade most of my life, but I have always written code in my personal time as I have always loved programming. Professionally, I've written apps for companies that deal mainly in their specific processes so a few database-centric programs that I've had the privilege of maintaining over the years. What landed me here, was a recent question I posted to StackExchange concerning an issue I was having where the content of a ScrollPane was being shown over the border of the ScrollPanes viewport. You can see the question I posted here for more detail if interested. It was suggested by one of the moderators that I come over here to see if this issue had ever been reported as a bug and to possibly post a bug report, which led me to trying to figure out how to actually do that, which led me to find the OCA, which I signed and submitted, and was notified today that it was approved. And in that email, it was suggested that I come to this list and introduce myself. I am an avid proponent of continually educating one's self so I am looking forward to not only possibly offering something of value to Java, but also in being observant and learning more about Java from those who have experience in it. It seems that the more I learn about Java, I become aware of just how much I don't know. Ultimately, I'd like to become a better programmer and also a participant in the community, giving back what I can as I learn and grow. Thank you, Mike Sims -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexey.ivanov at oracle.com Tue Nov 22 21:09:09 2022 From: alexey.ivanov at oracle.com (Aleksei Ivanov) Date: Tue, 22 Nov 2022 21:09:09 +0000 Subject: Introduction In-Reply-To: References: Message-ID: <44e133b4-ade3-1079-aa00-722594da4a34@oracle.com> Hello Mike, Signing the OCA does not give you access to JBS to create a bug report. You have to contribute at least two fixes to OpenJDK or OpenJFX for that matter before you can become an Author [1] and get access to JBS. You can report a bug using https://bugreport.java.com/ I assume you ran the search in JBS as suggested in the comment on Stack Overflow and didn't find a similar issue reported. Since you already signed the OCA, you can fix the problem and create a Pull Request. See OpenJDK Developers? Guide . I can't say whether the problem you describe is a bug or not. Engineers at openjfx-dev at openjdk.org could be a better fit for that. If you think this is a bug, please report it along with a test case and it will be routed to the correct team. Regards, Alexey [1] https://openjdk.org/guide/#becoming-an-author On 22/11/2022 05:27, Mike Sims wrote: > Hello, > > My name is Mike Sims, and I've been teaching myself Java for several > years now. I got interested in Java after taking some classes when I > pursued my bachelor's degree (in CIS, not programming). > > I have been a Network Engineer by trade most of my life, but I have > always written code in my personal time as I have always?loved > programming. Professionally, I've written apps for companies that deal > mainly in their specific processes so a few?database-centric programs > that I've had the privilege of maintaining over the years. > > What landed me here, was a recent question I posted to StackExchange > concerning an issue I was having where the content of a ScrollPane was > being shown over the border of the ScrollPanes viewport. You can see > the question I posted here > for more detail if > interested. > > It was suggested by one of the moderators that I come over here to see > if this issue had ever been reported as a bug and to possibly post a > bug report, which led me to trying to figure out how to actually do > that, which led me to find the OCA, which I signed and submitted, and > was notified today that it was approved. And in that email, it was > suggested that I come to this list and introduce myself. > > I am an avid proponent of continually educating one's self so I am > looking forward to not only possibly offering something of value to > Java, but also in being observant and learning more about Java from > those who have experience in it. It seems that the more I learn about > Java, I become aware of just how much I don't know. > > Ultimately, I'd like to become a better programmer and also a > participant in the community, giving back what I can as I learn and grow. > > Thank you, > > Mike Sims -------------- next part -------------- An HTML attachment was scrubbed... URL: