Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 73573 - Use 1.5 lang features in openide/util internally
Use 1.5 lang features in openide/util internally
Status: RESOLVED DUPLICATE of bug 67888
Product: platform
Classification: Unclassified
Component: -- Other --
All All
: P1 (vote)
: 6.x
Assigned To: apireviews
Depends on:
Blocks: 67888
  Show dependency treegraph
Reported: 2006-03-14 12:09 UTC by Jaroslav Tulach
Modified: 2008-12-22 19:00 UTC (History)
2 users (show)

See Also:
Issue Type: TASK

The patch to allow javac.source=1.5 without a bunch of warnings (90.81 KB, patch)
2006-03-15 13:02 UTC, Jaroslav Tulach
Details | Diff
Fix for everything even APIs except Lookup (88.08 KB, patch)
2006-03-16 13:24 UTC, Jaroslav Tulach
Details | Diff
Same as previous, just better type for topologicalSort (91.86 KB, patch)
2006-03-16 13:53 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 2006-03-14 12:09:12 UTC
openide/util offers a bunch of APIs that are candidates to be converted to 
generics. However no attempt like that can happen until we clean up the code 
base and start to use 1.5 generified libraries internally - e.g. until we 
remove all the warnings produced by 1.5 javac running with -Xlint check on.

This patch removes or at leasts supresses all the warnings for all classes 
except those that are Lookup related (this is going to be solved by work in 
issue 67888). It intends to do minimal changes to public signatures. The only 
ones are: Enumerations.empty() and modification of WeakSet to match Set<T> 
contract[1]. The rest of the warnings has been supressed and marked with "// 
NEED.*API comment" they will be fixed as soon as we decide to modify those 

[1] without the second change we could not fix a lot of other code  that uses 
Comment 1 Jesse Glick 2006-03-15 09:44:50 UTC
Sounds good.

For tracking purposes, from 67888, API-visible generics changes possible in

WeakSet, Enumerations, Utilities.topologicalSort,
Utilities.activeReferenceQueue, Mutex.{,Exception}Action and methods which use
them, NbBundle.getLocalizedValue, Queue, SharedClassObject.findObject,
WeakListeners.create, SystemAction.get.

Others: use varargs for NbBundle.getMessage(Class,String,Object...) and
Comment 2 Jaroslav Tulach 2006-03-15 13:02:13 UTC
Created attachment 29248 [details]
The patch to allow javac.source=1.5 without a bunch of warnings
Comment 3 Jaroslav Tulach 2006-03-15 13:03:04 UTC
I'd like to apply the UsageOf15InUtilities.diff first and then move to other 
fixes in the API of openide/util
Comment 4 Jesse Glick 2006-03-15 15:08:07 UTC
BTW diff -u is a lot easier to read for this kind of patch.

Value types of IconManager.{map,localizedMap} could use union type.

@SuppressWarnings should not be needed on IconManager.ActiveRef if we fix

Enumerations.empty() could read

return Collections.enumeration(Collections.<T>emptyList());

More to come...
Comment 5 Jesse Glick 2006-03-15 16:55:13 UTC
Why is WeakSet.Entry not <E>? IMHO all of should compile without
warnings, no?

TimedSoftReference can be fully generified - it is not public.

NbBundle.propsToStringMap could be written to actually wrap its arg in a
type-safe proxy map (not copy).

Generally I think it would be a bit simpler to update the APIs to be generic at
the same time as you update the impl, because in a lot of cases you have to do
some hacks to make the impl generic and the API nongeneric. For example, if
SharedClassObject was fixed, to use

public static <T extends SharedClassObject> T findObject(Class<T>, boolean);

then the impl would be cleaner since SetAccessibleAction would be
SetAccessibleAction<T extends SharedClassObject> implements
PrivilegedExceptionAction<T> and be constructed using Class<T>, so e.g. the
SharedClassObject.class.cast call would be unnecessary. (In this case the impl
will get more complicated because of the static cache, but...)
Comment 6 Jaroslav Tulach 2006-03-16 13:24:06 UTC
Created attachment 29262 [details]
Fix for everything even APIs except Lookup
Comment 7 Jaroslav Tulach 2006-03-16 13:28:54 UTC
Jesse, I have fixed most of your requests. I changed all the non-lookup APIs 
that needed change (in order to prevent warnings). I am realatively satisfied 
with the signature changes, except topologicalSort, I am not sure if it is 
typed in the most generic way[1]. Anyway I hope this is integratable. 

[1] Map<Object,List<String>> m; Collection<String> c; topoSort(c, m); // does 
not compile
Comment 8 Jaroslav Tulach 2006-03-16 13:53:13 UTC
Created attachment 29267 [details]
Same as previous, just better type for topologicalSort
Comment 9 Jesse Glick 2006-03-16 15:04:42 UTC
Re. topologicalSort - there are only a few usages, so just make sure those can
be adapted and it will probably be OK.
Comment 10 Jaroslav Tulach 2006-03-21 08:18:55 UTC
Will be merged together with issue 67888 soon.

*** This issue has been marked as a duplicate of 67888 ***

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