Skip to content
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

The PHP plugin accesses internals of the AdapterManager which have changed in 2021-12 / Eclipse Platform 4.22 #122

Closed
jonahgraham opened this issue Oct 31, 2021 · 6 comments
Assignees

Comments

@jonahgraham
Copy link

Hi PDT devs,

This bit of code references the internal class for AdapterManager, but the signature changed of the method (getFactories). It now returns a Map instead of HashMap.

https://github.com/eclipse/pdt/blob/cbff9260efedf8063029339ae1ffc800f9f4ba65/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/PHPDebugUIPlugin.java#L110

This results in an exception like this in 2021-12 M2:

Caused by: java.lang.NoSuchMethodError: 'java.util.HashMap org.eclipse.core.internal.runtime.AdapterManager.getFactories()'
    at org.eclipse.php.internal.debug.ui.PHPDebugUIPlugin.start(PHPDebugUIPlugin.java:110)

Note that AFAIU you won't be able to run the same version of PDT against 4.21 and 4.22 (unless you removed the access to internals or jump through hoops and use reflection). Also note that the reason the API changed is a side effect of behaviour changes of the Adapater Manager (See Bug 576024 - I don't think there is a N&N entry about this yet.

PS I would guess manager.registerAdapters(propertiesFactory, IVariable.class); can be replaced with manager.registerAdapters(propertiesFactory, PHPVariable.class); and then you can delete all the internals access. That would make PHPDebugElementAdapterFactory preferred for PHPVariable. (I haven't tested it, and you may need to also register DBGpVariable but I wasn't sure what that was for.)

@zulus zulus self-assigned this Oct 31, 2021
zulus added a commit to zulus/pdt that referenced this issue Oct 31, 2021
Signed-off-by: Dawid Pakuła <zulus@w3des.net>
@zulus
Copy link
Member

zulus commented Oct 31, 2021

Looks like author of this code, use PHPDebugElementAdapterFactory not only for PHPVariable, but also PHPLaunch, PHPMultiDebugTarget, DBGpMultiSessionTarget, IWatchExpression, DBGpVariable. I've checked code and looks, like this was workaround for problems similar to bug 576024. Wanted to be sure that PHP results will be first.

As I see in bugzilla, bug 576024 already solves this (Adapter vs Context) but I haven't resources now to verify.

For now I just run call "getFactories" as Map, this should solve invoke problems.

@zulus zulus closed this as completed in 1254ae5 Nov 1, 2021
@jonahgraham
Copy link
Author

@zulus Are you sure this change works in 2021-12? 921846f updates the target platform, but just to 2021-09. If I have understood properly, this still won't work with 2021-12 as the method called will continue to be HashMap return value so the NoSuchMethodError will still occur.

Did you try installing the new build into a 2021-12 M2 build? You can give me the correct p2 URL and I can give it a try. At the moment the builds are broken on Jenkins (they pass on GH Actions because of no signing maybe??)

@jonahgraham
Copy link
Author

This issues still exists in 2021-12 M3. Can you please reopen the issue.

For example the user sees this error when trying to create a launch configuration:
image

The 2021-12 M3 build can be downloaded from https://download.eclipse.org/technology/epp/downloads/release/2021-12/M3/_mirrors.php

@jonahgraham
Copy link
Author

@zulus I have just realized that no new contribution was made for PDT to SimRel so the "Eclipse IDE for PHP Developers" is still using PDT 7.2 (from mid 2020).

Will you be scheduling a release for 2021-12 timeframe?

@zulus
Copy link
Member

zulus commented Nov 26, 2021

@jonahgraham
Copy link
Author

I just tried installing 7.2.1 into 2021-12 RC2 SDK from https://download.eclipse.org/eclipse/downloads/drops4/S-4.22RC2-202111241800/ and I get the same errors. AFAICT 7.2.1 is still building against 2021-09, that won't work because of the internal method signature change. The full build from EPP will be ready in a few hours, but I don't think the results can be different.

zulus added a commit that referenced this issue Dec 1, 2021
Signed-off-by: Dawid Pakuła <zulus@w3des.net>
zulus added a commit that referenced this issue Dec 1, 2021
Signed-off-by: Dawid Pakuła <zulus@w3des.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants