From 27a48fcbd5857e4a8fae6a1c93abde62563e4b78 Mon Sep 17 00:00:00 2001 From: BradWalker Date: Sat, 11 Jan 2025 12:40:24 -0700 Subject: [PATCH] Cleanup warnings that are related to the use of a Result raw type.. Warnings like this: [repeat] /home/bwalker/src/netbeans/ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java:107: warning: [rawtypes] found raw type: Result [repeat] private Lookup.Result colorSource; [repeat] ^ [repeat] missing type arguments for generic class Result [repeat] where T is a type-variable: [repeat] T extends Object declared in class Result This pull request reduces many of those warnings. --- .../api/client/WebServicesClientSupport.java | 3 ++- .../api/client/WebServicesClientView.java | 2 +- .../api/jaxws/client/JAXWSClientSupport.java | 2 +- .../api/jaxws/client/JAXWSClientView.java | 3 ++- .../ProjectTestRestServicesAction.java | 2 +- .../css/visual/CssStylesTCController.java | 2 +- .../editor/fold/ui/FoldViewFactory.java | 2 +- .../xml/api/model/GrammarQueryManager.java | 7 ++++--- .../org/openide/explorer/DefaultEMLookup.java | 12 +++++------ .../openide/loaders/InstanceDataObject.java | 4 ++-- .../loaders/XMLDataObjectInfoParser.java | 6 +++--- .../org/openide/util/lookup/ProxyLookup.java | 20 +++++++++---------- 12 files changed, 34 insertions(+), 31 deletions(-) diff --git a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientSupport.java b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientSupport.java index 57b29ff197f2..c0a92c70fa5b 100644 --- a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientSupport.java +++ b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientSupport.java @@ -38,6 +38,7 @@ import org.netbeans.modules.websvc.spi.client.WebServicesClientSupportImpl; import org.netbeans.modules.websvc.spi.client.WebServicesClientSupportProvider; import org.netbeans.modules.websvc.client.WebServicesClientSupportAccessor; +import org.netbeans.modules.websvc.spi.client.WebServicesClientViewProvider; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; @@ -56,7 +57,7 @@ public final class WebServicesClientSupport { public static final String WSCLIENTUPTODATE_CLASSPATH = "wsclientuptodate.classpath"; private WebServicesClientSupportImpl impl; - private static final Lookup.Result implementations = + private static final Lookup.Result implementations = Lookup.getDefault().lookupResult(WebServicesClientSupportProvider.class); static { diff --git a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientView.java b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientView.java index 48dd2dc3de69..311c9a5865cf 100644 --- a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientView.java +++ b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/client/WebServicesClientView.java @@ -41,7 +41,7 @@ public final class WebServicesClientView { private WebServicesClientViewImpl impl; - private static final Lookup.Result implementations = + private static final Lookup.Result implementations = Lookup.getDefault().lookupResult(WebServicesClientViewProvider.class); static { diff --git a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientSupport.java b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientSupport.java index 342344a41bf8..4c1694cacad3 100644 --- a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientSupport.java +++ b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientSupport.java @@ -44,7 +44,7 @@ public final class JAXWSClientSupport { private JAXWSClientSupportImpl impl; - private static final Lookup.Result implementations = + private static final Lookup.Result implementations = Lookup.getDefault().lookupResult(WebServicesClientSupportProvider.class); static { diff --git a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientView.java b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientView.java index 6053c25f3fbb..59f340fa8721 100644 --- a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientView.java +++ b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/api/jaxws/client/JAXWSClientView.java @@ -21,6 +21,7 @@ import java.util.Iterator; import org.netbeans.modules.websvc.jaxws.client.JAXWSClientViewAccessor; +import org.netbeans.modules.websvc.spi.client.WebServicesClientViewProvider; import org.netbeans.modules.websvc.spi.jaxws.client.JAXWSClientViewImpl; import org.netbeans.modules.websvc.spi.jaxws.client.JAXWSClientViewProvider; import org.openide.util.Lookup; @@ -39,7 +40,7 @@ public final class JAXWSClientView { private JAXWSClientViewImpl impl; - private static final Lookup.Result implementations = + private static final Lookup.Result implementations = Lookup.getDefault().lookupResult(JAXWSClientViewProvider.class); static { diff --git a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/projects/ProjectTestRestServicesAction.java b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/projects/ProjectTestRestServicesAction.java index 2918aca4b67f..b2a7f490fafc 100644 --- a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/projects/ProjectTestRestServicesAction.java +++ b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/projects/ProjectTestRestServicesAction.java @@ -53,7 +53,7 @@ public class ProjectTestRestServicesAction extends AbstractAction implements Pre private JMenuItem menuPresenter; private Lookup lookup; private Class[] watch; - private Lookup.Result results[]; + private Lookup.Result[] results; private boolean needsRefresh = true; private boolean initialized = false; private boolean refreshing = false; diff --git a/ide/css.visual/src/org/netbeans/modules/css/visual/CssStylesTCController.java b/ide/css.visual/src/org/netbeans/modules/css/visual/CssStylesTCController.java index 5ea183e7b793..811f3e8afe2d 100644 --- a/ide/css.visual/src/org/netbeans/modules/css/visual/CssStylesTCController.java +++ b/ide/css.visual/src/org/netbeans/modules/css/visual/CssStylesTCController.java @@ -172,7 +172,7 @@ static TopComponentGroup getCssStylesTCGroup() { public final void resultChanged(LookupEvent ev) { PageInspector pageInspector = PageInspector.getDefault(); if (pageInspector != null) { - Lookup.Result lookupResult = (Lookup.Result) ev.getSource(); + Lookup.Result lookupResult = (Lookup.Result) ev.getSource(); lookupResult.removeLookupListener(this); pageInspector.addPropertyChangeListener(this); } diff --git a/ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java b/ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java index c729e3e87472..9dbdefcf70aa 100644 --- a/ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java +++ b/ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java @@ -104,7 +104,7 @@ public static void register() { /** * Lookup results for color settings, being listened for changes. */ - private Lookup.Result colorSource; + private Lookup.Result colorSource; private Preferences prefs; diff --git a/ide/xml.core/src/org/netbeans/modules/xml/api/model/GrammarQueryManager.java b/ide/xml.core/src/org/netbeans/modules/xml/api/model/GrammarQueryManager.java index 058fb3c1aed0..1c1b6ae72382 100644 --- a/ide/xml.core/src/org/netbeans/modules/xml/api/model/GrammarQueryManager.java +++ b/ide/xml.core/src/org/netbeans/modules/xml/api/model/GrammarQueryManager.java @@ -108,7 +108,7 @@ private static class DefaultQueryManager extends GrammarQueryManager { private static final String FOLDER = "Plugins/XML/GrammarQueryManagers";// NOI18N - private Lookup.Result registrations; + private Lookup.Result registrations; private static ThreadLocal transaction = new ThreadLocal(); @@ -145,8 +145,9 @@ public GrammarQuery getGrammar(GrammarEnvironment ctx) { } } + @Override public Enumeration enabled(GrammarEnvironment ctx) { - Iterator it = getRegistrations(); + Iterator it = getRegistrations(); transaction.set(null); List list = new ArrayList<>(5); { @@ -172,7 +173,7 @@ public Enumeration enabled(GrammarEnvironment ctx) { return null; } - private synchronized Iterator getRegistrations() { + private synchronized Iterator getRegistrations() { if (registrations != null) { return registrations.allInstances().iterator(); } diff --git a/platform/openide.explorer/src/org/openide/explorer/DefaultEMLookup.java b/platform/openide.explorer/src/org/openide/explorer/DefaultEMLookup.java index 5f7b62625565..a204e2794e99 100644 --- a/platform/openide.explorer/src/org/openide/explorer/DefaultEMLookup.java +++ b/platform/openide.explorer/src/org/openide/explorer/DefaultEMLookup.java @@ -47,7 +47,7 @@ final class DefaultEMLookup extends ProxyLookup implements LookupListener, Prope private LookupListener listener; /** Map of (Node -> node Lookup.Result) the above lookup listener is attached to */ - private Map attachedTo; + private Map> attachedTo; /** action map for the top component */ private Lookup actionMap; @@ -78,7 +78,7 @@ public void updateLookups(Node[] arr) { Lookup[] lookups = new Lookup[arr.length]; - Map copy; + Map> copy; synchronized (this) { if (attachedTo == null) { @@ -97,8 +97,8 @@ public void updateLookups(Node[] arr) { } } - for (Iterator it = copy.values().iterator(); it.hasNext();) { - Lookup.Result res = it.next(); + for (Iterator> it = copy.values().iterator(); it.hasNext();) { + Lookup.Result res = it.next(); res.removeLookupListener(listener); } @@ -126,10 +126,10 @@ protected synchronized void beforeLookup(Template t) { if ((attachedTo == null) && isNodeQuery(t.getType())) { Lookup[] arr = getLookups(); - attachedTo = new WeakHashMap(arr.length * 2); + attachedTo = new WeakHashMap<>(arr.length * 2); for (int i = 0; i < (arr.length - 2); i++) { - Lookup.Result res = arr[i].lookup(t); + Lookup.Result res = arr[i].lookup(t); res.addLookupListener(listener); attachedTo.put(arr[i], res); } diff --git a/platform/openide.loaders/src/org/openide/loaders/InstanceDataObject.java b/platform/openide.loaders/src/org/openide/loaders/InstanceDataObject.java index 1ea22c3998af..d0e5e30c5d55 100644 --- a/platform/openide.loaders/src/org/openide/loaders/InstanceDataObject.java +++ b/platform/openide.loaders/src/org/openide/loaders/InstanceDataObject.java @@ -671,8 +671,8 @@ public Lookup getLookup() { } } - private Lookup.Result cookieResult = null; - private Lookup.Result nodeResult = null; + private Lookup.Result cookieResult = null; + private Lookup.Result nodeResult = null; private Lookup cookiesLkp = null; private LookupListener cookiesLsnr = null; private LookupListener nodeLsnr = null; diff --git a/platform/openide.loaders/src/org/openide/loaders/XMLDataObjectInfoParser.java b/platform/openide.loaders/src/org/openide/loaders/XMLDataObjectInfoParser.java index 14c22cc5d4bb..d1012fb4c097 100644 --- a/platform/openide.loaders/src/org/openide/loaders/XMLDataObjectInfoParser.java +++ b/platform/openide.loaders/src/org/openide/loaders/XMLDataObjectInfoParser.java @@ -95,7 +95,7 @@ private static class StopSaxException extends SAXException { private Reference xml; private String parsedId; private Lookup lookup; - private Lookup.Result result; + private Lookup.Result result; private ThreadLocal> QUERY = new ThreadLocal>(); XMLDataObjectInfoParser(XMLDataObject xml) { @@ -151,7 +151,7 @@ public Object lookupCookie(final Class clazz) { break; } } - Lookup.Result r = result; + Lookup.Result r = result; if (r != null) { if (XMLDataObject.ERR.isLoggable(Level.FINE)) { XMLDataObject.ERR.fine("Querying the result: " + r); @@ -327,7 +327,7 @@ private Lookup updateLookup(XMLDataObject realXML, String previousID, String id) } } synchronized (this) { - Lookup.Result prevRes = result; + Lookup.Result prevRes = result; lookup = newLookup; if (XMLDataObject.ERR.isLoggable(Level.FINE)) { XMLDataObject.ERR.fine("Shared lookup updated: " + lookup + " for " + realXML); diff --git a/platform/openide.util.lookup/src/org/openide/util/lookup/ProxyLookup.java b/platform/openide.util.lookup/src/org/openide/util/lookup/ProxyLookup.java index aad92b784c0b..c11b6d5ee754 100644 --- a/platform/openide.util.lookup/src/org/openide/util/lookup/ProxyLookup.java +++ b/platform/openide.util.lookup/src/org/openide/util/lookup/ProxyLookup.java @@ -197,8 +197,8 @@ protected final void setLookups(Executor notifyIn, Lookup... lookups) { Set current; Lookup[] old; - Map toRemove = new IdentityHashMap(); - Map toAdd = new IdentityHashMap(); + Map,LookupListener> toRemove = new IdentityHashMap<>(); + Map,LookupListener> toAdd = new IdentityHashMap<>(); ImmutableInternalData orig; synchronized (ProxyLookup.this) { @@ -211,16 +211,16 @@ protected final void setLookups(Executor notifyIn, Lookup... lookups) { } // better to do this later than in synchronized block - for (Map.Entry e : toRemove.entrySet()) { + for (Map.Entry, LookupListener> e : toRemove.entrySet()) { e.getKey().removeLookupListener(e.getValue()); } - for (Map.Entry e : toAdd.entrySet()) { + for (Map.Entry, LookupListener> e : toAdd.entrySet()) { e.getKey().addLookupListener(e.getValue()); } // this cannot be done from the synchronized block - final ArrayList evAndListeners = new ArrayList(); + final List evAndListeners = new ArrayList<>(); for (Reference ref : arr) { R r = ref.get(); if (r != null) { @@ -340,7 +340,7 @@ private ImmutableInternalData getData() { private Collection> setData( ImmutableInternalData newData, Lookup[] current, - Map toAdd, Map toRemove + Map,LookupListener> toAdd, Map,LookupListener> toRemove ) { assert Thread.holdsLock(ProxyLookup.this); assert newData != null; @@ -487,7 +487,7 @@ private Result[] initResults() { final void lookupChange( ImmutableInternalData newData, Lookup[] current, ImmutableInternalData oldData, Set added, Set removed, - Map toAdd, Map toRemove + Map,LookupListener> toAdd, Map,LookupListener> toRemove ) { if (weakL.getResults() == null) { // not computed yet, do not need to do anything @@ -497,7 +497,7 @@ final void lookupChange( Lookup[] old = oldData.getLookups(false); // map (Lookup, Lookup.Result) - Map> map = new IdentityHashMap>(old.length * 2); + Map> map = new IdentityHashMap<>(old.length * 2); for (int i = 0; i < old.length; i++) { if (removed.contains(old[i])) { @@ -609,7 +609,7 @@ private Collection computeResult(int indexToCache, boolean callBeforeLookup) { } } // if caches exist, wait for finished - Lookup.Result[] arr = myBeforeLookup(callBeforeLookup, cachedResult != null); + Lookup.Result[] arr = myBeforeLookup(callBeforeLookup, cachedResult != null); // use caches, if they exist Collection[] cc; synchronized (proxy()) { @@ -1117,7 +1117,7 @@ private static class LazyCollection implements Collection { private final Object[] cc; private final int indexToCache; private final boolean callBeforeLookup; - private final Lookup.Result[] arr; + private final Lookup.Result[] arr; /** GuardedBy("this") */ private final Collection[] computed; /** GuardedBy("this") */