diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 6215d7600e..1400af48bd 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -139,6 +139,7 @@ CPD also parses raw string literals now correctly (see [#1784](https://github.co * [#1820](https://github.com/pmd/pmd/pull/1820): \[cpp] \[cpd] Improve support for raw string literals - [Maikel Steneker](https://github.com/maikelsteneker) * [#1821](https://github.com/pmd/pmd/pull/1821): \[matlab] \[cpd] Matlab question mark token - [Maikel Steneker](https://github.com/maikelsteneker) * [#1822](https://github.com/pmd/pmd/pull/1822): \[matlab] \[cpd] Double quoted string - [Maikel Steneker](https://github.com/maikelsteneker) +* [#1837](https://github.com/pmd/pmd/pull/1837): \[core] Minor performance improvements - [Michael Hausegger](https://github.com/TheRealHaui) * [#1840](https://github.com/pmd/pmd/pull/1840): \[java] Whitelist serialPersistentFields - [Marcel Härle](https://github.com/marcelhaerle) {% endtocmaker %} 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); }