recommended IDE for developing openjdk?

285 views
Skip to first unread message

Clemens Eisserer

unread,
Jan 15, 2021, 3:33:31 PM1/15/21
to dis...@openjdk.java.net
Hi,

About 10 years ago I used eclipse to work on OpenJDK, however I would like
to get rid of it because of its slow/ugly user interface.
I wonder, are there any recommendations which IDE to use these days?
I gave IntelliJ a try but having not used it that much (except for some
fairly standard maven based projects) I failed to configure it correctly,
however I haven't tried Netbeans still.

So to make it short: Which IDE is known to cope well with working on the
OpenJDK codebase?
And are there detailed instructions available for creating an openjdk
project with intellij?
Or would I be better off using netbeans?

Thank, Clemens

Jonathan Gibbons

unread,
Jan 15, 2021, 3:44:52 PM1/15/21
to dis...@openjdk.java.net
IntelliJ IDEA works well, and more than a few OpenJDK developers use it.

There's a script bin/idea.sh in the OpenJDK repos that you can execute
to initialize a project that can be opened in the IDE.

-- Jon

Langer, Christoph

unread,
Jan 18, 2021, 4:46:30 AM1/18/21
to Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net
Hi Clemens,

while I won't argue about the fanciness of the Eclipse user interface (😉), I'd like to point you to a set of Eclipse projects that I created nevertheless...

You'll find them here: https://github.com/RealCLanger/OpenJDKEclipseProjects

The main benefit of these Eclipse projects is that the projects for all modules and tests are linked together so you will immediately recognize errors in dependencies. I think that doesn't work so well with IntelliJ.

Another hint: There's a mailing list called ide-support-dev where questions around IDE support can get discussed.

Best regards
Christoph

Maurizio Cimadamore

unread,
Jan 18, 2021, 6:13:28 AM1/18/21
to Langer, Christoph, Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net, Jan Lahoda
Hi,
thanks for the pointer to the Eclipse project - I'm sure folks will find
that useful.

I think these days the IntelliJ support is relatively polished - there
are features missing yes (for instance the project is monolitic, and not
modularized, but folks here are using it pretty regularly and I can't
say that has been a huge issue so far).

To get started with intellij you have to create an IDE configuration first.

1. first run `sh configure` as you normally would to set up your JDK
build - that build configuration would then be reused by Intellij

2. then run `sh bin/idea.sh <list of module names> - e.g. `sh
bin/idea.sh java.base jdk.compiler java.desktop` - this will create an
`.idea` folder in the current directory and set the sources for the JDK
modules you specified.

3. open IntelliJ and point it to the folder where the `.idea` folder has
been created. If everything worked correctly you should have a project
up and running.

The base project supports actions for cleaning, rebuilding the selected
modules, or building a JDK image.

Optionally, you can also build and install a jtreg plugin, to run and
debug tests:

https://openjdk.java.net/jtreg/intellij-plugin.html


I use this setup on a daily basis and I think it works pretty well -
there are things that can be improved (for instance, I don't think the
generated sources are always recognized correctly, we need to look into
that), but I'm quite productive with it (especially with the jtreg
plugin enabled).

I know that there is also some limited support for VSCode (especially
for hotspot development):

https://github.com/openjdk/jdk/blob/master/doc/ide.md

And that there is Netbeans support as well - CC'ing Jan who knows more
than I do on how to get started there.

Eventually we should collect all this info in a single place, but I
never found the time to do so. Apologies!

Cheers
Maurizio

Pavel Rappo

unread,
Jan 18, 2021, 6:49:45 AM1/18/21
to Maurizio Cimadamore, Langer, Christoph, Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net, Jan Lahoda
I note that the last time I configured IntelliJ IDEA for `openjdk/jdk` using a procedure similar to the one that Maurizio has just described, I had to tweak inclusion of generated source.

IIRC, after the `idea.sh` script completed, I opened the project it created and went to "File > Project Structure... Project Settings > Modules > Add Content Root" to fix up the way `support/gensrc/java.base` was included. Before I did that, IntelliJ IDEA couldn't see `java.nio.ByteBuffer` and friends.

There's always a chance that I followed the reference procedure incorrectly since I haven't seen others complaining about having had to do similar tweaks.

-Pavel

Ty Young

unread,
Jan 18, 2021, 7:37:04 AM1/18/21
to dis...@openjdk.java.net
FWIW, I use Netbeans. It *technically* works from my experience but
there are some issues:


* There is no auto-configure(read: auto *bash configure*) or project
settings for multiple build types and customization. You'll have to do
those yourself through the command line.

* A bug was introduced which prevents any application using the Swing 
GTK L&F from starting on some distros based on and including Arch Linux.
You can get it to work still by copying folder from another install that
doesn't use the GTK L&F or by using command line switches.

* If the OpenJDK source files are on an FUSE drive(NTFS on Linux, for
example) then Netbeans will fail to clean due to remaining .fuse_hidden
files in jdk/lib if that JDK build is used as a Java Platform. You can
manually delete these but Netbeans for some reason can't.

* Netbeans doesn't seem to handle(read: see at all) API changes between
Java Platforms correctly and as a result you have to make the
built-from-source JDK your default JDK and restart Netbeans to see API
changes that you make.

* Netbeans likes to randomly expand the java.base module's
/share/classes directory leaf for some weird reason.

* Netbeans will mark classes as having compilation errors even after
doing an initial build such as in java.util.concurrent.Semaphore and
java.security.AlgorithmConstraints. The OpenJDK source will still
compile despite these errors just fine, even from within Netbeans
itself. Looking at the files that supposedly have errors shows that it's
either because of:


A. instanceof preview feature


or


B. Netbeans fails to correctly read and/or process a Java file resulting
in Netbeans thinking constructors need identifiers(e.g.
java.util.concurrent.Semaphore's Sync abstract static class's
constructor) or entire method signatures being misinterpreted(e.g. every
method in  java.security.AlgorithmConstraints).


* Netbeans from my experience has a cascading error issue where an error
somewhere in a different part of a project will cause Netbeans to
incorrectly see errors somewhere else, which may explain the above.


* Netbeans has really bad general bugs with refactoring. Don't use it if
you can help it.


Basically, all you have to do is do an initial configure via:


bash configure


and build via:


make images


and then load any of the modules under "src" from within Netbeans.
Netbeans will show a different non-folder icon(cup?) for the JDK modules
that you can load.


Hope this helps.

Maurizio Cimadamore

unread,
Jan 18, 2021, 10:04:10 AM1/18/21
to Pavel Rappo, Langer, Christoph, Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net, Jan Lahoda

On 18/01/2021 11:49, Pavel Rappo wrote:
> I note that the last time I configured IntelliJ IDEA for `openjdk/jdk` using a procedure similar to the one that Maurizio has just described, I had to tweak inclusion of generated source.
>
> IIRC, after the `idea.sh` script completed, I opened the project it created and went to "File > Project Structure... Project Settings > Modules > Add Content Root" to fix up the way `support/gensrc/java.base` was included. Before I did that, IntelliJ IDEA couldn't see `java.nio.ByteBuffer` and friends.
>
> There's always a chance that I followed the reference procedure incorrectly since I haven't seen others complaining about having had to do similar tweaks.
Hi Pavel,

this is also what I do.

I believe the problem is a consequence of something Chris and I have
tried early on as a way to reduce indexing time of the project - e.g. a
long time was spent indexing files in the build folder - so we excluded
that. The project also re-add generated sources folders - but since
these occur inside an excluded folder, it seems like the IDE gets confused.

I tried your trick of adding a new content folder and, while clever, it
doesn't seem to help - e.g. as long as the build folder is excluded, the
IDE cannot see the generated files when try to open a class (e.g. CTRL + N).

Maurizio

Pavel Rappo

unread,
Jan 19, 2021, 12:34:15 PM1/19/21
to Maurizio Cimadamore, Langer, Christoph, Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net, Jan Lahoda
Maurizio,

Here are three observations on configuring the JDK project in IntelliJ IDEA.

1. A folder can be present or absent in the "Excluded Folders" list. This list sits below the "+ Add Content Root" button on the right-hand side of the "Project Structure / Project Settings / Modules" window. The list's entries are of brown-red color. (Note: if the list is empty, it doesn't display its title "Excluded Folders" making it impossible to locate.)

2. The icon of a folder can be displayed in a bleak orange color; selecting such a folder causes the "Excluded" toggle to become pressed. This toggle is the rightmost toggle from the "Mark as:" label on the "Project Structure / Project Settings / Modules" window.

3. It seems that a folder can be both "Excluded" (2) and absent in "Excluded Folders" (1). For example, this is the case for the `build/macosx-x86_64-server-release` folder. If you delete the corresponding entry from "Excluded Folders" (1), that folder will stay "Excluded" (2). I believe this is because that folder is specified in the "Project compiler output" field on the "Project Structure / Project Settings / Project" window and, thus, is excluded implicitly.

If we assume that being "Excluded" (2) implies that a folder is not indexed, then we could piggyback on (3) and simply delete the corresponding entry from "Excluded Folders" (1). I do that by pressing a cross-shaped, gray "Include" button on the corresponding entry and then press the "Apply" button on the window. That causes IDE to familiarize itself with the contents of `build/macosx-x86_64-server-release/support/gensrc/java.base`: symbols in editor are no longer of red color with a "Cannot resolve symbol ... " tooltip.

I'm not sure how this tweak affects indexing though.

-Pavel

Maurizio Cimadamore

unread,
Jan 20, 2021, 7:28:46 AM1/20/21
to Pavel Rappo, Langer, Christoph, Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net, Jan Lahoda
Hi Pavel,

Here are three observations on configuring the JDK project in IntelliJ IDEA.

1. A folder can be present or absent in the "Excluded Folders" list. This list sits below the "+ Add Content Root" button on the right-hand side of the "Project Structure / Project Settings / Modules" window. The list's entries are of brown-red color. (Note: if the list is empty, it doesn't display its title "Excluded Folders" making it impossible to locate.)

Gotcha - I can see the excluded folders
2. The icon of a folder can be displayed in a bleak orange color; selecting such a folder causes the "Excluded" toggle to become pressed. This toggle is the rightmost toggle from the "Mark as:" label on the "Project Structure / Project Settings / Modules" window.

Yup - this is what I normally use to exclude folders "on the fly".
3. It seems that a folder can be both "Excluded" (2) and absent in "Excluded Folders" (1). For example, this is the case for the `build/macosx-x86_64-server-release` folder. If you delete the corresponding entry from "Excluded Folders" (1), that folder will stay "Excluded" (2). I believe this is because that folder is specified in the "Project compiler output" field on the "Project Structure / Project Settings / Project" window and, thus, is excluded implicitly.

Here my head starts spinning - different exclusion mechanisms, partially overlapping?
If we assume that being "Excluded" (2) implies that a folder is not indexed, then we could piggyback on (3) and simply delete the corresponding entry from "Excluded Folders" (1). I do that by pressing a cross-shaped, gray "Include" button on the corresponding entry and then press the "Apply" button on the window. That causes IDE to familiarize itself with the contents of `build/macosx-x86_64-server-release/support/gensrc/java.base`: symbols in editor are no longer of red color with a "Cannot resolve symbol ... " tooltip.
I tried doing just that, but opening e.g. ByteBuffer with CTRL+N just doesn't work. But... you are right in that there's an hidden dependencies between the "Project Output" path and this quirky behavior. If I set "Project Output" to some other folder (e.g. somewhere other than "build") then indexing starts to work as it should... maybe a simple fix can be developed for this...

Cheers
Maurizio



________________________________
From: Pavel Rappo <pavel...@oracle.com>
Sent: Tuesday, January 19, 2021 5:33 PM
To: Maurizio Cimadamore <maurizio....@oracle.com>
Cc: Langer, Christoph <christop...@sap.com>; Clemens Eisserer <linux...@gmail.com>; dis...@openjdk.java.net <dis...@openjdk.java.net>; ide-sup...@openjdk.java.net <ide-sup...@openjdk.java.net>; Jan Lahoda <jan.l...@oracle.com>
Subject: Re: recommended IDE for developing openjdk?

Maurizio Cimadamore

unread,
Jan 20, 2021, 7:59:27 AM1/20/21
to Pavel Rappo, Langer, Christoph, Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net, Jan Lahoda
Resending with right formatting, sorry

On 19/01/2021 17:33, Pavel Rappo wrote:
> Maurizio,
>
> Here are three observations on configuring the JDK project in IntelliJ IDEA.
>
> 1. A folder can be present or absent in the "Excluded Folders" list. This list sits below the "+ Add Content Root" button on the right-hand side of the "Project Structure / Project Settings / Modules" window. The list's entries are of brown-red color. (Note: if the list is empty, it doesn't display its title "Excluded Folders" making it impossible to locate.)

Gotcha - I can see the excluded folders

>
> 2. The icon of a folder can be displayed in a bleak orange color; selecting such a folder causes the "Excluded" toggle to become pressed. This toggle is the rightmost toggle from the "Mark as:" label on the "Project Structure / Project Settings / Modules" window.

Yup - this is what I normally use to exclude folders "on the fly".

>
> 3. It seems that a folder can be both "Excluded" (2) and absent in "Excluded Folders" (1). For example, this is the case for the `build/macosx-x86_64-server-release` folder. If you delete the corresponding entry from "Excluded Folders" (1), that folder will stay "Excluded" (2). I believe this is because that folder is specified in the "Project compiler output" field on the "Project Structure / Project Settings / Project" window and, thus, is excluded implicitly.

Here my head starts spinning - different exclusion mechanisms, partially overlapping?

>
> If we assume that being "Excluded" (2) implies that a folder is not indexed, then we could piggyback on (3) and simply delete the corresponding entry from "Excluded Folders" (1). I do that by pressing a cross-shaped, gray "Include" button on the corresponding entry and then press the "Apply" button on the window. That causes IDE to familiarize itself with the contents of `build/macosx-x86_64-server-release/support/gensrc/java.base`: symbols in editor are no longer of red color with a "Cannot resolve symbol ... " tooltip.
>
> I'm not sure how this tweak affects indexing though.

I tried doing just that, but opening e.g. ByteBuffer with CTRL+N just doesn't work. But... you are right in that there's an hidden dependencies between the "Project Output" path and this quirky behavior. If I set "Project Output" to some other folder (e.g. somewhere other than "build") then indexing starts to work as it should... maybe a simple fix can be developed for this...

Cheers
Maurizio

>

Pavel Rappo

unread,
Jan 20, 2021, 1:41:43 PM1/20/21
to Maurizio Cimadamore, Langer, Christoph, Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net, Jan Lahoda
Maurizio,

Replies are inline.

> On 20 Jan 2021, at 12:56, Maurizio Cimadamore <maurizio....@oracle.com> wrote:
>
> Resending with right formatting, sorry
>
> On 19/01/2021 17:33, Pavel Rappo wrote:
>> Maurizio,
>>
>> Here are three observations on configuring the JDK project in IntelliJ IDEA.
>>
>> 1. A folder can be present or absent in the "Excluded Folders" list. This list sits below the "+ Add Content Root" button on the right-hand side of the "Project Structure / Project Settings / Modules" window. The list's entries are of brown-red color. (Note: if the list is empty, it doesn't display its title "Excluded Folders" making it impossible to locate.)
>
> Gotcha - I can see the excluded folders
>
>>
>> 2. The icon of a folder can be displayed in a bleak orange color; selecting such a folder causes the "Excluded" toggle to become pressed. This toggle is the rightmost toggle from the "Mark as:" label on the "Project Structure / Project Settings / Modules" window.
>
> Yup - this is what I normally use to exclude folders "on the fly".
>
>>
>> 3. It seems that a folder can be both "Excluded" (2) and absent in "Excluded Folders" (1). For example, this is the case for the `build/macosx-x86_64-server-release` folder. If you delete the corresponding entry from "Excluded Folders" (1), that folder will stay "Excluded" (2). I believe this is because that folder is specified in the "Project compiler output" field on the "Project Structure / Project Settings / Project" window and, thus, is excluded implicitly.
>
> Here my head starts spinning - different exclusion mechanisms, partially overlapping?

This is my impression too. Here's my speculation: there seems to be implicit and explicit exclusion. While "explicit exclusion" implies "implicit exclusion", "implicit exclusion" does not imply "explicit exclusion". Unfortunately, reading this article didn't clarify the exclusion mechanism for me: https://www.jetbrains.com/help/idea/indexing.html

>>
>> If we assume that being "Excluded" (2) implies that a folder is not indexed, then we could piggyback on (3) and simply delete the corresponding entry from "Excluded Folders" (1). I do that by pressing a cross-shaped, gray "Include" button on the corresponding entry and then press the "Apply" button on the window. That causes IDE to familiarize itself with the contents of `build/macosx-x86_64-server-release/support/gensrc/java.base`: symbols in editor are no longer of red color with a "Cannot resolve symbol ... " tooltip.
>>
>> I'm not sure how this tweak affects indexing though.
>
> I tried doing just that, but opening e.g. ByteBuffer with CTRL+N just doesn't work. But... you are right in that there's an hidden dependencies between the "Project Output" path and this quirky behavior. If I set "Project Output" to some other folder (e.g. somewhere other than "build") then indexing starts to work as it should... maybe a simple fix can be developed for this...

Interesting; I have a few questions on that.

1. What version of IntelliJ IDEA did you try that in?
2. Did you build the project before executing `sh ./bin/idea.sh <...> java.base <...>`?
3. Could you see the "build/<...>/support/gensrc/java.base [generated]" entry in the "Source Folders" list above the "Excluded Folders" list?
4. Did you allow the IDE to complete the incremental indexing after pressing "Apply"?

-Pavel

Maurizio Cimadamore

unread,
Jan 20, 2021, 1:46:09 PM1/20/21
to Pavel Rappo, Langer, Christoph, Clemens Eisserer, dis...@openjdk.java.net, ide-sup...@openjdk.java.net, Jan Lahoda

> Interesting; I have a few questions on that.
>
> 1. What version of IntelliJ IDEA did you try that in?
Latest (2020.3.1)
> 2. Did you build the project before executing `sh ./bin/idea.sh <...> java.base <...>`?
Yes
> 3. Could you see the "build/<...>/support/gensrc/java.base [generated]" entry in the "Source Folders" list above the "Excluded Folders" list?
Yes
> 4. Did you allow the IDE to complete the incremental indexing after pressing "Apply"?

Yes

Maurizio

>
> -Pavel
>
Reply all
Reply to author
Forward
0 new messages