{"id":9736,"date":"2020-06-06T19:27:30","date_gmt":"2020-06-06T17:27:30","guid":{"rendered":"https:\/\/www.salvis.com\/blog\/?p=9736"},"modified":"2023-11-08T21:06:34","modified_gmt":"2023-11-08T20:06:34","slug":"bye-bye-xtend-welcome-java","status":"publish","type":"post","link":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/","title":{"rendered":"Bye bye Xtend, Welcome Java"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>The utPLSQL extension for SQL Developer was originally written in <a href=\"https:\/\/www.eclipse.org\/xtend\/\">Xtend<\/a>. In this blog post I explain why we decided to migrate the project to Java and how we&#8217;ve done that.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Replace Xtend?<\/h2>\n\n\n\n<p>Xtend is a statically typed, clean language with excellent string templating features and a fine integration into the Eclipse IDE. From a technical point of view it is an excellent choice for code generation projects, especially if you are a happy user of the Eclipse IDE.<\/p>\n\n\n\n<p>In the Xtext <a href=\"https:\/\/www.eclipse.org\/Xtext\/releasenotes.html#\/releasenotes\/2019\/12\/03\/version-2-20-0\">release notes<\/a> for version 2.20.0 &#8211; released in December 2019 &#8211; you will find the following statement about &#8220;Xtend&#8221;:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>A word on Xtend. Back in 2013 Xtend was the \u201cJava 10 of today\u201d even before Java 8 was out. Meanwhile Java Release cadence has speeded up and many of Xtends features can be achieved with pure Java, too. <span class=\"highlight highlight-\" style=\"background-color:Lemonchiffon;color:black;\">There is still some areas where Xtend is particularly advanced like Code generation, Unit tests and lambda heavy APIs like JvmModelInferrer and Formatter. For other tasks there is no need to use Xtend.<\/span>\n Also the resources we have no longer allow us to keep the head start against Java. And learning Xtend still is a burden for new Xtext users. To reflect this changed situation we have decided to make Java the default in the wizard again (except e.g. the Generator and a few other APIs). You can still decide if you want Java or Xtend in the workflow.<\/p>\n<\/blockquote>\n\n\n\n<p>The situation of Xtend has not improved. Quite the contrary. In the <a href=\"https:\/\/www.eclipse.org\/xtend\/releasenotes.html#\/releasenotes\/2020\/06\/02\/version-2-22-0\">release notes<\/a> of Xtend 2.22.0 &#8211; released in Juni 2020 &#8211; you find the following statement prominent at the beginning:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>As you might have recognized, the number of people contributing to Xtext &amp; Xtend on a regular basis has declined over the past years and so has the number of contributions. At the same time the amount of work for basic maintenance has stayed the same or even increased with the new release cadence of Java and the Eclipse simultaneous release. Briefly: <span class=\"highlight highlight-\" style=\"background-color:Lemonchiffon;color:black;\">The future maintenance of Xtext &amp; especially Xtend is at risk<\/span>\n. If you care, please join the discussion in&nbsp;<a href=\"https:\/\/github.com\/eclipse\/xtext\/issues\/1721\">https:\/\/github.com\/eclipse\/xtext\/issues\/1721<\/a>.<\/p>\n<\/blockquote>\n\n\n\n<p>The above mentioned GitHub issue was created in late March 2020 and referenced on <a href=\"https:\/\/twitter.com\/chrdietrich\/status\/1244592314024103938\">Twitter<\/a>. My current assessment is that Xtext will survive and Xtend will eventually die. This assessment was the main driver to think about replacing Xtend in the utPLSQL code base.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Java?<\/h2>\n\n\n\n<p>SQL Developer runs on a JVM (current LTS versions 8 and 11 are supported only). Hence, extensions have to be written in a JVM language. The utPLSQL extension generates some code and SQL statements. Therefore a language supporting multiline strings would be helpful. Options are<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Kotlin<\/li>\n\n\n\n<li>Scala<\/li>\n\n\n\n<li>Groovy<\/li>\n\n\n\n<li>Clojure<\/li>\n\n\n\n<li>Java (version 15 introduced the final version of <a href=\"https:\/\/openjdk.java.net\/jeps\/378\">Text blocks<\/a>, the first LTS version with this feature will probably be 17, expected in September 2021)<\/li>\n<\/ul>\n\n\n\n<p>However, the support for multiline strings in all these languages is inferior to what Xtend provides. The <a href=\"https:\/\/www.eclipse.org\/xtend\/documentation\/203_xtend_expressions.html#templates\">template expressions<\/a> of Xtend are extremely powerful. It&#8217;s a statically typed code templating language after all (sigh, there is no adequate replacement for that).<\/p>\n\n\n\n<p>I had a closer look at Kotlin, since the grammar has a lot of similarities with Xtend and it seems to be the rising star according to the <a href=\"https:\/\/snyk.io\/blog\/kotlin-overtakes-scala-and-clojure-to-become-the-2nd-most-popular-language-on-the-jvm\/\">JVM ecosystem report<\/a>. However, it requires a runtime library and the support of the language is very much IDE dependent. As with Xtend, just the other way around. This means, excellent support in IntelliJ IDEA, but significantly weaker in the Eclipse IDE.<\/p>\n\n\n\n<p>At this point I stopped evaluating other JVM languages and decided to go with Java for the utPLSQL extension. The support of Java is excellent in any Java IDE. No wonder, Java is by far the most popular JVM language. Furthermore Java is used in the other utPLSQL projects (Java API, CLI and Maven plugin). This simplifies the contribution to the project. And last but not least I expected the least effort for the migration when using Java as the target language.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Migration Approach<\/h2>\n\n\n\n<p>Every Xtend file in the utPLSQL project is migrated. The following Nassi-Shneiderman diagram visualizes the migration approach.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"484\" src=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png\" alt=\"\" class=\"wp-image-9766\" srcset=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png 704w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach-300x206.png 300w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach-212x146.png 212w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach-50x34.png 50w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach-109x75.png 109w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach-1x1.png 1w\" sizes=\"auto, (max-width:767px) 480px, 704px\" \/><\/a><\/figure>\n\n\n\n<p>The blue box &#8220;More Xtend Files?&#8221; represents the loop over all .xtend files. All green actions are trivial. Only the orange action &#8220;Refactor Java Source&#8221; is laborious.<\/p>\n\n\n\n<p>At the very end you can remove Xtend and all its dependencies from your project build file (e.g. the Maven <code>pom.xml<\/code>).<\/p>\n\n\n\n<p>I will explain every action for a Xtend source file in the next chapters. I used the Eclipse IDE for the migration process.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Copy Generated Java Source<\/h3>\n\n\n\n<p>Xtend compiles to Java 8 source code. Select <code>Open Generated File<\/code> from the context menu of the Xtend editor. Copy the complete generated Java code to the clipboard.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Rename .xtend to .java<\/h3>\n\n\n\n<p>Select the .xtend file in the Package Explorer, select <code>Refactor -&gt; Rename<\/code> from the context menu and change the extension to .java. This will delete the generated Java file. That&#8217;s why we saved it to the clipboard before.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Paste Generated Java Source<\/h3>\n\n\n\n<p>Open the .java file in the editor (still containing the Xtend source) and replace the content with the one in your clipboard.<\/p>\n\n\n\n<p>Now it&#8217;s a good time to save the changes in the version control system. Git in my case. I committed the rename and the content change. This way I still have access to the full history of the file. To the old Xtend version(s) and the Java source code generated by Xtend.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Refactor Java Source<\/h3>\n\n\n\n<p>Technically, we&#8217;re done. Unfortunately the generated Java code rarely looks as if you wrote it by hand. We have to refactor the code to make it maintainable. Furthermore we want to eliminate all dependencies to the Xtend runtime library. In this project, we went a step further and eliminated all dependencies to Eclipse libraries including their dependencies.<\/p>\n\n\n\n<p>Open the Java file and the original Xtend file (based on the Git history) side-by-side. Then apply the actions outlined in the next chapters.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1 &#8211; Fix Copyright Comment<\/h4>\n\n\n\n<p>In this project we define a copyright header in each file as a normal comment. This means with <code>\/* ... *\/<\/code> . The generated Java file converted them to Javadoc style comments (<code>\/** ... *\/<\/code>). Remove the superfluous <code>*<\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2 &#8211; Remove Xtend Annotations<\/h4>\n\n\n\n<p>In our case the generated Java file contained the following Xtend specific annotations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>@SuppressWarnings(\"all\")<\/code><\/li>\n\n\n\n<li><code>@Extension<\/code><\/li>\n\n\n\n<li><code>@Accessors<\/code><\/li>\n\n\n\n<li><code>@Pure<\/code><\/li>\n<\/ul>\n\n\n\n<p>Remove these annotations. They are not needed. However, there will be a lot of warnings. This is good. We have to address them eventually.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3 &#8211; Format<\/h4>\n\n\n\n<p>Format the whole Java file with your favorite formatter settings.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 4 &#8211; Remove Class References<\/h4>\n\n\n\n<p>The generated Java code references static methods and fields with the class name. That&#8217;s fine for other classes. But I do not like it for my own class. Here an Example:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"progressBar.foreground = GREEN\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">progressBar<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">foreground<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #4EC9B0\">GREEN<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"this.progressBar.setForeground(RunnerPanel.GREEN);\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">progressBar<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">setForeground<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">RunnerPanel<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">GREEN<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"progressBar.setForeground(GREEN);\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">progressBar<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">setForeground<\/span><span style=\"color: #D4D4D4\">(GREEN);<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<p>Search for the Classname followed by a dot (<code>.<\/code>) and replace it with nothing. This may lead to compile errors. E.g. when initializing the logger field. Add the class reference again to fix these kind of errors. Of course, you could also decide for each occurrence whether a replacement is useful. I tried that as well but found that it was easier to fix the few errors afterwards.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 5 &#8211; Remove <code>this.<\/code> References<\/h4>\n\n\n\n<p>The generated code references all fields and instance methods with <code>this.<\/code> I do not like that either. Therefore I replaced all occurrences of <code>this.<\/code> with nothing. Then I fixed the compile errors by adding <code>this.<\/code> where it was really necessary. I found it easier and less error-prone to do it this way.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 6 &#8211; Fix Fields<\/h4>\n\n\n\n<p>The generated Java file has blank lines between fields. Remove the unwanted blank lines. Use the original Xtend file as a reference. This is why we opened the original Xtend file before, side by side with the Java file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 7 &#8211; Fix Constructors, Methods<\/h4>\n\n\n\n<p>Fix each constructor and method individually. For me, a method was a good unit of work. Follow the steps in the next subchapters.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.1 &#8211; Add Missing Comments<\/h5>\n\n\n\n<p>Javadoc comments are part of the generated Java file. But all other comments are missing. You have to copy these comments from the original Xtend file to the Java file. The side-by-side view is really helpful for this step.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.2 &#8211; Eliminate Variables Beginning with an Underscore (<code>_<\/code>)<\/h5>\n\n\n\n<p>All variables starting with an underline are intermediate results of an expression. Here&#8217;s an Example:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"ret = formatter.format(seconds \/ 60 \/ 60) + &quot; h&quot;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">ret = <\/span><span style=\"color: #9CDCFE\">formatter<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">format<\/span><span style=\"color: #D4D4D4\">(seconds \/ <\/span><span style=\"color: #B5CEA8\">60<\/span><span style=\"color: #D4D4D4\"> \/ <\/span><span style=\"color: #B5CEA8\">60<\/span><span style=\"color: #D4D4D4\">) + <\/span><span style=\"color: #CE9178\">&quot; h&quot;<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"String _format = formatter.format((((this.seconds).doubleValue() \/ 60) \/ 60));\nString _plus = (_format + &quot; h&quot;);\nret = _plus;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #4EC9B0\">String<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_format<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">formatter<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">format<\/span><span style=\"color: #D4D4D4\">((((<\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">seconds<\/span><span style=\"color: #D4D4D4\">).<\/span><span style=\"color: #DCDCAA\">doubleValue<\/span><span style=\"color: #D4D4D4\">() \/ <\/span><span style=\"color: #B5CEA8\">60<\/span><span style=\"color: #D4D4D4\">) \/ <\/span><span style=\"color: #B5CEA8\">60<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span>\n<span class=\"line\"><span style=\"color: #4EC9B0\">String<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_plus<\/span><span style=\"color: #D4D4D4\"> = (_format + <\/span><span style=\"color: #CE9178\">&quot; h&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">ret = _plus;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"ret = formatter.format(seconds \/ 60 \/ 60) + &quot; h&quot;;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">ret = <\/span><span style=\"color: #9CDCFE\">formatter<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">format<\/span><span style=\"color: #D4D4D4\">(seconds \/ <\/span><span style=\"color: #B5CEA8\">60<\/span><span style=\"color: #D4D4D4\"> \/ <\/span><span style=\"color: #B5CEA8\">60<\/span><span style=\"color: #D4D4D4\">) + <\/span><span style=\"color: #CE9178\">&quot; h&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<p>In this case, you could simply copy the original Xtend expression to Java. However, this is not always possible and I found it error-prone. For me it was much safer to edit each variable individually. In this case this means:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Copy the expression of the variable <code>_format<\/code> to the clipboard<\/li>\n\n\n\n<li>Replace the usage of <code>_format<\/code> in the expression of the variable <code>_plus<\/code> with the clipboard content<\/li>\n\n\n\n<li>Copy the expression of the variable <code>_plus<\/code> to the clipboard<\/li>\n\n\n\n<li>Replace the usage of <code>_plus<\/code> in the expression of the variable <code>ret<\/code> with the clipboard content<\/li>\n\n\n\n<li>Remove the now unused variables <code>_format<\/code> and <code>_plus<\/code><\/li>\n\n\n\n<li>Simplify the expression, remove unnecessary parts (see also next chapters)<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.3 &#8211; Eliminate Unnecessary Parentheses<\/h5>\n\n\n\n<p>Boolean parts of an expression are surrounded by additional parentheses in the generated Java file. Remove these superfluous parentheses. Here&#8217;s an example:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"if (desktop !== null \n    &amp;&amp; desktop.isSupported(Desktop.Action.BROWSE) \n    &amp;&amp; url !== null)\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (desktop !== <\/span><span style=\"color: #569CD6\">null<\/span><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    &amp;&amp; <\/span><span style=\"color: #9CDCFE\">desktop<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">isSupported<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">Desktop<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">Action<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">BROWSE<\/span><span style=\"color: #D4D4D4\">) <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    &amp;&amp; url !== <\/span><span style=\"color: #569CD6\">null<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"if ((((desktop != null) \n    &amp;&amp; desktop.isSupported(Desktop.Action.BROWSE)) \n    &amp;&amp; (url != null)))\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> ((((desktop != <\/span><span style=\"color: #569CD6\">null<\/span><span style=\"color: #D4D4D4\">) <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    &amp;&amp; <\/span><span style=\"color: #9CDCFE\">desktop<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">isSupported<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">Desktop<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">Action<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">BROWSE<\/span><span style=\"color: #D4D4D4\">)) <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    &amp;&amp; (url != <\/span><span style=\"color: #569CD6\">null<\/span><span style=\"color: #D4D4D4\">)))<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"if (desktop != null \n    &amp;&amp; desktop.isSupported(Desktop.Action.BROWSE) \n    &amp;&amp; url != null)\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (desktop != <\/span><span style=\"color: #569CD6\">null<\/span><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    &amp;&amp; <\/span><span style=\"color: #9CDCFE\">desktop<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">isSupported<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">Desktop<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">Action<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">BROWSE<\/span><span style=\"color: #D4D4D4\">) <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    &amp;&amp; url != <\/span><span style=\"color: #569CD6\">null<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.4 &#8211; Eliminate Unnecessary <code>else<\/code> Branches<\/h5>\n\n\n\n<p><code>else if<\/code> branches are converted to <code>else { ... if<\/code> constructs in the generated Java file, if the Xtend generator creates an intermediate variable. Simplify these constructs. Here&#8217;s an example:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"if (itemType == &quot;pre-run&quot;) {\n    event = doc.convertToPreRunEvent\n} else if (itemType == &quot;post-run&quot;) {\n    event = doc.convertToPostRunEvent\n} else if (itemType == &quot;pre-suite&quot;) {\n    event = doc.convertToPreSuiteEvent\n} else if (itemType == &quot;post-suite&quot;) {\n    event = doc.convertToPostSuiteEvent\n} else if (itemType == &quot;pre-test&quot;) {\n   event = doc.convertToPreTestEvent\n} else if (itemType == &quot;post-test&quot;) {\n   event = doc.convertToPostTestEvent\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (itemType == <\/span><span style=\"color: #CE9178\">&quot;pre-run&quot;<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #9CDCFE\">doc<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">convertToPreRunEvent<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (itemType == <\/span><span style=\"color: #CE9178\">&quot;post-run&quot;<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #9CDCFE\">doc<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">convertToPostRunEvent<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (itemType == <\/span><span style=\"color: #CE9178\">&quot;pre-suite&quot;<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #9CDCFE\">doc<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">convertToPreSuiteEvent<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (itemType == <\/span><span style=\"color: #CE9178\">&quot;post-suite&quot;<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #9CDCFE\">doc<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">convertToPostSuiteEvent<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (itemType == <\/span><span style=\"color: #CE9178\">&quot;pre-test&quot;<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   event = <\/span><span style=\"color: #9CDCFE\">doc<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">convertToPreTestEvent<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (itemType == <\/span><span style=\"color: #CE9178\">&quot;post-test&quot;<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   event = <\/span><span style=\"color: #9CDCFE\">doc<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">convertToPostTestEvent<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"boolean _equals = Objects.equal(itemType, &quot;pre-run&quot;);\nif (_equals) {\n    event = this.convertToPreRunEvent(doc);\n} else {\n    boolean _equals_1 = Objects.equal(itemType, &quot;post-run&quot;);\n    if (_equals_1) {\n        event = this.convertToPostRunEvent(doc);\n    } else {\n        boolean _equals_2 = Objects.equal(itemType, &quot;pre-suite&quot;);\n        if (_equals_2) {\n            event = this.convertToPreSuiteEvent(doc);\n        } else {\n            boolean _equals_3 = Objects.equal(itemType, &quot;post-suite&quot;);\n            if (_equals_3) {\n                event = this.convertToPostSuiteEvent(doc);\n            } else {\n                boolean _equals_4 = Objects.equal(itemType, &quot;pre-test&quot;);\n                if (_equals_4) {\n                    event = this.convertToPreTestEvent(doc);\n                } else {\n                    boolean _equals_5 = Objects.equal(itemType, &quot;post-test&quot;);\n                    if (_equals_5) {\n                        event = this.convertToPostTestEvent(doc);\n                    }\n                }\n            }\n        }\n    }\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #4EC9B0\">boolean<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_equals<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">Objects<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equal<\/span><span style=\"color: #D4D4D4\">(itemType, <\/span><span style=\"color: #CE9178\">&quot;pre-run&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (_equals) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">convertToPreRunEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #4EC9B0\">boolean<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_equals_1<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">Objects<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equal<\/span><span style=\"color: #D4D4D4\">(itemType, <\/span><span style=\"color: #CE9178\">&quot;post-run&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (_equals_1) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        event = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">convertToPostRunEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">    } <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #4EC9B0\">boolean<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_equals_2<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">Objects<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equal<\/span><span style=\"color: #D4D4D4\">(itemType, <\/span><span style=\"color: #CE9178\">&quot;pre-suite&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (_equals_2) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            event = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">convertToPreSuiteEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">        } <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #4EC9B0\">boolean<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_equals_3<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">Objects<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equal<\/span><span style=\"color: #D4D4D4\">(itemType, <\/span><span style=\"color: #CE9178\">&quot;post-suite&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (_equals_3) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                event = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">convertToPostSuiteEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">            } <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                <\/span><span style=\"color: #4EC9B0\">boolean<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_equals_4<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">Objects<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equal<\/span><span style=\"color: #D4D4D4\">(itemType, <\/span><span style=\"color: #CE9178\">&quot;pre-test&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (_equals_4) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                    event = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">convertToPreTestEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">                } <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                    <\/span><span style=\"color: #4EC9B0\">boolean<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_equals_5<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">Objects<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equal<\/span><span style=\"color: #D4D4D4\">(itemType, <\/span><span style=\"color: #CE9178\">&quot;post-test&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                    <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (_equals_5) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                        event = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">convertToPostTestEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"if (&quot;pre-run&quot;.equals(itemType)) {\n    event = convertToPreRunEvent(doc);\n} else if (&quot;post-run&quot;.equals(itemType)) {\n    event = convertToPostRunEvent(doc);\n} else if (&quot;pre-suite&quot;.equals(itemType)) {\n    event = convertToPreSuiteEvent(doc);\n} else if (&quot;post-suite&quot;.equals(itemType)) {\n    event = convertToPostSuiteEvent(doc);\n} else if (&quot;pre-test&quot;.equals(itemType)) {\n    event = convertToPreTestEvent(doc);\n} else if (&quot;post-test&quot;.equals(itemType)) {\n    event = convertToPostTestEvent(doc);\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&quot;pre-run&quot;<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equals<\/span><span style=\"color: #D4D4D4\">(itemType)) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #DCDCAA\">convertToPreRunEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&quot;post-run&quot;<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equals<\/span><span style=\"color: #D4D4D4\">(itemType)) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #DCDCAA\">convertToPostRunEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&quot;pre-suite&quot;<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equals<\/span><span style=\"color: #D4D4D4\">(itemType)) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #DCDCAA\">convertToPreSuiteEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&quot;post-suite&quot;<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equals<\/span><span style=\"color: #D4D4D4\">(itemType)) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #DCDCAA\">convertToPostSuiteEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&quot;pre-test&quot;<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equals<\/span><span style=\"color: #D4D4D4\">(itemType)) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #DCDCAA\">convertToPreTestEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #CE9178\">&quot;post-test&quot;<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">equals<\/span><span style=\"color: #D4D4D4\">(itemType)) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event = <\/span><span style=\"color: #DCDCAA\">convertToPostTestEvent<\/span><span style=\"color: #D4D4D4\">(doc);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.5 &#8211; Eliminate Unnecessary <code>Objects.equal<\/code> Usages<\/h5>\n\n\n\n<p>Xtend supports equality operators (<code>==<\/code>) and implements that with Google&#8217;s <code>Objects.equal<\/code> in the generated Java file. Since we want to eliminate all Xtend dependencies and we are not planning to use Guava as an additional dependency, we replace the comparison with a plain Java construct. See the previous example in step 7.4.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.6 &#8211; Eliminate Unnecessary Code Blocks<\/h5>\n\n\n\n<p>The generated Java file may contain unnecessary code blocks <code>{...}<\/code>. Remove them. Here&#8217;s an example.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"val failedExpectations = node.getNodeList(&quot;failedExpectations\/expectation&quot;)\nfor (i : 0 ..&lt; failedExpectations.length) {\n    val expectationNode = failedExpectations.item(i)\n    val expectation = new Expectation\n    event.failedExpectations.add(expectation)\n    expectation.populate(expectationNode)\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">val failedExpectations = <\/span><span style=\"color: #9CDCFE\">node<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">getNodeList<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;failedExpectations\/expectation&quot;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> (i <\/span><span style=\"color: #C586C0\">:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\"> ..&lt; <\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">length<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    val expectationNode = <\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">item<\/span><span style=\"color: #D4D4D4\">(i)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    val expectation = <\/span><span style=\"color: #C586C0\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Expectation<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    event.<\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">add<\/span><span style=\"color: #D4D4D4\">(expectation)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #9CDCFE\">expectation<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">populate<\/span><span style=\"color: #D4D4D4\">(expectationNode)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"final NodeList failedExpectations = this.xmlTools.getNodeList(node, &quot;failedExpectations\/expectation&quot;);\nint _length = failedExpectations.getLength();\nExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _length, true);\nfor (final Integer i : _doubleDotLessThan) {\n    {\n        final Node expectationNode = failedExpectations.item((i).intValue());\n        final Expectation expectation = new Expectation();\n        event.getFailedExpectations().add(expectation);\n        this.populate(expectation, expectationNode);\n    }\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">NodeList<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">xmlTools<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">getNodeList<\/span><span style=\"color: #D4D4D4\">(node, <\/span><span style=\"color: #CE9178\">&quot;failedExpectations\/expectation&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #4EC9B0\">int<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_length<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">getLength<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #4EC9B0\">ExclusiveRange<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_doubleDotLessThan<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #C586C0\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">ExclusiveRange<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">, _length, <\/span><span style=\"color: #569CD6\">true<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Integer<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">i<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">:<\/span><span style=\"color: #D4D4D4\"> _doubleDotLessThan) {<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">    {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Node<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">expectationNode<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">item<\/span><span style=\"color: #D4D4D4\">((i).<\/span><span style=\"color: #DCDCAA\">intValue<\/span><span style=\"color: #D4D4D4\">());<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Expectation<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">expectation<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #C586C0\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">Expectation<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #9CDCFE\">event<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">getFailedExpectations<\/span><span style=\"color: #D4D4D4\">().<\/span><span style=\"color: #DCDCAA\">add<\/span><span style=\"color: #D4D4D4\">(expectation);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">populate<\/span><span style=\"color: #D4D4D4\">(expectation, expectationNode);<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"final NodeList failedExpectations = xmlTools.getNodeList(node, &quot;failedExpectations\/expectation&quot;);\nfor (int i = 0; i &lt; failedExpectations.getLength(); i++) {\n    final Node expectationNode = failedExpectations.item(i);\n    final Expectation expectation = new Expectation();\n    event.getFailedExpectations().add(expectation);\n    populate(expectation, expectationNode);\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">NodeList<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">xmlTools<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">getNodeList<\/span><span style=\"color: #D4D4D4\">(node, <\/span><span style=\"color: #CE9178\">&quot;failedExpectations\/expectation&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #4EC9B0\">int<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">i<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">; i &lt; <\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">getLength<\/span><span style=\"color: #D4D4D4\">(); i++) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Node<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">expectationNode<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">failedExpectations<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">item<\/span><span style=\"color: #D4D4D4\">(i);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Expectation<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">expectation<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #C586C0\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">Expectation<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #9CDCFE\">event<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">getFailedExpectations<\/span><span style=\"color: #D4D4D4\">().<\/span><span style=\"color: #DCDCAA\">add<\/span><span style=\"color: #D4D4D4\">(expectation);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #DCDCAA\">populate<\/span><span style=\"color: #D4D4D4\">(expectation, expectationNode);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.7 &#8211; Eliminate <code>StringConcatenation<\/code> Usages<\/h5>\n\n\n\n<p>Xtend implements multiline strings with the help of the <code>StringConcatenation<\/code> class in the generated Java file. To eliminate Xtend dependencies we use either the Java <code>+<\/code> operator or the <code>StringBuilder<\/code> class. Here&#8217;s an example:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"val sql = '''\n    SELECT table_owner\n      FROM \u00abIF dbaViewAccessible\u00bbdba\u00abELSE\u00bball\u00abENDIF\u00bb_synonyms\n     WHERE owner = 'PUBLIC'\n       AND synonym_name = '\u00abUTPLSQL_PACKAGE_NAME\u00bb'\n       AND table_name = '\u00abUTPLSQL_PACKAGE_NAME\u00bb'\n'''\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">val sql = <\/span><span style=\"color: #CE9178\">&#39;&#39;&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #CE9178\">    SELECT table_owner<\/span><\/span>\n<span class=\"line\"><span style=\"color: #CE9178\">      FROM \u00abIF dbaViewAccessible\u00bbdba\u00abELSE\u00bball\u00abENDIF\u00bb_synonyms<\/span><\/span>\n<span class=\"line\"><span style=\"color: #CE9178\">     WHERE owner = &#39;<\/span><span style=\"color: #D4D4D4\">PUBLIC<\/span><span style=\"color: #CE9178\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #CE9178\">       AND synonym_name = &#39;<\/span><span style=\"color: #D4D4D4\">\u00abUTPLSQL_PACKAGE_NAME\u00bb<\/span><span style=\"color: #CE9178\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #CE9178\">       AND table_name = &#39;<\/span><span style=\"color: #D4D4D4\">\u00abUTPLSQL_PACKAGE_NAME\u00bb<\/span><span style=\"color: #CE9178\">&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #CE9178\">&#39;&#39;&#39;<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"StringConcatenation _builder = new StringConcatenation();\n_builder.append(&quot;SELECT table_owner&quot;);\n_builder.newLine();\n_builder.append(&quot;  &quot;);\n_builder.append(&quot;FROM &quot;);\n{\n    boolean _isDbaViewAccessible = this.isDbaViewAccessible();\n    if (_isDbaViewAccessible) {\n        _builder.append(&quot;dba&quot;);\n    } else {\n        _builder.append(&quot;all&quot;);\n    }\n}\n_builder.append(&quot;_synonyms&quot;);\n_builder.newLineIfNotEmpty();\n_builder.append(&quot; &quot;);\n_builder.append(&quot;WHERE owner = \\'PUBLIC\\'&quot;);\n_builder.newLine();\n_builder.append(&quot;   &quot;);\n_builder.append(&quot;AND synonym_name = \\'&quot;);\n_builder.append(UtplsqlDao.UTPLSQL_PACKAGE_NAME, &quot;   &quot;);\n_builder.append(&quot;\\'&quot;);\n_builder.newLineIfNotEmpty();\n_builder.append(&quot;   &quot;);\n_builder.append(&quot;AND table_name = \\'&quot;);\n_builder.append(UtplsqlDao.UTPLSQL_PACKAGE_NAME, &quot;   &quot;);\n_builder.append(&quot;\\'&quot;);\n_builder.newLineIfNotEmpty();\nfinal String sql = _builder.toString();\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #4EC9B0\">StringConcatenation<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #C586C0\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">StringConcatenation<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;SELECT table_owner&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">newLine<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;  &quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;FROM &quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #4EC9B0\">boolean<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_isDbaViewAccessible<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">isDbaViewAccessible<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (_isDbaViewAccessible) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;dba&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    } <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;all&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;_synonyms&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">newLineIfNotEmpty<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot; &quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;WHERE owner = <\/span><span style=\"color: #D7BA7D\">\\&#39;<\/span><span style=\"color: #CE9178\">PUBLIC<\/span><span style=\"color: #D7BA7D\">\\&#39;<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">newLine<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;   &quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;AND synonym_name = <\/span><span style=\"color: #D7BA7D\">\\&#39;<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">UtplsqlDao<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">UTPLSQL_PACKAGE_NAME<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;   &quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D7BA7D\">\\&#39;<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">newLineIfNotEmpty<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;   &quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;AND table_name = <\/span><span style=\"color: #D7BA7D\">\\&#39;<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">UtplsqlDao<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">UTPLSQL_PACKAGE_NAME<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;   &quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D7BA7D\">\\&#39;<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">newLineIfNotEmpty<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">String<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">sql<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">_builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">toString<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"final StringBuilder sb = new StringBuilder();\nsb.append(&quot;SELECT table_owner\\n&quot;);\nsb.append(&quot;  FROM &quot;);\nsb.append(getDbaView(&quot;synonyms\\n&quot;));\nsb.append(&quot; WHERE owner = 'PUBLIC'\\n&quot;);\nsb.append(&quot;   AND synonym_name = '&quot;);\nsb.append(UtplsqlDao.UTPLSQL_PACKAGE_NAME);\nsb.append(&quot;'\\n&quot;);\nsb.append(&quot;   AND table_name = '&quot;);\nsb.append(UtplsqlDao.UTPLSQL_PACKAGE_NAME);\nsb.append(&quot;'&quot;);\nfinal String sql = sb.toString();\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">StringBuilder<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #C586C0\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">StringBuilder<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;SELECT table_owner<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;  FROM &quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #DCDCAA\">getDbaView<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;synonyms<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot; WHERE owner = &#39;PUBLIC&#39;<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;   AND synonym_name = &#39;&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">UtplsqlDao<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">UTPLSQL_PACKAGE_NAME<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;&#39;<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;   AND table_name = &#39;&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">UtplsqlDao<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">UTPLSQL_PACKAGE_NAME<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">append<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;&#39;&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">String<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">sql<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">sb<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">toString<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.8 &#8211; Eliminate Escaped Apostrophe (<code>\\'<\/code>) Usages<\/h5>\n\n\n\n<p>The generated Java file escapes every apostrophe. This is necessary for chars (<code>'\\''<\/code>), but not for strings (<code>\"'\"<\/code>).&nbsp; We replace all escaped apostrophes (<code>\\'<\/code>) in strings with a plain apostrophe (<code>'<\/code>).&nbsp; This improves the readability, especially for SQL statements. See the example in step 7.7.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.9 &#8211; Eliminate <code>Conversions<\/code> Usages<\/h5>\n\n\n\n<p>Xtend implements collection literals (<code>#[...]<\/code> and <code>#{...}<\/code>) with the help of the <code>Conversions<\/code> class in the generated Java file. We replace all usages of this class with plain Java constructs. Here&#8217;s an example:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"lov.put(RESET_PACKAGE, #[YES, NO])\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">lov<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">put<\/span><span style=\"color: #D4D4D4\">(RESET_PACKAGE, #[YES, NO])<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"lov.put(RunGenerator.RESET_PACKAGE, \n    Collections.&lt;String&gt;unmodifiableList(\n        CollectionLiterals.&lt;String&gt;newArrayList(\n            RunGenerator.YES, RunGenerator.NO\n        )\n    )\n);\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">lov<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">put<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">RunGenerator<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">RESET_PACKAGE<\/span><span style=\"color: #D4D4D4\">, <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    Collections.&lt;String&gt;<\/span><span style=\"color: #DCDCAA\">unmodifiableList<\/span><span style=\"color: #D4D4D4\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        CollectionLiterals.&lt;String&gt;<\/span><span style=\"color: #DCDCAA\">newArrayList<\/span><span style=\"color: #D4D4D4\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #9CDCFE\">RunGenerator<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">YES<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">RunGenerator<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">NO<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        )<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    )<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">);<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"lov.put(RESET_PACKAGE, Arrays.asList(YES, NO));\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">lov<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">put<\/span><span style=\"color: #D4D4D4\">(RESET_PACKAGE, <\/span><span style=\"color: #9CDCFE\">Arrays<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">asList<\/span><span style=\"color: #D4D4D4\">(YES, NO));<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.10 &#8211; Eliminate all <code>Exceptions<\/code> Usages<\/h5>\n\n\n\n<p>Xtend does not force you to handle checked exceptions, instead, it catches them in the generated Java file and throws an own RuntimeException using the <code>Exceptions<\/code> class. We replace all usages of this class with plain Java constructs. Here&#8217;s an example:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"def getNodeList(Node doc, String xpathString) {\n    val expr = xpath.compile(xpathString);\n    val NodeList nodeList = expr.evaluate(doc, XPathConstants.NODESET) as NodeList\n    return nodeList \n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">def <\/span><span style=\"color: #DCDCAA\">getNodeList<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #4EC9B0\">Node<\/span><span style=\"color: #D4D4D4\"> doc, <\/span><span style=\"color: #4EC9B0\">String<\/span><span style=\"color: #D4D4D4\"> xpathString) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    val expr = <\/span><span style=\"color: #9CDCFE\">xpath<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">compile<\/span><span style=\"color: #D4D4D4\">(xpathString);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    val <\/span><span style=\"color: #4EC9B0\">NodeList<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">nodeList<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">expr<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">evaluate<\/span><span style=\"color: #D4D4D4\">(doc, <\/span><span style=\"color: #9CDCFE\">XPathConstants<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">NODESET<\/span><span style=\"color: #D4D4D4\">) as <\/span><span style=\"color: #4EC9B0\">NodeList<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> nodeList <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"public NodeList getNodeList(final Node doc, final String xpathString) {\n    try {\n        final XPathExpression expr = this.xpath.compile(xpathString);\n        Object _evaluate = expr.evaluate(doc, XPathConstants.NODESET);\n        final NodeList nodeList = ((NodeList) _evaluate);\n        return nodeList;\n    } catch (Throwable _e) {\n        throw Exceptions.sneakyThrow(_e);\n    }\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">NodeList<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">getNodeList<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Node<\/span><span style=\"color: #D4D4D4\"> doc, <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">String<\/span><span style=\"color: #D4D4D4\"> xpathString) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">try<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">XPathExpression<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">expr<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">xpath<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">compile<\/span><span style=\"color: #D4D4D4\">(xpathString);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #4EC9B0\">Object<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_evaluate<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">expr<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">evaluate<\/span><span style=\"color: #D4D4D4\">(doc, <\/span><span style=\"color: #9CDCFE\">XPathConstants<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">NODESET<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">NodeList<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">nodeList<\/span><span style=\"color: #D4D4D4\"> = ((NodeList) _evaluate);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> nodeList;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    } <\/span><span style=\"color: #C586C0\">catch<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #4EC9B0\">Throwable<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_e<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">throw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">Exceptions<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">sneakyThrow<\/span><span style=\"color: #D4D4D4\">(_e);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"public NodeList getNodeList(final Node doc, final String xpathString) {\n    try {\n        final XPathExpression expr = xpath.compile(xpathString);\n        return ((NodeList) expr.evaluate(doc, XPathConstants.NODESET));\n    } catch (XPathExpressionException e) {\n        final String msg = &quot;XPathExpressionException for &quot; + xpathString + &quot;.&quot;;\n        logger.severe(() -&gt; msg);\n        throw new GenericRuntimeException(msg, e);\n    }\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">NodeList<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">getNodeList<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Node<\/span><span style=\"color: #D4D4D4\"> doc, <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">String<\/span><span style=\"color: #D4D4D4\"> xpathString) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">try<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">XPathExpression<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">expr<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">xpath<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">compile<\/span><span style=\"color: #D4D4D4\">(xpathString);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> ((NodeList) <\/span><span style=\"color: #9CDCFE\">expr<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">evaluate<\/span><span style=\"color: #D4D4D4\">(doc, <\/span><span style=\"color: #9CDCFE\">XPathConstants<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">NODESET<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    } <\/span><span style=\"color: #C586C0\">catch<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #4EC9B0\">XPathExpressionException<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">e<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">String<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">msg<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #CE9178\">&quot;XPathExpressionException for &quot;<\/span><span style=\"color: #D4D4D4\"> + xpathString + <\/span><span style=\"color: #CE9178\">&quot;.&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #9CDCFE\">logger<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">severe<\/span><span style=\"color: #D4D4D4\">(() <\/span><span style=\"color: #569CD6\">-&gt;<\/span><span style=\"color: #D4D4D4\"> msg);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #C586C0\">throw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">GenericRuntimeException<\/span><span style=\"color: #D4D4D4\">(msg, e);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7.11 &#8211; Fix Return Type <code>void<\/code><\/h5>\n\n\n\n<p>In Xtend everything is an expression. The return type of a method is inferred if it is not explicitly defined. Therefore the generated Java file might have determined a &#8220;wrong&#8221; return type when you do not really need one. Change the return type to <code>void<\/code> in such cases. Here&#8217;s an example:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Xtend Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"def setSeconds(Double seconds) {\n    this.seconds = seconds\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">def <\/span><span style=\"color: #DCDCAA\">setSeconds<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #4EC9B0\">Double<\/span><span style=\"color: #D4D4D4\"> seconds) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">seconds<\/span><span style=\"color: #D4D4D4\"> = seconds<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Generated Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"public Double setSeconds(final Double seconds) {\n    return this.seconds = seconds;\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Double<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">setSeconds<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Double<\/span><span style=\"color: #D4D4D4\"> seconds) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">seconds<\/span><span style=\"color: #D4D4D4\"> = seconds;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">Fixed Java Code<\/span><span role=\"button\" tabindex=\"0\" data-code=\"public void setSeconds(final Double seconds) {\n    this.seconds = seconds;\n}\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">void<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">setSeconds<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Double<\/span><span style=\"color: #D4D4D4\"> seconds) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">seconds<\/span><span style=\"color: #D4D4D4\"> = seconds;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Step 8 &#8211; Eliminate Remaining Usages of Classes Provided by Xtend<\/h4>\n\n\n\n<p>Check the import section of the Java file. Look for the following packages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>com.google.common.base.*<\/code><\/li>\n\n\n\n<li><code>org.eclipse.xtend2.lib.*<\/code><\/li>\n\n\n\n<li><code>org.eclipse.xtext.xbase.lib.*<\/code><\/li>\n<\/ul>\n\n\n\n<p>Remove these imports and find a plain Java solution.<\/p>\n\n\n\n<p>The replacement of <code>ToStringBuilder<\/code> was challenging. This class builds a nice String representation of all fields using Java Reflection. I thought about using <a href=\"https:\/\/commons.apache.org\/proper\/commons-lang\/apidocs\/org\/apache\/commons\/lang3\/builder\/ToStringBuilder.html\">Apache Commons<\/a> or <a href=\"https:\/\/projectlombok.org\/\">Project Lombok<\/a> for my model classes. However, for the utPLSQL project, I decided to use a solution without Java Reflection and without adding dependencies to the project. We already use the Spring Framework, mainly for JDBC. Therefore I used Spring&#8217;s <code><a href=\"https:\/\/docs.spring.io\/spring\/docs\/current\/javadoc-api\/org\/springframework\/core\/style\/ToStringCreator.html\">ToStringCreator<\/a><\/code> with a custom <a href=\"https:\/\/github.com\/utPLSQL\/utPLSQL-SQLDeveloper\/blob\/main\/sqldev\/src\/main\/java\/org\/utplsql\/sqldev\/model\/JsonToStringStyler.java\">styler<\/a> to represent the String as nicely formatted JSON.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 9 &#8211; Test<\/h4>\n\n\n\n<p>After these refactoring steps, it&#8217;s about time to run tests. I was glad to have unit tests with reasonable coverage. Since this is an extension for SQL Developer, some things only work in the SQL Developer environment (e.g. the controller for actions in the context menu of the navigator etc.). By reasonable coverage, I mean for the code that can be executed outside of SQL Developer via JUnit tests.<\/p>\n\n\n\n<p>So at this point, I ran the unit tests and depending on the class I built the extension, installed it in SQL Developer and tried if the changed class behaved as expected. Of course, I found a couple of places where I could or better should change things to improve the testability of the code. Maybe one day. But without unit testing, I would never have found the confidence to do all these refactoring.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>Using this approach I was able to migrate the complete utPLSQL for SQL Developer project. The migration was time-consuming, but not complicated. I think it was the right decision for the utPLSQL project. We have reduced the number of languages and therefore the overall complexity of the project. The code base is now independent of an IDE. I used IntelliJ IDEA to implement additional features for version 1.2.0 of the utPLSQL extension. And it worked like a charm. I&#8217;m sure that this will simplify the contribution to this project in the future.<\/p>\n\n\n\n<p>But what does this mean for other projects that are using Xtend? Should they also migrate to Java? That really depends on the kind of project. In code generation projects, the code template classes written in Xtend are superior to other technologies. You really have to weigh the pros and cons. However, the fact that the future of Xtend is currently uncertain should not affect the decision. I have proven that it is possible to migrate from Xtend to Java in a reasonable time. Hence there is no reason to panic.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction The utPLSQL extension for SQL Developer was originally written in Xtend. In this blog post I explain why we decided to migrate the project to Java and how we&#8217;ve done that. Why Replace Xtend? Xtend is a statically typed, clean language with excellent string templating features and a fine integration into<span class=\"excerpt-hellip\"> [\u2026]<\/span><\/p>\n","protected":false},"author":1,"featured_media":9766,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[107,87,105],"class_list":["post-9736","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-java","tag-sql-developer","tag-utplsql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Bye bye Xtend, Welcome Java - Philipp Salvisberg&#039;s Blog<\/title>\n<meta name=\"description\" content=\"The utPLSQL extension for SQL Developer was originally written in Xtend. I explain why have we migrated the project to Java and how we\u2019ve done that.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bye bye Xtend, Welcome Java - Philipp Salvisberg&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"The utPLSQL extension for SQL Developer was originally written in Xtend. I explain why have we migrated the project to Java and how we\u2019ve done that.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/\" \/>\n<meta property=\"og:site_name\" content=\"Philipp Salvisberg&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-06T17:27:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-08T20:06:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png\" \/>\n\t<meta property=\"og:image:width\" content=\"704\" \/>\n\t<meta property=\"og:image:height\" content=\"484\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Philipp Salvisberg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@phsalvisberg\" \/>\n<meta name=\"twitter:site\" content=\"@phsalvisberg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Philipp Salvisberg\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/\"},\"author\":{\"name\":\"Philipp Salvisberg\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"headline\":\"Bye bye Xtend, Welcome Java\",\"datePublished\":\"2020-06-06T17:27:30+00:00\",\"dateModified\":\"2023-11-08T20:06:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/\"},\"wordCount\":2363,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"image\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2120\\\/05\\\/Xtend-to-Java-Migration-Approach.png\",\"keywords\":[\"Java\",\"SQL Developer\",\"utPLSQL\"],\"articleSection\":[\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/\",\"name\":\"Bye bye Xtend, Welcome Java - Philipp Salvisberg&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2120\\\/05\\\/Xtend-to-Java-Migration-Approach.png\",\"datePublished\":\"2020-06-06T17:27:30+00:00\",\"dateModified\":\"2023-11-08T20:06:34+00:00\",\"description\":\"The utPLSQL extension for SQL Developer was originally written in Xtend. I explain why have we migrated the project to Java and how we\u2019ve done that.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2120\\\/05\\\/Xtend-to-Java-Migration-Approach.png\",\"contentUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2120\\\/05\\\/Xtend-to-Java-Migration-Approach.png\",\"width\":704,\"height\":484},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/06\\\/06\\\/bye-bye-xtend-welcome-java\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bye bye Xtend, Welcome Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/\",\"name\":\"Philipp Salvisberg&#039;s Blog\",\"description\":\"Database-centric development\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\",\"name\":\"Philipp Salvisberg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"contentUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"width\":400,\"height\":400,\"caption\":\"Philipp Salvisberg\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\"},\"sameAs\":[\"http:\\\/\\\/www.salvis.com\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bye bye Xtend, Welcome Java - Philipp Salvisberg&#039;s Blog","description":"The utPLSQL extension for SQL Developer was originally written in Xtend. I explain why have we migrated the project to Java and how we\u2019ve done that.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/","og_locale":"en_US","og_type":"article","og_title":"Bye bye Xtend, Welcome Java - Philipp Salvisberg&#039;s Blog","og_description":"The utPLSQL extension for SQL Developer was originally written in Xtend. I explain why have we migrated the project to Java and how we\u2019ve done that.","og_url":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/","og_site_name":"Philipp Salvisberg&#039;s Blog","article_published_time":"2020-06-06T17:27:30+00:00","article_modified_time":"2023-11-08T20:06:34+00:00","og_image":[{"width":704,"height":484,"url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png","type":"image\/png"}],"author":"Philipp Salvisberg","twitter_card":"summary_large_image","twitter_creator":"@phsalvisberg","twitter_site":"@phsalvisberg","twitter_misc":{"Written by":"Philipp Salvisberg","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/#article","isPartOf":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/"},"author":{"name":"Philipp Salvisberg","@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"headline":"Bye bye Xtend, Welcome Java","datePublished":"2020-06-06T17:27:30+00:00","dateModified":"2023-11-08T20:06:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/"},"wordCount":2363,"commentCount":4,"publisher":{"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"image":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png","keywords":["Java","SQL Developer","utPLSQL"],"articleSection":["Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/","url":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/","name":"Bye bye Xtend, Welcome Java - Philipp Salvisberg&#039;s Blog","isPartOf":{"@id":"https:\/\/www.salvis.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/#primaryimage"},"image":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png","datePublished":"2020-06-06T17:27:30+00:00","dateModified":"2023-11-08T20:06:34+00:00","description":"The utPLSQL extension for SQL Developer was originally written in Xtend. I explain why have we migrated the project to Java and how we\u2019ve done that.","breadcrumb":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/#primaryimage","url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png","contentUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2120\/05\/Xtend-to-Java-Migration-Approach.png","width":704,"height":484},{"@type":"BreadcrumbList","@id":"https:\/\/www.salvis.com\/blog\/2020\/06\/06\/bye-bye-xtend-welcome-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.salvis.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Bye bye Xtend, Welcome Java"}]},{"@type":"WebSite","@id":"https:\/\/www.salvis.com\/blog\/#website","url":"https:\/\/www.salvis.com\/blog\/","name":"Philipp Salvisberg&#039;s Blog","description":"Database-centric development","publisher":{"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.salvis.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515","name":"Philipp Salvisberg","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","contentUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","width":400,"height":400,"caption":"Philipp Salvisberg"},"logo":{"@id":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg"},"sameAs":["http:\/\/www.salvis.com\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/9736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/comments?post=9736"}],"version-history":[{"count":82,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/9736\/revisions"}],"predecessor-version":[{"id":12762,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/9736\/revisions\/12762"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/media\/9766"}],"wp:attachment":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/media?parent=9736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/categories?post=9736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/tags?post=9736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}