From aph at redhat.com Mon Nov 13 17:21:50 2017 From: aph at redhat.com (Andrew Haley) Date: Mon, 13 Nov 2017 17:21:50 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: References: Message-ID: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> On 13/06/17 03:06, Bradford Wetmore wrote: > 4. Install Jan Lahoda's (Oracle JDK/Netbeans) "JDK Project for > NetBeans" plugin. Also "JTReg Support" if you are using JTReg. > > . In Tools->Plugins menu go to Settings > . Click Add button > . In the URL paste: > > > http://lahoda.info/hudson/job/nb-jdk-project/lastSuccessfulBuild/artifact/build/updates/updates.xml It's been a while, but ... this project seems to be dead. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From aph at redhat.com Mon Nov 13 17:55:10 2017 From: aph at redhat.com (Andrew Haley) Date: Mon, 13 Nov 2017 17:55:10 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <7f5aa14e-a7b5-f7f5-a66f-a9edd32b4f2f@redhat.com> References: <19d2b78d-0fba-05f8-462d-a31723bad80a@redhat.com> <9e79837b-c60b-8dff-1aa6-6ee3646a5eb7@oracle.com> <8215ad5d-f2d0-45ed-9ee8-5a59b1a2b8aa@oracle.com> <7f5aa14e-a7b5-f7f5-a66f-a9edd32b4f2f@redhat.com> Message-ID: <55fcec21-39c2-959c-4ebc-a46b21b2bde0@redhat.com> I'm working with netbeans and the JDK project in make/jdk/netbeans/j2se. When I try to run the tests, it says ant -f /scratch/jdk/make/jdk/netbeans/j2se jtreg /scratch/jdk/make/jdk/netbeans/common/shared.xml:266: No tests selected BUILD FAILED (total time: 0 seconds) So, I would like to set jtreg.tests in build.properties to some string that will run the tests. What should that string be? Nothing I have tried works. A simple example is all I need, thanks. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From aph at redhat.com Mon Nov 20 18:21:01 2017 From: aph at redhat.com (Andrew Haley) Date: Mon, 20 Nov 2017 18:21:01 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <593595B5.9060709@oracle.com> References: <593595B5.9060709@oracle.com> Message-ID: <4faee2a4-1ffa-7f7a-6cf4-81556d4c36f4@redhat.com> On 05/06/17 18:32, Jonathan Gibbons wrote: > While the d-i-y approach works as far as it goes, the JDK support for > IDE projects typically has direct support for running jtreg tests in the > repos. Sure, I get that, and I'd love to be able to use NetBeans to run tests. But I've never been able to get it to work. Let's say I have built the JDK project. I then, asz the documentation says, use *Test Project* from NetBeans. What then happens is that I then get /home/aph/jdk/make/jdk/netbeans/common/shared.xml:239: You must define jtreg.tests to select some tests to run. I have tried setting jtreg.tests to all manner of things, and none of them work. A single example of a jtreg.tests= string that works would get me a very long way. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From aph at redhat.com Mon Nov 20 18:31:43 2017 From: aph at redhat.com (Andrew Haley) Date: Mon, 20 Nov 2017 18:31:43 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <4faee2a4-1ffa-7f7a-6cf4-81556d4c36f4@redhat.com> References: <593595B5.9060709@oracle.com> <4faee2a4-1ffa-7f7a-6cf4-81556d4c36f4@redhat.com> Message-ID: On 20/11/17 18:21, Andrew Haley wrote: > On 05/06/17 18:32, Jonathan Gibbons wrote: >> While the d-i-y approach works as far as it goes, the JDK support for >> IDE projects typically has direct support for running jtreg tests in the >> repos. > > Sure, I get that, and I'd love to be able to use NetBeans to run tests. > But I've never been able to get it to work. > > Let's say I have built the JDK project. I then, asz the documentation > says, use *Test Project* from NetBeans. What then happens is that I > then get > > /home/aph/jdk/make/jdk/netbeans/common/shared.xml:239: You must define jtreg.tests to select some tests to run. > > I have tried setting jtreg.tests to all manner of things, and none > of them work. A single example of a jtreg.tests= string that works > would get me a very long way. What I always get is: /home/aph/jdk/make/jdk/netbeans/common/shared.xml:266: No tests selected So I'd really love to have a concrete example of what people do. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From dean.long at oracle.com Mon Nov 20 19:01:36 2017 From: dean.long at oracle.com (dean.long at oracle.com) Date: Mon, 20 Nov 2017 11:01:36 -0800 Subject: Using an IDE to work on the Java library In-Reply-To: References: <593595B5.9060709@oracle.com> <4faee2a4-1ffa-7f7a-6cf4-81556d4c36f4@redhat.com> Message-ID: <7625a64a-6638-177f-f037-7cd5e8832384@oracle.com> On 11/20/17 10:31 AM, Andrew Haley wrote: > On 20/11/17 18:21, Andrew Haley wrote: >> On 05/06/17 18:32, Jonathan Gibbons wrote: >>> While the d-i-y approach works as far as it goes, the JDK support for >>> IDE projects typically has direct support for running jtreg tests in the >>> repos. >> Sure, I get that, and I'd love to be able to use NetBeans to run tests. >> But I've never been able to get it to work. >> >> Let's say I have built the JDK project. I then, asz the documentation >> says, use *Test Project* from NetBeans. What then happens is that I >> then get >> >> /home/aph/jdk/make/jdk/netbeans/common/shared.xml:239: You must define jtreg.tests to select some tests to run. >> >> I have tried setting jtreg.tests to all manner of things, and none >> of them work. A single example of a jtreg.tests= string that works >> would get me a very long way. > What I always get is: > > /home/aph/jdk/make/jdk/netbeans/common/shared.xml:266: No tests selected > > So I'd really love to have a concrete example of what people do. > This is just a guess, but this part: ??????? makes me think that it's a directory under jdk/test, so maybe "." or "jdk" would work? dl From john.r.rose at oracle.com Mon Nov 20 19:17:38 2017 From: john.r.rose at oracle.com (John Rose) Date: Mon, 20 Nov 2017 11:17:38 -0800 Subject: Using an IDE to work on the Java library In-Reply-To: References: Message-ID: <92EF9C4A-C49A-425D-9353-E3853ABA7AD2@oracle.com> It's extra difficult if you try to develop *part* of a module. As a JDK developer (java.lang.invoke!) I made a concerted effort in IDEA to get it to work and found several bugs. I logged them here with Jetbrains, starting here and continuing to linked issues: support {{--patch-module}} option as fix for "package exists in another module" error in Java 9 https://youtrack.jetbrains.com/issue/IDEA-180982 One thing that you might find useful is the sample project I posted with the bug, which shows my attempt to do incremental development in the java.base module: https://youtrack.jetbrains.com/_persistent/java-base-hack.zip?file=74-459648&c=true It sort of works, and will work better as folks hammer on it. See also: https://youtrack.jetbrains.com/issue/IDEA-180981 https://bugs.openjdk.java.net/browse/JDK-8190672 HTH ? John On Jun 5, 2017, at 9:30 AM, Andrew Haley wrote: > > Sorry for what must seem like a newbie question... > > I've done almost all of my work on HotSpot, and have very little > experience trying to use an IDE to work on the Java library. Eclipse > is fine when working on libraries outdie the JDK itself, but seems to > want to look inside src.zip for its sources when debugging. It would > be really nice to be able to see (and edit) the real Java source files > in jdk/java.base/. > > I suppose there must be some way to create a Project for an IDE, so > that debugging the standard library is easy. Is there some advice > around somewhere? What do people do? > > Thanks, > > -- > Andrew Haley > Java Platform Lead Engineer > Red Hat UK Ltd. > EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From bradford.wetmore at oracle.com Wed Nov 22 01:27:22 2017 From: bradford.wetmore at oracle.com (Bradford Wetmore) Date: Tue, 21 Nov 2017 17:27:22 -0800 Subject: Using an IDE to work on the Java library In-Reply-To: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> Message-ID: <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> On 11/13/2017 9:21 AM, Andrew Haley wrote: > On 13/06/17 03:06, Bradford Wetmore wrote: >> 4. Install Jan Lahoda's (Oracle JDK/Netbeans) "JDK Project for >> NetBeans" plugin. Also "JTReg Support" if you are using JTReg. >> >> . In Tools->Plugins menu go to Settings >> . Click Add button >> . In the URL paste: >> >> >> http://lahoda.info/hudson/job/nb-jdk-project/lastSuccessfulBuild/artifact/build/updates/updates.xml > > It's been a while, but ... this project seems to be dead. Jan has been updating when significant issues are discovered/reported, there is a version coming based on my report last week. BTW, are you trying to run a test suite from within Netbeans, or just debug an individual test? If the latter, what I used to do before I found out about Jan's project is basically the same as what I wrote back in June[1], but with the following changes: *N.B., I don't use any of the netbeans projects in the OpenJDK workspaces.* 1. In step 1, build jdk10 instead of 9. 2. Skip step 4, or else disable OpenJDK/JTREG projects. 3. In step 5, after you add the platform without specifying the source (only one directory possible), now go back and add all of the desired source locations using the sources tab. Include any that you might want, in the right order. e.g. gensrc, java.base-os-specific, java.base-shared, jdk.crypto.*, etc. Step 6 no longer applies. Likely only 7a works since you skipped step 4. In 7a, I often will specify the project using "existing sources". Then "Debug Project". I just tried this out on a closed build and stepped through some simple test Projects, it works for JDK 10. > So I'd really love to have a concrete example of what people do Hope this helps, Brad [1] http://mail.openjdk.java.net/pipermail/jdk10-dev/2017-June/000291.html From aph at redhat.com Wed Nov 22 11:31:03 2017 From: aph at redhat.com (Andrew Haley) Date: Wed, 22 Nov 2017 11:31:03 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> Message-ID: <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> On 22/11/17 01:27, Bradford Wetmore wrote: > > On 11/13/2017 9:21 AM, Andrew Haley wrote: >> On 13/06/17 03:06, Bradford Wetmore wrote: >>> 4. Install Jan Lahoda's (Oracle JDK/Netbeans) "JDK Project for >>> NetBeans" plugin. Also "JTReg Support" if you are using JTReg. >>> >>> . In Tools->Plugins menu go to Settings >>> . Click Add button >>> . In the URL paste: >>> >>> >>> http://lahoda.info/hudson/job/nb-jdk-project/lastSuccessfulBuild/artifact/build/updates/updates.xml >> >> It's been a while, but ... this project seems to be dead. > > Jan has been updating when significant issues are discovered/reported, > there is a version coming based on my report last week. He's updated his site, and I now have been able to use it. > BTW, are you trying to run a test suite from within Netbeans, or just > debug an individual test? I'm trying to debug AOT compilation. All I want is a JDK that I can debug and edit. I've been trying to use the Netbeans projects because there are dozens (hundreds? :-) of source directories in the JDK and having to enter every single one of them into the Netbeans "add source" dialogue is incredibly painful. I thought I'd use one of the Netbeans projects, but I can't run a simple program, and I can't get any of the test cases to run either. > Hope this helps, I'll give it a try, thanks. But many of the directories are still missing from that project, such as jdk.internal.vm.compiler. Can that project be fixed so that everything is included and can be debugged and edited? -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From neugens.limasoftware at gmail.com Wed Nov 22 11:52:07 2017 From: neugens.limasoftware at gmail.com (Mario Torre) Date: Wed, 22 Nov 2017 12:52:07 +0100 Subject: Using an IDE to work on the Java library In-Reply-To: <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> Message-ID: 2017-11-22 12:31 GMT+01:00 Andrew Haley : > All I want is a JDK that I can debug and edit. I've been trying to > use the Netbeans projects because there are dozens (hundreds? :-) of > source directories in the JDK and having to enter every single one of > them into the Netbeans "add source" dialogue is incredibly painful. I > thought I'd use one of the Netbeans projects, but I can't run a simple > program, and I can't get any of the test cases to run either. If you only want to debug AOT maybe the best solution is to add the custom JDK you just compiled in the "Java Platforms" menu and then create a simple applications within NetBeans using this same JDK, forgetting any custom "JDK as a project" trick. Attaching the debugger at startup via NetBeans or even launching the application in debug mode will use this JDK, so you can debug and see the code. Now, I need to try this, but if I remember correctly, if you configured the "Sources" for this custom JDK in the "Java Platform" sources tab (again, not as a Java JDK project, but linked in the properties of the JDK itself), Netbeans allows you to edit the files that it opens (at least, it used to), you can point to the root directory and NetBeans should be clever enough to figure out the files. If instead you go with the creation of a JDK as a project (like it was suggested here before), consider that you don't need to necessarily add all the sources for all the projects, just the ones you are interested in, for instance, the AOT/Graal code and the Java base, or such, you don't need it all. I'll try later with a fresh clone of everything if I'm anywhere successful to use a project with Netbeans using the project definitions in the JDK, maybe I can help fixing those projects files. Cheers, Mario -- pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF Java Champion - Blog: http://neugens.wordpress.com - Twitter: @neugens Proud GNU Classpath developer: http://www.classpath.org/ OpenJDK: http://openjdk.java.net/projects/caciocavallo/ Please, support open standards: http://endsoftpatents.org/ From aph at redhat.com Wed Nov 22 13:04:52 2017 From: aph at redhat.com (Andrew Haley) Date: Wed, 22 Nov 2017 13:04:52 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> Message-ID: <4c9f0a08-acfb-0219-ac48-0cfc75ed4544@redhat.com> On 22/11/17 11:52, Mario Torre wrote: > Now, I need to try this, but if I remember correctly, if you > configured the "Sources" for this custom JDK in the "Java Platform" > sources tab (again, not as a Java JDK project, but linked in the > properties of the JDK itself), Netbeans allows you to edit the files > that it opens (at least, it used to), you can point to the root > directory and NetBeans should be clever enough to figure out the > files. That doesn't work for me. > If instead you go with the creation of a JDK as a project (like it was > suggested here before), consider that you don't need to necessarily > add all the sources for all the projects, just the ones you are > interested in, for instance, the AOT/Graal code and the Java base, or > such, you don't need it all. > > I'll try later with a fresh clone of everything if I'm anywhere > successful to use a project with Netbeans using the project > definitions in the JDK, maybe I can help fixing those projects files. Sure, that would be good. The really weird thing is that everyone seems to be re-inventing this process, which really should Just Work. Everybody working on the JDK must have the same set of problems. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From neugens.limasoftware at gmail.com Wed Nov 22 13:12:06 2017 From: neugens.limasoftware at gmail.com (Mario Torre) Date: Wed, 22 Nov 2017 14:12:06 +0100 Subject: Using an IDE to work on the Java library In-Reply-To: <4c9f0a08-acfb-0219-ac48-0cfc75ed4544@redhat.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <4c9f0a08-acfb-0219-ac48-0cfc75ed4544@redhat.com> Message-ID: 2017-11-22 14:04 GMT+01:00 Andrew Haley : > On 22/11/17 11:52, Mario Torre wrote: >> Now, I need to try this, but if I remember correctly, if you >> configured the "Sources" for this custom JDK in the "Java Platform" >> sources tab (again, not as a Java JDK project, but linked in the >> properties of the JDK itself), Netbeans allows you to edit the files >> that it opens (at least, it used to), you can point to the root >> directory and NetBeans should be clever enough to figure out the >> files. > > That doesn't work for me. > >> If instead you go with the creation of a JDK as a project (like it was >> suggested here before), consider that you don't need to necessarily >> add all the sources for all the projects, just the ones you are >> interested in, for instance, the AOT/Graal code and the Java base, or >> such, you don't need it all. >> >> I'll try later with a fresh clone of everything if I'm anywhere >> successful to use a project with Netbeans using the project >> definitions in the JDK, maybe I can help fixing those projects files. > > Sure, that would be good. > > The really weird thing is that everyone seems to be re-inventing this > process, which really should Just Work. Everybody working on the JDK > must have the same set of problems. I think the problem is that project files tend to be per OpenJDK release which takes (or took!) years between updates, while IDE move faster, sometime resulting in incompatible changes in the project structure across releases, so one project structure may work only on some version of any given IDE. This is also complicated by the fact that the actual build is make based, most of those tools don't understand that so they don't really create an actual usable build of the JDK, they can only reference code. I think everything is getting more or less stable lately also on IDE space regarding project layout and descriptors, so there probably should only be one way to do this all, I don't think we will be able to do all in the IDEs though. Cheers, Mario -- pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF Java Champion - Blog: http://neugens.wordpress.com - Twitter: @neugens Proud GNU Classpath developer: http://www.classpath.org/ OpenJDK: http://openjdk.java.net/projects/caciocavallo/ Please, support open standards: http://endsoftpatents.org/ From aph at redhat.com Wed Nov 22 13:45:05 2017 From: aph at redhat.com (Andrew Haley) Date: Wed, 22 Nov 2017 13:45:05 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> Message-ID: <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> On 22/11/17 11:31, Andrew Haley wrote: > All I want is a JDK that I can debug and edit. I've been trying to > use the Netbeans projects because there are dozens (hundreds? :-) of > source directories in the JDK and having to enter every single one of > them into the Netbeans "add source" dialogue is incredibly painful. And, I forgot to say, Netbeans returns hundreds of errors with the source covered in red underlining, with messages like "error: package jdk.vm.ci.code does not exist". It does, and it's in the JDK, but for some reason Netbeans doesn't look in there. So I can't set breakpoints on it either, because I get the Not able to submit breakpoint MethodBreakpoint [jdk.tools.jaotc.Main].main '([Ljava/lang/String;)V', reason: Breakpoint belongs to disabled source root '/home/aph/jdk/src/jdk.aot/share/classes/jdk.tools.jaotc/src'. See Window/Debugging/Sources. message. I was hoping that the Netbeans projects would fix this. Like I said, lots of people are working on the JDK, and they must do their development somehow. But it seems impossible. The Netbeans projects don't work -- I guess they got broken when the source was reorganized. I'm going to try John Rose's suggestion next, to see if that works. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From jan.lahoda at oracle.com Wed Nov 22 15:09:43 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Wed, 22 Nov 2017 16:09:43 +0100 Subject: Using an IDE to work on the Java library In-Reply-To: <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> Message-ID: <5A159337.7050804@oracle.com> Hi Andrew, I suspect the problem is that the sources of the jdk.internal.vm.ci module (and a few other modules) are not in the package hierarchy under share/classes. I.e., there is no src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code (as there is src/java.base/share/classes/java/lang). There is only src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code, but the (module) source path is referring to src/*/share/classes, not to src/*/share/classes/jdk.vm.ci.code/src. I suspect this needs some workarounds in IDE projects, as there are workarounds in the build system for this. I don't think anyone was using the project for these modules so far (the project is working OK for me for java.compiler, jdk.compiler, java.base, jdk.jshell and occasionally java.desktop). I'll see what can be done. Jan On 22.11.2017 14:45, Andrew Haley wrote: > On 22/11/17 11:31, Andrew Haley wrote: > >> All I want is a JDK that I can debug and edit. I've been trying to >> use the Netbeans projects because there are dozens (hundreds? :-) of >> source directories in the JDK and having to enter every single one of >> them into the Netbeans "add source" dialogue is incredibly painful. > > And, I forgot to say, Netbeans returns hundreds of errors with the > source covered in red underlining, with messages like "error: package > jdk.vm.ci.code does not exist". It does, and it's in the JDK, but for > some reason Netbeans doesn't look in there. So I can't set breakpoints > on it either, because I get the > > Not able to submit breakpoint MethodBreakpoint [jdk.tools.jaotc.Main].main '([Ljava/lang/String;)V', reason: Breakpoint belongs to disabled source root '/home/aph/jdk/src/jdk.aot/share/classes/jdk.tools.jaotc/src'. See Window/Debugging/Sources. > > message. I was hoping that the Netbeans projects would fix this. > > Like I said, lots of people are working on the JDK, and they must do > their development somehow. But it seems impossible. The Netbeans > projects don't work -- I guess they got broken when the source was > reorganized. I'm going to try John Rose's suggestion next, to see if > that works. > From aph at redhat.com Wed Nov 22 15:30:35 2017 From: aph at redhat.com (Andrew Haley) Date: Wed, 22 Nov 2017 15:30:35 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <5A159337.7050804@oracle.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> Message-ID: <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Hi, On 22/11/17 15:09, Jan Lahoda wrote: > I suspect the problem is that the sources of the jdk.internal.vm.ci > module (and a few other modules) are not in the package hierarchy under > share/classes. I.e., there is no > src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code (as there is > src/java.base/share/classes/java/lang). There is only > src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code, > but the (module) source path is referring to src/*/share/classes, not to > src/*/share/classes/jdk.vm.ci.code/src. I suspect this needs some > workarounds in IDE projects, as there are workarounds in the build > system for this. I don't think anyone was using the project for these > modules so far (the project is working OK for me for java.compiler, > jdk.compiler, java.base, jdk.jshell and occasionally java.desktop). I'll > see what can be done. That would be awesome! The last few days I've been trying to work on this have sometimes felt like I was losing my mind. Rather ironically, the explanation for the very odd arrangement of these source files was that it was what IDEs wanted. Go figure... Thanks again. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From adinn at redhat.com Wed Nov 22 16:52:43 2017 From: adinn at redhat.com (Andrew Dinn) Date: Wed, 22 Nov 2017 16:52:43 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: On 22/11/17 15:30, Andrew Haley wrote: > That would be awesome! The last few days I've been trying to work on > this have sometimes felt like I was losing my mind. Rather > ironically, the explanation for the very odd arrangement of these > source files was that it was what IDEs wanted. Go figure... I have not repeated the experiment with jdk10 yet but I was able to get Idea to use the correct sources for the jdk.internal.vm.ci tree when using Graal and jdk9. As I recall, I merely added the top level dir in the hotspot tree (hotspot/src/jdk.internal.vm.ci) as a source root and Idea worked out how to find the underlying subdirs (share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code etc). Maybe Idea was the only IDE which wanted this? :-) regards, Andrew Dinn ----------- Senior Principal Software Engineerth Red Hat UK Ltd Registered in England and Wales under Company Registration No. 03798903 Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander From martinrb at google.com Wed Nov 22 17:54:44 2017 From: martinrb at google.com (Martin Buchholz) Date: Wed, 22 Nov 2017 09:54:44 -0800 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: I remember back in the '80s the tool vendors were making fun of us folk who used "grep" as their code understanding tool. Now 30 years later, I still live in Emacs with recursive grep being my main way of navigating the sources. It's tough because openjdk's java sources may be ahead of IDE language support, and the sources also come with lots of hard-to-grok C++ and Makefiles. From sean.coffey at oracle.com Wed Nov 22 18:06:56 2017 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Wed, 22 Nov 2017 18:06:56 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: Slightly off topic.. but I'm a big fan of OpenGrok[1] for navigating the JDK sources. Great for sharing links also. It would be great if we could get an external instance of such a service to index JDK sources. regards, Sean. [1] https://opengrok.github.io/OpenGrok/ On 22/11/2017 17:54, Martin Buchholz wrote: > I remember back in the '80s the tool vendors were making fun of us folk who > used "grep" as their code understanding tool. Now 30 years later, I still > live in Emacs with recursive grep being my main way of navigating the > sources. It's tough because openjdk's java sources may be ahead of IDE > language support, and the sources also come with lots of hard-to-grok C++ > and Makefiles. From neugens.limasoftware at gmail.com Wed Nov 22 19:04:17 2017 From: neugens.limasoftware at gmail.com (Mario Torre) Date: Wed, 22 Nov 2017 20:04:17 +0100 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: 2017-11-22 18:54 GMT+01:00 Martin Buchholz : > I remember back in the '80s the tool vendors were making fun of us folk who > used "grep" as their code understanding tool. Now 30 years later, I still > live in Emacs with recursive grep being my main way of navigating the > sources. It's tough because openjdk's java sources may be ahead of IDE > language support, and the sources also come with lots of hard-to-grok C++ > and Makefiles. The irony is not lost on me that is Andrew that is asking how to configure an IDE to work on Java :) Cheers, Mario -- pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF Java Champion - Blog: http://neugens.wordpress.com - Twitter: @neugens Proud GNU Classpath developer: http://www.classpath.org/ OpenJDK: http://openjdk.java.net/projects/caciocavallo/ Please, support open standards: http://endsoftpatents.org/ From jan.lahoda at oracle.com Wed Nov 22 20:38:12 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Wed, 22 Nov 2017 21:38:12 +0100 Subject: Using an IDE to work on the Java library In-Reply-To: <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: <5A15E034.3090701@oracle.com> On 22.11.2017 16:30, Andrew Haley wrote: > Hi, > > On 22/11/17 15:09, Jan Lahoda wrote: >> I suspect the problem is that the sources of the jdk.internal.vm.ci >> module (and a few other modules) are not in the package hierarchy under >> share/classes. I.e., there is no >> src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code (as there is >> src/java.base/share/classes/java/lang). There is only >> src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code, >> but the (module) source path is referring to src/*/share/classes, not to >> src/*/share/classes/jdk.vm.ci.code/src. I suspect this needs some >> workarounds in IDE projects, as there are workarounds in the build >> system for this. I don't think anyone was using the project for these >> modules so far (the project is working OK for me for java.compiler, >> jdk.compiler, java.base, jdk.jshell and occasionally java.desktop). I'll >> see what can be done. > > That would be awesome! The last few days I've been trying to work on There should be an updated version of of the plugin available now. Should be possible to open src/jdk.internal.vm.ci/ as a project, set breakpoints in the source files, and when debugging, debugger should be able to stop there (I was able to only do limited testing, though). Current caveat/bug: types from src/jdk.internal.vm.ci/ appear twice in the Go to Type dialog, but only one of the results works (the other one that does not work has src/jdk/internal/vm/ci/ in the path). Not sure yet what is the problem. Jan > this have sometimes felt like I was losing my mind. Rather > ironically, the explanation for the very odd arrangement of these > source files was that it was what IDEs wanted. Go figure... > > Thanks again. > From aph at redhat.com Thu Nov 23 09:36:28 2017 From: aph at redhat.com (Andrew Haley) Date: Thu, 23 Nov 2017 09:36:28 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: On 22/11/17 19:04, Mario Torre wrote: > 2017-11-22 18:54 GMT+01:00 Martin Buchholz : >> I remember back in the '80s the tool vendors were making fun of us folk who >> used "grep" as their code understanding tool. Now 30 years later, I still >> live in Emacs with recursive grep being my main way of navigating the >> sources. It's tough because openjdk's java sources may be ahead of IDE >> language support, and the sources also come with lots of hard-to-grok C++ >> and Makefiles. > > The irony is not lost on me that is Andrew that is asking how to > configure an IDE to work on Java :) Irony? There's nothing ironic about it, it's a complete mess. All that I need is a debugger, and there seems to be no way to get one without all of the associated baggage that comes along with an IDE. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From aph at redhat.com Thu Nov 23 09:51:14 2017 From: aph at redhat.com (Andrew Haley) Date: Thu, 23 Nov 2017 09:51:14 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: <473e0417-6970-859f-64ef-de2f491e6497@redhat.com> On 22/11/17 17:54, Martin Buchholz wrote: > I remember back in the '80s the tool vendors were making fun of us folk who > used "grep" as their code understanding tool. Now 30 years later, I still > live in Emacs with recursive grep being my main way of navigating the > sources. It's tough because openjdk's java sources may be ahead of IDE > language support, and the sources also come with lots of hard-to-grok C++ > and Makefiles. The saddest thing about all this is that using the IDE to edit the system itself just worked 30-odd years ago on Smalltalk systems. All you had to do was open a class in the browser, edit a method and save it. All of the debugging just worked. We have regressed tremendously. I wonder if it ought to be a basic release criterion for OpenJDK that some basic tooling for working on the system itself should just work. If we want to attract people to work on this project we don't need barriers which make their life impossible. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From neugens.limasoftware at gmail.com Thu Nov 23 10:55:51 2017 From: neugens.limasoftware at gmail.com (Mario Torre) Date: Thu, 23 Nov 2017 10:55:51 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: But I was trying to be sarcastic, there is indeed a serious problem, most of us are not so much affected because everyone ends with their custom solution that works somehow, but your point is absolutely correct, the barriers to enter are unnecessarily high here. On Thu 23. Nov 2017 at 10:36, Andrew Haley wrote: > On 22/11/17 19:04, Mario Torre wrote: > > 2017-11-22 18:54 GMT+01:00 Martin Buchholz : > >> I remember back in the '80s the tool vendors were making fun of us folk > who > >> used "grep" as their code understanding tool. Now 30 years later, I > still > >> live in Emacs with recursive grep being my main way of navigating the > >> sources. It's tough because openjdk's java sources may be ahead of IDE > >> language support, and the sources also come with lots of hard-to-grok > C++ > >> and Makefiles. > > > > The irony is not lost on me that is Andrew that is asking how to > > configure an IDE to work on Java :) > > Irony? There's nothing ironic about it, it's a complete mess. All that > I need is a debugger, and there seems to be no way to get one without all > of the associated baggage that comes along with an IDE. > > -- > Andrew Haley > Java Platform Lead Engineer > Red Hat UK Ltd. > EAC8 43EB D3EF DB98 CC7 > 7 2FAD A5CD > 6035 332F A671 > From thomas.stuefe at gmail.com Sat Nov 25 07:38:30 2017 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Sat, 25 Nov 2017 08:38:30 +0100 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> Message-ID: On Wed, Nov 22, 2017 at 7:06 PM, Se?n Coffey wrote: > Slightly off topic.. but I'm a big fan of OpenGrok[1] for navigating the > JDK sources. Great for sharing links also. > > It would be great if we could get an external instance of such a service > to index JDK sources. > > regards, > Sean. > > [1] https://opengrok.github.io/OpenGrok/ > > > The BSD folks use it too: http://bxr.su/ I love OpenGrok. Have set it up internally for our team and it is almost the first thing I set up on every development machine I work on, even on Windows. I always wanted to set up a public opengrok server to grep openjdk repos, but so far shied away from cost and maintenance. ..Thomas > On 22/11/2017 17:54, Martin Buchholz wrote: > >> I remember back in the '80s the tool vendors were making fun of us folk >> who >> used "grep" as their code understanding tool. Now 30 years later, I still >> live in Emacs with recursive grep being my main way of navigating the >> sources. It's tough because openjdk's java sources may be ahead of IDE >> language support, and the sources also come with lots of hard-to-grok C++ >> and Makefiles. >> > > From maurizio.cimadamore at oracle.com Mon Nov 27 15:42:48 2017 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Mon, 27 Nov 2017 15:42:48 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> Message-ID: <5fb76283-d490-8e92-db85-ae41030427ba@oracle.com> Hi Andrew, over the last few years, Chris and I have been promoting IntelliJ support for JDK [1] - the results of this work are included in OpenJDK, and you can create an idea project as follows: ?sh bin/idea.sh jdk.internal.vm.ci the command idea.sh takes a list of modules you want to work on. I tested it with the above module (which I've seen mentioned in this thread) and found no issues. Few months ago we also released the IntelliJ jtreg plugin which allows you to run/debug tests. I agree that we need to come up with ways to make it easier for people to work/hack on openjdk using IDEs - hopefully this is a step in the right direction. Note that this script works by delegating all configuration decisions to the makefile - so, assuming you have an existing build configuration, the source roots should be tailored for your OS/HW combo. [1] - http://mail.openjdk.java.net/pipermail/discuss/2015-January/003645.html [2] - http://mail.openjdk.java.net/pipermail/jtreg-dev/2016-October/000390.html Maurizio On 22/11/17 13:45, Andrew Haley wrote: > On 22/11/17 11:31, Andrew Haley wrote: > >> All I want is a JDK that I can debug and edit. I've been trying to >> use the Netbeans projects because there are dozens (hundreds? :-) of >> source directories in the JDK and having to enter every single one of >> them into the Netbeans "add source" dialogue is incredibly painful. > And, I forgot to say, Netbeans returns hundreds of errors with the > source covered in red underlining, with messages like "error: package > jdk.vm.ci.code does not exist". It does, and it's in the JDK, but for > some reason Netbeans doesn't look in there. So I can't set breakpoints > on it either, because I get the > > Not able to submit breakpoint MethodBreakpoint [jdk.tools.jaotc.Main].main '([Ljava/lang/String;)V', reason: Breakpoint belongs to disabled source root '/home/aph/jdk/src/jdk.aot/share/classes/jdk.tools.jaotc/src'. See Window/Debugging/Sources. > > message. I was hoping that the Netbeans projects would fix this. > > Like I said, lots of people are working on the JDK, and they must do > their development somehow. But it seems impossible. The Netbeans > projects don't work -- I guess they got broken when the source was > reorganized. I'm going to try John Rose's suggestion next, to see if > that works. > From aph at redhat.com Mon Nov 27 15:59:02 2017 From: aph at redhat.com (Andrew Haley) Date: Mon, 27 Nov 2017 15:59:02 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <5fb76283-d490-8e92-db85-ae41030427ba@oracle.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5fb76283-d490-8e92-db85-ae41030427ba@oracle.com> Message-ID: <116ddc44-89cb-7426-dad7-5e6b6efe9480@redhat.com> On 27/11/17 15:42, Maurizio Cimadamore wrote: > over the last few years, Chris and I have been promoting IntelliJ > support for JDK [1] - the results of this work are included in OpenJDK, > and you can create an idea project as follows: > > ?sh bin/idea.sh jdk.internal.vm.ci Thank you very much! I can't wait to try this. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From bradford.wetmore at oracle.com Tue Nov 28 02:08:59 2017 From: bradford.wetmore at oracle.com (Bradford Wetmore) Date: Mon, 27 Nov 2017 18:08:59 -0800 Subject: Using an IDE to work on the Java library In-Reply-To: <5A15E034.3090701@oracle.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5A159337.7050804@oracle.com> <8c2cbb4a-d168-aa4a-6469-fd6c19245659@redhat.com> <5A15E034.3090701@oracle.com> Message-ID: <215d181d-5378-9e86-819b-3f5aa8b6174a@oracle.com> >>> I suspect the problem is that the sources of the jdk.internal.vm.ci >>> module (and a few other modules) are not in the package hierarchy under >>> share/classes. I.e., there is no >>> src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code (as there is >>> src/java.base/share/classes/java/lang). There is only >>> src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code, >>> but the (module) source path is referring to src/*/share/classes, not to >>> src/*/share/classes/jdk.vm.ci.code/src. I suspect this needs some >>> workarounds in IDE projects, as there are workarounds in the build >>> system for this. I don't think anyone was using the project for these >>> modules so far (the project is working OK for me for java.compiler, >>> jdk.compiler, java.base, jdk.jshell and occasionally java.desktop). I'll >>> see what can be done. >> >> That would be awesome!? The last few days I've been trying to work on > > There should be an updated version of of the plugin available now. > Should be possible to open src/jdk.internal.vm.ci/ as a project, set > breakpoints in the source files, and when debugging, debugger should be > able to stop there (I was able to only do limited testing, though). Just FYI, I was able to open the jdk.internal.vm.ci module using Jan's updated plugin, and could at least see under ${basedir}/share/classes/jdk.vm.ci.common/src, that there is a package jdk.vm.ci.common with the file JVMCIError.java. I was able to tag a breakpoint, but didn't actually try anything that would test it. (screenshot on request :) ) Good luck, Brad From aph at redhat.com Tue Nov 28 18:11:54 2017 From: aph at redhat.com (Andrew Haley) Date: Tue, 28 Nov 2017 18:11:54 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: <5fb76283-d490-8e92-db85-ae41030427ba@oracle.com> References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5fb76283-d490-8e92-db85-ae41030427ba@oracle.com> Message-ID: Hi, and thanks for helping. Thanks for your patience! On 27/11/17 15:42, Maurizio Cimadamore wrote: > over the last few years, Chris and I have been promoting IntelliJ > support for JDK [1] - the results of this work are included in OpenJDK, > and you can create an idea project as follows: > > sh bin/idea.sh jdk.internal.vm.ci > > the command idea.sh takes a list of modules you want to work on. I > tested it with the above module (which I've seen mentioned in this > thread) and found no issues. > > Few months ago we also released the IntelliJ jtreg plugin which allows > you to run/debug tests. > > I agree that we need to come up with ways to make it easier for people > to work/hack on openjdk using IDEs - hopefully this is a step in the > right direction. Note that this script works by delegating all > configuration decisions to the makefile - so, assuming you have an > existing build configuration, the source roots should be tailored for > your OS/HW combo. > > [1] - > http://mail.openjdk.java.net/pipermail/discuss/2015-January/003645.html > [2] - > http://mail.openjdk.java.net/pipermail/jtreg-dev/2016-October/000390.html OK, so I do this and open the [jdk] directory. So far, so good. And I can open the files in the jdk.internal.vm.ci directory, and they are recognized. Now, I see at the top of the file "Project SDK is not defined". That looks bad -- is there something wrong? Do you expect to see this message? But the really severe problem I now have is that I can't see any way to create a program that uses this configuration. Let's say I want to create Hello.java that uses this JDK. I can create a new Java class under test, but I'm now stuck because of "Project SDK is not defined". What would you do at this point? Thanks. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671 From maurizio.cimadamore at oracle.com Tue Nov 28 18:36:42 2017 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Tue, 28 Nov 2017 18:36:42 +0000 Subject: Using an IDE to work on the Java library In-Reply-To: References: <94a9a291-5d93-1061-edb6-5469b9ab6d55@redhat.com> <38e22e43-20e2-cf3c-ff9a-51f0da6547e1@oracle.com> <9ab0735d-7795-573c-27bd-ed96376a6f26@redhat.com> <11154552-03c7-51b6-8af4-3d29cf3f1a4e@redhat.com> <5fb76283-d490-8e92-db85-ae41030427ba@oracle.com> Message-ID: <97159d99-af7f-dbbe-98f0-0807858b2769@oracle.com> On 28/11/17 18:11, Andrew Haley wrote: > Hi, and thanks for helping. Thanks for your patience! > > On 27/11/17 15:42, Maurizio Cimadamore wrote: > >> over the last few years, Chris and I have been promoting IntelliJ >> support for JDK [1] - the results of this work are included in OpenJDK, >> and you can create an idea project as follows: >> >> sh bin/idea.sh jdk.internal.vm.ci >> >> the command idea.sh takes a list of modules you want to work on. I >> tested it with the above module (which I've seen mentioned in this >> thread) and found no issues. >> >> Few months ago we also released the IntelliJ jtreg plugin which allows >> you to run/debug tests. >> >> I agree that we need to come up with ways to make it easier for people >> to work/hack on openjdk using IDEs - hopefully this is a step in the >> right direction. Note that this script works by delegating all >> configuration decisions to the makefile - so, assuming you have an >> existing build configuration, the source roots should be tailored for >> your OS/HW combo. >> >> [1] - >> http://mail.openjdk.java.net/pipermail/discuss/2015-January/003645.html >> [2] - >> http://mail.openjdk.java.net/pipermail/jtreg-dev/2016-October/000390.html > OK, so I do this and open the [jdk] directory. So far, so good. > > And I can open the files in the jdk.internal.vm.ci directory, and they > are recognized. Now, I see at the top of the file "Project SDK is not > defined". That looks bad -- is there something wrong? Do you expect > to see this message? Yes, that's expected - it's standard for intellij - each project must be associated with an SDK - so you can click on the baloon notification and set it up from there (even adding the default one would be ok - it won't be used much since the JDK is all in the sources :-)). Now that I think about it, we could improve this by automatically setting project SDK to the bootstrap JDK that is passed to configure - that should work. > > But the really severe problem I now have is that I can't see any way > to create a program that uses this configuration. Let's say I want to > create Hello.java that uses this JDK. I can create a new Java class > under test, but I'm now stuck because of "Project SDK is not defined". See above on how to fix that. I believe that to create a run configuration to e.g. run some Foo.class class, you will need at least to point IntelliJ at the place where the class you wanna run can be found. This can be done by adding new paths to the 'classpath' in the project structure dialog (the bluish icon on the top right). Click on that icon, then Modules (on the left panel), then click on the Dependencies tab, then on the '+' sign, then Add jar or directory, and select the folder that contains the class you wanna execute. Then you should be set, and you should be able to create a run configuration that uses the new JDK. Btw, you will also have to tweak the new run configuration to point to the new JDK image in the build folder, or the project SDK will be used (which you don' want). If you were to run a jtreg test using the plugin, things would be much, much easier, as all these details are handled automatically by the plugin. Maurizio > > What would you do at this point? Thanks. >