Welcome to the OpenJDK Developers’ Guide!
The OpenJDK Community is the place to collaborate on open-sourceimplementations of the Java Platform, Standard Edition, and relatedProjects. It wascreated in November 2006, when initial portions of the JDK sourcecode were published under the GPLv2 license.
In order to work together efficiently, clear directions aresometimes needed to avoid misconceptions and to aligndevelopers’ views of terminology and process. The OpenJDKCommunity is a fairly pragmatic place. “Do the rightthing” is most often the right course of action. Still, ifpeople do things in the same right way then everyone’s workbecomes more transparent and easier for others to follow. For thisreason most parts of the development process have standard flowsthat are the recommended ways to do things.
The goal of this guide is to answer questions that developers ofthe JDK might have around development process, tooling, standards,and so forth. The formal rules and processes are described in otherdocuments, such asJEP 1for the JDK Enhancement-Proposal & Roadmap Process, andJEP 3 for the JDK ReleaseProcess. This guide is meant to be a complement to such documents,with tutorials and examples for how to follow these rules and howto work together with the rest of the OpenJDK Community.
There are many common use cases that aren’t detailed inthe formal process. This guide suggests how to work in suchcases.
Quick Links
OpenJDK consists of a number ofGroups. Members of aGroup collaborate onan area of mutual interest. The right hand side bar on theOpenJDK website has a list of allGroups in OpenJDK.If you’re interested in a specific area, this is where youwould start your OpenJDK experience. Look at theGroup’s informationand wiki pages, and see whatProjects they sponsor ontheCensus page. TheCensus shows the structureof the OpenJDK Community.
Projects arewhere the coding and much of the other work is done in OpenJDK.There are many differentProjects, some produceshippable artifacts, like theJDK Project, some producetools to be used by developers of these artifacts, like theCode ToolsProject orProject Skara, and someproduce documentation, like theDevelopers’ GuideProject. ManyProjects designs anddevelops new features for the Java language or the JVM, but thereare also less code centric ones like theDuke Project whichcollects images of the Java mascot, Duke.
OpenJDK has a few different roles that determine who has theright to do what in the differentProjects. These roles aredefined in theOpenJDK Bylaws. Theroles are earned based on experience and knowledge within eachProject.
AContributor can havedifferent roles in differentProjects. Whenyou’re new to aProject you don’tyet have a formal role in that specificProject, even though youmight have earned roles in otherOpenJDK Projects or havebeen recognized as aContributor or aMember ofOpenJDK. By contributing high-quality content you’ll soon beeligible forOpenJDK roles in theProject. FirstAuthor, thenCommitter, andfinallyReviewerif you stay active and earn the trust of the community. Trust is animportant part of earning these roles. There’s arough guideline saying that tobecome aCommitter you shouldhave contributed 8 significant changes, and to become aReviewer you should havecontributed 32 significant changes. In reality it’s not aseasy as “just” contributing code. You need to build atrack record of good decisions and sound judgment and show that youknow what differentiates a good change from a not so good one.It’s not only correctness of the code that matters,it’s also the appropriateness. In the end the trustyou’ve earned is put to the test through a vote.
Note that when a newProject is created aninitial set of members can be brought in at different levelswithout a vote.
Becoming anAuthor is the first step.To achieve this you need to contribute two changes to theProject in which you wishto become anAuthor. Once your changesare integrated into the code base and has been vetted enough todetermine that the changes were indeed good changes you can goahead and send an email to the Project lead of that particularProject and ask tobe added as anAuthor. Note that“theProject” is notOpenJDK, but rather the specificdevelopment Project whereyou did your contributions (e.g. “JDK”, “JDKUpdates”, “Amber”, etc). TheOpenJDK Projectdescription has a template for such an email. In short theemail should contain your name, the Project name, your emailaddress, and GitHub links to your changes. In response to youremail you will get a time-limited invite which you should fillout.
To see who the Project lead is for yourProject, see theOpenJDK Census. TheCensus unfortunately doesn’tprovide email addresses for people, but assuming you have beenactive on the Project mailing list (since you are applying forAuthor after all),you should be able to find the lead’s email address in yourlocal email archive, or ask yourSponsor.
As anAuthor youwill get your OpenJDK user name. Once you have gotten the username, this should be associated with your GitHub account in orderfor the bots to be able to identify you onGitHub. See theSkara documentation for more details on that. Once that’sdone you can create PRs and get them reviewed, but you’llstill need aSponsor to integratechanges. You’ll also get write access toJBS and theOpenJDK wiki related to theProject in question, andtocr.openjdk.org via an SSHkey provided at the time you accept your invitation.
The rules of any particularProject may have differentguidelines regarding requirements for Authorship at the discretionof the Lead.
To become aCommitter you shouldshow that you intend to actively contribute to theProject and that you canproduce non-trivial changes that are accepted for inclusion intothe Project code base. The number eight has been seen as a formallower limit on the number of changes, but since the changes must benon-trivial, or “significant” as theOpenJDK Project descriptionsays, and the definition of significant is subjective, the generalrecommendation is to wait with aCommitter nominationuntil there’s at least 10-12 changes integrated to have somemargin for different interpretations of “significant”.In practice though, we have seen several examples where the numberof significant changes hasn’t been the dominating factor in aCommitter vote.AContributor’swork in anotherOpenJDK Project may alsobe relevant for the vote. What the vote should ultimately test istheContributor’scommitment to theOpenJDK Project for whichthe vote applies - is it believed that the person is dedicated andwilling to spend time and effort on theProject? Is the personbelieved to be a good citizen of theProject? It’s alwaysa good idea to seek the advice of aSponsor who can guide youthrough the process to becoming aCommitter - you willneed one to run the Committer vote anyway. They will probably alsohave a better idea of what constitutes a “significant”change.
Once you have the required changes, aCommitter in theProject can starta vote by sending an email proposing that you should become aCommitter. Theemail should follow the template found in theOpenJDK Projectdescription.
ACommitteris allowed to integrate changes without the aid of aSponsor. ACommitter is alsoallowed to nominate other non-Committers to becomeCommitters in theProject.
To become aReviewer you must show atrack record of sound and correct judgment calls as mentionedabove. Being a goodCommitter doesn’tnecessarily make you a goodReviewer. As aReviewer you have thepower to approve changes for inclusion into the Project sourcecode. This means that aReviewer needs to be ableto judge the quality and appropriateness of any proposed change,not just the mechanics of the code.
The assumption is that after having produced 32 significantchanges one should have become familiar with the process aroundreviews and the requirements around getting a change approved. Thisshould really be seen as a minimum requirement though. A morepractical consideration would be to look at whether the non-trivialcommits of a potentialReviewer are acceptedlargely intact or whether they are always being refined by thereview process. There may be cases where it will take significantlymore than 32 changes for aCommitter to be ready tobecome aReviewer.
Once you are deemed ready, aReviewer in theProject can start a voteby sending an email proposing that you should become aReviewer. The emailshould follow the template found in theOpenJDK Projectdescription.
One key definition when advancing through the OpenJDK roles isthe significant change. What exactly does it take for a change tobe significant?
Instead of describing the significant change (becausethat’s quite difficult to define) provided here is a fewexamples of changes that wouldn’t be considered significantor for other reasons wouldn’t count as significantcontributions.
Contributing to OpenJDK can take many forms. Writing code andproviding patches is just one of them. A big part of developing afeature or a bugfix is testing and code review. Anything you can doto help out in these areas will be recognized as a contribution.Join themailing lists to engage indesign discussions and reviews, and download the latest EA buildsor Project repositories to try out new features and give feedback.If you see some misbehavior, or if you see somebody mention somemisbehavior on some internet forum, try to track it down. Good bugreports with reproducible test cases are extremely valuable andmake excellent contributions.
Anything you can do to spread the word about Java, new features,and your experiences using the JDK will be helpful for thecommunity and to the OpenJDK developers. Trying out a new featureand reporting your experiences is also a contribution. Whether youfind that the new feature improves your application, or if you findsome area that needs to be improved, your feedback is valuable tothe developers of that feature.
If you have a success story where Java solved your problem, orif you successfully upgraded to a more recent version of the JDKand noticed some improvements, spreading this story through a blog,news article, or some other channel is also a contribution.
If you’re in a position to choose what programminglanguage to use in a project, in a tutorial, or in a class, youhave the power to enlarge the Java community in a very direct way,and your colleagues or students will get an opportunity to learnone of the most used programming languages in the world.
Every change to JDK code carries a risk of changes in behaviorwhich may adversely affect applications. Generally we’relooking to improve the functionality and capability and sometimesperformance of the platform without that negative consequence. Sowe need to ask ourselves whether each change is worthwhile - andsome may not be no matter how well intentioned.
One question to ask yourself is:What problem are youtrying to solve?
The important thing here is to understand the problem itself,independent of any solution (and independently of the solution thatcurrently happens to be in your change). A number of otherquestions and lines of thought emanate from thinking about theproblem. For example: is this the right problem to solve? Doessolving this problem create worse problems elsewhere; that is, isthere a net benefit? Does this problem need to be solved in theJDK, or can and should it be solved elsewhere (e.g., intooling)?
The next question you need to answer before making any changeis:What is the main intention of your change?
Depending on your answer to that question you will need toconsider one or more of the following paragraphs.
Correctness – If your change improvesprogram correctness, that’s important. And to broaden this,fixing of all kinds of bugs that really make things better forapplications in ways they can detect is important.
Robustness – Updating code to use a newerplatform API can be a good change. Moving away from APIs that arebeing deprecated or that are no longer maintained is likelydesired. Do note though that supposedly equivalent APIs may not bethe drop in replacement you think they are. You’ll need toprove that the code has the same behavior after the change throughextensive testing.
Security – If you intend to increase theoverall security of the platform, changes following secure codingpractices and using appropriate platform APIs for that are usuallywelcome. The exception might be if it’s a potentiallydestabilizing change in code where there’s only a theoreticalproblem.Please note: If you think you found areal security bug that might compromise the platform you shouldfollow the processhere.
Refactoring / Cleanup – Making codeeasier to understand or reducing code size may be a good change inareas that are under active development. Stable code howeverisn’t a good candidate for refactoring regardless of what thecode looks like. The OpenJDK has evolved over many years and someparts have been stable for decades. If there’s no immediateneed to work on the code for other reasons, then what will acleanup actually achieve? One specific area where refactoring andcleanups are explicitly discouraged is in third-party code.
Performance – Can you demonstrate a userperceptible change? If you can’t measure the change, or auser can’t notice the change, or the change only improvescode that is used infrequently, then maybe it isn’t worth it.Do you have benchmarks to back up your claims? Do you understandthe results? Performance testing is complex and often there aremany factors unrelated to your change that affects the numbers.What’s the tradeoff? The performance improvements that justmake everything better do exist, but they are extremely rare. Mostoften the code gets more complex, or you speed up one case but slowdown another. Are you making the right tradeoff?
Modernizing – Changing code purely forthe sake of using a new language feature isn’t usually a goodchange. Be a subject matter expert, not just a language expert.Writing code in “a better way” is not guaranteed to besafe. A change of behavior is always possible and unless youunderstand the code you are changing at more than the corelanguage/API level, and have looked into appropriate tests and canspeak to the risks, then you should first find a subject matterexpert to discuss it with. Keep in mind that the OpenJDK code isdeveloped by a large community. If a new language feature isintroduced, all developers working in that code must learn this newfeature and understand the implications of using it.
Quick Links
In many GitHub projects the standard way to propose a change isto create a pull request (PR) and discuss the patch in the PR. ForOpenJDK Projectsthe situation is somewhat different. The JDK is used for missioncritical applications and by millions of developers, the bar tocontributing changes is high. Please follow the steps outlinedbelow to make sure your change passes above the bar before creatinga PR.
Like many other open-source communities, the OpenJDK Communityrequires Contributors to jointly assign their copyright oncontributed code.Oracle isthe steward of OpenJDK and if you haven’t yet signed theOracle ContributorAgreement (OCA), and are not covered by a company-levelagreement, then please do so. This is required in order to makeyour patch available for review. The OCA givesOracle and you as a Contributor jointcopyright interests in the code. You will retain your copyrightwhile also granting those rights toOracle. If you don’t know ifyour organization has signed the OCA you can check theOCASignatories List, or ask your legal advisor.
When you sign the OCA, please make sure that you specify yourGitHub user name in theUsername
field of the OCA. Ifyou try to create a PR before you have signed the OCA, or if youdidn’t specify your GitHub user name, you’ll getinstructions telling you to do so, and the PR won’t bepublished until this is done. OCA registration is a manual process.Please allow for up to several days to have your OCA applicationprocessed, even though it’s normally processed swiftly. Analphabetical list of all of the assigned OpenJDK usernames can befound on theOpenJDKpeople list.
You only need to sign the OCA once in order to cover all changesthat you might contribute to any Oracle-sponsored open-sourcecommunity. If you’ve already signed the OCA or the former SCA(Sun Contributor Agreement) for any Oracle-sponsored open-sourcecommunity, then you do not need to sign it again in order tocontribute to OpenJDK. Please note that you don’t need tosign an OCA if you work at Oracle or a company which has negotiatedan equivalent agreement.
Once the OCA is signed, please restrain your urge to create a PRjust a little while longer. In order to prepare the community foryour patch, please socialize your idea on the relevantmailing lists. Almost all changes, and inparticular any API changes, must go this route and have a broadagreement in place before there is any point in presenting code. Tounderstand the criteria by which your patch is going to be judged,please readWhy is My ChangeRejected? below. In short, hidden constraints and assumptions,stability and quality, maintainability, compatibility, andconformance to specifications must be considered before your PR isready to be submitted. If you don’t understand theconstraints for acceptance, you might be surprised when your PR isrejected.
Please note that lack of engagement should not be interpreted assupporting the proposal. Lack of engagement might be betterinterpreted as people are busy or maybe that the problemisn’t compelling or high priority enough to spend time onright now. If you didn’t get the desired attention and therequired agreement in your mail thread,do notproceed to create a PR.
Socializing your change on the mailing lists also prevents thesurprise that would otherwise make the community choke on theirmorning coffee when they see a huge patch in a new, unknown PR. Asa new developer in the community you’ll need to make a fewfriends that agree with your change. There are many good reasons tomake friends, but the one relevant here is that for your firstchanges you’ll need aSponsor to facilitate theintegration of your work. TheSponsor will perform anynumber of administrative tasks like JBS updates, additionaltesting, etc. It’s usual for aSponsor to also be areviewer of a change and thus familiar with it, but it’s nota requirement.
ManyOpenJDKProjects require a tracking issue to be filed in theJDK Bug System (JBS) before achange can be integrated. This is the case for instance for the JDKand the JDK Updates Projects. In order to obtain write access toJBS you need to be anAuthor in anOpenJDK Project (seeBecoming an Author). For yourfirst changes, ask yourSponsor to help you createthe issue or file the bug through theBug Report Tool.
Even though we strive to unify how things are done withinOpenJDK, different areas andProjects in OpenJDK mayhave slight variations in how they work. Some of these differencesare highlighted throughout this guide, some aren’t. Ifyou’re new to an area, make sure you understand localdifferences before you proceed. Ask yourSponsor who should be yourmain point of contact through your first developer experience inOpenJDK.
Just about every Java developer out there has an idea or two forhow to enhance something. And believe it or not, not every idea isa good idea. Even though many ideas are indeed good, we must bequite restrictive on what we actually include into the JDK. Thegoal is not to take in the maximum number of contributionspossible, but rather to accept only the highest-qualitycontributions. The JDK is used daily by millions of people andthousands of businesses, often in mission-critical applications,and so every change must be scrutinized in detail. There are manyreasons for this.
Hidden constraints and assumptions – Manysections of code have constraints and assumptions that aren’tnecessarily visible at first glance. This might preclude certainchanges, even those that might seem obvious.
Stability and quality – The JDK is usedby millions of developers and as a widely deployed commercialproduct, it’s held to a high standard of quality. Changesshould include tests where practical, and core tests should pass atall times. The value of the change should outweigh the risk ofintroducing a bug or performance regression.
Maintainability – Any new feature or codechange will need to be maintained in the JDK essentially forever,thus imposing a maintenance burden on future maintainers. The codemight still be in use long after you and the people who reviewed ithave moved on. New maintainers must be able to understand how tofix bugs in this code.
Complexity – Each new feature interactswith all the existing features, which can result in geometricgrowth of the interactions among features if features are addedunchecked. Sometimes we avoid adding a new feature, even if itseems like an obvious thing to add, if that feature would make itdifficult to add a more important feature in the future.
Adherence to specifications – Much of theJDK is governed by a series of specifications, in particular theJava LanguageSpecification, theJava Virtual MachineSpecification, and theJavaAPI Specification (“javadocs”). All changes must bechecked and tested carefully to ensure that they don’tviolate these specifications.
Javadoc comments are specifications – TheJava API Specification is authored in the form of javadoc comments,so even apparently innocuous changes to comments can be quitesignificant. It’s not always easy to tell what comments arepart of the specification and what parts are merely code comments.Briefly, documentation comments on public packages, classes, andclass members of exported modules are specifications.
Specification changes – It’spossible to change the API specifications, and this is doneregularly. However, these changes require even more scrutiny thancode changes. This extra review is handled by theCSR Process.Specifications are written in stylized, somewhat formal language,and they don’t simply describe what the code does. Writingspecifications is a separate skill from coding.
Compatibility – Changes should alsoadhere to high standards of binary, source, and behavioralcompatibility. The compatibility impact of apparently innocuouschanges is sometimes startling.
For reasons like these it’s quite possible that yourchange, even though it adds value to you, isn’t deemed to addenough value to the larger community.
If you’re relatively new to the Java platform then werecommend that you gain more experience writing Java applicationsbefore you attempt to work on the JDK itself. The purpose of thesponsored-contribution process is to bring developers who alreadyhave the skills required to work on the JDK into the existingdevelopment community. The members of this community have neitherthe time nor the patience required to teach basic Java programmingskills or platform implementation techniques.
The feature releases currently under development are in the JDKProject. Most development work is focused on the newest release, sogenerally you should be working against the latest JDK sourcesrather than the JDK Updates sources.
Quick Links
The mailing lists are the key communications mechanism for allOpenJDK work. All participation in anOpenJDK Project startswith joining the relevant mailing list. A subscriber to an OpenJDKmailing list is referred to as aParticipant in theBylaws. As a generalrecommendation we suggest to subscribe toannounce,discuss,and the-dev
lists covering your explicit area ofinterest. All OpenJDK mailing lists are found here:
Please note that OpenJDK mailing lists typically are fordiscussions about thedevelopment of the JDK, notits usage. This is not a place to ask support questions. If youthink you found an issue in or with the JDK, seeJBS - JDK Bug System for instructionson reporting it.
The OpenJDK Community is a friendly place. To keep it that wayit’s important to keep a professional tone in emails and beaware that the community is global. Many different people withdifferent backgrounds collaborate in these lists. Even thoughEnglish is the required language for all lists, many Participantsspeak other languages as their native language. A high tolerancefor non-perfect English is expected from anyone joining theselists. You’re also strongly encouraged to use your real nameon the mailing lists. This adds to the professional tone of youremail. Postings from anonymized mailboxes risk being seen as spam.If you do work in OpenJDK on behalf of your employer, please alsolist this affiliation. If your GitHub username differs from yourreal name it’s also a good idea to include that to identifyyourself and your actions onGitHub.
You must be a member of a list to be able to post to that list.Some lists are moderated to keep the content on topic. Each listhas its own archive where you can browse older conversations on thelist.
There are a few different types of lists. The list name has twoparts to explain what the list is intended for,<name>-<suffix>
. The name often refers totheProject thatowns the list or a specific area of interest that the list focuseson. The suffix is explained below. Not allProjects or areas have alltypes of lists described here.
-dev
- Technical discussions around the implementation of the Projectartifacts. This is also where code reviews happen.
-use
- Technical discussions around the usage of the Projectartifacts.
-discuss
- General discussions around theProject. The special case
discuss@openjdk.org
is used for general discussionsaround OpenJDK. Discussions around new Project proposals usuallyhappen here.
-changes
- Changeset notifications from the source code repositoriesmaintained by theProject.
-announce
- General Project announcements. These lists are tightlymoderated and are expected to be low traffic. The special case
announce@openjdk.org
is used for announcements forOpenJDK.
-experts
- Expert group discussions. The list is restricted; only membersof the expert group can subscribe.
-observers
- Open for anyone to subscribe to see what the experts arediscussing and potentially to have some dialog with othernon-experts. There is no guarantee that an expert is subscribed tothe
-observers
list or will see any responses on thatlist.
-comments
- Used by observers to directly provide feedback/comments to theexperts (typically a lead will process the comments list andforward things on to the experts list).
If you need to change your registered email address, or if youhave any other problems with the mailing lists, please contactmailman@openjdk.org.
Quick Links
JBS is a public issuetracker used by manyOpenJDK Projects and isopen for anyone to read and search. To get write access you need tobe registered in theOpenJDKCensus by becoming, for instance, anAuthor in anOpenJDK Project.
When a new failure is found, or an improvement identified, anissue should be filed to describe and track its resolution.Depending on your role in OpenJDK you can either use theBug Report Tool or, if you areregistered in theOpenJDKCensus, you can report the issue directly inJBS.
When filing an issue, try to make the report as complete aspossible in order to make it easier to triage, investigate andresolve the issue. Bug descriptions and comments should be writtenin a professional manner.
If you suspect that the issue is a vulnerability,don’t file a JBS issue! Instead send yourreport tovuln-report@openjdk.org. Alsouse this alias if you find an existing report which may cover avulnerability - please donot report or discuss potentialvulnerabilities on any open lists or other public channels - seeOpenJDKVulnerabilities for more information.
A few things to keep in mind when filing an issue:
java -version
wheneverpossible - this version information is particularly critical forhangs, JVM bugs, and network issues.The most common issue types are:
Issue Type | Covers |
---|---|
Bug | ABug should relateto functional correctness - a deviation from behavior that can betied back to a specification. Anything else, including performanceconcerns, is generally not a bug, but an enhancement. Thoughit’s not clear-cut as a significant performance regressionmay be classified as aBug, forexample. |
Enhancement | AnEnhancement is asmall to medium improvement to existing functionality. |
JEP | TheJEP issue typeis used for a proposal of a significant change or new feature whichwill take four or more weeks of work - seeJEP-1. |
Sub-task | Sub-tasks can be used to break up the work for anissue, such as the changes to the docs, tests etc. This is notrecommended as a way to break up a large amount of code changeassociated with a new feature - seeImplementing a JEP orImplementing a large changebelow. |
Task | Tasks are used to track work that isn’texpected to result in a change in any code repository. They areused for related activities such as a new JBS version number, abuild request, an update to a document etc. |
New Feature | Not recommended for use. |
ABug orEnhancement should only be used if the work isexpected to result in a change in a code repository. ABug orEnhancement with resolutionFixed is required to have a correspondingchangeset in one of the OpenJDK repositories.
Knowing when an issue was introduced is important to determinethe impact of the issue and where it needs to be resolved. While insome cases it may be clear, it is likely that on submission andduring triage this won’t be known, instead we will have oneor two data points from which we can begin to understand the rangeof releases which the issue impacts.
TheAffects Version/s field isused to indicate which releases an issue is applicable to, and toavoid having to set it to an exhaustive list of impacted releasesthe following assumptions are used to give that range:
Another aspect is when the impacted code was added or removedfrom the JDK, which in either case limits the range of releases theissue impacts. Knowing that a feature was removed before the oldestcurrently maintained release means it can be resolved asWon’t Fix.
Note that theAffects Version/sfield is mainly used for bugs and bug-like tasks/sub-tasks etc. Ingeneral enhancements and enhancement-like tasks/sub-tasks shouldnot have anAffects Version/s.
Set theAffects Version/s fieldto the lowest release where the bug has been seen.
Labels of the form (Rel)-na (eg.17-na) should be used when a bug isnot applicable to a more recent release family. For example:
Affects Version/s:7u111,8u131
add the label9-na if the issueis not relevant to JDK 9 and above. Reasons why this would be thecase include the fact that the source has been removed from a laterrelease or rewritten such that the issue is no longer relevant.
Don’t:
use the label to indicate that a bug is not relevant to anearlier release, for example
Affects Version/s:11.0.20,17
the label8-na would not beneeded - as it doesn’t have a JDK 8 release, or earlier,value in theAffects Version/s, itis not relevant to JDK 8. Also seeUsage of the (Rel)-wnf Label
add multiple-na labels: you onlyneed one, for example don’t add both9-na and11-na—9-na implies all followingreleases therefore11-na, or17-na etc. are not needed.
It’s not recommended to specify update releases like 17u4or 21u in the label. Labels like17-na and21-naare in general enough.
Labels of the form (Rel)-wnf(e.g. 11-wnf) should be used toindicate that a bug is not going to be fixed in a release thatit’s applicable to, or any earlier releases. For example,11-wnf states it won’t befixed in JDK 11 and implicitly indicates it won’t be fixed inJDK 8 either.
Add a comment when adding a (Rel)-wnf label so that it’s clear for thoselooking at the issue, why it won’t be fixed in thatrelease.
Guidelines for settingAffects Version/s
Unlike reporting a problem, when it comes to improvements, whatconstitutes a reasonable request can take discussion, and ingeneral it’s encouraged that themailing list for the area is used to suggestan improvement before filing.
Enhancements to the Java Language Specification and the JVMSpecification are managed through theJava Community Process.
To find out which component to use for different bugs, consultthedirectory to areamapping.
When managing the work for a large change, especially when thework involves multiple engineers, it’s recommended that thework is distributed across one or more “implementation”issues which should be linked to the main enhancement with a“blocks” link along with any relevant CSRs. Theenhancement shouldn’t be considered done until all theblocking elements are completed. The use of sub-tasks forenhancements is not recommended unless all the sub-tasks arerelevant to the fix, if it were to be backported, for exampleJDK-8231641 orJDK-8171407.
It’s recommended forJEPsthat the implementation is spread across one or moreEnhancements as described above.
JBS only has a few states in which aBug orEnhancement can be:
Type | Covers |
---|---|
New | Initial state after an issue is filed. Bugs in theJDK Project must be taken out of theNew state (“Triaged” - see below) ina timely manner. In general, triaging is recommended to be done forall issue types and projects as a sign that the issue is correctlyfiled, and will be seen by the right developers - this isespecially important towards the end of a release. |
Open | Once the issue has been triaged it will be in theOpen state and will stay here untilan assignee decides to work on it, at which point it’sencouraged that the “Start Work” option be selected tomove it toIn Progress. |
In Progress | TheIn Progressstate is used to show that the assignee is actively working on theissue. It has the optional sub-states (Understanding):CauseKnown,Fix Understood,In Review. |
Resolved | When the issue has been fixed it isResolved using the Resolve action in JBS. |
Closed | To finally close an issue it also needs to beverified using the issue’s regression test. |
JBS Issue Flow
For most JDK areas, triage is performed on a regular basis (atleast weekly) by triage teams. Each triage team consists ofContributorswho are area experts for a specific area or feature. If youhaven’t been selected to be part of a triage team for aspecific areayou shouldn’t be triaging bugs in thatarea.
When triaging an issue, first give it a general review.
Now that the issue is in the right component and has the basicinformation, the analysis continues to get a more detailedunderstanding of the issue, and what should be done:
At this point move the issue into theOpen state.
It may sound obvious, but avoid placing sensitive information inbug reports. Things like usernames, IP addresses, host names, andexact version information of third party libraries etc. may becrucial to be able to debug in some cases, but could also help anattacker gain information about your system. JBS is a publicdatabase that anyone can search, so be mindful of what you placethere. In particular when attaching log files like the hs_err.logyou should make sure that you are comfortable sharing the detailsexposed in it. Sometimes it may be better to leave a comment sayingthat these details can be obtained on request.
If you file a bug through theBug Report Tool there’s aspecific field that should be used to place sensitive informationlike this. Information placed there will not be part of the publicbug report.
Once you are made, or you make yourself, the assignee of anissue you take on the responsibility of moving the issue through toresolution - providing the current status, and ultimately leaving arecord for others in the future to understand what happened. Thereare no set rules for how you manage the bug while you are assignedto it, as it depends on the type and importance of an issue. Asimple update to the doc needs little to be done, fix the problemand close the issue; an intricate timing issue or crash should behandled differently - documenting your progress in identifying theproblem (e.g. JDK-8212207,JDK-6984895,JDK-8287982),this is especially helpful if you ultimately move the issue to adifferent area as you have found that the problem lies elsewhere,or is closed asWon’t Fix.Your updates then provide a resource to others to better understandwhat has been done or the code itself. SeeThe Importance of Writing Stuff Down for a good explanation asto why it’s important.
Some additional fields should be filled out or updated as youget a better understanding of the issue:
Note: If during your investigation of the bugyou determine that the issue is in the wrong component, make sureto move it back to theNew statebefore moving it to the new component, so that it will be picked upby the component’s triage team. Make sure there is a commentoutlining the reason for the move, as explained above.
An important aspect of any issue is making clear how it isconnected/related to other issues. This can occur at any stage ofthe issue’s lifecycle. For example, as information becomesavailable that might suggest a cause, or similar issue (relatesto).
There are the following link types:
Type | Usage |
---|---|
duplicate of | Normally set automatically when an issue is closedas a duplicate - seeClosing issues as duplicatesfor more information. |
backported by | Normally set automatically when creating abackport with the “More -> Create Backport” option,or by the Skara tooling. |
CSR for | When creating a CSR with the “More ->Create CSR” option, a link is automatically created betweenthe main issue and the new CSR. |
blocks | For when other issues are dependent on the currentissue being resolved/fixed before they can be. For example, when afix is broken down into a number of parts theblocks link should be used to ensure they areall fixed before the main issue is considered resolved - seeImplementing a largechange. |
relates to | Used to indicate a relationship between twoissues. To avoid lots ofrelates tolinks, the links should have some significance in relation to thecause and/or fix, for the current issue. |
causes/caused by | Thecauses linkimplies a stronger relationship thanrelates to. If an issue ‘B’ can betraced back to the fix for issue ‘A’ then ‘Acauses B’ (or ‘B is caused by A’). |
Note: There should never be more than one typeof link between two issues. It may be necessary to manually removea link, e.g. relates to, iflater aduplicated by orcaused by link is added.
Once the work on an issue has been completed the issue’sStatus should be in a“completed” state. There are two“completed” states:Resolved andClosed. These are accompanied by aResolution and aFixVersion/s. Which combination ofStatus,Resolution, andFixVersion/s you should use depends on how the issue iscompleted.
Most resolutions are used to close an issue so that it ends upbeingClosed directly, butresolutions that indicates that a change has been integrated into aProject repository must go through theResolved state. An issue inResolved state needs to go throughverification to end up asClosed. For the JDK Project in almost all casesthe bots will transition the issue toResolved/Fixedwhen the changeset is integrated to the repository.
TheFix Version/s field shouldindicate when an issue was fixed. The most common value for thisfield is a JDK version number. There are some special valuesavailable for this field in JBS, these should only be used forspecial cases as outlined in this Guide.
Note: An issue should never be closed if it hasopen sub-tasks.
Status Resolution | Covers |
---|---|
Resolved/Closed Fixed | The resolutionFixed should be usedonly if achange has been integrated in a Project repository to address theissue, and theFix Version/s mustalways correspond to the version where the change was integrated,or be one of therepo-* fix versionsorinternal. If there isn’t afix in the repository (and so no associated changeset) then theissue shouldnot be marked asFixed. |
Closed Won’t Fix | Used when the issue is describing behavior which,while maybe problematic or not ideal, isn’t going to bechanged - for compatibility reasons for example. |
Closed Duplicate | Used to indicate that the same issue is describedin another JBS issue. SeeClosing issues as duplicatesfor more information. |
Resolved/Closed Incomplete | Used to indicate that the JBS issue doesn’tcontain enough information to work on the issue. SeeClosing incomplete issues for moreinformation. |
Closed Cannot Reproduce | Use when a reproducer is provided (or clear steps)but it’s not possible to see the faulty behavior. When youcan’t reproduce an issue, where feasible try on the releasethe issue was reported against as a way of confirming thatit’s indeed addressed on the latest release, rather than younot having the right environment in which to reproduce theissue. |
Closed Other | Used in rare cases where none of the otherstatuses fit the situation. |
Closed External | Use where the issue is due to a problem in a Javalibrary (not part of the OpenJDK code base), an IDE or otherexternal tool etc. Where known, it’s good to provide a linkto the site where the issue should be reported. |
Closed Not an Issue | Use when the behavior is expected and valid(cf. Won’t Fix) and thereporter perhaps has misunderstood what the behavior shouldbe. |
Closed Migrated | Used rarely, but can be seen when issues aretransferred into another project by opening up a separate issue inthat project, with the issue in the original project beingClosed. |
Resolved/Closed Delivered | Used to close out issues where a change to thecode isn’t required, common examples are Tasks, ReleaseNotes, and umbrella issues for larger changes. Note that theverification step is always needed to move an issue fromResolved toClosed. If your issue doesn’t needverification (e.g. it’s an umbrella where each sub-taskis verified as a separate fix) then please move the issue directlytoClosed without going throughResolved. |
Closed Withdrawn | Withdrawn isessentially the partner state toDelivered for issues that would not haveresulted in a fix to the repo, and also part of theCSR andRelease Note process. |
Closed Approved | Used as part of theCSR process. |
Challenge States | Exclude[Challenge],Alternative Tests[Challenge], andReject[Challenge] are only relevant within the context of the JCKProject. |
Future Project | This status is not recommended for use. |
Rejected | This status should not be used. |
When an issue is closed asWon’tFix, do not remove theFixVersion/s. It’s valuable information to know whatversion it was decided not to fix an issue in. The same goes forresolutions such asDuplicate,Cannot Reproduce andNot an Issue.
The fix versionna should only beused on backport issues that is created by mistake. SeeHow to fix anincorrect backport creation in JBS.
If the same issue is described in another JBS issue then closeone against the other asClosed/Duplicate.In general the newer issue is closed as aDuplicate of the older one, but where the newerissue has a clearer description, or more useful, up-to-datecomments then doing it the other way round is ok as long as none ofthem has beenFixed already. If oneof the issues has beenFixed theother one should be closed as aDuplicate of theFixed issue. There may be other reasons tochoose to close one or the other issue as theDuplicate. As always - use your best judgementto make the end result as good as possible.
Any issue closed as aDuplicatemust have a “Duplicates” link to theduplicating issue.
Be mindful of labels on issues closed asDuplicate. Some labels need to be copied over tothe duplicating issue, see for instance thetck-red-(Rel) label.
If it’s determined that an issue has been fixed, butit’s unknown what change that fixed it, closing asFixed is not an option as thisrequires a changeset in a project repository.Duplicate is also not an option since thisrequires a duplicate-link to the issue that fixed it. A common wayto handle such cases is to close the issue asDelivered with theFixversion/s set tounknown.Closing an issue asCannot Reproducehas also been common practice but is no longer recommended ifit’s known that the issue has actually been fixed.
As mentioned above, issues that lack the information needed toinvestigate the problem are placed in statusResolved -Incomplete. Triage teams should monitorincomplete issues in their area and if needed ping the relevantperson. When new information is received, the bug should bereturned to statusOpen. If therequired information hasn’t been obtained within reasonabletime (3-4 weeks) the bug should be closed asIncomplete.
Once an issue is marked as resolved there is now the option ofsomeone, other than the person that fixed it, of marking it asVerified to confirm that the issueis fixed after testing; marking it asFixFailed if it didn’t solve the issue; or,Not Verified to indicate that it wasn’texplicitly tested. Note that the JBS UI doesn’t highlightwhenFix Failed has been set, youneed to look for theVerificationfield at the bottom of the left-hand column in the Detailssection.
Removing a JBS issue is a rare extreme case that shouldn’tbe part of the normal workflow. For this reason, removing issues isrestricted to admins only. If you for some reason need to remove anissue, send an email toops@openjdk.org. You need to providethe bug id and a well considered reason the issue should beremoved.
Note that JBS issues are not removed just because something wasa bad idea, or a reported issue turned out to be an embarrassinguser mistake. Such issues are simply closed.
JBS labels are used to tag and group related issues. JBS labelsare an open namespace, which means that anyone can create newlabels at any time. In order to avoid confusion, however,it’s best to reuse existing labels where possible. Most areashave their commonly used labels to identify issues in theirrespective area. Make an effort to find and use these labels. Thiscan be done by editing theLabelsfield of a bug and entering the first few characters of the labelyou want to add. JIRA will pop up an autocomplete window withexisting labels that match that prefix. Then choose one of theexisting labels. Using the autocomplete window is preferable totyping the whole label name (even if you’re a good typist)because it’s easy for minor spelling errors to creep in,which can inadvertently introduce multiple labels with spuriousspelling variations.
JBS labels should not be used to write documentation -don’t try to write sentences using labels. Adding a number ofrandom labels is unlikely to be helpful to anyone.
Labels are case sensitive When using labels inJira gadgets (like pie charts, heat maps, and statistics tables)Jira will be case-sensitive and treat e.g. OpenJDK and openjdkas two different labels. Searching however is case-insensitive.This means that if you group a set of issues in a gadget based on alabel, and then click one of the groups to see the list of issues,that list will contain more results than the gadget if there areusages of the label with different casing. This can be veryconfusing and for this reason the recommendation is to stick withthe commonly used case for all labels, regardless of your personaltaste for upper or lower case letters. Most labels are lower caseonly, but there are examples where upper case letters are used inthe most common version of a label. Use of the autocomplete popupwindow (described above) when adding labels will avoid inadvertentintroduction of labels with differing case.
This table contains some frequently used JBS labels and theirmeaning. Please help keeping this dictionary up to date by addingyour favorite labels. This table doesn’t dictate how to uselabels, but rather document how they are used. That said, obviouslyit will help everyone if we try to follow a common standard and usesimilar labels in the same way across all entities that useJBS.
Label | Description |
---|---|
(Area)-interest | Used to indicate that an area (usually ateam orProject)is interested in the issue. This label doesn’t indicateownership of the issue. E.g.,redhat-interest,azul-interest,coin-interest |
(Area)-related | Used to indicate that an issue is related toa specific area (usually a feature orProject). This labeldoesn’t indicate ownership of the issue. E.g.,graal-related,testcolo-related,doc-related |
(Rel)-bp | Used to indicate that a bug would besuitable for backport to a release(Rel). This isn’ta decision to backport, just a suggestion / recommendation. E.g.,11-bp |
(Rel)-critical-request (Rel)-critical-approved (Rel)-critical-watch | Used in the ramp down phases of specific releases to requestapproval of changes that requires Project lead approval (orsimilar) to be included.(Rel) is the release in question.E.g.,jdk11-critical-request (Rel)-critical-approvedis used to signal that the change has been approved for inclusion.E.g.,jdk11-critical-approved |
(Rel)-defer-request (Rel)-defer-yes (Rel)-defer-no | Used to request deferral of changes that requires Project leadapproval (or similar) to defer.(Rel) is the release inquestion. E.g.,jdk12-defer-request (Rel)-defer-yes and(Rel)-defer-no are used toindicate wether the deferral has been approved or not. E.g.,jdk12-defer-yes These labels are always placed on the main JBS issue, never onbackports or subtasks. Further details are found in theJDK ReleaseProcess. |
(Rel)-enhancement-request (Rel)-enhancement-yes (Rel)-enhancement-no | Used in the ramp down phases to request the late inclusion of anenhancement.(Rel) is the release in question. E.g.,jdk10-enhancement-request (Rel)-enhancement-yesand(Rel)-enhancement-noare used to indicate the response on the request. E.g.,jdk10-enhancement-yes,jdk10-enhancement-no These labels are always placed on the main JBS issue, never onbackports or subtasks. Further details are found in theJDKRelease Process. |
(Rel)-fix-request (Rel)-fix-SQE-ok (Rel)-fix-yes (Rel)-fix-no | (Rel)-fix-request isused in ramp down phase 2 to indicate that an issue would be ofinterest to be integrated into release(Rel). E.g.,jdk12-fix-request(Rel)-fix-SQE-ok is used toindicate that the issue will be covered by the test plan for(Rel). E.g.,jdk12-fix-SQE-ok |
(Rel)-na | Labels of the form11-na or21-na should be used when a bug isnot applicable to amore recent release family.SeeUsage of the (Rel)-naLabel. (Rel) can also refer to more general release atrifacts likeoraclejdk-na,openjdk-na, andsap-aix-na to indicate that the issuedoesn’t affect code included in that specific atrifact. |
(Rel)-wnf | Labels of the form11-wnf or21-wnf should be used to indicatethat a bug is not going to be fixed in a release where it’spresent. Note that there should only beone(Rel)-wnf label on any JBSissue. It is implied that earlier versions will not be fixedeither. Also seeUsage of the(Rel)-wnf Label. |
(Team)-triage-(Rel) | Used to indicate that(Team) has triaged this issue forrelease(Rel). It’s encouraged that all open bugsare triaged on a regular basis so that old bugs aren’tforgotten. It’s therefore common to see several triage labelson the same issue which helps keeping track of which bugs have beentriaged for each release. E.g.,oracle-triage-13 There are many label variants that include the word triage in someform. The form described above is the only one recommended. Pleaserefrain from using other forms. |
aot | Used to identify issues in the JVM featureAhead of Time Compilation. |
Deprecated. Was used toidentify issues in Application Class-Data Sharing. Thecds label is now used instead. | |
c1 | Used to identify issues in the JVM JITcompiler C1. |
c2 c2- .* | Used to identify issues in the JVM JIT compiler C2. c2-.* labels are usedto identify different C2 features. E.g.,c2-intrinsic,c2-loopopts |
cds | Used to identify issues in the JVM featureClass Data Sharing. |
cleanup | Thecleanuplabel is used to indicate enhancements which has no semanticchanges, whose only purpose is to make the code more maintainableor better looking. |
compilercontrol | Used to identify issues in the JVM CompilerControl feature. |
conformance | Used to identify all TCK related conformanceissues. |
docker | Used to identify issues in dockersupport. |
footprint | Used to identify issues affecting Java SEfootprint. Issues with this label should also have aperformance label. |
gc-.* | Used to identify issues in specific garbage collectors in theJVM. E.g.,gc-g1,gc-shenandoah,gc-serial,gc-epsilon There are also labels in use to identify different GC featuresor areas rather than GC algorithms. E.g.,gc-g1-fullgc,gc-largeheap,gc-performance Note that ZGC breaks this pattern and uses the labelzgc. |
graal | Used to indicate that this is a Graal issue.(Something that needs to be fixed in Graal rather than in theJDK.) |
graal-integration | Reserved for Graal integration umbrellabugs. The automated integration script will break if this label isused for other bugs. |
hgupdate-sync | Used to identify backport issues created aspart of automatic syncing between releases. |
Deprecated. Was used to tagbugs found in the HotSpot nightly testing. Since we are now runningtiered testing there is no more nightly HotSpot testing. Seetier[1-8] . | |
hs-sbr | Used to identify issues that are found inthe “same binary runs”, a stress testing method used tofind intermittent failures. |
[1-8] | Deprecated. Was used toidentify which HotSpot tier a test failure was seen in. Wedon’t separate HotSpot tiers from the JDK tiers anymore. Seetier[1-8] . |
i18n | Used to identify issues ininternationalization. i18n is short for internationalizationmeaning “i 18 letters and an n”. Used for bugs whoseimpact varies depending on a user’s writing system, language,or locale, but aren’t just a matter of locale data. The labelisn’t needed for classes_text, classes_util_i18n,classes_awt_im, classes_fontprop, or char_encodings. |
integration-blocker | Used to indicate that a bug is present in adownstream repository but not present in the upstream repositoryand is therefore blocking integration of downstream changes intoupstream. |
intermittent intermittent-environment intermittent-hardware | An intermittent issue is one that fails sometimes but notalways. The exact reason for the intermittent failure is perdefinition unknown. Once the reason has been identified the issueis no more considered intermittent. An issue isn’tintermittent if some characteristics has been found that triggersthe failure consistently, even if the actual cause for the failurehasn’t been found. For instance if a test fails every timeit’s executed on a specific host but not on other hosts itwouldn’t be considered intermittent as it fails consistentlyon that specific host. In other cases it may be that we know that atest sometimes is unlucky in some respect and fails due to this.This test could still be considered intermittent even though weknow what the reason is if the reason itself appearsintermittently. Some issues may seem intermittent when looking at test results,even though the reason for failing is actually known. One exampleis where a test fails consistently on a specific host, or due tospecific conditions in the environment. These failuresshouldn’t be considered intermittent but it may still bevaluable to tag these in JBS with one of the labelsintermittent-hardware orintermittent-environment. This will help tofaster identify that the cause of the failure is known withouthaving to read through the entire bug. A test that should be platform agnostic but is consistently failingon a specific OS would for instance be labeled withintermittent-environment, while a test thatfails every time it’s run on some specific hardware would belabeled withintermittent-hardware. |
jep-superseded | Used to tag JEPs that have been supersededby a newer version of the JEP. |
jvmci | Used to identify issues in the JVM CompilerInterface. |
maintainer-pain | Used to tag bugs that for some reason is wasting time or inother ways are causing pain for the OpenJDK maintainers. Examplesof issues that could be considered a pain:
There are other cases as well and there is some flexibility inthe definition. If you see a problem that is causing pain for alarge number of maintainers, add an explanation in the JBS issue towhy you think the issue is a pain and add the label. If you have amaintainer-pain bugassigned to you please consider fixing it asap. If you chose not towork on the issue, you should at least be aware that you arechoosing to waste others’ time and people will be affected bythis choice. As with any issue the best way to deal with amaintainer-pain issue is to fix it. Another wayto reduce the noise is toexclude thefailing test. This is a viable option if there is a limited setof tests that are failing and the bug is actively investigated.When excluding amaintainer-painissue, remember to move themaintainer-pain label to the JBS issue used toexclude. Leaving the label on the closed exclude-issue is helpfulfor tracking purposes. |
noreg-.* nounit- .* | Thenoreg- Please note that thenoreg-namespace is closed, meaning that no newnoreg- labels should be added unless properlymotivated, discussed, and agreed upon.
|
performance | Used to identify an issue with noticeableperformance impact. Either positive or negative. |
Deprecated. Was used toindicate that a failure happened in product integration testing(PIT). Since we are now running tiered testing there is no morePIT. Seetier[1-8] . | |
problemlist | One or more tests have been problem-listeddue to this bug. |
regression | Used to identify regressions. A regressionis where behavior hasincorrectly changed from a previousbuild or release. Ideally all regressions are identified and fixedbefore they are released, if not they must be fixed at latest inthe following release after they are identified. All regressionsmust have theAffects Version/sset. |
regression_(ID) | Deprecated. Formerly usedto identify the fix that caused the regression, where known.Replaced by the use of thecaused bylink. |
release-note | Used to indicate that the issue is a releasenote. SeeRelease Notes. |
release-note=yes release-note=no | Used to indicate whether a change requires a release note ornot. The labels are always placed on the main JBS issue, never onthe actual release note issue. SeeReleaseNotes. release-note=done is deprecated andshould no longer be used. |
RN-.* | Used to indicate what kind of change therelease note is for. SeeReleaseNotes. |
starter | A starter bug is a well contained, smallissue that is suitable for someone new to the codebase. |
startup | Used to identify an issue as affecting JavaSE startup performance. Issues with this label should also have aperformance label. |
tck-red-(Rel) | Used to identify TCK conformance stoppers (e.g. failure ofa valid TCK test that exists in a shipped TCK). The release numberindicates which release of the TCK that failed. E.g.,tck-red-11 If an issue with atck-red-(Rel) label is closed as aDuplicate, the labelmust be added to the duplicating issue aswell. There aretck-red labels without therelease number out there as well. This usage is deprecated. |
The labelstest,test-only,andtestbug are deprecated andshould no longer be used. Usenoreg-self to indicate that an issue is abug in test code. | |
tier[1-8] | Used to indicate which tier in the jdk/jdk CI pipeline. Use(Rel)-tier[1-8] for other CI pipelines,where(Rel) is the name of the pipeline. E.g.8u-tier1 |
webbug | Used to identify a bug as submitted onbugs.java.com. |
zgc | Used to identify an issue in ZGC. |
After the initial release of the JDK source code into OpenJDK in2007 the OpenJDK project moved from TeamWare to using Mercurial.Starting in 2019 the source revision control has been moved to Git.The complete source code for the JDK is today hosted atGitHub. You can browse the code directlyin theopenjdk/jdkrepository, or download the code for offline browsing, editing,and building usinggit clone
.
$ git clone https://github.com/openjdk/jdk.git
openjdk/jdk
is the mainline JDK developmentrepository where the next major release of the JDK is beingdeveloped. OtherProjects have their ownrepositories onGitHub.
Note that source may be available from other locations, forexamplesrc.zip
from a full JDK distribution. However,OpenJDK contributions must use source from the appropriateOpenJDK GitHub repository sinceother source distributions may contain older code or code whichdiffers due to licensing. Consult the Project’s documentationormailing lists to determine theappropriate repository, development conventions, and helpfultools.
If you intend to contribute patches, you should firstfork the repository onGitHub and clone your ownpersonalfork as shown below. To fork aProject onGitHub, go to the GitHub Project page andclick the ‘Fork’ button in the upper right corner, thenfollow the on screen instructions.
This is the typical development model:
Diagram of upstream repos and user's clone
Pushes to your personal fork can be made either using HTTPS orSSH. These examples assume you have an SSH key installed onGitHub. If this is the first timeyou clone your personal fork of an OpenJDK repository you may wantto create an SSH key to use with it. SeeGenerating an SSH key below. Once youhave your personal fork and an SSH key to go with it, go ahead andclone.
$ git clone git@github.com:OpenDuke/jdk.git$ cd jdk$ git remote add upstream https://github.com/openjdk/jdk.git
In the example above Duke cloned his personal fork of the JDKmainline repository using SSH. You should of course use your ownGitHub username instead. Then, byadding a newremote named ‘upstream’, theclone is associated withopenjdk/jdk. Doing this willallow the tooling to automatically create a PR onopenjdk/jdk whenever a changeis pushed to the personal fork. The way that works is that once thechange has been pushed to the personal fork, and you navigate totheopenjdk/jdkrepository onGitHub, there willbe a message saying that you just pushed a change and asking if youwant to create a PR.
It isstrongly recommended to always create anew branch for any change you intend to implement. If your PR getsaccepted, it will be squashed and pushed by the OpenJDK bots. Thismeans that if you make changes to yourmaster
branch,it will diverge from the upstreammaster
branch. Thisin turn means that your repo will forever be out of sync with theupstream repo, which will cause merge conflicts every single timeyou want to update your repo from upstream. Having a separatebranch for each change also means that you can easily work on manydifferent changes in parallel in the same code repository. Unlessyou know what you are doing, the recommendation is also to alwaysbase your new branch on themaster
branch.
$ git switch -c JDK-8272373 master
Here we create a new branch calledJDK-8272373
based on themaster
branch and set the repository upto work in that new branch.
If you intend to work on a backport to a feature releasestabilization branch, your new local branch should of course bebased on the stabilization branch instead ofmaster
.
$ git switch -c JDK-8272373 jdk23
git switch
was introduced in Git version 2.23. Forearlier versions of Gitgit checkout
can be usedinstead. However it is always recommended to use the latestversions of all your tools when possible.
More information about how to work with git and the dedicatedtooling that is available for OpenJDK can be found in theProject SkaraDocumentation. If you’re new to git you can also readmore about how to work with it in one of the many fine gittutorials available on the Internet. For instance thePro Git book. This guidedoesn’t aspire to become another git guide.
For security reasons you should always create new keys and usedifferent keys with each repository you clone. Thessh-keygen
command generates an SSH key. The-t
option determines which type of key to create.ed25519
is recommended.-C
is used to adda comment in the key file, to help you remember which key it is.While it’s possible to use SSH without a passphrase, this isstrongly discouraged. Empty or insecurepassphrases may be reset usingssh-keygen -p
; thisdoesn’t change the keys.
$ ssh-keygen -t ed25519 -C openjdk-jdk -f ~/.ssh/openjdk-jdkGenerating public/private ed25519 key pair.Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /Users/duke/.ssh/openjdk-jdk.Your public key has been saved in /Users/duke/.ssh/openjdk-jdk.pub.The key fingerprint is:SHA256:WS4jCQMtat75ZEue+so+Lgj7V/sdMtj1FTNkfNsCfHA openjdk-jdkThe key's randomart image is:+--[ED25519 256]--+| .. ..oE || ... o+o .|| . .o . o+.o||.. o . + .=.||o . . o S o .. ||.. o +.+ + . . ||o. *.+.+ . . ||o....=. + . || .=B=. .. . |+----[SHA256]-----+
~/.ssh/openjdk-jdk
is a text file containing yourprivate ssh key. There’s a corresponding public key in~/.ssh/openjdk-jdk.pub
(as detailed in the exampleabove). You shouldnever share your private key.Thepublic key on the other hand should be uploaded toGitHub. Follow the steps below todo that.
~/.ssh/openjdk-jdk.pub
intothe text fieldcat ~/.ssh/openjdk-jdk.pub
ssh-ed25519AAAAC3NzaC1lZDI1NTE5AAAAIO8+egiIgWV+tE7LVVJmlR7WS2Lr3Fj7dXVo9HiasD6Topenjdk-jdk
Now you are ready to clone youropenjdk/jdk fork usingSSH.
Quick Links
In case you jumped directly here and skipped reading the earliersections of this guide, please keep in mind that there’s alot more to it than just making a change in the code and submit aPR to GitHub. The list below shows the bare minimum required beforea change can be accepted into OpenJDK.
Changes that have a compatibility impact will require a separateapproval besides the code review. This is handled through aCompatibilityand Specification Review, a.k.a. CSR. Compatibility impact canbe things like requiring a specification change, directly affect anexternal interface, changing command line options, or otherwisealter the behavior of the JDK in ways that could cause issues forusers when upgrading to the next JDK version.
See theCSRwiki for information on how to work through the CSRprocess.
The CSR must be approved before the change is allowed to beintegrated to a feature release or update release repository.Feature design and implementation work may begin concurrently withthe CSR review, but may need to be modified in response to CSRfeedback.
All source code files in OpenJDK has a header with copyrightstatements and a license. Since this is legal documentation itshall not be updated or modified without seeking guidance from yourlegal representative. For that reason this guide can’t reallygive detailed information on what you can or should do. There arehowever a few generic things that can be clarified.
This is an example copyright/license header:
/* * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */
This header has two copyright notices at the top (Oracle and SAPSE) and below them the license text.
As stated in the header, don’t make changes to thecopyright notices or the license text below them. If youraffiliation has a copyright notice at the top of the header,consult your legal representative on how to update it. If youraffiliation doesn’t have a copyright notice, again consultyour legal representative to see if you should add one. Do notupdate a copyright notice if you don’t belong to thataffiliation unless explicitly asked by the affiliation inquestion.
If you create a new file, copy the license text from a nearbyfile. Do not add copyright notices for affiliations to which youdon’t belong.
If you move code from an existing file to a new file, bring theentire copyright + license header over to the new file.
You should always aim to get your changes integrated as early ina release as possible to maximize the amount of testing done beforerelease. If you risk running late, it’s almost always abetter idea to defer the change to the next release rather thantrying to squeeze it in in the last minute. The next release isonly six months away, the world can wait even though you areeager.
Integrating during the rampdown phase is not recommended. Thebar to integrate a change in the rampdown phase is considerablyhigher than during the normal development phase. SeeThe JDK Release Process for moreinformation. Also note that changes that are made late in therelease shouldn’t expect localization since this in itselftakes some time.
The JDK build system is a fairly complex machine that has theability to build anything from a single module to a completeshippable JDK bundle with various levels of debug capabilities, runtests, install your newly built JDK on your system, orcross-compile for some other system. The build usesmake
and a few other tools that you will have toinstall on your system before starting.
The JDK supports incremental builds. This means that if you havea complete build and make changes in just a single part of the JDK(e.g. a module or part of the JVM), only that particular partneeds to be rebuilt. So subsequent builds will be faster and youcan always use a make target that results in a complete JDK imagewithout having to worry about actually building the entire JDKevery time. Please note that the incremental build do have limitsin its understanding of what you change. For instance, if youchange behaviors or conventions in one module there may be otherparts of the JDK that implicitly depends on these withoutmake’s knowledge. For this reason you may have to rebuildseveral modules, or do a clean build if you change things that mayhave a wider impact.
The examples below show the steps taken to build the JDK sourcecode. Please seeCloning the JDK forinformation on how to download it. These examples were written inthe JDK 17 development time frame which is why the boot JDK usedhere is JDK 16. Note that the download links used here point to JDK16 bundles. To build JDK N, use JDK N-1 as the boot JDK.
The configure script will tell you what additional packages youneed. In this first example several packages were needed since thisbuild was performed on a clean Ubuntu installation. The configurescript was run several times to get all the dependencies, but onlythe commands actually needed to get the JDK built are included inthe log. This is just an example log, don’t copy theapt-get install
line. Instead runsh./configure
to see what packages you actually need on yoursystem.
$ wget https://download.java.net/java/GA/jdk16/7863447f0ab643c585b9bdebf67c69db/36/GPL/openjdk-16_linux-x64_bin.tar.gz$ tar xzf openjdk-16_linux-x64_bin.tar.gz$ sudo apt-get install autoconf zip make gcc g++ libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev libcups2-dev libfontconfig1-dev libasound2-dev$ cd jdk$ sh ./configure --with-boot-jdk=$HOME/jdk-16/$ make images
The built JDK can be found inbuild/linux-x86_64-server-release/jdk
. The exact pathdepends on your build platform and selected configuration.
The second example is from a clean (newly installed) Mac runningMacOS Big Sur. Please note that in this case there are some stepstaken outside of the terminal. First XCode and the XCode commandline tools must be installed. It could be that the most recentversion of XCode that you get from App Store is too new to havebeen properly tested with the JDK build. Seethe JDK build instructions for supported versions and moredetails in case you need to install an older version of XCode. Inthis exampleMac Ports isused to installautoconf
.autoconf
canalso be installed usingHomebrew andsurely through other sources as well.
$ curl https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_osx-x64_bin.tar.gz --output openjdk-16.0.1_osx-x64_bin.tar.gz$ tar xzf openjdk-16.0.1_osx-x64_bin.tar.gz$ sudo port install autoconf$ sh ./configure --with-boot-jdk=$HOME/jdk-16.0.1.jdk/Contents/Home$ make images
In this case the built JDK can be found inbuild/macosx-x86_64-server-release/jdk
.
The JDK build is extremely configurable. This list only containsthe most basic configure options needed to get you started. Useconfigure --help
to see a complete list ofoptions.
Option | What it does |
---|---|
--with-boot-jdk | Tell configure what boot JDK to use to build theJava libraries. |
--with-debug-level | Set the debug level. Available levels arerelease ,fastdebug ,slowdebug ,optimized . |
Through the configure flags you will select what configurationof the JDK to build. The name of the output directory for the builddepends on this configuration. In the example above the JDK endedup inlinux-x86_64-server-release
. This means that wemade a release build of a 64 bit linux x86 version of the serverJDK. If we change some of these options the output directory willbe affected accordingly.
--with-debug-level
is one example of a configureoption that will change the output directory name. Sometimes itmakes sense to have several different configurations in parallel.For example while debugging some code you might want to have both adebug build and a release build to be able to test it properly. Thedirectory naming scheme makes this very easy. Simply configure andbuild the JDKs you need and they will end up next to each other inthe build directory.
In the example above we built arelease
image. Tobuild a debug image as well we can configure with--with-debug-level=slowdebug
. This will give us a JDKwhere for instance asserts in the JDK source code are enabled. Toselect which JDK to work with in later calls tomake
addCONF=<configuration>
.
$ sh ./configure --with-boot-jdk=$HOME/jdk-16/ --with-debug-level=slowdebug$ make CONF=slowdebug images$ ls build/linux-x86_64-server-releaselinux-x86_64-server-slowdebug
make images
, as used in the example above, willbuild a JDK image which is very close to what you’d get fromany JDK provider. There are several other make targets you can usedepending on what you’re looking for. The table belowcontains some commonly used make targets.
Target | What it does |
---|---|
exploded-image | This is the default make target that you’llget if you simply invokemake . |
image | Builds a complete JDK image. A good target to useif you want to build a JDK for general usage or if you want to testsomething closer to the shipping product. This can also be a goodtarget to use if doing something which might have a build aspect toit. |
<name>-image | Build just the image for any of jdk, test, docs,symbols, etc. |
reconfigure | Re-runs the configure script with the samearguments as given the last time. |
demos | Builds the demos which for instance make it easyto test something UI related. |
docs | Builds the javadoc. Note that a number of classesin the javadoc API are generated during the build, somakedocs might do more than simply invokejavadoc ,depending on the state of your build. |
java.base | Builds the base module. You can (re)build anymodule withmake <module> . |
hotspot | Builds the JVM. Note that the JVM depends onseveral other parts of the JDK, somake hotspot mightbuild more than just the JVM, depending on the state of yourbuild. |
clean | Removes all files generated by make, but not thosegenerated by configure. Useful when doing significant renaming orrefactoring which may confuse the incremental build. To clean out aspecific module only usemakeclean-<module> . |
dist-clean | Removes all files, including configuration. |
There are many other targets available as well. Usemakehelp
to find out more.
In addition to your own Java applications, OpenJDK has supportfor two test frameworks to test the JDK, jtreg and GTest. jtreg isa Java regression test framework that is used for most of the teststhat are included in the OpenJDK source repository. The Google Test(GTest) framework is intended for unit testing of the C++ nativecode. Currently only JVM testing is supported by the GTestframework. Other areas use jtreg for unit testing of C++ code.
This section provides a brief summary of how to get started withtesting in OpenJDK. For more information on configuration and howto use the OpenJDK test framework, a.k.a. “run-testframework”, seedoc/testing.md
.
Please note that what’s mentioned later in this section,likeGHA and tier 1 testing, willonly run a set of smoke-tests to ensure your change compiles andruns on a variety of platforms. They won’t do any targetedtesting on the particular code you have changed. You must alwaysmake sure your change works as expected before integrating, usingtargeted testing. In general all changes should come with aregression test, so if you’re writing product code you shouldalso be writing test code. Including the new tests (in the rightplaces) in your change will ensure your tests will be run as partof your testing on all platforms and in the future.
A few key items to think about when writing a regressiontest:
The jtreg documentation has a section onhow to write good jtregtests.
There are a few examples where it doesn’t make sense towrite an explicit regression test. These should be tagged in JBSwith one of thenoreg-labels.
In-depth documentation about the jtreg framework is found here:jtreg harness. jtregitself is available in theCode ToolsProject.
Below is a small example of a jtreg test. It’s a cleanJava class with a main method that is called from the test harness.If the test fails we throw a RuntimeException. This is picked up bythe harness and is reported as a test failure. Try to always writea meaningful message in the exception. One that actually helps withunderstanding what went wrong once the test fails.
/* * @test * @summary Make sure feature X handles Y correctly * @run main TestXY */publicclass TestXY{publicstaticvoidmain(String[] args)throwsException{= X.y(); var resultif(result!= expected_result){thrownewRuntimeException("X.y() gave "+ result+", expected "+ expected_result);}}}
This example only utilizes three jtreg specific tags,@test
,@summary
, and@run
.@test
simply tells jtreg that this class is a test,and@summary
provides a description of the test.@run
tells jtreg how to execute the test. In this casewe simply tell jtreg to execute the main method of the classTestXY
.@run
isn’t strictlynecessary for jtreg to execute the test, an implicit@run
tag will be added if none exists. However, forclarity and in order to avoid bugs it’s recommended to alwaysexplicitly use the@run
tag.
There are several other tags that can be used in jtreg tests.You can for instance associate the test with a specific bug thatthis test is a regression test for. The bug id is written withouttheJDK-
prefix.
@bug 8272373
You can add several bug ids in the same@bug
tag,separated by a single space. These bug ids refer to product bugsfor which a fix is verified by this test. JBS issues that trackchanges to the test itself are not listed here.
You can also specify a number of requirements that must befulfilled for jtreg to execute the test.
@requires docker.support@requires os.family != "windows"@requires os.maxMemory > 3G@requires os.arch=="x86_64" | os.arch=="amd64"
And you can specify if the test requires specific modules, orcommand line flags to run the test in several different ways.
@modules java.base/jdk.internal.misc@run main/othervm -Xmx128m TestXY
Note that you can have several@run
tags in thesame test with different command line options.
jtreg also have support for labeling tests with keys using the@key
tag. These keywords can then be used to filterthe test selection. For instance if you have a UI test which needsto display a window you’ll want to make sure the test harnessdoesn’t try to run this test on a system which doesn’tsupport headful tests. You do this by specifying
@key headful
Another example is@key randomness
that should beused to indicate that a test is using randomness - i.e. isintentionally non-deterministic.
There are many other keywords in use and their usage may differbetween areas in the JDK. Make sure you understand the conventionsfor the particular area you are testing since these are justexamples.
Thejtreg documentationprovides information on many more tags like these.
Thecompilergroup has a section in their wiki withGuidelines for“langtools” tests.
When configuring the OpenJDK build you can tell it where yourjtreg installation is located. When providing this information youcan later runmake run-test
to execute jtregtests.
sh ./configure --with-jtreg=/path/to/jtregmake run-test TEST=tier1
In the OpenJDK source tree you can find a directory calledtest
. There are a large number of tests in thisdirectory that are written to be used with jtreg.
make run-test TEST=test/jdk/java/lang/String/
You can also run jtreg without invoking make. In this caseyou’ll need to tell jtreg which JDK to test.
jtreg -jdk:/path/to/jdk /path/to/test
As mentioned the Google test framework is mainly used for C++unit tests. There are several of these in thetest/hotspot
directory. Currently, only the C++ codein the JVM area is supported by the OpenJDK GTest framework. Thetests can be run without starting the JVM, which enables testing ofJVM data structures that would be fragile to play with in a runningJVM.
staticintdemo_comparator(int a,int b){if(a== b){return0;}if(a< b){return-1;}return1;}TEST(Demo, quicksort){int test_array[]={7,1,5,3,6,9,8,2,4,0};int expected_array[]={0,1,2,3,4,5,6,7,8,9};::sort(test_array,10, demo_comparator,false); QuickSortfor(int i=0; i<10; i++){ASSERT_EQ(expected_array[i], test_array[i]);}}
ASSERT_EQ
is one example of an assertion that canbe used in the test. Below are a few other examples. A full list isfound in theGoogleTest Documentation.
ASSERT_TRUE(condition);ASSERT_FALSE(condition);EXPECT_EQ(expected, actual);EXPECT_LT(val1, val2);EXPECT_STREQ(expected_str, actual_str);
ASSERT
is a fatal assertion and will interruptexecution of the current sub-routine.EXPECT
is anonfatal assertion and will report the error but continues to runthe test. All assertions have both anASSERT
and anEXPECT
variant.
For more information on how to write good GTests in HotSpot, seedoc/hotspot-unit-tests.md
.
When configuring the OpenJDK build you can tell it where yourGTest installation is located. Once configured, use make to runGTests.
sh ./configure --with-gtest=/path/to/gtestmake test TEST=gtest
You can also use a regular expression to filter which tests torun:
make test TEST=gtest:code.*:os.*make test TEST=gtest:$X/$variant
The second example above runs tests which match the regexp$X.*
on a specific variant of the JVM. The variant isone of client, server, etc.
GitHub has a feature calledGitHub actions (GHA) that can be used to automatetesting. The GHA is executed whenever a push is made to a branch inyour repository. The bots will show the results of the GHA in yourPR when you create or update it. The GHA in the JDK Project isconfigured to run a set of tests that is commonly known astier 1. This is a relatively fast, small set oftests that tries to verify that your change didn’t break theJDK completely. In tier 1 the JDK is built on a small set ofplatforms including (but not necessarily limited to) Linux,Windows, and MacOS, and a few tests are executed using thesebuilds. There’s also a set of other platforms for which GHAdoes cross-complilation builds.
In addition to the testing you run manually before publishingyour changes, it’s recommended that you take advantage ofthis automated testing that the GHA offers. This will for instanceallow you to run tests on platforms that you may not otherwise haveaccess to. To enable this on your personal fork of the JDK onGitHub go to the“Actions” tab and click the big green button saying“I understand my workflows, go ahead and enable them”.If you don’t understand these workflows there’s a linkto the actual file that describes them right below the greenbutton.
In case of failures in the GHA it’s always a good start totry to reproduce the failure locally on a machine where you havebetter control and easier access to a debug environment. There havebeen cases where the GHA has failed due to issues unrelated to thechange being tested, e.g. because the GHA environment wasupdated and changes were needed to the JDK GHA configuration. Theconfiguration is in general updated fairly quickly, so in caseswere you can’t reproduce the failure locally, considerre-running the GHA later.
Please keep in mind that the tier 1 tests run by the GHA shouldonly be seen as a smoke test that finds the most criticalbreakages, like build errors or if the JDK is DOA. These tests cannever replace the targeted testing that you always must do on yourchanges. There are several areas of the JDK that aren’t partof tier 1 at all. To see exactly what tier 1 includes, please seethe various TEST.groups files that you will find in thesubdirectories ofjdk/test/
.
In the past there used to be a sandbox repository that could beused for testing purposes. With the move to Git this has beenreplaced by GitHub Actions.
Sometimes tests break. It could be e.g. due to bugs in thetest itself, due to changed functionality in the code that the testis testing, or changes in the environment where the test isexecuted. While working on a fix, it can be useful to stop the testfrom being executed in everyone else’s testing to reducenoise, especially if the test is expected to fail for more than aday. There are two ways to stop a test from being run in standardtest runs: ProblemListing and using the@ignore
keyword. Removing tests isn’t the standard way to remove afailure. A failing test is often a regression and should ideally behandled with high urgency.
Remember to remove the JBS id from the ProblemList or the testwhen the bug is closed. This is especially easy to forget if a bugis closed asDuplicate orWon’t Fix. jcheck will reportan error and prohibit an integration if a PR is created for anissue that is found in a ProblemList if the fix doesn’tremove the bug ID from the ProblemList.
ProblemListing should be used for a short term exclusion while atest is being fixed, and for the exclusion of intermittentlyfailing tests that cause too much noise, but can still be useful torun on an ad-hoc basis. ProblemListing is done in the fileProblemList.txt
. For more details about theProblemList.txt
file see thejtreg FAQ.
There are actually several ProblemList files to choose from inthe JDK. Their location and name hint about what area or featureeach file belongs to. Each file has sections for differentcomponents. All ProblemList files complement each other to buildthe total set of tests to exclude in jtreg runs.
test/hotspot/jtreg/ProblemList.txttest/hotspot/jtreg/ProblemList-aot.txttest/hotspot/jtreg/ProblemList-graal.txttest/hotspot/jtreg/ProblemList-non-cds-mode.txttest/hotspot/jtreg/ProblemList-Xcomp.txttest/hotspot/jtreg/ProblemList-zgc.txttest/jaxp/ProblemList.txttest/jdk/ProblemList.txttest/jdk/ProblemList-aot.txttest/jdk/ProblemList-graal.txttest/jdk/ProblemList-Xcomp.txttest/langtools/ProblemList.txttest/langtools/ProblemList-graal.txttest/lib-test/ProblemList.txt
Use the suitable ProblemList and add a line like this in theproper section:
foo/bar/MyTest.java 4711 windows-all
In this example,MyTest.java
is ProblemListed onwindows, tracked by bugJDK-4711
.
Currently there’sno support formultiple lines for the same test. For this reason it’simportant to always make sure there’s no existing entry forthe test before adding a new one, as multiple entries might lead tounexpected results, e.g.
foo/bar/MyTest.java 4710 generic-all...foo/bar/MyTest.java 4711 windows-all
This would lead tosun.tools.jcmd.MyTest.java
beingProblemListed only onwindows-all
. The proper way towrite this is:
foo/bar/MyTest.java 4710,4711 generic-all,windows-all
Althoughwindows-all
isn’t strictly requiredin this example, it’s preferable to specify platforms foreach bugid (unless they are allgeneric-all
), thismakes it easier to remove one of the bugs from the list.
A common way to handle the JBS issue used to problemlist a testis to create aSub-task of the bugthat needs to be fixed to be able to remove the test from theproblem list again.
Remember to always add aproblemlist label in the JBS issue referenced inthe ProblemList entry. When the issue is fixed, theproblemlist label can be removed from the JBSissue.
Some tests contain several test cases and there may be a need toProblemList only a few of them. To do this use the full test name,i.e. <filename> + # + <test case id>
,where test case id can be specified in the test header. If no id isspecified each test case can be referenced withid
+ordinary number of the test case in the test file.
Let’s assume we have four test cases infoo/bar/MyTest.java
:
/* @test *//* @test id=fancy_name *//* @test *//* @test */
A ProblemList entry that excludes the first, second, and thirdtest case would look like this:
foo/bar/MyTest.java#id0 4720 generic-allfoo/bar/MyTest.java#fancy_name 4721 generic-allfoo/bar/MyTest.java#id2 4722 generic-all
Due to an issue described inCODETOOLS-7902712tests that contains more than one@test
must actuallyuse this way to specify all test cases if all of them should beProblemListed. Specifying just the test name will not work.
To run ad-hoc runs of ProblemListed tests useRUN_PROBLEM_LISTS=true
.
make test TEST=... JTREG=RUN_PROBLEM_LISTS=true
@ignore
The@ignore
keyword is used in the test sourcecode. This is mainly used for tests that are so broken that theymay be harmful or useless, and is less common than ProblemListing.Examples can be tests that don’t compile because somethingchanged in the platform; or a test which might remove your/etc/shadow
. Use@ignore
with a bugreference in the test case to prevent the test from being run.
/***@test*@ignore4711*/
In this example,MyTest.java
is excluded, trackedby bugJDK-4711
.@ignore
should generallybe placed directly before the first “action” tag(e.g. @compile
,@run
) if any in thetest.
ProblemListing and@ignore
-ing are done in the JDKsource tree, that means a check-in into the repository is needed.This in turn means that a unique JBS issue and a code review areneeded. This is a good thing since it makes test problemsvisible.
The fix for the main issue should remove the test from theProblemList or remove the@ignore
keyword from thetest.
After a failure is handled by excluding a test, the main JBSissue should be re-triaged and possibly given a new priority. Thisshould be handled by the standard triage process. A test exclusionresults in an outage in our testing. This outage should be takeninto consideration when triaging, in addition to the impact of thebug itself.
If a change causes a regression that can’t be fixed withinreasonable time, the best way to handle the regression can be toback out the change. Backing out means that the inverse(anti-delta) of the change is integrated to effectively undo thechange in the repository. Whether to back out a change or not willalways be a judgement call. How noisy and frequent are the failurescaused by the broken change? How soon can the fix be expected? Ifyou want to avoid having your change backed out, you should makesure to let the relevant developers know that you are working onthe fix and give an estimated ETA of the fix.
It will happen of course when the build is broken or the JDK isDOA and similar situations that a change is immediately backed outwithout further investigation. Backing out a change is howeverseldom the first course of action if the change has been done inaccordance with the guidance inWorking With Pull Requests. If,when investigated, it is found that a change didn’t gothrough relevant testing or there are other issues that should havebeen caught before integration if proper procedure had beenfollowed, it’s quite possible that a change is backed outeven if the author is desperately working on a fix. The JDK sourcecode is deliberately menat to have a high bar for acceptance ofchanges. If something crawls in underneath that bar it should mostlikely be backed out.
The backout is a regular change and will have to go through thestandard code review process, but is considered atrivial change. The rationale is that a backout isusually urgent in nature and the change itself is automaticallygenerated. In areas where two reviewers are normally required, onlyoneReviewer isrequired for a backout since the person who is performing thebackout also should review the change.
There are two parts to this task, how to do the bookkeeping inJBS, and how to do the actual backout in git.
[REDO]
on the summary - the clone becomes theredo-issue(R).[BACKOUT]
.[BACKOUT]
.[BACKOUT]
.ProblemList entries and@ignore
keywords willcontinue to point to the original bug (unless updated at back out).This is accepted since there is a clone link to follow.
To backout a change with git, usegit revert
. Thiswill apply (commit) the anti-delta of the change. Then proceed asusual with creating a PR and getting it reviewed.
$ git show aa371b4f02c2f809eb9cd3e52aa12b639bed1ef5 commit aa371b4f02c2f809eb9cd3e52aa12b639bed1ef5 (HEAD -> master) Author: Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com> Date: Wed Jun 23 20:31:32 2021 +0200 8272373: Make the JDK mine Reviewed-by: dukediff --git a/README.md b/README.md index 399e7cc311f..4961acb2126 100644--- a/README.md+++ b/README.md@@ -1,4 +1,4 @@-# Welcome to the JDK!+# Welcome to my modified JDK! For build instructions please see the [online documentation](https://openjdk.org/groups/build/doc/building.html), $ git revert aa371b4f02c2f809eb9cd3e52aa12b639bed1ef5 [master d454489052d] 8280996: [BACKOUT] Make the JDK mine Reviewed-by: duke 1 file changed, 1 insertion(+), 1 deletion(-) $ git show d454489052dc6ff69a21ad9c8f56b67fdeb435ee commit d454489052dc6ff69a21ad9c8f56b67fdeb435ee (HEAD -> master) Author: Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com> Date: Wed Jun 23 20:32:08 2021 +0200 8280996: [BACKOUT] Make the JDK mine Reviewed-by: dukediff --git a/README.md b/README.md index 4961acb2126..399e7cc311f 100644--- a/README.md+++ b/README.md@@ -1,4 +1,4 @@-# Welcome to my modified JDK!+# Welcome to the JDK! For build instructions please see the [online documentation](https://openjdk.org/groups/build/doc/building.html),
In rare cases it may be necessary to back out a backport from anupdate release without backing out the original fix in mainline.This will require a somewhat different procedure and will result ina small mess in JBS. It’s extremely important to add commentsin all relevant issues explaining exactly what’shappened.
The steps to take in order to do this are described below.(M) used below refers to the main bug entry - thefirst fix that was later backported.
[REDOBACKPORT]
on the summary - the clone becomes the redo-issue(R).<N>-pool
if it’s not critical whichrelease the fixed backport goes into.[BACKOUT BACKPORT]
.[BACKOUTBACKPORT]
.[BACKOUTBACKPORT]
.The end result in JBS should look like this:
JBS structure after backout and redo of abackport
For this example in JBS see the 15.0.2 backport ofJDK-8272373.
The approach described here has both advantages anddisadvantages. The key invariants that lead to this model are:
Disadvantages of this model are that the list of backports inJBS will still list the old (failed) backport as the 15.0.2backport, and the new backport will not be linked to using abackported by link. It is assumed that the advantagesabove outweighs the disadvantages and that the capital letterprefixes for the backout and the redo will be visible enough in JBSto alert that something fishy is going on.
Quick Links
Once you have made a change that you want to integrate into anOpenJDK code base you need to create aPull Request (PR)onGitHub. This section assumesthat you have previous experience from using git andGitHub, and won’t go into details ofhow those work. Still, the aim is of course to provide a usefulguide, sosend an email if moredetails are needed.
This section also assumes that you have already readI have a patch, what do I do?and followedall the steps there.
Please note that the description of a change should always be inthe JBS issue. TheGitHub PR canbe a good place to discuss technical implementation detailsregarding your change, but it’s not the right place todescribe the problem. Make sure you have a proper problemdescription in your JBS issue before publishing a PR.
All code reviews in OpenJDK are done in public. Once you openyour PR for public review the internet can see it and comment onit. Make sure your code is ready for it. Look through yourcomments, make sure that temporary code is gone, and make sure youhave sanitized your method and variable names. Also, make sure youunderstand your code. Why is it working? What are the potentialpitfalls? What are the edge-cases? If you haven’t alreadyanswered all these questions in the mail conversation that precededthis PR, it’s likely that you will need to answer them duringthe review.
It’s also worth taking the extra time to see if the changecan be split into a few different separate changes. A large changewill take more effort and thus attract fewerReviewers. Smallerchanges will get reviewed faster and get better quality reviews.You can compare proposing a single large change to proposing tenindividual small unrelated changes. What happens in practice whenall these ten changes are presented as one PR is that there’sa focus on say 5-6 of these smaller changes and no one really lookshard at the other 4-5. For complexity, even small changes that arehard to understand and test may be risky.
The timing of your change will also affect the availability ofreviewers. The JDK runs on asix-monthsrelease cadence. During the months around the start of the rampdown phase most area experts will be busy working on their ownchanges and reviewing major features that are planned for therelease. If you propose a change during this period (basicallyMay-June, or November-December) it may take a long time before youget the required reviews.
It’s likely that other people have integrated changes tothe code base since you created your branch. Make sure to pull thelatest changes and rebase your fix on top of that before creatingyour PR. This is a courtesy issue. Your reviewers shouldn’thave to read your patch on top of old code that has since changed.This is hopefully obvious in cases where the upstream code has gonethrough cleanups or refactorings, and your patch may need similarcleanups in order to even compile. But even in cases where onlysmaller changes have been done, the reviewers shouldn’t haveto react to issues like “that line of code was moved lastweek, why is it back there?”.
Most changes are made to themaster
branch of themainline repository. In these cases, rebase using:
git rebase master
Note that if you are working on a backport to a stabilizationbranch you should replacemaster
above with the nameof the branch you are targeting. This would be the same name aswhen you cloned the branch.
After the PR has been published, rebasing, force-pushing, andsimilar actions are strongly discouraged. Such actions will disruptthe workflow for reviewers who fetch the PR branch. Pushing newchanges is fine (and even merging if necessary) for a PR underreview. Incremental diffs and other tools will help your reviewerssee what you have changed. In the end, all commits will be squashedinto a single commit automatically, so there’re actually nodrawbacks whatsoever to making commits to a PR branch duringreview.
Creating the PR is essentially the same as asking a large groupof people to start reviewing your change. Before doing that, youwant to make sure your change is done in every detail you have thepower to control. These are a few of the things you should thinkabout in order to avoid wasting people’s time on anunfinished change. (You may think that some of these are tooobvious to even mention, but all of them are things that in thepast have caused actual failures that broke the JDK forall developers out there.)
Is the copyright statement at the top of each modified sourcefile correct?
Did you run a full build and all relevant tests on thefinal version of the change? It’s importantto do this on the truly final version, as even an apparentlytrivial change in a comment can break the build.
Did yougit add
all new files?
Did you add regression tests for your change?
Did you run those new regression tests?
If you are unsure of any of these things but still want to goahead and create the PR,don’t!
If you have an actual reason to create a PR before the change isall done, make sure to create it inDRAFT
mode. Thebot won’t add therfr
label or send emails tolabeledGroups aslong as the PR is inDRAFT
mode.
Make sure the PR is reviewable
There are changes that span across several areas, for examplewide spread cleanups or the introduction of a new language feature.Accordingly, the number of lines of code touched can be quitelarge, which makes it harder to review the entire PR. In suchcases, it may make sense to split the change into several PRs, mostcommonly by grouping them by module or area.
Make sure you target the correct branch
Many project repositories have several branches. Make sure yourPR targets the correct one. This is of course especially importantwhen not targeting the default branch. At the top of your PR, rightbelow the title, it will say “NNN wants to merge X commit(s)into [branch]”. A typical red flag to watch out for is ifyour PR seems to include commits or changed files thatshouldn’t be part of your integration. E.g. Seeing the“Start of release updates for JDK N” when backportingsomething to JDK N-1 is a bad sign.
Set a correctly formatted title
The title of the PR should be of the form “nnnnnnn:Title of JBS issue
” wherennnnnnn
is theJBS issue id of the main JBS issue that is being fixed, and theTitle of JBS issue
is the exact title of the issue aswritten in JBS. In fact, the title can be set toonly theJBS issue id (nnnnnnn
) in which case the bot willfetch the title from JBS automatically. If you are creating abackport PR, seeUsing the Skaratooling to help with backports for more details on the titlerequirements.
Write a useful description
The description of the PR should state what problem is beingsolved and shortly describe how it’s solved. The PRdescription should also list what testing has been done.Reviewers and otherinterested readers are referred to the text in the JBS issue fordetails, but the description should be enough to give an overview.This assumes there’s useful information in the JBS issue,like an evaluation etc. If not, add it.
Remember that the description is included in many emails sent tolists with many receivers, so a too long description can cause alot of noise, while of course a too short description won’tgive the reader enough information to perform the review. If youhave a lot of information you wish to add to your PR, likeperformance evaluations, you can put that in a separate comment inthe PR.
Finish the change before publishing it
Each update to a published PR will result in emails being sentto all relevant lists. This is per design and it’s how wewant it to be, but it also mean that if you publish a PR before youhave gone through the final check mentioned above, and later findthat a few more updates are necessary, a lot of people will get alot of emails.
Make sure all relevantGroups areincluded
The bot will make an attempt to include theGroups that need to reviewyour change based on the location of the source code you havechanged. There may be aspects of your change that are relevant tootherGroups aswell, and the mapping from source toGroups isn’t alwaysperfect, so make sure all relevantGroups have been included,and add new labels using/label
if needed. Consult theCode Owners section if you are unsure of whoowns the code you are changing.
Allow enough time for review
In general all PRs should be open for at least 24 hours to allowfor reviewers in all time zones to get a chance to see it. It mayactually happen that even 24 hours isn’t enough. Take intoaccount weekends, holidays, and vacation times throughout the worldand you’ll realize that a change that requires more than justa trivial review may have to be open for a while. In some areastrivial changes are allowed to beintegrated without the 24 hour delay. Ask your reviewers if youthink this applies to your change.
Get the required reviews
At least oneReviewer knowledgeable ineach area being changed must approve every change. A change maytherefore require multipleReviewers because itaffects multiple areas. Some areas (e.g. Client and HotSpot)require two reviewers in most cases, so be sure to read therelevantOpenJDKGroup pages for advice or ask yourSponsor.
Be open to comments and polite in replies. Remember that thereviewer wants to improve the world just as much as you do, only ina slightly different way. If you don’t understand somecomment, ask the reviewer to clarify. Accept authority whenapplicable. If you’re making changes in an area whereyou’re not the area expert, acknowledge that your reviewersmay be. Take their advice seriously, even if it is to not make thechange. There are many reasonswhy a change may get rejected. Andyou did read the sectionThingsto consider before proposing changes to OpenJDK code,right?
Updating the PR
You may need to change the code in response to review comments.To do this, simply commit new changes and push them onto the PRbranch. The PR will be updated automatically. Multiple commits tothe branch will be squashed into a single commit when the PR iseventually integrated.
If the set of files in the PR has changed, this may affect theGroups that need toreview the PR. Make sure to adjust the PR labels accordingly.
If you want to update the title of the PR, remember that the oneand only truth is the JBS issue, so the title must first be changedthere.
After having made all updates needed to get to the final versionof the change, remember to re-run relevant testing. Even minorchanges may go bad and you don’t want to cause (another)build failure due to an updated comment.
Merge the latest changes
If your PR is out for review for a longer time it’s a goodhabit to pull from the target repository regularly to keep thechange up to date. This will make it easier to review the changeand it will help you find issues caused by other changes sooner.Typically this involves fetching changes from themaster
branch of the main JDK repo, merging them intoyour local branch, resolving conflicts if necessary, and thenpushing these changes to the PR branch. Pushing additional commitsand merges into the PR branch is fine; they will be squashed into asingle commit when the PR is integrated. Avoid rebasing changes,and prefer merging instead.
If your PR is targeting some other branch thanmaster
, make sure to merge the correct upstream branch(the target branch). Verify that your PR doesn’t includechanges from some other branch (e.g. master
) thataren’t supposed to be there.
If there are upstream changes that might affect your change,it’s likely a good idea to rerun relevant testing as well.TheGHA testing that’s doneautomatically byGitHub shouldonly be seen as a smoke test that finds the most severe problemswith your change. It’s highly unlikely that it will test youractual change in any greater detail - or even at all execute thecode that you have changed in most cases.
Integrate your change
When you have the required reviews and have made sure allrelevant areas have had a chance to look at your change, integrateby entering the command/integrate
in a comment on the PR. If you are notyet aCommitterin theProject,ask yourSponsorto enter the command/sponsor
in the PR as well in order for yourchange to be allowed to be integrated.
After integration
After you have integrated your change you are expected to stayaround in case there are any issues with it. As mentioned above,you are expected to have run all relevant testing on your changebefore integrating your PR, but regardless of how thorough you testit, things might slip through. After your change has beenintegrated an automatic pipeline of tests is triggered and yourchange will be tested on a variety of platforms and in a variety ofdifferent modes that the JDK can be executed in. A change thatcauses failures in this testing may be backed out if a fixcan’t be provided fast enough, or if the developerisn’t responsive when noticed about the failure. Note thatthis directive should be interpreted as “it’s a reallybad idea to integrate a change the last thing you do beforebedtime, or the day before going on vacation”.
Quick Links
As allOpenJDKProjects are hosted onGitHub,most code reviews takes place there. When you publish a PR to anOpenJDK repository the corresponding JBS issue will get a link tothe code review in the PR, making this the natural place to go forreview. OpenJDK do however provide other tools and infrastructurefor code reviews as well: Thewebrevs.
Webrev refers to both the tool used to create them and itsoutput. The script,webrev.ksh
,is maintained in theCode ToolsProject. Please note that this version of webrev is for usewith mercurial and won’t work with the git basedrepositories. You don’t actually need tools like this anymoreunless you want to host code reviews in other locations thanGitHub.
On the GitHub reviews you will find links to webrevs. These areautomatically generated by the bot and are provided as a complementfor those who prefer this style of code review. Many OpenJDKdevelopers are used to the webrevs as this was the default way toprovide code for review before OpenJDK moved toGitHub. Though webrevs are mainlydeprecated today, they used to be a central part of OpenJDKdevelopment and you may still see people use the word as a synonymfor code review, so they do deserve to be mentioned here aswell.
cr.openjdk.org
Thecr.openjdk.org
server provides storage anddisplay of code review materials such as webrevs and otherartifacts related to the OpenJDK Community. This area can also beused to store design documents and other documentation relatedOpenJDK but not related to any specificProject that have anOpenJDK wiki space for such purposes.
Any OpenJDKAuthor can publishmaterials on thecr.openjdk.org
server. Users canupload files to temporary storage using secure methods(rsync
,scp
, andsftp
).
This site is for open source materials related to the OpenJDKCommunity only. Users uploading inappropriate materials will loseaccess and the material will be deleted. Please review theTerms of Use beforeusing this server.
To usecr.openjdk.org
you’ll need to get anSSH key installed. SeeGeneratingan SSH key for guidance on how to generate a key. Your publickey (~/.ssh/id_rsa.pub
) should be mailed as anattachment along with your JDK username tokeys@openjdk.org. An administratorwill install your key on the server and notify you on completion.This process may take a couple of days.
Users behind a SOCKS firewall can add a directive to the~/.ssh/config
file to connect to the OpenJDKserver:
Host *.openjdk.orgProxyCommand /usr/lib/ssh/ssh-socks5-proxy-connect -h [socks_proxy_address] %h %p
See thessh-socks5-proxy-connect
man page andssh-config
man page for more information. Othersystems may require proxy access via other programs. Some Linuxdistributions provide thecorkscrew
package whichprovides ssh access through HTTP proxies.
It’s recommended that all users check with theirnetwork administrators before installing any kind of TCP forwardingtool on their network. Many corporations and institutions havestrict security policies in this area.
Quick Links
Two of the most important contributions you can make in theOpenJDK community are to review and sponsor changes for otherdevelopers. All changes needs to be reviewed. Many changes evenneed to be reviewed by more than one person. This means that inorder to enable a fast-pased development experience, all developersneed to review more changes then they produce themself.
If you are new to an area, reviewing changes is also a great wayto learn the code and see what general styles and types of changesare relevant in the area. Be mindful though, if you don’tknow the area well you should state this in your reviewcomments.
New developers in the OpenJDK community don’t have thepermissions needed to integrate changes to the repositories. Thisis a feature that ensures that all developers get familiar with thecode, processes, and community before being allowed to actuallymake changes. To get their first changes in, the new Contributorneeds the help of a Sponsor. The Sponsor’s role is to offerconstructive advice and eventually integrate the sponsoredcontribution into the repository.
Sponsoring new contributions is an important activity -it’s how the engineering culture of a project gets passed onfrom the core group to new Contributors, from one generation to thenext. Take pride in the value you provide to Contributors. Theirsuccess reflects well on you.
There are many different reasons to sponsor a change anddepending on the situation the exact steps involved may differsignificantly. An experienced developer hired into a larger team ofOpenJDK developers is likely to get much of the requiredinformation by osmosis and will likely need less help from asponsor than the enthusiast sitting at home with no priorexperience of large scale software development. This text aims tohighlight the steps involved in sponsoring a change but can’tcover all possible scenarios. As always, common sense takesprecedence where the assumptions made here doesn’t apply toyour use case.
As aRevieweryou have a responsibility to make sure changes are sound and alignwith the general direction of the area. If you, as aReviever, review a changein an area that you don’t know well you probablyshouldn’t be the one to approve the change.
Reviewersshould be aware that they take full responsibility for theappropriateness and correctness of any changes in their area ofexpertise. If something goes wrong (e.g., the build breaks) and thechange’s author is unavailable, they may be asked to dealwith the problem. PotentialReviewers are encouragedto refuse to review code for which they aren’t qualified.
Reviewersshould examine not only the code being added or changed but alsothe relevant unit or regression tests. If no tests are being addedfor a change that isn’t already covered by existing tests andhave the appropriatenoreg- label,theReviewershould question this.
As aReviewer,Contributors will look up to you for guidance to get theircontributions into the project - your actions will determinewhether Contributors will feel welcome and want to engage furtherwith the project beyond their initial attempt, or not. Let’snot lose enthusiastic, engaged and technically competentContributors due to a lack of communication. If you see a requestin your area of expertise and you can’t address it, at leastacknowledge receipt of the request and provide an estimate for whenyou’ll be able to give it your attention. A frank explanationof your time constraints or commitments will be appreciated andrespected.
Code reviews in OpenJDK happens onGitHub. This guide will hint atthe most common steps to perform a review but it’s not acomplete documentation of all features. For official documentationsee theGitHub Docs.
When you arrive at a pull request there are a few differentsections that you can browse through, Conversation, Commits,Checks, and Files changed. We will look at the first and the lastof these.
The Conversation section is where all discussion around the PRhappens. Note that this section is intended for technicaldiscussion around the actual implementation of a change. This is ingeneral not the place to discuss the appropriateness of the changeor have overarching design discussions, that should happen on theappropriatemailing lists. Yes, PRcomments will be sent to the mailing lists as well, but it’sunlikely that all the right people will see it. PR mails sent tothe mailing lists will have a subject indicating that it’sabout the specific implementation in the PR. If the discussion islarger than just about the specific implementation, for instancearound the design or future of the feature, then a much largeraudience needs to be made aware of the discussion. A separate emailthread with a proper subject is preferred in such cases.
You can either reply to existing comments by using the textfield beneath each comment, or add a new comment by scrolling tothe bottom of the page and use the larger text field where it says“Leave a comment”.
Reviews take time for everyone involved. Your opinions are muchappreciated as long as they are on-topic and of a constructivenature. A comment of the form “I don’t like this”won’t help anyone to improve the change. Instead express whatit is that you don’t like and give examples of how to do itdifferently. Always be polite and make sure you read through allprevious comments before adding your own, the answer you arelooking for may already have been given.
Note that GitHub will collapse comments if there are many ofthem, and if an issue is marked as resolved. This means that youhave to be observant and may have to dig around a bit to find allcomments in the PR.
Never ask the author of a change to fix unrelated issues in thecode that you find during your review. Such issues should behandled through a separate JBS issue and PR.
The Files changed-section is where the actual change ispresented. On the left hand side there’s a list of all fileschanged. This is useful to get a quick overview and to see if thechange touches an area that you need to review.
The diff view is pretty straight forward, red stuff has beenremoved, green stuff has been added. You can configure (among otherthings) if you want a unified diff or a split view, if you want tohide whitespace changes, what types of files you want to show, andif you want to show the entire change or just what’s happenedsince your last review.
When you hover the text in the change a blue square with a plussign pops up to the left of the line. Click it to add a commentabout the change on the corresponding line. When you create yourfirst comment you have the option to simply add a single comment orto start a review. In general you want to start a review so thatall your comments are gathered in the same context when emails aresent out etc. You can also attach a comment to a file rather thanto a specific line in the file by using the speech bubble icon atthe top right.
When a complete file has been reviewed there’s a“viewed” checkbox at the top right that can be used tohide the files that you are done with. This is useful for changesthat involve many files.
Once you have looked through all the changes and added all yourcomments, the green button at the top right of the screen“Review changes” is used to finish your review. You canadd a final comment to sum up your findings and then choose whetheryou just want to provide your comments, if you want to approve thechanges, or request that changes are done before the change can beapproved. Finally click “Submit review” to publish yourthoughts.
A change that is small, well contained, and that makes nosemantic changes can be calledtrivial. Typical examplesare fixing obvious typos or renaming a local identifier. A trivialchange can also be integrating an already-reviewed change that wasmissed in an earlier integration (e.g., forgot to add a file) orgenerated changes like agitrevert
. It’s up to the author of a change to claimthat the change is trivial in the RFR, and it’s up to theReviewer whetherto approve such a claim. A change is trivial only if theReviewer agrees that itis. A trivial change doesn’t need to wait 24 hours beforebeing pushed, and it only needs oneReviewer, even in areaswhere stricter rules for integration normally apply.
In an ideal situation opportunities to sponsor contributionsoccur in the OpenJDK mail lists. Since Contributors are encouragedto discuss their intended changes before they submit a patch, theideal time to declare your sponsorship is during that initialconversation. As a Sponsor you should offer advice and collaboratewith the Contributor as necessary to produce a high-quality patch.In addition to sponsoring changes to code you regularly maintain,there may be other areas where you can serve as a Sponsor.
After publicly committing to sponsoring a contribution, you needto “claim the sponsorship request” inJBS unless the Contributor already hasa JBS account and can assign the bug to themself. To do that youneed to perform three steps:
If the contribution doesn’t already have an associatedOpenJDK bug then create one inJBS.
It should be noted that claiming the sponsorship can take manyother forms. In cases where a change has been discussed, or astarter bug has been picked up and fixed even though a sponsorhasn’t been identified yet it may be as simple as justshowing up at the PR and sponsor the change once it’s beenreviewed.
As a sponsor, you aren’t technically required to reviewthe change, other Reviewers may already have looked at it or signedup to review. But it will be your name on the commit so you shoulddo whatever you feel is needed to be comfortable with that. You mayneed to work with the Contributor to make any necessary changes,until you and the Contributor are satisfied with the result, andyou are satisfied that the proposed contribution will pass anyrelevant review and testing. That may take more than one iterationin the worst case. You may also need to help out with any processor practical questions around the OCA, GitHub PRs, and specificrequirements in the area or project.
To integrate the change the Contributor should use the command/integrate
on the PR as prompted by the bots. Oncethat is done, you as a sponsor enter the command/sponsor
in a comment on the PR.
Once the change has been integrated you may need to keep an eyeout for any reported test failures and be prepared to investigateif such failures stem from the change you sponsored, and if so,work with the Contributor to resolve the issue.
Development of the latest version of the JDK often results inbug fixes that might be interesting to include in some of the JDKUpdate releases still being maintained or in a feature releasestabilization branch. Moving a fix from a more recent release train(e.g. JDK 21) to an older release train (e.g. JDK 17) iscalledbackporting.
The guideline for what to backport into a specific release willvary over the lifetime of that release. Initially more fixes areexpected to be backported as new features and large changesintroduced in a mainline release stabilize. Over time the focuswill shift from stabilization to keeping it stable - the releasewill go into maintenance mode. This means that bug fixes thatrequire larger disruptive changes are more likely to be made inmainline and backported to more recent release trains only, and notto older release trains.
Over time it’s likely that the code base will divergebetween mainline and any given update release, and the cost ofbackporting will increase. The cost in this case is not only theeffort needed to perform the actual backport, but also the costinferred by bugs introduced by the backport. This should be takeninto consideration when deciding if a change should be backportedor not. For more details on how to reason around what to backport,this email from JDK 8 Updates Project lead Andrew Haley hassome guidelines for JDK 8u. The reasoning in this mail is specificto JDK 8u, but will in general apply to any JDK release inmaintenance mode.
Any change that originally required a CSR will require a new CSRto be backported unless the backport was covered by the initialCSR. Changes to Java SE specifications cannot be made in an updaterelease without a Java SE Maintenance Release. CSR-related issuesaffect interfaces and behavior and must be very carefullyscrutinized.
During ramp down of a feature release there are two branches ofthe mainline repository in play, the release stabilization branchfor the outgoing release, and themaster
branch wherethe next release is being developed. Any change going into therelease stabilization branch is likely to be desired inmaster
as well. When making a change intended for boththe stabilization branch andmaster
, you should alwayscreate your pull request targetingmaster
first, andthen, once the pull request is integrated, backport the resultingcommit to the release stabilization branch. For bug fixes that areonly applicable to the release stabilizationbranch, regular pull requests targeting the stabilization branchshould be created.
Please note that special rules applies during ramp downregarding what can and can’t be included into thestabilization branch. See theThe JDK Release Process for moreinformation.
Ideally fixes should not be backported until there has beenenough time for any regressions or follow-on issues to have beenidentified. Then, when looking to backport a fix the developershould look for bothblocked by andcauses links in order to understandthe complete set of fixes that should be backported.
When backporting a number of changes that are dependent on eachother, like a change with a tail of bug fixes, it can sometimesseem attractive to merge all those commits into a single change toavoid backporting a broken change. Please don’t. The generalrecommendation is to backport each commit individually. There areseveral reasons for this recommendation.
If, for instance, there are other changes between the originalone and the followup fix(es) there may be a dependency on otherchanges that are unrelated to the issue itself. By merging theoriginal change, the fix(es), and the unrelated changes to meet thedependency, a single very different change is created. It’sunlikely that this change will match the description in the singleJBS issue used for the merged backport. Backporting each commitindividually will preserve the git history and make it easy tofigure out what has actually been backported.
Testing each individual change is more likely to find issuesthan just testing the single merged change. It’s also easierand less error prone to use the/backport
command oneach commit instead of manually cherrypick and deal with the mergesetc.
And finally, if backporting each commit individually, the JBSrecords will clearly indicate that the followup changes have beenbackported as well. This is important as there is tooling thatverifies that everything is done in the right way. That toolingwill be confused if it can’t deduct from JBS what hashappened.
Terminology
Main issue - The top issue in a backport hierarchy. Eg.JDK-8272373 is amain issue, whileJDK-8277498 andJDK-8277499 arebackport issues of this main issue.
Example of backport hierarchy
In general there’s no need to create backport issues inJBS manually. All work that’s done in JBS in preparation fora backport (requesting approvals etc) is done in the main issue.The backport issue will be created automatically by the bots whenyou integrate the change to the source code repository.
There can be cases where it’s desirable to create abackport issue before the fix is done, e.g. if a CSR needs tobe filed. In these cases set theFixVersion/s of the backport toN
orN-pool
, whereN
is the release train thebackport is targeting. E.g.17-pool
. Please note thateven if a backport issue is created ahead of time, all work done inJBS for approvals and similar is still done in the main issue.
Obviously it’s possible to set theFix Version/s to the exact release the backportis targeting, but in general this isn’t recommended unlessyou are targeting a feature release in ramp down. When a change isintegrated to an update release repository, the bots will look atthe main issue as indicated in the PR title, and look for backportswith the currentN.0.x
release version asFix Version/s, if no such backport is found theywill look forN-pool
, and if that isn’t foundeither, a new backport issue will be created. This means that ifthe backport has an exactFixVersion/s set, but is delayed and misses the releaseindicated by thisFix Version/s, anew, superfluous backport issue is created with a small mess as theresult. (SeeHow to fix anincorrect backport creation in JBS.)
Setting theFix Version/s of abackport targeted to an update release toN
is alwayswrong. JDKN
has already been released (or itwouldn’t be an update release) and can’t get any morefixes.
In order to be allowed to integrate a change to one of theOpenJDK update development repositories (e.g. jdk17u-dev
),an approval is required. Theofficialprocess for how to request push approval for a backportdescribes in detail how to work with JBS when requesting approvals.In short, there’s a labeljdk<release>u-fix-request that should beadded to the main JBS issue. Also put a motivation as to why theissue needs to be backported as a comment in the main issue. Oncethe label and motivation has been added, wait for the maintainersof the release to approve your request. The approval will beindicated with a label,jdk<release>u-fix-yes, added to the mainissue.
If the update release is in ramp down, changes are integrated tothe release repository (e.g. jdk17u
).During ramp down the bar to get changes in is significantly higherand fixes need to be approved withjdk<release>u-critical-request /jdk<release>u-critical-yes.
If your request to backport a change is denied, but you for somereason already created the backport issue in JBS (why?!), thebackport issue should be closed asWon’t Fix.
The Skara tooling includes support for backports.The officialSkara documentation describes in detail how to work with thetooling to create backport PRs onGitHub or using the CLI tools. Asdescribed in the documentation, the/backport
command can be used on a commit or a PRto create the backport PR:
/backport jdk21u-dev/backport jdk jdk23/backport :jdk23
In the first example we backport the change to the JDK 21 updaterelease. To backport to other update releases, replacejdk21u
with the corresponding name for the targetupdate repository.
The second and third example above will backport the change to astabilization branch, in this case JDK 23. As beforejdk
is the name of the target repository, andjdk23
is the name of the stabilization branch.
Using the/backport
command is the recommended wayto perform backports as the tooling will automatically handle allthe necessary steps in the background. If a backport PR is manuallycreated, set the PR title toBackport <original commithash>
. This ensures that the bots will recognize it as abackport as opposed to a main fix specifically targeting an olderrelease. One can tell whether or not the bots recognized a PR as abackport by thebackport label beingadded if it’s recognized.
If an issue is targeted to a release and a fix referring to thatissue is integrated to a different release repository, then abackport issue is automatically created in JBS. Usually this is a“good thing”, e.g., when you are backporting a fix toan earlier release, but not always… If the main issue istargeted to a later release (due to schedule planning) but someonefinds the time to fix that issue in the current release, or if themain issue is targeted to a feature release in ramp down and thefix is integrated to the master branch, then the issue should beretargeted to the correct release before integrating the fix.However, sometimes we forget.
Here’s how to fix that:
In this example a fix was integrated to JDK N+1 (the mainlinemaster branch) while the JBS bug was targeted to JDK N (a featurerelease in ramp down). The same procedure can be used in theopposite situation, when a fix has been integrated to JDK N whenthe JBS bug was targeted to JDK N+1, by switching N and N+1 below.Remember, to keep the record clean for the future, what matters themost is that thebug id used in the commit comment is themain bug, and thatthe“backports” (regardless of if they are toearlier or later releases)are Backport type issues of thatmain issue. Also make sure there are never more than oneBackport issue of the same main issue targeted to any givenrelease.
Reopen thebackport issue that was createdautomatically
This change was integrated while the main issue was targeted to 'N'. The main issue has been reset to fixed in 'N+1', this backport issue has been reset to fix in 'na' and closed as Not An Issue to avoid confusion.
Even if you intend to backport the issue from ‘N+1’to ‘N’ you shouldn’t reuse this backport issue.The existing (bad) push notification comment and the later to beadded correct push notification comment will look very similar andit’s just a disaster waiting to happen to deliberately addthese to the same issue.
Clean up themain issue
Changeset: 12345678Author: Duke <duke@openjdk.org>Date: 2020-10-23 15:37:46 +0000URL: https://git.openjdk.org/jdk/commit/12345678
This change was integrated to 'N+1' while this main issue was targeted to 'N'. This issue has been reset to fixed in 'N+1' and the Robo Duke entry was copied here.
Release notes for a product such as the JDK are part of therelease deliverables providing a way to highlight information abouta fix, such as when it may have changed behavior, or whenit’s decided not to fix something. While what should go intoa release note isn’t something that can be precisely defined,it should describe changes that are important for a user to takeinto account when they are upgrading to the specific version. Whilerelease notes should not duplicate information in other documents,they can serve to highlight that a change has been made.
Release notes are associated with a JBS issue that has beenfixed (or in some cases not been fixed) in a release and aregenerated with each build of a release. Any note should beconsidered as an integral part of the fix process, rather thanwaiting until the end of the release to determine what to write. InOpenJDK, release notes are currently being generated for the JDKand JDK Updates Projects.
Writing the release note is the responsibility of the engineerwho owns the issue. The note should be generated before the fix isreviewed, or in the case of known issues, when it’sdetermined that a fix won’t be possible in the release theissue was found in.
When writing a release note, be prepared for rather picky reviewcomments about grammar, typos, and wording. This is for the sake ofthe Java community as a whole, as the language of the release notesets the tone for many blogs and news articles. For a widely usedproduct like the JDK, the release notes are often copied verbatim(including typos) and published to highlight news in the release.This means that we need to take extra care to make sure the text inthe release note is correct and follows a similar style.
The release note itself is written in aJBS sub-task of the issue that is usedto integrate the change. There are a few steps to follow for therelease note to find its way from JBS to the actual release notedocument.
Create a sub-task (More → Create Sub-Task) for the issuethat requires a release note - the main issue, that is, the JBSissue that is used to integrate the original change,not for backports or the CSR (if there isone).
For the newly created sub-task, follow these steps:
Have the release note ready to be reviewed at the same time asthe code is reviewed. If it’s later determined that a releasenote is necessary, then go back to the same engineers who reviewedthe fix to review the release note. Special care should be takenwhen writing a release note that will cover changes related to avulnerability fix in order to avoid describing technical details ofhow it could have been exploited.
When you are done,Resolve the release note sub-task asDelivered
. Only release notes where the sub-task hasbeen resolved asDelivered
is considered to be part ofthe EA/GA release notes. To avoid mixing up the release notes withthe code fixes that have gone into a particular release or build,we don’t useResolved/Fixed
.
If you see an issue you feel should have a release note but youare not the assignee of the bug, then add the labelrelease-note=yes to the main bug (not on abackport nor a sub-task). This acts as a flag to make sure that therelease note is considered. This can be done even with fixes thathave been shipped already if it’s noticed that there isconfusion around the change. If, after discussion, it’sdecided that a release note isn’t required either remove thelabel, or change it torelease-note=no if it makes sense to have aclear indication that a release note isn’t required for thefix. The labelrelease-note=yes canbe removed once the release note sub-task has been created.
For examples of well written release note issues in JBS, seeJDK-8276929 orJDK-8278458.
The following are general practices that should be followed whencreating release notes.
Release notes should be no longer than 2-3 paragraphs.
Don’t repeat information that will be included in updatesto the docs, keep it to a high level summary or key changes.
Note that where the changes are more fully documented in the JDKdocumentation, then refer to that document for details. Whencovering a change in behavior provide some idea to what can be doneif a developer or user encounters problems from the change.
Don’t include graphics etc. Refer to the main docs ifthere are more details that need explaining.
Don’t include your name or affiliation, make sure however,you are the assignee of the release note sub-task.
If you have a < in theSummarythen use<
. For <’s in theDescription surround them byback-ticks.
Avoid using Latin and abbreviations in the release note.
TheSummary should be in titlecase instead of sentence case.
TheDescription should bestandardized to follow this pattern:
jdk.disableLastUsageTracking
, has been introduced todisable JRE last usage tracking for a running VM.Unless labeled otherwise it will be assumed that the releasenote documents a change in behavior (will have likely required aCSR) or other item which should be included in the release notes.If the note covers a more specific type of change, then one of thefollowing labels can be included (notes of a similar type will belisted together).
The Release Notes for a particular release can be found usingthe JBS query
affectedversion = <version> and type = sub-task and labels = release-note
where<version>
is the appropriate releasevalue, e.g. 17.
Quick Links
The JDK Project has a well defined release process.JEP 3 describes this process indetail. This section intends to clarify some topics that oftencause questions.
The release cycle starts when development of a new releasebegins, and ends when that release is delivered to the public. Thecurrent release cadence is six months. This means that every sixmonths we start development of a new release, and every six monthsa new release is delivered. However, this doesn’t mean thateach release cycle is six months. As described below, the totaldevelopment time for a release (the release cycle) is actually ninemonths. Obviously this in turn doesn’t mean that all featuresare developed in nine months. Most features are developed for amuch longer time than that, and goes through long time developmentin other Project repositories, and through a series of preview andexperimental stages. But any feature that is to be included in aspecific release has a specific window of nine months to integratethe code into mainline and fix all the remaining bugs.
It may be tempting to integrate a new feature near the end of arelease cycle, to get more time to fix all those last bugs beforeintegration. Please don’t. If you are getting close to theend of a release and you still just have one more bug to fix,please defer your feature to the next release. It’s only sixmonths out. Not only will this vouch for your new feature to bemore stable on release, you will also help keeping the JDK as awhole more stable by allowing others to find and fix bugs in theirnew code that might come as a result of your changes.
Integrating early in a release is preferable, but all newfeatures can’t be integrated at the same time. If many largechanges enters the repository at the same time it will be moredifficult to determine which change that caused all the new bugs.If you’re about to integrate a larger change you musttherefore communicate this on the relevantmailing lists to synchronize with otherProjects that may also be planning to integrate something soon.
Throughout the release there are a number of milestones andphases that define where in the release cycle we are.
JEP 3 contains theexact definitions for what can be done when. This is avisualization of those definitions that may or may not clarifythings.
Push and defer guidelines during ramp down
Even though there’s nothing explicitly written in theprocess about deferring P1 and P2 bugs during the initialdevelopment phase, the assumption is that these aren’tdeferred unless time runs out at the end of the release cycle.
Please note that the priority of a bug doesn’t change justbecause you want to get your fix in late in the release, or if youwant to be able to defer it. The priority is based on the severityof the bug and if it was deemed to be a P2 before, you better havea really good explanation to why that conveniently has changed bythe end of the release. Being hard to fix isnot areason to lower the priority of a bug.
ManyOpenJDKProjects build on top of the JDK source code for instance toproduce new language features, like ProjectsAmber andValhalla. When doingthis there are a number of common workflows that are dealt with bymost Project maintainers. For instance, updating the codebase(merging) to bring in the latest changes from the upstream JDKProject.
Merging changes from one git repository to another is basicallythe same thing as getting your own changes merged into the Projectrepository, with the slight twist that you don’t write allthe changes yourself, you just pull them from somewhere else.
In this example we’ll use a separate clone of the Projectrepository to perform the merge in. This can be done using branchesas well, but let’s keep it simple for now.
First set up your personal fork of the Project repository, inthis example calledmy-project
. If you already are aContributor totheProject youmost likely have this set up. If not, seeCloning the JDK for details on how to dothat.
git clone git@github.com:OpenDuke/my-project.git project-mergecd project-mergegit remote add upstream git@github.com:openjdk/my-project.gitgit remote add mainline git@github.com:openjdk/jdk.git
We clone the personal fork (in this case we cloneOpenDuke’s personal fork) into a local directory, here calledproject-merge
. We then set up two remotes,upstream
andmainline
.
The clone we set up above is used each time you want to bringchanges from mainline in to yourProject. This is done byfirst pulling the changes from mainline and then pushing to yourpersonal fork. A regular PR will then be created which you canintegrate into your main Project repository. It sounds easy, and itis, but there are a few details below to keep in mind.
cd project-mergegit pull upstream mastergit pushgit switch -c Merge_mainlinegit fetch mainline
We start by updating the local fork with the latest changes fromthe main Project repository. Note that we then create a new branch“Merge_mainline
” in which the merge willhappen. Finally we fetch all new changes from mainline.
Merging from what ever is latest isn’t usually a goodidea, mainline code is not “clean” for any givencommit. Merging JDK tags ensures you have a known quality, thosetagged commits are known to compile and pass tests. Therefore, nextwe check which tags have not been merged yet.
git tag -l "jdk-*" --no-merged
Or if you just want to see the latest tag you haven’tmerged,
git tag -l "jdk-*" --no-merged | tail --lines 1
Before merging, you may want to check what’s incoming, toget an idea of the size of the merge and look for any incomingchanges that you suspect may cause issues.
git log --topo-order --pretty=oneline --reverse ..$TAG
And finally we initiate the actual merge.
git merge $TAG
The commands above will likely run without a hitch up until thefinalgit merge
. This is where you need to combine thechanges that were made in mainline with the changes that have beenmade in your Project repository. If there are no conflictsyou’re in luck, then the merge will be completely automatedand you will end up with a committed merge. If there are conflictshowever you’ll need to manually go through the files wherethe conflicts are and make sure you select the correct version foreach change. Usinggit status
you can see what filesthat need to be merged. Depending on how much code yourProject has touched, thiscan be quite a bit of work.
For complicated merges, seeSharingthe work below.
Regardless of if you encountered conflicts or not, you shouldalways build and test your merge before integrating it to yourProject repository. Testing needs to be done even when there are notextual conflicts as changes like for instance a rename can resultin a compile or test error without any conflict. One could arguethatgit merge --no-commit
could be used and havelogical errors fixed in the merge commit. However, a subsequent“Fix logical merge errors” commit, is in fact moreuseful, as it clearly shows the Project specific adjustments neededfor incoming changes.
It’s always okay to have further commits to clean up aftera merge. Hiding a large amount of reworking Project code to fitwith upstream changes in a single merge commit will make it hardfor further errors post integration to be identified.
Once you have a working version of your merged code you’reready to create the merge commit and push. Please note thatgit commit
is only needed if there were conflicts. Ifthe changes were successfully merged bygit merge
, youalready have a committed merge.
git commit -m "Merge"git push --set-upstream origin Merge_mainline
Now it’s time to create the PR onGitHub. Just opening the PR page in yourbrowser will most often be enough to see a message about new codethat was pushed to your personal fork. Click the button to createthe PR.
Make sure the PR title starts with “Merge”. You mayhave noticed that when you integrate a “normal” PR intoan OpenJDK repository, all commits that have been done in that PRwill be squashed into a single commit. For normal changes this is agood thing as each PR normally corresponds to a single JBS issue,but for a merge it would be highly undesirable to squash all thedifferent commits that you pull in from mainline. A PR with a titlethat starts with “Merge” won’t be squashed. Thatmeans that all the changes that you brought over will remainseparate changes.
It’s always a good idea to also include what was merged inthe title of the PR. If you for instance is pulling in JDK mainlineinto your Project repository it’s likely (because it’sin general a good idea) that you choose some stable EA tag inmainline to merge. Your PR title could then be something like“Merge jdk-21+2”.
Whether a merge requires a review or not is up to your Projectlead to decide. ManyProjects don’trequire this so the GitHub bots will allow you to integrate themerge as soon as theGHAs are done.(They actually allow you to integrate even before the GHAs aredone, but that’s in general not a good idea.)
Once the PR has been integrated, you can clean up your fork andits clone in preparation for the next merge.
git switch mastergit branch -d Merge_mainlinegit push -d origin Merge_mainline
These commands will remove the temporary branch that we createdto perform the merge. There’s a button in the GitHub GUI todelete the branch after you have integrated the PR. This can beused instead of the last of the three commands above (gitpush -d...
).
When conflicts take place in areas requiring specializedknowledge you may need help from otherContributors. Backingup the original conflicts will help if you find yourself “intoo deep”, and need assistance from otherContributors. You canadd and later remove these backups, along with a readme describingthe merge status, to the actual merge branch to aid communication(i.e. you may not be able to compile certain components).
Something like the following shell one-liner can be used toperform the backup.
git status | grep "both modified:" | while read B M FILE; do cp -v $FILE $DEST ; done
Below are two different methods of collaborating on a mergedescribed. Please note that extra commits are fine. The merge PRitself will describe any special actions that were taken in casefurther failures turn up after merge integration. Ultimately thesecommits will be squashed when integrating the project back intomainline.
“Park” the conflicts, unresolved, in a personalfork, and let others do the further work (by sending you a patch,or opening your personal fork up to push from otherContributors). Do thisby keeping a list of unresolved conflicts (perhaps checking in saidlist to describe the merge state), and then marking them asresolved in git, committing, and pushing them to your personalfork. E.g.git add $UNRESOLVED_FILES; git commit; gitpush
Pros: All unresolved conflicts are stated andcan be worked on by multiple parties, all at once.
Cons: Broken branch in terms of compile andtest, may require temporary workaround patches to be passed aroundto complete work on specific unresolved components.
An alternative to parking a merge with conflicts in place, is toincrementally merge up to the troublesome point. For example:
git merge $TAG
git merge --abort
git log --topo-order--pretty=oneline --reverse $(current_branch)..$TAG
Pros: All commits in the merge branch compileand test, you always have a working branch.
Cons: There is an unknown extra amount of mergework, multiple iterations create more work. For instance you mayfind yourself resolving the same files multiple times(e.g. back-out commits).
SeeWorking With PullRequests for generic guidance and requirements aroundintegrating changes. For the HotSpot codebase there are a fewadditional requirements:
test/hotspot/jtreg/TEST.groups
.)Quick Links
While developing your fix, you might want your code to outputsome diagnostic information. You might even want to leave somelogging in the code you check in, to facilitate future diagnostics.The appropriate way to print logging output from HotSpot is throughtheUnified LoggingFramework (JEP 158). It gives you a lot of nice features andenables common command-line options for all logging.
A basic log message can be output like this:
(gc, marking)("Mark Stack Usage: " SIZE_FORMAT"M", _mark_stack_usage/ M); log_info
Where ‘gc’ and ‘marking’ are tags, and‘info’ is the log level. Tags associate log messageswith certain subsystems or features and the log level determinesthe importance and verbosity of the message. The most verboseoutput is trace, and the least is error. The full list of tags andlevels are available via-Xlog:help
.
The basic log API looks as follows:
log_<level>(Tag1[,...])(fmtstr,...)
Sometimes single line printf-style logging isn’t enough.For example, it can be useful to group several log lines togetheror to use HotSpot’s outputstream API. UL supports both ofthese use cases usingLogMessage
andLogStream
, respectively.
(gc, marking) lm; LogMessageif(lm.is_info()){.info("We are guaranteed to be"); lm.info(" grouped together"); lm}
LogMessage
will submit its output when it goes outof scope.
LogStream
is typically used when a singleprintf-style format string becomes unwieldy.
(Log(gc, marking)::info()); LogStream stif(st.is_enabled()){// Print without newline.print("I'm printing a lot of%s ","arguments"); st.print("With a lot of extra info%d ",3); st// Print with newline (cr stands for carriage return).print_cr("and so it's useful to use a stream"); st}
If you need to print multiple lines grouped together withcomplex formatting requirements thenNonInterleavingLogStream
is probably what youwant.
(gc) lm; LogMessage{LogLevelType::Info, lm}; NonInterleavingLogStream stif(st.is_enabled()){.print_cr("Line one:%d%d%d ",1,2,3); st.print("Line two:%d%d%d",4,5,6); st.print_cr(" still line two:%d%d%d",7,8,9); st}
You enable logging in the JVM by using the-Xlog
command line option specified. For example, the messages from theexamples would be visible if the JVM were run with any of thefollowing options:
-Xlog:gc+marking=info-Xlog:gc+marking-Xlog:gc*
You can have multiple-Xlog
options, these areapplied in an additive manner. Consider this example:
-Xlog:gc+marking=info:stdout -Xlog:alloc=warning:stderr -Xlog:breakpoint=error:breakpoint.txt:level
This specifies that:
UL automatically applies a default argument of-Xlog:all=warning:stdout:uptime,level,tags
whenlogging is enabled. This can be disabled by prepending-Xlog:disable
to your arguments.
-Xlog:disable -Xlog:gc+marking=info -Xlog:alloc=warning
Starting the JVM with the option-Xlog:help
outputsmore information and more examples.
A full description of the syntax of-Xlog
isavailable inJEP158.
This list is intended to make it easier to identify which emaillist to include in code reviews when making changes in differentareas. The list may also help when assigning bugs based on whichcode they are found in. Please note that some directories may havebeen created or removed between releases. The intention here is toinclude directories that exists in mainline, LTS releases and otherreleases (post JDK 9) commonly being updated.
jdk-dev
build-dev
client-libs-dev
core-libs-dev
hotspot-dev
hotspot-compiler-dev
hotspot-gc-dev
hotspot-runtime-dev
hotspot-jfr-dev
serviceability-dev
compiler-dev
security-dev
javadoc-dev
kulla-dev
nashorn-dev
src
. The owners are the same fordirectories with the same names.jdk.aot
– Compiler (Removed in17)jdk.crypto.ucrypto
– Security (Removed in12)jdk.incubator.concurrent
– Core Libs(Removed in21)jdk.internal.vm.compiler
– Compiler (Removedin22)jdk.internal.vm.compiler.management
–Compiler (Removed in22)jdk.pack
– Tools (Removed in14)jdk.random
– Core Libs (Removed in23)jdk.rmic
– Core Libs (Removed in15)jdk.scripting.nashorn
– Tools (Removed in15)jdk.scripting.nashorn.shell
– Tools (Removedin15)This guide is being maintained through theOpenJDK Developers’ GuideProject. The source repository is available atGitHub. The revision hash atthe bottom of this page refers to the last published commit.
Comments and questions may be sent toguide-dev@openjdk.org. Pleaselet us know if there’s anything in the guide that isn’tclear.