Bug 67888 - Generify Lookup APIs
Generify Lookup APIs
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Lookup
5.x
All All
: P1 (vote)
: 6.x
Assigned To: Jaroslav Tulach
issues@platform
: API_REVIEW_FAST
: 73573 (view as bug list)
Depends on: 73573 74348
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-01 10:02 UTC by Jaroslav Tulach
Modified: 2008-12-22 20:59 UTC (History)
1 user (show)

See Also:
Issue Type: TASK
:


Attachments
Changes in openide/util to have generified Lookup interface (10.29 KB, patch)
2006-03-13 08:46 UTC, Jaroslav Tulach
Details | Diff
Patch fixing everything in openide/util including lookup and all warnings (226.42 KB, patch)
2006-03-17 20:18 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2005-11-01 10:02:41 UTC
For people writing modules on top of java5 it would be excelent to have 
support for generic versions of certain API interfaces, especially Lookup.
Comment 1 Jaroslav Tulach 2005-11-01 11:04:27 UTC
The Lookup has been generified on a branch. Currently just three files are 
branched (while the common.xml is needed just to enable -Xlint:unchecked): 
nbbuild/templates/common.xml 
openide/util/nbproject/project.properties 
openide/util/src/org/openide/util/Lookup.java 
the name of the branch is generic_67888 and its root is generic_67888_root 
Comment 2 Jaroslav Tulach 2006-03-13 08:46:10 UTC
Created attachment 29222 [details]
Changes in openide/util to have generified Lookup interface
Comment 3 Jaroslav Tulach 2006-03-13 08:53:55 UTC
Trung builds are now switched to Java5 and we so slowly start to use new 
features of Java5. There are many things to updated, but one of the most 
externally visible things to change is to generify our APIs. And where else 
shall we start than with an API that everyone uses and everyone relies on - 
Lookup.

The Lookup is an example of an API that greatly benefits from usage of 
generics. It turns out that the one can completely remove all casts if using 
Java5 and new "generified" version of lookup interface. This is a great 
improvement to original state where casts were necessary to achieve anything 
when using Lookup API.

There are two puproses of the review:
#1 - review the API change and confirm that is it using Java5 generics 
correctly, I'd like to ask people with insight into Java5 to add comment into 
this issue

#2 - identify necessary precondition that need to be fulfilled before the API 
change can be merged into the trunk. If anyones sees any blocker, please 
report it as separate issue and make this one depend on it.

Long live generics!
Comment 4 Jesse Glick 2006-03-13 12:49:03 UTC
How does new Lookup.Template(null, ...) work? Can you do e.g.

new Lookup.Template((Class<Object>) null, ...)

instead?

Should Result.allClasses return Set<Class<? extends T>> instead? And similarly
Item.getType might return Class<? extends T>? I think it is OK for
Lookup.Result.allInstances to return simply Collection<T> but Collection<?
extends T> could also be considered - AFAIK only affects subclassers.

Some other related things like certain Lookups.* methods, LookupEvent, etc.
probably need to be generified too. Otherwise looks fine.

BTW I know of a number of other APIs in openide/util that need to be generified.
E.g.: WeakSet, Enumerations, Utilities.topologicalSort,
Utilities.activeReferenceQueue, Mutex.{,Exception}Action and methods which use
them, NbBundle.getLocalizedValue, Queue, SharedClassObject.findObject,
WeakListeners.create, SystemAction.get, maybe a few others. Should these be
handled here, or file them separately?
Comment 5 ivan 2006-03-13 21:22:47 UTC
What aboud pseudo-lookup interfaces like
debuggercore...org.netbeans.spi.debugger.ContextProvider?
Comment 6 Jaroslav Tulach 2006-03-14 07:05:03 UTC
Re: debuggercore - unrelated to this effort, someone needs to file another 
issue.

Re: "number of other APIs in openide/util" - imho it is better to track them 
separately. Doing one big review would give a change for a lot of small 
mistakes to sneak in.

Re: "Class<? extends T>" - right this is necessary. Thanks.
Re: "Collection<? extends T>" - this is not necessary at all, but it may be 
helpful as in fact it defacto turns the returned collection into immutable one 
(except c.add(null)). 

Anyway I am going to also change the implementation of AbstractLookup to 
generics and make it without warnings - that way we'll be more sure the types 
are right. 

I've just branched the whole openide/util to generic_67888 with root 
generic_67888_root
Comment 7 Jaroslav Tulach 2006-03-14 12:18:17 UTC
Before any cleanup of API happens, we need to start to use 1.5 internally - 
issue 73573 is here to track that task.
Comment 8 Jaroslav Tulach 2006-03-17 20:18:32 UTC
Created attachment 29299 [details]
Patch fixing everything in openide/util including lookup and all warnings
Comment 9 Jaroslav Tulach 2006-03-17 20:23:20 UTC
The changes are available in the generic_67888 branch, if there are no major 
objections I merge to trunk on Tuesday.
Comment 10 Jaroslav Tulach 2006-03-21 08:17:50 UTC
Ok, thanks for all your feedback.
Comment 11 Jaroslav Tulach 2006-03-21 08:18:54 UTC
*** Issue 73573 has been marked as a duplicate of this issue. ***
Comment 12 Jaroslav Tulach 2006-03-21 08:20:30 UTC
IDE:-------------------------------------------------
IDE: [21.3.06 9:16] Committing started
Checking in src/org/openide/util/IconManager.java;
/cvs/openide/util/src/org/openide/util/IconManager.java,v  <--  
IconManager.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/Utilities.java;
/cvs/openide/util/src/org/openide/util/Utilities.java,v  <--  Utilities.java
new revision: 1.11; previous revision: 1.10
done
Checking in src/org/openide/util/TimedSoftReference.java;
/cvs/openide/util/src/org/openide/util/TimedSoftReference.java,v  <--  
TimedSoftReference.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/UtilitiesCompositeActionMap.java;
/cvs/openide/util/src/org/openide/util/UtilitiesCompositeActionMap.java,v  <--  
UtilitiesCompositeActionMap.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/WeakListenerImpl.java;
/cvs/openide/util/src/org/openide/util/WeakListenerImpl.java,v  <--  
WeakListenerImpl.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/openide/util/RE13.java;
/cvs/openide/util/src/org/openide/util/RE13.java,v  <--  RE13.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/Task.java;
/cvs/openide/util/src/org/openide/util/Task.java,v  <--  Task.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/Enumerations.java;
/cvs/openide/util/src/org/openide/util/Enumerations.java,v  <--  
Enumerations.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/Lookup.java;
/cvs/openide/util/src/org/openide/util/Lookup.java,v  <--  Lookup.java
new revision: 1.6; previous revision: 1.5
done
Checking in src/org/openide/util/RequestProcessor.java;
/cvs/openide/util/src/org/openide/util/RequestProcessor.java,v  <--  
RequestProcessor.java
new revision: 1.13; previous revision: 1.12
done
Checking in src/org/openide/util/Queue.java;
/cvs/openide/util/src/org/openide/util/Queue.java,v  <--  Queue.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/WeakSet.java;
/cvs/openide/util/src/org/openide/util/WeakSet.java,v  <--  WeakSet.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/NbBundle.java;
/cvs/openide/util/src/org/openide/util/NbBundle.java,v  <--  NbBundle.java
new revision: 1.7; previous revision: 1.6
done
Checking in src/org/openide/util/Mutex.java;
/cvs/openide/util/src/org/openide/util/Mutex.java,v  <--  Mutex.java
new revision: 1.7; previous revision: 1.6
done
Checking in src/org/openide/util/TopologicalSortException.java;
/cvs/openide/util/src/org/openide/util/TopologicalSortException.java,v  <--  
TopologicalSortException.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/WeakListeners.java;
/cvs/openide/util/src/org/openide/util/WeakListeners.java,v  <--  
WeakListeners.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/SharedClassObject.java;
/cvs/openide/util/src/org/openide/util/SharedClassObject.java,v  <--  
SharedClassObject.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/openide/util/actions/CallbackSystemAction.java;
/cvs/openide/util/src/org/openide/util/actions/CallbackSystemAction.java,v  
<--  CallbackSystemAction.java
new revision: 1.7; previous revision: 1.6
done
Checking in src/org/openide/util/actions/CallableSystemAction.java;
/cvs/openide/util/src/org/openide/util/actions/CallableSystemAction.java,v  
<--  CallableSystemAction.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/openide/util/actions/SystemAction.java;
/cvs/openide/util/src/org/openide/util/actions/SystemAction.java,v  <--  
SystemAction.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/openide/util/lookup/InstanceContent.java;
/cvs/openide/util/src/org/openide/util/lookup/InstanceContent.java,v  <--  
InstanceContent.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/lookup/WaitableResult.java;
/cvs/openide/util/src/org/openide/util/lookup/WaitableResult.java,v  <--  
WaitableResult.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/lookup/SimpleProxyLookup.java;
/cvs/openide/util/src/org/openide/util/lookup/SimpleProxyLookup.java,v  <--  
SimpleProxyLookup.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/openide/util/lookup/Lookups.java;
/cvs/openide/util/src/org/openide/util/lookup/Lookups.java,v  <--  
Lookups.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/lookup/ExcludingLookup.java;
/cvs/openide/util/src/org/openide/util/lookup/ExcludingLookup.java,v  <--  
ExcludingLookup.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/lookup/DelegatingStorage.java;
/cvs/openide/util/src/org/openide/util/lookup/DelegatingStorage.java,v  <--  
DelegatingStorage.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/lookup/InheritanceTree.java;
/cvs/openide/util/src/org/openide/util/lookup/InheritanceTree.java,v  <--  
InheritanceTree.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/lookup/MetaInfServicesLookup.java;
/cvs/openide/util/src/org/openide/util/lookup/MetaInfServicesLookup.java,v  
<--  MetaInfServicesLookup.java
new revision: 1.4; previous revision: 1.3
done
Checking in src/org/openide/util/lookup/AbstractLookup.java;
/cvs/openide/util/src/org/openide/util/lookup/AbstractLookup.java,v  <--  
AbstractLookup.java
new revision: 1.7; previous revision: 1.6
done
Checking in src/org/openide/util/lookup/ArrayStorage.java;
/cvs/openide/util/src/org/openide/util/lookup/ArrayStorage.java,v  <--  
ArrayStorage.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/lookup/ALPairComparator.java;
/cvs/openide/util/src/org/openide/util/lookup/ALPairComparator.java,v  <--  
ALPairComparator.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/util/lookup/SimpleLookup.java;
/cvs/openide/util/src/org/openide/util/lookup/SimpleLookup.java,v  <--  
SimpleLookup.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/openide/util/lookup/ProxyLookup.java;
/cvs/openide/util/src/org/openide/util/lookup/ProxyLookup.java,v  <--  
ProxyLookup.java
new revision: 1.7; previous revision: 1.6
done
Checking in test/unit/src/org/openide/util/UtilitiesTopologicalSortTest.java;
/cvs/openide/util/test/unit/src/org/openide/util/UtilitiesTopologicalSortTest.java,v  
<--  UtilitiesTopologicalSortTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in test/unit/src/org/openide/util/WeakListenersTest.java;
/cvs/openide/util/test/unit/src/org/openide/util/WeakListenersTest.java,v  <--  
WeakListenersTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/openide/util/datatransfer/ExTransferable.java;
/cvs/openide/util/src/org/openide/util/datatransfer/ExTransferable.java,v  <--  
ExTransferable.java
new revision: 1.3; previous revision: 1.2
done
Checking in src/org/openide/util/io/NbObjectOutputStream.java;
/cvs/openide/util/src/org/openide/util/io/NbObjectOutputStream.java,v  <--  
NbObjectOutputStream.java
new revision: 1.4; previous revision: 1.3
done
Checking in 
test/unit/src/org/openide/util/lookup/AbstractLookupMemoryTest.java;
/cvs/openide/util/test/unit/src/org/openide/util/lookup/AbstractLookupMemoryTest.java,v  
<--  AbstractLookupMemoryTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in nbproject/project.properties;
/cvs/openide/util/nbproject/project.properties,v  <--  project.properties
new revision: 1.10; previous revision: 1.9
done
Checking in src/org/openide/ServiceType.java;
/cvs/openide/util/src/org/openide/ServiceType.java,v  <--  ServiceType.java
new revision: 1.4; previous revision: 1.3
done
Checking in src/org/openide/ErrorManager.java;
/cvs/openide/util/src/org/openide/ErrorManager.java,v  <--  ErrorManager.java
new revision: 1.4; previous revision: 1.3
done
Checking in src/org/openide/xml/EntityCatalog.java;
/cvs/openide/util/src/org/openide/xml/EntityCatalog.java,v  <--  
EntityCatalog.java
new revision: 1.2; previous revision: 1.1
done
Checking in src/org/openide/xml/XMLUtil.java;
/cvs/openide/util/src/org/openide/xml/XMLUtil.java,v  <--  XMLUtil.java
new revision: 1.10; previous revision: 1.9
done
IDE: [21.3.06 9:16] Committing finished
Comment 13 Jesse Glick 2006-03-21 23:15:31 UTC
Changes used successfully in Ant module, which now compiles without warnings.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo