You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2020/01/27 12:41:08 UTC

[cayenne] 01/02: minor code cleanup

This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 5a81bc8a43938c67fa8f0e3a075425f133f981dc
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Mon Jan 27 15:25:00 2020 +0300

    minor code cleanup
---
 .../java/org/apache/cayenne/modeler/Application.java    | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
index 119def6..b029254 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Application.java
@@ -231,7 +231,6 @@ public class Application {
     /**
      * Reinitializes ModelerClassLoader from preferences.
      */
-    @SuppressWarnings("unchecked")
     public void initClassLoader() {
         final FileClassLoadingService classLoader = new FileClassLoadingService();
 
@@ -240,9 +239,8 @@ public class Application {
                 ClasspathPreferences.class,
                 "");
 
-        Collection<String> details = new ArrayList<>();
         String[] keys;
-        ArrayList<String> values = new ArrayList<>();
+        Collection<String> values = new ArrayList<>();
 
         try {
             keys = classLoaderPreference.keys();
@@ -252,10 +250,8 @@ public class Application {
         } catch (BackingStoreException ignored) {
         }
 
-        details.addAll(values);
-
-        if (details.size() > 0) {
-            classLoader.setPathFiles(details.stream().map(File::new).collect(Collectors.toList()));
+        if (values.size() > 0) {
+            classLoader.setPathFiles(values.stream().map(File::new).collect(Collectors.toList()));
         }
 
         this.modelerClassLoader = classLoader;
@@ -264,12 +260,7 @@ public class Application {
         if (SwingUtilities.isEventDispatchThread()) {
             Thread.currentThread().setContextClassLoader(classLoader.getClassLoader());
         } else {
-            SwingUtilities.invokeLater(new Runnable() {
-
-                public void run() {
-                    Thread.currentThread().setContextClassLoader(classLoader.getClassLoader());
-                }
-            });
+            SwingUtilities.invokeLater(() -> Thread.currentThread().setContextClassLoader(classLoader.getClassLoader()));
         }
     }