{"id":229511,"date":"2022-10-21T00:22:48","date_gmt":"2022-10-21T07:22:48","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/java\/?p=229511"},"modified":"2022-10-21T00:22:48","modified_gmt":"2022-10-21T07:22:48","slug":"java-on-visual-studio-code-update-october-2022","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/java\/java-on-visual-studio-code-update-october-2022\/","title":{"rendered":"Java on Visual Studio Code Update \u2013 October 2022"},"content":{"rendered":"<p>Hi everyone, welcome to the October update of Visual Studio Code Java. We have brought a lot of improvements in code editing and debugging experience this time, so let&#8217;s get started!<\/p>\n<h4><strong>Debugging Experience Enhancements<\/strong><\/h4>\n<p><strong>Visual indicator for inline breakpoints<\/strong><\/p>\n<p>Consider a line like this:<\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\">Stream.of(&#8220;Frank&#8221;).map(name -&gt; name.toUpperCase()).forEach((item -&gt; System.out.println(item));<\/span><\/p>\n<p>Now when you set a breakpoint on this line, Visual Studio Code will automatically identify the lambda expressions in this line, and visualize them with grey dots. If you want to further set inline breakpoints on those lambda expressions, you can directly click on those grey dots, and the grey dots will turn into red dots like normal breakpoints, then the debugger will stop at these breakpoints during the code execution. This will provide you much easier debugging experience for these lambda expressions. Here&#8217;s a quick demo.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/inlinebreakpoint.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-229518\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/inlinebreakpoint.gif\" alt=\"Inline breakpoint visual indicator\" width=\"1936\" height=\"1202\" \/><\/a><\/p>\n<p><strong>Support Java virtual threads<\/strong><\/p>\n<p>Java 19 brings the first preview of virtual threads to the Java platform; This is the primary deliverable of Project Loom. Virtual threads are designed to significantly boost the scalability of concurrent Java programming while making little change to the current API. In our September release, we have <a href=\"https:\/\/github.com\/microsoft\/vscode-java-debug\/issues\/1159\">enabled the support<\/a> for virtual threads in our Java debugger. Note that you will need to install JDK 19 to use this feature. Here&#8217;s a screenshot of our debugger in action.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/virtualthread.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-229522\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/virtualthread.png\" alt=\"Virtual thread debugger\" width=\"1503\" height=\"1075\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/virtualthread.png 1503w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/virtualthread-300x215.png 300w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/virtualthread-1024x732.png 1024w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/virtualthread-768x549.png 768w\" sizes=\"(max-width: 1503px) 100vw, 1503px\" \/><\/a><\/p>\n<p>For more details about virtual threads, you can read the <a href=\"https:\/\/blogs.oracle.com\/javamagazine\/post\/java-loom-virtual-threads-platform-threads\">official blog post here<\/a>.<\/p>\n<h4><strong>Code Editing Improvements<\/strong><\/h4>\n<p><strong>Code action: Lombok &amp; Delombok<\/strong><\/p>\n<p>Since we introduced the support for Lombok in July, we have been getting lots of feature requests! One of the popular asks is to provide convenient Lombok operations when user clicks on the Code Action lightbulb (Quick Fix), and we have added this feature into our latest version. The annotations we currently support are:<\/p>\n<ul>\n<li>@Data<\/li>\n<li>@NoArgsConstructor<\/li>\n<li>@AllArgsConstructor<\/li>\n<li>@Getter<\/li>\n<li>@Setter<\/li>\n<li>@ToString<\/li>\n<li>@EqualsAndHashCode<\/li>\n<\/ul>\n<p>Not only you can use this shortcut to &#8220;Lombok&#8221; your code, you can also &#8220;DeLombok&#8221; the annotations you don&#8217;t want anymore by unpicking some of them. Here&#8217;s a demo.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/lombok.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-229520\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/lombok.gif\" alt=\"Lombok and DeLombok code action\" width=\"1920\" height=\"1080\" \/><\/a><\/p>\n<p>In addition, we want to mention again that our extensions now have built-in support for Lombok and this is also mentioned\u00a0on Project Lombok&#8217;s <a href=\"https:\/\/projectlombok.org\/setup\/vscode\">official homepage<\/a>!<\/p>\n<p><strong>Support @Nullable and @Nonnull annotations<\/strong>\u200b<\/p>\n<p>Lastly, we have <a href=\"https:\/\/github.com\/eclipse\/eclipse.jdt.ls\/pull\/2228\">enhanced our code analysis<\/a> to support @Nullable and @Nonnull annotations. @Nullable and @Nonnull annotation let the developer and compiler know if it is fine to allow null for a variable, parameter or return value.<\/p>\n<p>If we detect certain contracts are being violated, we will show the warnings in the problems section and also highlight the them in the editor area for you. Here&#8217;s a quick demo of this feature in action.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis.gif\"><img decoding=\"async\" class=\"alignnone size-full wp-image-229530\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis.gif\" alt=\"Null Analysis\" width=\"1920\" height=\"1080\" \/><\/a><\/p>\n<p>Currently, we support the @NonNull and @Nullable annotations from the following packages<\/p>\n<ul>\n<li>javax.annotation.*<\/li>\n<li>org.eclipse.jdt.annotation.*<\/li>\n<li>org.springframework.lang.*<\/li>\n<\/ul>\n<p>If you wish to include or exclude certain annotations from the code analysis, you can configure them in the settings.json under &#8220;<strong>java.compile.compileAnalysis.nonnull<\/strong>&#8221; and &#8220;<strong>java.compile.compileAnalysis.nullable<\/strong>&#8220;. Here&#8217;s a screenshot.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-229528\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis.png\" alt=\"Null analysis configuration\" width=\"1920\" height=\"1080\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis.png 1920w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis-300x169.png 300w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis-1024x576.png 1024w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis-768x432.png 768w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/nullanalysis-1536x864.png 1536w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4><strong>Install Extension Pack for Java<\/strong><\/h4>\n<p>To use all features mentioned above, please download and install <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-java-pack\">Extension Pack for Java<\/a> on Visual Studio Code.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/09\/javapack.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-229421\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/09\/javapack.png\" alt=\"Extension pack for Java\" width=\"1215\" height=\"238\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/09\/javapack.png 1215w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/09\/javapack-300x59.png 300w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/09\/javapack-1024x201.png 1024w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/09\/javapack-768x150.png 768w\" sizes=\"(max-width: 1215px) 100vw, 1215px\" \/><\/a><\/p>\n<p>If you are a Spring developer working on a Spring Boot application, you can also download the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=Pivotal.vscode-boot-dev-pack\">Spring Boot Extension Pack<\/a> for specialized Spring experience.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/spring.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-229533\" src=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/spring.png\" alt=\"Spring boot extension pack\" width=\"1221\" height=\"224\" srcset=\"https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/spring.png 1221w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/spring-300x55.png 300w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/spring-1024x188.png 1024w, https:\/\/devblogs.microsoft.com\/java\/wp-content\/uploads\/sites\/51\/2022\/10\/spring-768x141.png 768w\" sizes=\"(max-width: 1221px) 100vw, 1221px\" \/><\/a><\/p>\n<p><span style=\"font-size: 18pt;\"><strong><span class=\"x-hidden-focus\">Feedback and suggestions<\/span><\/strong><\/span><\/p>\n<p>As always, your feedback and suggestions are very important to us and will help shape our product in future. There are several ways to give us feedback<\/p>\n<ul>\n<li>Leave your comment on this blog post<\/li>\n<li><a href=\"https:\/\/github.com\/microsoft\/vscode-java-pack\/issues\/new\/choose\" target=\"_blank\" rel=\"noopener\">Open an issue<\/a>\u00a0on our GitHub Issues page<\/li>\n<li>Send an email to: vscjfeedback@microsoft.com<\/li>\n<\/ul>\n<h2 id=\"try-it-out\" class=\"x-hidden-focus\"><span style=\"font-size: 18pt;\"><strong><span class=\"x-hidden-focus\">Resources<\/span><\/strong><\/span><\/h2>\n<p>Here is a list of links that are helpful to learn Java on Visual Studio Code.<\/p>\n<ul>\n<li class=\"x-hidden-focus\">Learn more about\u00a0<a class=\"x-hidden-focus\" href=\"https:\/\/code.visualstudio.com\/docs\/languages\/java\" target=\"_blank\" rel=\"noopener noreferrer\">Java on Visual Studio Code<\/a>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Hi everyone, welcome to the October update of Visual Studio Code Java. We have brought a lot of improvements in code editing and debugging experience this time, so let&#8217;s get started! Debugging Experience Enhancements Visual indicator for inline breakpoints Consider a line like this: Stream.of(&#8220;Frank&#8221;).map(name -&gt; name.toUpperCase()).forEach((item -&gt; System.out.println(item)); Now when you set a breakpoint [&hellip;]<\/p>\n","protected":false},"author":31999,"featured_media":229538,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,22,1,8,15],"tags":[],"class_list":["post-229511","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-desktop","category-java","category-open-source","category-vscode"],"acf":[],"blog_post_summary":"<p>Hi everyone, welcome to the October update of Visual Studio Code Java. We have brought a lot of improvements in code editing and debugging experience this time, so let&#8217;s get started! Debugging Experience Enhancements Visual indicator for inline breakpoints Consider a line like this: Stream.of(&#8220;Frank&#8221;).map(name -&gt; name.toUpperCase()).forEach((item -&gt; System.out.println(item)); Now when you set a breakpoint [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/229511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/users\/31999"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/comments?post=229511"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/229511\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media\/229538"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media?parent=229511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/categories?post=229511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/tags?post=229511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}