[hg] main-silver: Some code warnings removed.

  • From:
  • To:
  • Subject: [hg] main-silver: Some code warnings removed.
  • Date: Sat, 01 Dec 2012 13:36:43 -0800

changeset 404ad87d2e9e in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/404ad87d2e9e
description:
        Some code warnings removed.

diffstat:

 api.debugger/src/org/netbeans/api/debugger/ActionsManager.java  |   30 +-
 api.debugger/src/org/netbeans/api/debugger/Lookup.java          |  119 
+++++++--
 api.debugger/src/org/netbeans/spi/debugger/ActionsProvider.java |   16 +-
 3 files changed, 121 insertions(+), 44 deletions(-)

diffs (508 lines):

diff --git a/api.debugger/src/org/netbeans/api/debugger/ActionsManager.java 
b/api.debugger/src/org/netbeans/api/debugger/ActionsManager.java
--- a/api.debugger/src/org/netbeans/api/debugger/ActionsManager.java
+++ b/api.debugger/src/org/netbeans/api/debugger/ActionsManager.java
@@ -176,7 +176,9 @@
             fireActionDone (action);
         }
         doiingDo = false;
-        if (destroy) destroyIn ();
+        if (destroy) {
+            destroyIn ();
+        }
     }
     
     /**
@@ -227,7 +229,9 @@
                                 task.actionDone();
                                 fireActionDone (action);
                                 doiingDo = false;
-                                if (destroy) destroyIn ();
+                                if (destroy) {
+                                    destroyIn ();
+                                }
                             }
                         }
                     }
@@ -240,7 +244,9 @@
         }
         if (!posted) {
             doiingDo = false;
-            if (destroy) destroyIn ();
+            if (destroy) {
+                destroyIn ();
+            }
             task.actionDone();
         }
         return task;
@@ -292,7 +298,9 @@
      * Stops listening on all actions, stops firing events.
      */
     public void destroy () {
-        if (!doiingDo) destroyIn ();
+        if (!doiingDo) {
+            destroyIn ();
+        }
         destroy = true;
     }
 
@@ -349,7 +357,9 @@
     ) {
         synchronized (listeners) {
             List<ActionsManagerListener> ls = listeners.get (propertyName);
-            if (ls == null) return;
+            if (ls == null) {
+                return;
+            }
             ls.remove(l);
             if (ls.isEmpty()) {
                 listeners.remove(propertyName);
@@ -494,11 +504,12 @@
             }
             for (ActionsProvider ap : aps) {
                 Iterator ii = ap.getActions ().iterator ();
-                while (ii.hasNext ())
+                while (ii.hasNext ()) {
                     registerActionsProvider (ii.next (), ap);
             }
         }
     }
+    }
 
     private void initActionImpls () {
         aps = lookup.lookup(null, ActionsProvider.class);
@@ -525,7 +536,9 @@
     private List lazyListeners;
     
     private synchronized void initListeners () {
-        if (listerersLoaded) return;
+        if (listerersLoaded) {
+            return;
+        }
         listerersLoaded = true;
         lazyListeners = lookup.lookup (null, 
LazyActionsManagerListener.class);
         int i, k = lazyListeners.size ();
@@ -567,8 +580,9 @@
                         continue;
                     }
                     int j, jj = props.length;
-                    for (j = 0; j < jj; j++)
+                    for (j = 0; j < jj; j++) {
                         removeActionsManagerListener (props [j], l);
+                    }
                     l.destroy ();
                 }
                 lazyListeners = new ArrayList ();
diff --git a/api.debugger/src/org/netbeans/api/debugger/Lookup.java 
b/api.debugger/src/org/netbeans/api/debugger/Lookup.java
--- a/api.debugger/src/org/netbeans/api/debugger/Lookup.java
+++ b/api.debugger/src/org/netbeans/api/debugger/Lookup.java
@@ -47,15 +47,11 @@
 import java.beans.Customizer;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -84,11 +80,9 @@
 import org.openide.util.Exceptions;
 import org.openide.util.Lookup.Item;
 import org.openide.util.LookupEvent;
-import org.openide.util.LookupListener;
 import org.openide.util.RequestProcessor;
 import org.openide.util.WeakListeners;
 import org.openide.util.WeakSet;
-import org.openide.util.lookup.Lookups;
 import org.openide.util.Lookup.Result;
 import org.openide.util.lookup.AbstractLookup;
 
@@ -110,14 +104,18 @@
 
     private static final Logger logger = 
Logger.getLogger(Lookup.class.getName());
     
+    @Override
     public <T> T lookupFirst(String folder, Class<T> service) {
         List<? extends T> l = lookup(folder, service);
         synchronized (l) {
-            if (l.isEmpty ()) return null;
+            if (l.isEmpty ()) {
+                return null;
+            }
             return l.get (0);
         }
     }
     
+    @Override
     public abstract <T> List<? extends T> lookup(String folder, Class<T> 
service);
     
     
@@ -132,15 +130,17 @@
             this.services = services;
         }
         
+        @Override
         public <T> List<? extends T> lookup(String folder, Class<T> service) 
{
             List<T> l = new ArrayList<T>();
             for (Object s : services) {
                 if (service.isInstance(s)) {
                     l.add(service.cast(s));
-                    if (verbose)
+                    if (verbose) {
                         System.out.println("\nR  instance " + s + " found");
                 }
             }
+            }
             return l;
         }
     }
@@ -155,15 +155,24 @@
             setContext (this);
         }
         
+        @Override
         public <T> List<? extends T> lookup(String folder, Class<T> service) 
{
             return new CompoundLookupList<T>(folder, service);
         }
         
         void setContext (Lookup context) {
-            if (l1 instanceof Compound) ((Compound) l1).setContext (context);
-            if (l1 instanceof MetaInf) ((MetaInf) l1).setContext (context);
-            if (l2 instanceof Compound) ((Compound) l2).setContext (context);
-            if (l2 instanceof MetaInf) ((MetaInf) l2).setContext (context);
+            if (l1 instanceof Compound) {
+                ((Compound) l1).setContext (context);
+            }
+            if (l1 instanceof MetaInf) {
+                ((MetaInf) l1).setContext (context);
+            }
+            if (l2 instanceof Compound) {
+                ((Compound) l2).setContext (context);
+            }
+            if (l2 instanceof MetaInf) {
+                ((MetaInf) l2).setContext (context);
+            }
         }
 
         @Override
@@ -283,24 +292,36 @@
                 }
             }
             
+            @Override
             public synchronized void setObject(Object bean) {
-                if (sublist1 != null) sublist1.setObject(bean);
-                if (sublist2 != null) sublist2.setObject(bean);
+                if (sublist1 != null) {
+                    sublist1.setObject(bean);
+                }
+                if (sublist2 != null) {
+                    sublist2.setObject(bean);
+                }
             }
 
+            @Override
             public synchronized void 
addPropertyChangeListener(PropertyChangeListener listener) {
                 if (propertyChangeListeners == null) {
                     propertyChangeListeners = new 
ArrayList<PropertyChangeListener>();
-                    if (sublist1 != null) 
sublist1.addPropertyChangeListener(this);
-                    if (sublist2 != null) 
sublist2.addPropertyChangeListener(this);
+                    if (sublist1 != null) {
+                        sublist1.addPropertyChangeListener(this);
+                    }
+                    if (sublist2 != null) {
+                        sublist2.addPropertyChangeListener(this);
+                    }
                 }
                 propertyChangeListeners.add(listener);
             }
 
+            @Override
             public synchronized void 
removePropertyChangeListener(PropertyChangeListener listener) {
                 propertyChangeListeners.remove(listener);
             }
 
+            @Override
             public void propertyChange(PropertyChangeEvent e) {
                 setUp();
                 List<PropertyChangeListener> listeners;
@@ -357,7 +378,9 @@
 
         
         MetaInf (String rootFolder) {
-            if (rootFolder != null && rootFolder.length() == 0) rootFolder = 
null;
+            if (rootFolder != null && rootFolder.length() == 0) {
+                rootFolder = null;
+            }
             this.rootFolder = rootFolder;
             moduleLookupResult = 
org.openide.util.Lookup.getDefault().lookupResult(ModuleInfo.class);
             //System.err.println("\nModules = 
"+moduleLookupResult.allInstances().size()+"\n");
@@ -372,6 +395,7 @@
             this.context = context;
         }
         
+        @Override
         public <T> List<? extends T> lookup(String folder, Class<T> service) 
{
             MetaInfLookupList<T> mll = new MetaInfLookupList<T>(folder, 
service);
             synchronized (lookupLists) {
@@ -446,19 +470,28 @@
                 while (e.hasMoreElements ()) {
                     URL url = e.nextElement();
                     // Ignore duplicated URLs, necessary because of tests
-                    if (urls.contains(url)) continue;
+                    if (urls.contains(url)) {
+                        continue;
+                    }
                     urls.add(url);
                     InputStream is = url.openStream ();
-                    if (is == null) continue;
+                    if (is == null) {
+                        continue;
+                    }
                     try {
                         BufferedReader br = new BufferedReader (
                             new InputStreamReader (is)
                         );
                         for (String s = br.readLine(); s != null; s = 
br.readLine()) {
-                            if (s.startsWith ("#")) continue;
-                            if (s.length () == 0) continue;
-                            if (verbose)
+                            if (s.startsWith ("#")) {
+                                continue;
+                            }
+                            if (s.length () == 0) {
+                                continue;
+                            }
+                            if (verbose) {
                                 v.append("\nR  service ").append(s).append(" 
found");
+                            }
 
                             l.add (s);
                         }
@@ -466,8 +499,9 @@
                         is.close();
                     }
                 }
-                if (verbose)
+                if (verbose) {
                     System.out.println (v.toString());
+                }
                 return l; 
             } catch (IOException e) {
                 e.printStackTrace ();
@@ -569,6 +603,7 @@
 
         private static Comparator<MetaInfLookupList> 
getMetaInfLookupListComparator(final boolean load) {
             return new Comparator<MetaInfLookupList>() {
+                @Override
                 public int compare(MetaInfLookupList l1, MetaInfLookupList 
l2) {
                     if (load) {
                         return l1.notifyLoadOrder - l2.notifyLoadOrder;
@@ -593,6 +628,7 @@
             }
 
             // Some module enabled or disabled
+            @Override
             public void propertyChange(PropertyChangeEvent evt) {
                 
//System.err.println("ModuleChangeListener.propertyChange("+evt+")");
                 //System.err.println("  getPropertyName = 
"+evt.getPropertyName()+", source = "+evt.getSource());
@@ -618,6 +654,7 @@
                     if (mi.isEnabled()) {
                         if (refreshListEnabled == null) {
                             refreshListEnabled = RP.create(new Runnable() {
+                                @Override
                                 public void run() { refreshLists(true); }
                             });
                         }
@@ -625,6 +662,7 @@
                     } else {
                         if (refreshListDisabled == null) {
                             refreshListDisabled = RP.create(new Runnable() {
+                                @Override
                                 public void run() { refreshLists(false); }
                             });
                         }
@@ -635,6 +673,7 @@
             }
 
             // Some new modules installed or old uninstalled
+            @Override
             public void resultChanged(LookupEvent ev) {
                 clearCaches(null);
                 synchronized (moduleChangeListeners) {
@@ -678,6 +717,7 @@
                 this.service = service;
                 fillInstances(l, lr, s);
                 RP.post(new Runnable() {
+                    @Override
                     public void run() {
                         // This may take a while...
                         listenOnDisabledModules();
@@ -687,8 +727,12 @@
             
             private void fillInstances(List<String> l, Result<T> lr, 
Set<String> s) {
                 for (String className : l) {
-                    if (className.endsWith(HIDDEN)) continue;
-                    if (s != null && s.contains (className)) continue;
+                    if (className.endsWith(HIDDEN)) {
+                        continue;
+                    }
+                    if (s != null && s.contains (className)) {
+                        continue;
+                    }
                     fillClassInstance(className);
                 }
                 for (Item<T> li : lr.allItems()) {
@@ -697,7 +741,9 @@
                     String serviceName = getServiceName(li.getId());
                     //System.err.println("ID = '"+li.getId()+"' => 
serviceName = '"+serviceName+"'");
                     // We do not recognize method calls correctly
-                    if (s != null && (s.contains (serviceName) || s.contains 
(serviceName+"()"))) continue;
+                    if (s != null && (s.contains (serviceName) || s.contains 
(serviceName+"()"))) {
+                        continue;
+                    }
                     //add(new LazyInstance<T>(service, li));
                     fillServiceInstance(li);
                 }
@@ -714,8 +760,11 @@
 
             private String getServiceName(String itemId) {
                 int i = itemId.lastIndexOf('/');
-                if (i < 0) i = 0;
-                else i++; // Skip '/'
+                if (i < 0) {
+                    i = 0;
+                } else {
+                    i++;
+                } // Skip '/'
                 String serviceName = itemId.substring(i);
                 boolean isMethodCall = serviceName.indexOf('.') > 0;
                 serviceName = serviceName.replace('-', '.');
@@ -726,7 +775,7 @@
             }
 
             private void fillClassInstance(String className) {
-                Object instance = null;
+                Object instance;
                 synchronized(instanceCache) {
                     instance = instanceCache.get (className);
                 }
@@ -745,7 +794,9 @@
             private String getClassName(Item li) {
                 String id = li.getId();
                 int i = id.lastIndexOf("/");
-                if (i >= 0) id = id.substring(i+1);
+                if (i >= 0) {
+                    id = id.substring(i+1);
+                }
                 return id.replace('-', '.');
             }
 
@@ -925,6 +976,7 @@
                 };
             }*/
             
+            @Override
             public void setObject(Object bean) {
                 if (NOTIFY_LOAD_FIRST == bean) {
                     notifyLoadOrder = -1;
@@ -939,6 +991,7 @@
                 }
             }
 
+            @Override
             public synchronized void 
addPropertyChangeListener(PropertyChangeListener listener) {
                 if (propertyChangeListeners == null) {
                     propertyChangeListeners = new 
ArrayList<PropertyChangeListener>();
@@ -946,6 +999,7 @@
                 propertyChangeListeners.add(listener);
             }
 
+            @Override
             public synchronized void 
removePropertyChangeListener(PropertyChangeListener listener) {
                 propertyChangeListeners.remove(listener);
             }
@@ -982,6 +1036,7 @@
 
                 private final Object instanceCreationLock = new Object();
                 
+                @Override
                 protected T getEntry() {
                     Object instance = null;
                     if (lookupItem != null) {
@@ -1180,8 +1235,7 @@
                     if (newHiddenClassNames != null) {
                         //System.err.println("\nLookupList.addAll("+c+"), 
hiddenClassNames = "+hiddenClassNames+" + "+newHiddenClassNames);
                         // Check the instances we have and remove the newly 
hidden ones:
-                        for (Iterator it = newHiddenClassNames.iterator(); 
it.hasNext(); ) {
-                            String className = (String) it.next();
+                        for (String className : newHiddenClassNames) {
                             String className2 = null;
                             if (className.endsWith("()")) {
                                 className2 = className.substring(0, 
className.length() - 2);
@@ -1233,6 +1287,7 @@
         }
 
         protected abstract class LookupLazyEntry<T> extends LazyEntry<T> {
+            @Override
             protected final T get() {
                 T e = getEntry();
                 synchronized (LookupList.this) {
diff --git a/api.debugger/src/org/netbeans/spi/debugger/ActionsProvider.java 
b/api.debugger/src/org/netbeans/spi/debugger/ActionsProvider.java
--- a/api.debugger/src/org/netbeans/spi/debugger/ActionsProvider.java
+++ b/api.debugger/src/org/netbeans/spi/debugger/ActionsProvider.java
@@ -124,6 +124,7 @@
     public void postAction (final Object action,
                             final Runnable actionPerformedNotifier) {
         debuggerActionsRP.post(new Runnable() {
+            @Override
             public void run() {
                 try {
                     doAction(action);
@@ -301,7 +302,7 @@
                 actionsDelegate = delegate;
                 if (actionsDelegate == null) {
                     listeners.remove(l);
-                    if (listeners.size() == 0 && contextDispatcherListener 
!= null) {
+                    if (listeners.isEmpty() && contextDispatcherListener != 
null) {
                         detachContextDispatcherListener();
                     }
                     return ;
@@ -310,6 +311,7 @@
             actionsDelegate.removeActionsProviderListener(l);
         }
 
+        @Override
         public ActionsProvider forContext(ContextProvider context) {
             if (context == this.context) {
                 return this;
@@ -351,14 +353,20 @@
             if (strArray == null) {
                 return null;
             }
-            if (strArray.startsWith("[")) strArray = strArray.substring(1);
-            if (strArray.endsWith("]")) strArray = strArray.substring(0, 
strArray.length() - 1);
+            if (strArray.startsWith("[")) {
+                strArray = strArray.substring(1);
+            }
+            if (strArray.endsWith("]")) {
+                strArray = strArray.substring(0, strArray.length() - 1);
+            }
             strArray = strArray.trim();
             int index = 0;
             List<String> strings = new ArrayList<String>();
             while (index < strArray.length()) {
                 int index2 = strArray.indexOf(',', index);
-                if (index2 < 0) index2 = strArray.length();
+                if (index2 < 0) {
+                    index2 = strArray.length();
+                }
                 if (index2 > index) {
                     String s = strArray.substring(index, index2).trim();
                     if (s.length() > 0) { // Can be trimmed to 0 length

[hg] main-silver: Some code warnings removed.

mentlicher 12/01/2012

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close