New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace internal SWTEventListener directly with java.util.EventListener #1101
Replace internal SWTEventListener directly with java.util.EventListener #1101
Conversation
* @noreference This class is not intended to be referenced by clients. | ||
* @noextend This class is not intended to be subclassed by clients. | ||
* @noinstantiate This class is not intended to be instantiated by clients. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should move this class into the o.e.swt.internal
package if it is meant to be internal?
As far as I can tell technically it should be possible.
There are ~5 direct references in the SDK and I'll check if they can be replaced with API.
Does anybody has objections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't touch this, even though it is marked as such it is visible to client and possibly break things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have objections. In my workspace I see our internal code using that in tests and also in 3rd party libraries like swtchart & cdt. Of course no one reads javadoc saying "don't use me!" on a public class, but moving it now would be not nice...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with either way. I wouldn't have a problem with moving, but I also have no strong preference to do it, so I'll keep it as it is if that's your preference.
I will just add the api-filters to suppress the error due to adding the javadoc-tags (without that API-tools complains that a protected field of a API class has changed its type).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we merge this after merging API checks enablement in SWT?
In the IDE we can only see API errors for the current platform.
This should not show any error on any platform.
Test Results 299 files 299 suites 6m 19s ⏱️ Results for commit 1dcd8de. ♻️ This comment has been updated with latest results. |
4d635be
to
aa222c1
Compare
Thanks for working on this, I tried the same in the past but never finished it (forgot why). |
aa222c1
to
7ad94c0
Compare
SWTEventListener was introduced to provide support for both J2SE and J2ME platforms. But SWT does not support the J2ME for over a decade now and other development artifacts have also been removed for a while already. Leftover of https://bugs.eclipse.org/bugs/show_bug.cgi?id=483638
7ad94c0
to
1dcd8de
Compare
Finally we have a successful build and are down to one API issue left. Unfortunately I noticed that the API verification is often unstable and fails with:
@laeubi do you have any idea why this happens? |
This broke our App. We use the Nebula widget
Any suggestions about what to do about this? |
I would suggest to ask Nebula to do the same like in this PR, if it is possible. |
That's impractical. This change breaks apps and libraries that reference For us it means the end of the road for our RCP app that has been around for 14 years. It means that we will never be able to target the latest version of SWT and Eclipse. This is a breaking change that marks the end of our product. I knew this day would come. |
@HannesWell : can we revert the change? I see I saw the reference in swtchart and cdt too before and had objections, I believe my secomd comment was misleading. |
This is one of those cases where it would be nice to remove old code but the consequences are devastating. Yes, We use the Nebula widget in our RCP app. It's unlikely that it will be updated to accommodate this change. So our options are:
or
Perhaps it might be better to revert this for now and think about it? |
Also the Nebula |
Why you can still sue old nebula with old swt, and if one updates also remove the reference?
I would instead keep the interface, mark it as deprecated and for removal so it can be deleted some time later. |
That means the agent get killed because of to high memory demands. |
That's not how it works. An RCP application such as ours targets an Eclipse version. We currently target Eclipse 4.31. With this change it means that we cannot target Eclipse 4.32 and greater. It means our product is frozen in time. |
That is exactly how it works, SWT / Platform is not responsible for the technical dept of other projects or their misuse of (non) API ... so at some point in time one can simply not use anymore "latest something" with "oldest other"...
That's exactly why there are releases, so one can stay at an older one, otherwise having releases is quite useless. |
I've been an Eclipse developer for 20 years. Today marks my final day. Our product Archi has been available for 14 years with 2000 downloads a week. Sadly, this breaking change is the end of the road for us. |
@Phillipus : please don’t panic. I believe the right way is to revert the change and work on active depreciation of this interface. Means - contact cross-project-issues-dev and directly related projects (swtchart, cdt, nebula) and help them to remove the code. |
Yes, we should avoid knowingly causing damage to our community. |
I have to say it's a bit frustrating if not even internal classes can be removed, but I guess for everyone involved.
Yes, we'll find a solution for this, no worries. It would be great if we can avoid reverting the second commit. If it's done somebody has to add countless api-filters due to the API leakages. |
That story again. Thanks. |
It's not always the case that a downstream library class is directly referencing |
Ok, I see. The problem is that the change in |
Exactly.
I just gave one example. The other listeners also reference |
Yes, but (depending on the exact use-case) I assume that the removal of the extension of SWTEventListener is not that problematic since the using projects can just replace it by the The more difficult part is probably the changed method signatures of As said I'll have a detailed look at the affected projects (Nebula, CDT, SWTForms? and I found RCPTT also uses The good news is all affected projects I know of so far had activity recently so I think there is a good chance we are able to adjust them and we have a lot of time until the next release to resolve this problem. :) |
See the amount of troubles, we need a revert: https://download.eclipse.org/eclipse/downloads/drops4/I20240312-1800 |
They can not Lines 27 to 30 in bd306ac
to be 100% sure I have already recommended to keep the interface for some time just in case someone is really referencing that (what is forbidden) or referencing Just to clarify: There might be cases were it is required / desired to break this rule but such libraries are tightly coupled to the SWT release, what means they can't be compatible to any older or any never release of SWT they are build with. That is the same as you usually can't randomly combine any newer or older release of platform bundles, JDT, PDE, ... |
What amount? Do you mean the Jface bundle needs a touch? Thats exactly such case where JFace is tightly coupled to SWT so I would assume this is "normal". |
I've asked Hannes, whether I should help or not. |
Are you referring to the comparator errors or test-failure or both? The latter is probably/maybe caused by the former.
I can work on this this evening, if you or somebody else wants to do it earlier, the second commit of this PR should be reverted and then one has to add the countless API-filters to suppress the API-leak issue, for all seven fragments (one can probably copy past the latter part). |
This Change is not binary compatible see NoSuchMethodError #1105 |
java.util.EventListener" This reverts commit bd306ac. Replacing SWTEventListener directly with java.util.EventListener breaks binary compatibility with bundles compiled against any older SWT version. See discussion on eclipse-platform#1101
I've pushed #1106 as draft now. |
@Phillipus : I've pushed revert. |
Thank-you. :-)
I need guidance on how to do this. What API baseline do I set? I have SWT projects in my workspace as cloned from GitHub. My current target is 4.31 latest I-build. |
In Preferences -> Plugin Development -> API baselines click on "Add baseline..." Click "Add existing installation directory" Point to the extracted 4.31 RC2 build from https://download.eclipse.org/eclipse/downloads/drops4/S-4.31RC2-202402290520/ and say "Apply and Close". After that "Clean Build" SWT fragment for Mac just to make sure there are no incremental build artifacts. |
A search through SWT code, the Nebula project, and other projects in GitHub shows that the following pattern is very popular: public void addSelectionListener(SelectionListener listener) {
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Selection,typedListener);
addListener (SWT.DefaultSelection,typedListener);
} Might be better to make |
Thanks Andrey for helping in reverting.
Yes I noticed this as well while investigating the usage further. That and
I think I have found a better alternative. I'll push it soon, stay tuned. :) |
As I still belive we should work towards removing SWTEventListener and to make TypedListener really internal, but in an ordered fashion I created #1112 to provide an alternative API to do that. |
SWTEventListener was introduced to provide support for both J2SE and J2ME platforms. But SWT does not support the J2ME for over a decade now and other development artifacts have also been removed for a while already.
Leftover of https://bugs.eclipse.org/bugs/show_bug.cgi?id=483638
See also #1011 (comment) ff.