Community
Participate
Working Groups
I would like to use the new IToggleBreakpointsTargetExtension2 in a debug extension that is compiled against a pre-3.8 version of Eclipse. The idea is, when running on 3.8, to contribute a Java proxy that dynamically implements IToggleBreakpointsTargetExtension2. However, the current way it is handled in ToggleBreakpointAction doesn't allow this since it assumes the target to directly implement the new interface. To solve this, the attached patch queries for an adapter to IToggleBreakpointsTargetExtension2 instead of the instanceof check. A client plug-in could then use the passed-in IToggleBreakpointsTargetExtension2 class in getAdapter() to do the check for the correct platform version.
Created attachment 211236 [details] Queries for an adapter instead of the instanceof check
Regressions should not occur since the used DebugPlugin.getAdapter() also does the previous instanceof check.
I'm not sure I completely understand your use case. Do you want to have a plugin in your product that is built against 3.8, which will contribute IToggleBreakpointTargetExtension2, but have the rest of your product built against 3.7? If so, I don't think we can accommodate you, since maintaining backward compatibility (and having interfaces like"...Extension2") is enough of a pain in the butt.
(In reply to comment #3) > I'm not sure I completely understand your use case. Do you want to have a > plugin in your product that is built against 3.8, which will contribute > IToggleBreakpointTargetExtension2, but have the rest of your product built > against 3.7? If so, I don't think we can accommodate you, since maintaining > backward compatibility (and having interfaces like"...Extension2") is enough of > a pain in the butt. I am assuming Christian means: http://docs.oracle.com/javase/1.5.0/docs/guide/reflection/proxy.html In that case I think it makes sense to make this small change so that he can create one of the these proxy classes and contribute it as an adapter and have it work. If this is the meaning of the request, we should also extend it to IToggleBreakpointsTargetExtension (for completeness). I tried his patch and works fine for JDT debug.
I updated the patch a bit to do the same check for IToggleBreakpointsTargetExtension: http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=f8db67f5e6ef22a2768e856d60a653b792f02385 Thanks for the patch Christian!
That's what I was talking about. Thanks, guys.
(In reply to comment #4) > In that case I think it makes sense to make this small change so that he can > create one of the these proxy classes and contribute it as an adapter and have > it work... I have no problem making small changes upon request to make compatibility easier. Although it seems that if we were to be really consistent we should use getAdapter() for all cases where we check for an extension to a client-implemented interface. I don't think we want to be going in that direction.