From 1e46eb4d92433a2cb863f0a12137c183a1450f58 Mon Sep 17 00:00:00 2001 From: Alex Bishop Date: Thu, 25 Jul 2024 15:52:19 +0100 Subject: [PATCH 1/5] Java style guide: IntelliJ Full Line code completion can be used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unlike JetBrains AI, IntelliJ IDEA’s Full Line code completion (which uses machine learning) can be used because it works entirely on device. This was discussed at the July 2024 Java community meeting. --- source/manuals/programming-languages/java.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/manuals/programming-languages/java.html.md.erb b/source/manuals/programming-languages/java.html.md.erb index 9fdecb31..4faba77b 100644 --- a/source/manuals/programming-languages/java.html.md.erb +++ b/source/manuals/programming-languages/java.html.md.erb @@ -15,7 +15,7 @@ The more far-reaching _[Java for Small Teams](https://ncrcoe.gitbooks.io/java-fo While the above resources are good guides, they may conflict with either each other or your team’s established practices. We favour consistency across our code, so make sure that you have the agreement of your team when considering using a new or different method or paradigm to those currently in use. -We generally use [IntelliJ IDEA](https://www.jetbrains.com/idea/) within GDS. Using it consistently helps when ensemble programming (pairing and mobbing). GDS have purchased licences for the commercial editions of IntelliJ IDEA for some teams. Some features of IntelliJ IDEA like [Code With Me](https://www.jetbrains.com/code-with-me/) and [JetBrains AI](https://www.jetbrains.com/ai/) have not passed an information assurance review and must not be used. +We generally use [IntelliJ IDEA](https://www.jetbrains.com/idea/) within GDS. Using it consistently helps when ensemble programming (pairing and mobbing). GDS have purchased licences for the commercial editions of IntelliJ IDEA for some teams. Some features of IntelliJ IDEA like [Code With Me](https://www.jetbrains.com/code-with-me/) and [JetBrains AI](https://www.jetbrains.com/ai/) have not passed an information assurance review and must not be used ([Full Line code completion](https://www.jetbrains.com/help/idea/full-line-code-completion.html) can be used because it runs entirely on your device). ## Code formatting From b8a5a48662db7161794c842f2f35a0c55ec6432b Mon Sep 17 00:00:00 2001 From: Alex Bishop Date: Fri, 26 Jul 2024 11:41:04 +0100 Subject: [PATCH 2/5] =?UTF-8?q?Java=20style=20guide:=20better=20guidance?= =?UTF-8?q?=20for=20IntelliJ=20=E2=80=98Optimize=20Imports=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document the keyboard shortcut for IntelliJ IDEA’s ‘Optimize Imports’ command and note it’s in the Code menu. Provide better guidance on where one can select all modified Java classes in IntelliJ IDEA and optimise the imports for just those. Exactly where this can be done varies depending on whether or not the non-modal commit interface is used and also differs slightly depending on whether or not the new UI is used. Point out the changes view in the commit tool window (non-modal) and the modified files pane of the commit dialogue (modal), with links to the IntelliJ IDEA docs. This was discussed at the July 2024 Java community meeting. --- source/manuals/programming-languages/java.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/manuals/programming-languages/java.html.md.erb b/source/manuals/programming-languages/java.html.md.erb index 4faba77b..f8eff127 100644 --- a/source/manuals/programming-languages/java.html.md.erb +++ b/source/manuals/programming-languages/java.html.md.erb @@ -69,7 +69,7 @@ assertThat(actual, is(expected)); Similarly, `Math.max(…)`, `Math.PI` and `ChronoUnit.DAYS` could be statically imported because their names make sense on their own. However, `LocalDate.of(…)` should not be statically imported because the type it comes from is crucial for comprehension. -The IntelliJ ‘Optimize Imports’ command sorts imports and removes any that are unused. Before committing some changes, you can select all the classes in the modified files pane and then use this command to fix the imports for just the classes you modified. +The IntelliJ ‘Optimize Imports’ (Ctrl+Option+O) command (in the Code menu) sorts imports and removes any that are unused. Before committing, you can select all the changed classes (for example, in the [changes view](https://www.jetbrains.com/help/idea/managing-changelists.html) of the commit [tool window](https://www.jetbrains.com/help/idea/tool-windows.html) or the modified files pane of the [commit dialogue](https://www.jetbrains.com/help/idea/commit-changes-dialog.html)) and then use this command to fix the imports for just the classes you modified. ## Optionals From 18bb7f927d78e12f14793e9e0c3c8af767c0f844 Mon Sep 17 00:00:00 2001 From: Alex Bishop Date: Fri, 26 Jul 2024 11:52:32 +0100 Subject: [PATCH 3/5] Java style guide: link to Eclipse Temurin website This was discussed at the July 2024 Java community meeting. --- source/manuals/programming-languages/java.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/manuals/programming-languages/java.html.md.erb b/source/manuals/programming-languages/java.html.md.erb index f8eff127..ed9a2ea0 100644 --- a/source/manuals/programming-languages/java.html.md.erb +++ b/source/manuals/programming-languages/java.html.md.erb @@ -233,7 +233,7 @@ In general, upgrading between recent Java versions is a lot easier than it was a Recent versions of the [Oracle JDK can be used free of charge](https://www.oracle.com/downloads/licenses/no-fee-license.html) for commercial and production purposes under the terms of a bespoke licence. OpenJDK is open source under the [GPLv2 with the Classpath Exception](https://openjdk.org/legal/gplv2+ce.html) but Oracle only provide general-availability [OpenJDK builds](https://jdk.java.net/) for the latest release. -The [Adoptium](https://adoptium.net/) (formerly AdoptOpenJDK) project (part of the [Eclipse Foundation](https://www.eclipse.org/)) provides fully open-source TCK-certified pre-built OpenJDK binaries under the name Eclipse Temurin. For LTS releases (such as Java 8, 11, 17 and 21), Adoptium have committed to releasing free updates for several years. +The [Adoptium](https://adoptium.net/) (formerly AdoptOpenJDK) project (part of the [Eclipse Foundation](https://www.eclipse.org/)) provides fully open-source TCK-certified pre-built OpenJDK binaries under the name [Eclipse Temurin](https://projects.eclipse.org/projects/adoptium.temurin). For LTS releases (such as Java 8, 11, 17 and 21), Adoptium have committed to releasing free updates for several years. In addition, Temurin has benefits such as being available in package repositories, having friendly installers for desktop use, and offering ready-made [Docker images containing OpenJDK](https://hub.docker.com/_/eclipse-temurin). It’s easy to [install Temurin on your computer](https://adoptium.net/en-GB/installation/) for development purposes using [Homebrew](https://brew.sh/) or similar. From e8def04765cc9ba7c9d853419c1ed64072fbaa35 Mon Sep 17 00:00:00 2001 From: Alex Bishop Date: Fri, 26 Jul 2024 11:56:19 +0100 Subject: [PATCH 4/5] Java style guide: link to better page for claiming Maven group IDs This was discussed at the July 2024 Java community meeting. --- source/manuals/programming-languages/java.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/manuals/programming-languages/java.html.md.erb b/source/manuals/programming-languages/java.html.md.erb index ed9a2ea0..8823713a 100644 --- a/source/manuals/programming-languages/java.html.md.erb +++ b/source/manuals/programming-languages/java.html.md.erb @@ -251,7 +251,7 @@ You will need to claim one or more [group IDs](https://maven.apache.org/guides/m The credentials used to create this account will be used during the publishing process, and should be stored safely and in accordance with any programme-specific guidance. -You should follow [Sonatype’s guidance on registering for and claiming a group ID](https://central.sonatype.org/publish/publish-guide/) such as `uk.gov.example`. It is likely that you will be asked to prove your identity as a government actor, to prevent malicious parties publishing artifacts and claiming that they have been issued by the UK government. +You should follow [Sonatype’s guidance on registering for and claiming a group ID](https://central.sonatype.org/publish/requirements/coordinates/) such as `uk.gov.example`. It is likely that you will be asked to prove your identity as a government actor, to prevent malicious parties publishing artifacts and claiming that they have been issued by the UK government. ### Signing artifacts From 702b3ea25b56dafcad6271f1c60933eb974839e3 Mon Sep 17 00:00:00 2001 From: Alex Bishop Date: Fri, 26 Jul 2024 11:58:14 +0100 Subject: [PATCH 5/5] Update last reviewed date for Java style guide to 2024-07-23 The Java community meeting reviewed the Java style guide on 23 July 2024. --- source/manuals/programming-languages/java.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/manuals/programming-languages/java.html.md.erb b/source/manuals/programming-languages/java.html.md.erb index 8823713a..c3e52ec5 100644 --- a/source/manuals/programming-languages/java.html.md.erb +++ b/source/manuals/programming-languages/java.html.md.erb @@ -1,6 +1,6 @@ --- title: Java style guide -last_reviewed_on: 2024-01-19 +last_reviewed_on: 2024-07-23 review_in: 6 months owner_slack: '#java' ---