DESCRIPTION

Fixed bug 436645: [CommonNavigator]
NavigatorContentDescriptorManager.EvaluationCache#getDescriptors does
not work

Fix NavigatorContentDescriptorManager.EvaluationCache#getDescriptors to
lookup keys correctly.
Also added logic to remove stale entries more promptly using
ReferenceQueues (can be moved to new commit if this is too drastic of a
change).

Change-Id: Ie057ec83cbd4a96aa755916bc1e2d54909224247
Signed-off-by: C. Kole Cochran xxx@xxx.xxx


COMMENTS

author: Kole Cochran
date: 2015-06-22 18:06:40.000000000

Uploaded patch set 19.

-------------------------------------
author: Brenden Conley
date: 2015-06-23 05:10:11.000000000

Patch Set 19:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/5902/

-------------------------------------
author: Brenden Conley
date: 2015-06-23 05:28:26.000000000

Patch Set 19: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/5902/ : SUCCESS

-------------------------------------
author: Brock Pruitt
date: 2015-06-23 23:33:18.000000000

Patch Set 19:

(24 comments)

Line:2, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Remove "2011, "

Line:60, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Instead of VisibleForTesting move this class to a separate java file.

Line:67, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Can the diamond operator <> be used here?

Line:179, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Use curly braces in 'if' statements containing 'else' branch.

Line:187, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Comment has no value. xxx@xxx.xxx instead.

Line:198, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Do not use single-line 'while' statements.

Line:614, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Useless comment.

Line:31, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Wrong version. Please set up the API baseline to Eclipse 4.5 in preferences.

Line:43, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Why not EvaluationReference<T>?

Line:97, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> A space is missing after the cast.

Line:97, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Remove redundant qualifier.

Line:107, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Remove redundant qualifier.

Line:49, tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorContentDescriptorManagerEvaluationCacheTest.java -> Useless comment.

Line:26, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java xxx@xxx.xxx tag is not needed.

Line:32, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> typeName is redundant since it is not used for anything except the toString method.

Line:58, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> The comment has no value.

Line:62, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> xxx@xxx.xxx

Line:71, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> xxx@xxx.xxx

Line:72, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Add curly braces.

Line:94, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> The comment has no value.

Line:97, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> xxx@xxx.xxx

Line:99, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> A space is missing before (.

Line:23, tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/TestNavigatorActivationService.java -> Comment has no value. xxx@xxx.xxx instead.

Same below.

Line:22, tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/TestNavigatorViewerDescriptor.java -> Useless comment. xxx@xxx.xxx instead.

-------------------------------------
author: Kole Cochran
date: 2015-06-25 15:21:47.000000000

Patch Set 19:

(3 comments)

Line:67, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> I think this is building against Java 1.6, not 1.7...

Line:198, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Preferred alternative?
I need to keep polling until it gives me a null.

Line:43, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Because the value may be pointing to a completely different type than what the key is.

EvaluationReference is the reference type to the key, but T (in this scope) is the type of the value.

-------------------------------------
author: Kole Cochran
date: 2015-06-25 15:23:10.000000000

Patch Set 19:

As I mentioned earlier, half of the convolution (basically, all of EvaluationReference) can be dropped if we are willing to weakly reference the keys rather than softly reference them. In that case, we can just you WeakHashMap, which will take care of handling the keys for us.

-------------------------------------
author: Kole Cochran
date: 2015-06-25 15:23:17.000000000

Patch Set 19:

Should I do that?

-------------------------------------
author: Brock Pruitt
date: 2015-06-25 18:09:39.000000000

Patch Set 19:

(3 comments)

Line:67, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> org.eclipse.ui.navigator is building against 1.7.

Line:198, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Closing brace on the next line.

Line:43, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Should the key type be used as the second type parameter for this class?

-------------------------------------
author: Kole Cochran
date: 2015-06-26 15:48:31.000000000

Patch Set 19:

(1 comment)

Line:66, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Half of the convolution (basically, all of EvaluationReference) can be dropped if we are willing to weakly reference the keys rather than softly reference them. In that case, we can just you WeakHashMap, which will take care of handling the keys for us; should I do that?

-------------------------------------
author: Brock Pruitt
date: 2015-06-26 16:48:18.000000000

Patch Set 19:

(1 comment)

Line:66, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Soft references are preferable in my opinion. This should be confirmed by an experiment, but my hunch is that the lifespan of objects in the cache has to significantly exceed the interval between GC runs for the cache to be effective. It would be nice to add counts of cache hits and misses controlled by a debugging option.

-------------------------------------
author: Kole Cochran
date: 2015-06-29 14:51:26.000000000

Patch Set 19:

(2 comments)

Line:31, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> What's the right version?

Line:43, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> You could, but given that this class nor any of the uses of this field don't care at all what the key's type is, I left it as wildcard (which semantically means "I don't care" AFIAK).

I could do either way though, as this is just an internal implementation class.

-------------------------------------
author: Kole Cochran
date: 2015-06-29 14:53:29.000000000

Patch Set 19:

(1 comment)

Line:66, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> You mean something like I accidentally checked into patch set 4, except cleaned up some?

-------------------------------------
author: Brock Pruitt
date: 2015-06-29 16:57:53.000000000

Patch Set 19:

(3 comments)

Line:31, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> The API tooling will suggest the right version once the API baseline is properly set.

Line:43, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> OK.

Line:60, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Wouldn't <> be sufficient?

-------------------------------------
author: Brock Pruitt
date: 2015-07-07 19:11:18.000000000

Patch Set 20: Patch Set 19 was rebased

-------------------------------------
author: Kole Cochran
date: 2015-07-09 20:12:08.000000000

Patch Set 19:

(17 comments)

Line:67, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java -> Done

Line:31, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Done

Line:60, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> No, because Java infers the wrong type if I use the diamond operator, and I get a Type Mismatch (it seems to have trouble dealing with the nested wildcard type and the fact that the field I am assigned is a Reference, not a WeakReference)

Line:97, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Done

Line:107, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationValueReference.java -> Done

Line:49, tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorContentDescriptorManagerEvaluationCacheTest.java -> Done

Line:26, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:32, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:58, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:62, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:71, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:72, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:94, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:97, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:99, bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/EvaluationReference.java -> Done

Line:23, tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/TestNavigatorActivationService.java -> Done

Line:22, tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/TestNavigatorViewerDescriptor.java -> Done

-------------------------------------
