Community
Participate
Working Groups
We at Code Recommenders just stumbled over the following situation and the fact that "Calculate Uses" does not generate a uses directive for package org.eclipse.recommenders.utils.names. Here's the situation: Bundle org.eclipse.recommenders.jdt - package org.eclipse.recommenders.jdt - class AstBindings - Optional<ITypeName> toTypeName(...) Bundle org.eclipse.recommenders.utils - package org.eclipse.recommenders.utils.names - class ITypeName One of our client bundles, requiring both the org.eclipse.recommenders.jdt and org.eclipse.recommenders.utils bundles, called toTypeName().get(). Now, on the caller's side, this generates a "checkcast org.eclipse.recommenders.utils.names.ITypeName" under the hood, but all "Calculate Uses" produced was a constraint on "com.google.common.base.Optional". Thus, at runtime, a ClassCastException ensued. This whole scenario reminds me a bit of the "pathological" case of <https://bugs.eclipse.org/bugs/show_bug.cgi?id=167968#c15>, only that generics and the checkcasts they result in are baked into the Java language. It would be great if "Calculate Uses" could take generics into account, generating uses directives for the packages of the upper type bounds of generic return types.
Dear PDE team, what would be needed to fix this bug? We (Eclipse Code Recommenders) have just been bitten (Bug 479540) by this bug *again*. Here's why: We are in the habit of regularly "calculating" our uses constraints (because maintaining them manually is just a pain). Alas, each time we hit "Calculate Uses" now, due to this bug, we have to *remember* to *manually* add certain uses constraints that PDE misses. This is almost as much pain as maintaining all uses constraints manually, making this feature almost useless to us. And all because we use Optional<T> (which will become more common in APIs, as Java 8 is spreading).
This is filed against API tools, are you referring to the API Use Scan to find all uses of types? Generics are already supposed to be supported there. Or is the the automated dependency management in the manifest editor? If so, I can't really say how much effort adding in generic support would be. Probably significant as the code is much older and less extensible than API tools.
(In reply to Curtis Windatt from comment #2) > This is filed against API tools, are you referring to the API Use Scan to > find all uses of types? Generics are already supposed to be supported there. > > Or is the the automated dependency management in the manifest editor? If so, > I can't really say how much effort adding in generic support would be. > Probably significant as the code is much older and less extensible than API > tools. Hi, I am referring to the "Calculate Uses" button on the "Runtime" tab in the manifest editor. Apologies if I picked the wrong component.
(In reply to Andreas Sewe from comment #3) > Hi, I am referring to the "Calculate Uses" button on the "Runtime" tab in > the manifest editor. Apologies if I picked the wrong component. Moving to PDE UI then. I'm guessing this would require significant investment of time (vs just a bugfix for API tools). Vikas, let me know what you think after investigating the code. The code likely has never been updated for any modern java code constructs, but hopefully it is based on JDT...
Can you attach a small sample project to recreate this behavior?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
This bug is marked as stale for some time. If it is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.