From 3b646edd718736c6d7bd643e3a600b0d4d89b509 Mon Sep 17 00:00:00 2001 From: Michael Hausegger Date: Mon, 20 May 2019 17:08:50 +0200 Subject: [PATCH 1/2] Small minor performance improvements --- pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java | 4 ++-- .../main/java/net/sourceforge/pmd/util/designer/Designer.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java index 916276502a..fd7e436af2 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java @@ -421,7 +421,7 @@ public class GUI implements CPDListener { ignoreAnnotationsCheckbox.setEnabled(current.canIgnoreAnnotations()); ignoreUsingsCheckbox.setEnabled(current.canIgnoreUsings()); extensionField.setText(current.extensions()[0]); - boolean enableExtension = current.extensions()[0].length() == 0; + boolean enableExtension = current.extensions()[0].isEmpty(); extensionField.setEnabled(enableExtension); extensionLabel.setEnabled(enableExtension); } @@ -611,7 +611,7 @@ public class GUI implements CPDListener { private boolean isLegalPath(String path, LanguageConfig config) { String[] extensions = config.extensions(); for (int i = 0; i < extensions.length; i++) { - if (path.endsWith(extensions[i]) && extensions[i].length() > 0) { + if (path.endsWith(extensions[i]) && !extensions[i].isEmpty()) { return true; } } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/util/designer/Designer.java b/pmd-core/src/main/java/net/sourceforge/pmd/util/designer/Designer.java index a43fa65778..90af1421f5 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/util/designer/Designer.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/util/designer/Designer.java @@ -939,7 +939,7 @@ public class Designer implements ClipboardOwner { } private String getXmlTreeCode() { - if (codeEditorPane.getText() != null && codeEditorPane.getText().trim().length() > 0) { + if (codeEditorPane.getText() != null && !codeEditorPane.getText().trim().isEmpty()) { Node cu = getCompilationUnit(); return getXmlTreeCode(cu); } From bd3dfb9d7dca1bd8836f89beea59c4df3e61a359 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 24 May 2019 19:36:09 +0200 Subject: [PATCH 2/2] Update release notes, refs #1837 --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index cdcddea67f..5a92853c34 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -32,6 +32,7 @@ This is a {{ site.pmd.release_type }} release. * [#1799](https://github.com/pmd/pmd/pull/1799): \[java] MethodReturnsInternalArray does not work in inner classes - Fixed #1738 - [Srinivasan Venkatachalam](https://github.com/Srini1993) * [#1802](https://github.com/pmd/pmd/pull/1802): \[python] \[cpd] Add support for Python 2 backticks - [Maikel Steneker](https://github.com/maikelsteneker) * [#1803](https://github.com/pmd/pmd/pull/1803): \[dart] \[cpd] Dart escape sequences - [Maikel Steneker](https://github.com/maikelsteneker) +* [#1837](https://github.com/pmd/pmd/pull/1837): \[core] Minor performance improvements - [Michael Hausegger](https://github.com/TheRealHaui) {% endtocmaker %}