-
Notifications
You must be signed in to change notification settings - Fork 143
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
Stop using SWTEventListener internally and mark it as deprecated forRemoval #1615
Stop using SWTEventListener internally and mark it as deprecated forRemoval #1615
Conversation
There already was an attempt here:
but there was some concerns raised. |
Test Results 483 files ±0 483 suites ±0 7m 21s ⏱️ -55s For more details on these failures, see this check. Results for commit d80bcdf. ± Comparison against base commit cfa74b4. ♻️ This comment has been updated with latest results. |
5633ddd
to
b3b9c37
Compare
Thanks for the pointers @laeubi . The new versions keeps SWTEventListener (marked as deprecated for removal) and should be compatible for all the cases except:
@Phillipus and @iloveeclipse can you check whether this PR works for you? |
I checked out the PR and get some errors in the Widget class:
|
b3b9c37
to
aad93cb
Compare
I did the change for Gtk only, new version should have the changes for mac/win too. |
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
Show resolved
Hide resolved
I'm using Nebula Grid and Gallery Widgets and get:
Does Nebula need a change? I'm using 3.1.1 |
aad93cb
to
d37cc18
Compare
The goal is to not need a change (for majority of cases). Please try with latest version. |
Now I get:
This is: addListener(SWT.Expand, new TypedListener(listener)); Also in Gallery Nebula Widget:
Seems that Nebula is expecting the old version of public TypedListener (SWTEventListener listener) {
eventListener = listener;
} |
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.
As Christoph mentioned I tried the same in #1101 and failed.
While I'm note happy about the current situation and would like to get rid of SWTEventListener
too I think we have to be much more careful here because although it should not have been used, SWTEventListener
is probably used in more places than we would like it happen. It seems it has become a de-factor API and we should treat it like this to not potentially break everything.
- SomeSWTListener instanceof SWTEventListener
Furthermore assigning SWT-events of a specific type to a variable of type SWTEventListener
does not work anymore too.
But in that case either a specific event type or the more general EventListener
can be used immediately as an replacement.
And the same solution can be used for existing instanceof
checks.
But of course there are no runtime errors like in the first case but the case will just always be false at runtime.
- TypedListener.getEventListener returning EventListener and not SWTEventListener
That could be a bigger problem, because although it again should not have been used, it was necessary to use it because a lack of API added only two/three releases ago and this change is binary incompatible.
I have to check the details again.
Does Nebula need a change? I'm using 3.1.1
I did a lot of migration in the past in the context of #1101 (comment) to use new APIs:
https://github.com/eclipse/nebula/pulls?q=is%3Apr+author%3AHannesWell+is%3Aclosed
But IIRC since the PRs were open for some time new code using the old APIs have been added, so another pass might be necessary. I'll check that.
bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SWTEventListener.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/SWTEventListener.java
Show resolved
Hide resolved
The past effort to really remove/hide SWT internals did not only affect |
You are not using the latest version of Nebula are you? But I don't know how often Nebula releases new versions. Btw. with EclipseNebula/nebula#613, all references to SWT's |
If "latest" means nightly build then no, because:
It's OK with the nightly build of Nebula. |
Looking at https://github.com/eclipse/nebula/releases, V3.1.1 seems to be the latest release and it's from February and therefore does not include all the mentioned changes. @Phillipus can you try the latest master? |
d37cc18
to
a34ed2f
Compare
Thanks for already trying. Then we should ask for a new Nebula release after EclipseNebula/nebula#613 has landed. |
I've added back the TypedListener constructor using SWTEventListener but marked it as deprecated forRemoval. That should fix this issue too. |
a34ed2f
to
6c43941
Compare
bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java
Outdated
Show resolved
Hide resolved
6c43941
to
1aafe1d
Compare
@Phillipus if we manage to get to a state where using your product as an experiment we can land this PR without any breakage in it that would be huge step. |
1aafe1d
to
40e5b62
Compare
Latest push to PR is working with existing Nebula Grid and Gallery widgets (3.1.1) |
40e5b62
to
f428954
Compare
I plan to merge this one in once new stream opens if there are no identified issues. |
I'll test again when that happens. But I only use two of the Nebula widgets, Grid and Gallery, Wouldn't it make more sense for the Nebula committers to test all their widgets against these changes in SWT using automated tests? |
Ideally every downstream project (not only Nebula) should test with latest I-builds constantly so issues are reported and identified ASAP. I am very grateful to everyone that tests and reports timely and of course this works in the other direction too - early testers don't face (or at least less often) face regressions. |
I can not reproduce locally. I have this project (+deps ) open in my swt workspace and they compile just fine. What am I missing? |
I've never seen this I think RWT has not been adapted, so the code doesn't work there, and that there is confusion here when RWT is in the target platform... |
So what I understand is that Nebula fails when RWT (RAP?) is used instead of SWT aka not not related to SWT itself. |
Yes, I think that's a reasonable theory at this point. (I'm not sure if resolving to both rwt and swt is new PDE behavior, but it's a complete confusing mess in the IDE.) |
It's indeed not used often but according to the spec it legal:
Looks like they have copied the class... Don't know why they do it but it's for sure their responsibility to update it. |
I'm prepping a new release. Let me know if you need something else. |
Would you please run your full test suite against SWT patched with this PR and report back ? |
b6bdc3e
to
4180c57
Compare
Does the build produce an update site? |
Nope. In order for people to try it they have to build it themself . At some point I hope that every git repo will provide update site for usage but I start from the leaves and this one is kind of 'root'. It feels right to ask you about "update sites" - eclipse-pde/eclipse.pde#1136 - would you please look into this one? If someone (I definitely can not now) can spend the time to make such update sites being generated and usable they might be able to team up at #1621 |
If the build would create a P2 repo just for SWT the result could be archived by the Jenkins build. The URL to the corresponding build artifact can then be used just like any other URL for a p2-repo, e.g. in a TP or to install new software. |
forRemoval As it: * is internal * makes api tools fail thanks to it * serves no purpose since SWT no longer runs on Java ME Internally SWT is moved to use java.util.EventListener and as it's the superclass of SWTEventListener makes all the APIs that taken SWTEventListener to keep working.
4180c57
to
d80bcdf
Compare
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/TypedListener.java
Show resolved
Hide resolved
This merge is working with the Nebula Grid and Gallery widgets (3.1.1). Thank-you! |
@Phillipus It wouldn't have been the case without you! |
As it:
Internally SWT is moved to use java.util.EventListener and as it's the
superclass of SWTEventListener makes all the APIs that taken
SWTEventListener to keep working.