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

Cyclic dependency between ProjectPreferences and Workspace init #87

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

laeubi
Copy link
Contributor

@laeubi laeubi commented Apr 25, 2022

Fix #86

Its not that nice because we use deprecated Preferences API here, but this prevents the implicit early Workspace access and is consistent to how ResourcesPlugin.getEncoding() and WorkspaceRoot.getDefaultCharset(boolean) behaves here.

Actually it would be good if none would ever call ResourcesPlugin.getEncoding() but instead Workspace.getRoot().getDefaultCharset() but unless this do not change we should simply keep this behavior here.

@eclipse-releng-bot
Copy link
Contributor

The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-87/1/

@vogella
Copy link
Contributor

vogella commented Apr 25, 2022

So any activator which uses regular preferences API may cause the same issue?

@laeubi
Copy link
Contributor Author

laeubi commented Apr 25, 2022

So any activator which uses regular preferences API may cause the same issue?

No that is a bit different as it will trigger activation of the Resource plugin and then "wait" for Workspace init (hopefully this does not take to long ...) while in this case we are in the (internal) init phase so should avoid relying to much on other parts that indirectly "recall".

Anyways I opened eclipse-equinox/equinox.bundles#24 to make this more declarative and do not require plugins to use activator at all or call static methods for this common use-case.

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need legacy code if we change calls order as proposed.

@eclipse-releng-bot
Copy link
Contributor

The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-87/2/

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep the initializePreferenceLookupOrder() inside open() call. The changes in the workspace init order are really hard to understand (like eclipse-platform/eclipse.platform.runtime#35 that was caused by a "trivial" 1:1 change in a8a8d82).

@laeubi
Copy link
Contributor Author

laeubi commented Apr 25, 2022

Old order should be preserved now (just moved the save a bit above), looking at the code it feels like both statements should be moved down throw new ResourceException .. strange enough there is already a WorkspacePreferences object created maybe we better should use that anyways??

@eclipse-releng-bot
Copy link
Contributor

The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-87/3/

@iloveeclipse
Copy link
Member

Old order should be preserved now (just moved the save a bit above),

thanks.

looking at the code it feels like both statements should be moved down throw new ResourceException

That was my original proposal (to move preferences order init after setting encoding)

.. strange enough there is already a WorkspacePreferences object created maybe we better should use that anyways??

The WorkspacePreferences is a "legacy wrapper" to few preference values that were previously in an xml file, see #93

@laeubi
Copy link
Contributor Author

laeubi commented Apr 25, 2022

So probably it would make sense to first getting #93 done and then rebase on that change?

@iloveeclipse
Copy link
Member

So probably it would make sense to first getting #93 done and then rebase on that change?

Sure, that's the reason you are set as reviewer on PR :-)

@laeubi
Copy link
Contributor Author

laeubi commented Apr 26, 2022

Rebased now.

@eclipse-releng-bot
Copy link
Contributor

The Jenkins build of this PR has now completed. See details at https://ci.eclipse.org/platform/job/eclipse.platform.resources/job/PR-87/4/

@iloveeclipse
Copy link
Member

Thanks, looks good, I'm looking into it now once again, just to be sure we don't change any logic here.

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@iloveeclipse iloveeclipse merged commit de35098 into eclipse-platform:master Apr 26, 2022
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

Successfully merging this pull request may close these issues.

Cyclic dependency between ProjectPreferences and Workspace init
4 participants