Re: Build the jdk with new or modified sources
Lorris, You cannot use new API in java.base in the code for javac, meaning the java.compiler and jdk.compiler modules. This is an ingherent limitation of the bootstrap process. -- Jon On 2/27/24 1:57 AM, Lorris wrote: Yes indeed, I am trying to use those changes from the jdk.compiler module. How can I make this work without causing problem when building the interim module ? Lorris On 26 Feb 2024, at 14:59, erik.joels...@oracle.com wrote: Hello Lorris, This is not expected behavior. Building incrementally is expected to work correctly. If you are making changes to java.base and then trying to use those changes from any of java.compiler, jdk.compiler and jdk.javadoc, you will have problems as those three modules have to be compatible with the previous JDK version (21 in this case). We build those modules for the "interim langtools" which is then used to compile the rest of the JDK by running this interim javac compiler on the boot jdk. I think the problems you are seeing appear when building the interim versions of these modules as they will never see the updates you are making to java.base. If that isn't the issue, could you share more details on what kind of environment you are building on (OS, arch etc), how you configured the build and the make command line you are using? /Erik On 2/26/24 05:40, Lorris wrote: Hello, I’m trying to build the JDK (version 23, my fork is up to date as of 2024/02/26) while adding new source files and also adding some fields or methods in existing files (in java.base and java.compiler modules). My problem is that when I try to build the image, most of the time (it seems to depend on the date of the last edited file) the new files and members I have added aren’t visible to the compiler which results in an error. Until now I have been using a workaround by building two times, firstly, only with the new code declarations and, secondly, with the references to this code. However, I’m now seeing the limits of this method. Regards, Lorris Creantor
Re: Build the jdk with new or modified sources
I don’t have problems with clock skew (or at least I never encountered any problem with it until today). The problem I was referring to in this statement is when I modify a class A, to add for example a method to it, and then reference this new method in another file B, when I build for the first time, I won’t have any problem. Although, if after this build I modify the B file, the next build will result in an error stating that the A method does not exist. If the A class has been modified after the files referencing the new methods it contains everything works correctly, but not vice versa. Lorris > On 26 Feb 2024, at 22:22, Magnus Ihse Bursie > wrote: > > On 2024-02-26 14:40, Lorris wrote: > >> (it seems to depend on the date of the last edited file) > Just checking: do you have a problem with clock skew on your machine, or are > you using some tools that modify time stamps on modified files? The make > machinery depends on the fact that edited files should have a newer > timestamp. If this does not work properly, dependency tracking will fail. > > /Magnus >
Re: Build the jdk with new or modified sources
Yes indeed, I am trying to use those changes from the jdk.compiler module. How can I make this work without causing problem when building the interim module ? Lorris > On 26 Feb 2024, at 14:59, erik.joels...@oracle.com wrote: > > Hello Lorris, > > This is not expected behavior. Building incrementally is expected to work > correctly. > > If you are making changes to java.base and then trying to use those changes > from any of java.compiler, jdk.compiler and jdk.javadoc, you will have > problems as those three modules have to be compatible with the previous JDK > version (21 in this case). We build those modules for the "interim langtools" > which is then used to compile the rest of the JDK by running this interim > javac compiler on the boot jdk. I think the problems you are seeing appear > when building the interim versions of these modules as they will never see > the updates you are making to java.base. > > If that isn't the issue, could you share more details on what kind of > environment you are building on (OS, arch etc), how you configured the build > and the make command line you are using? > > /Erik > > On 2/26/24 05:40, Lorris wrote: >> Hello, >> >> I’m trying to build the JDK (version 23, my fork is up to date as of >> 2024/02/26) while adding new source files and also adding some fields or >> methods in existing files (in java.base and java.compiler modules). My >> problem is that when I try to build the image, most of the time (it seems to >> depend on the date of the last edited file) the new files and members I have >> added aren’t visible to the compiler which results in an error. Until now I >> have been using a workaround by building two times, firstly, only with the >> new code declarations and, secondly, with the references to this code. >> However, I’m now seeing the limits of this method. >> >> Regards, >> Lorris Creantor >>
Re: Build the jdk with new or modified sources
On 2024-02-26 14:40, Lorris wrote: (it seems to depend on the date of the last edited file) Just checking: do you have a problem with clock skew on your machine, or are you using some tools that modify time stamps on modified files? The make machinery depends on the fact that edited files should have a newer timestamp. If this does not work properly, dependency tracking will fail. /Magnus
Re: Build the jdk with new or modified sources
Hello Lorris, This is not expected behavior. Building incrementally is expected to work correctly. If you are making changes to java.base and then trying to use those changes from any of java.compiler, jdk.compiler and jdk.javadoc, you will have problems as those three modules have to be compatible with the previous JDK version (21 in this case). We build those modules for the "interim langtools" which is then used to compile the rest of the JDK by running this interim javac compiler on the boot jdk. I think the problems you are seeing appear when building the interim versions of these modules as they will never see the updates you are making to java.base. If that isn't the issue, could you share more details on what kind of environment you are building on (OS, arch etc), how you configured the build and the make command line you are using? /Erik On 2/26/24 05:40, Lorris wrote: Hello, I’m trying to build the JDK (version 23, my fork is up to date as of 2024/02/26) while adding new source files and also adding some fields or methods in existing files (in java.base and java.compiler modules). My problem is that when I try to build the image, most of the time (it seems to depend on the date of the last edited file) the new files and members I have added aren’t visible to the compiler which results in an error. Until now I have been using a workaround by building two times, firstly, only with the new code declarations and, secondly, with the references to this code. However, I’m now seeing the limits of this method. Regards, Lorris Creantor