Skip to content

Clean Code for resources/bundles/org.eclipse.core.resources #1917

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eclipse-platform-bot
Copy link
Contributor

@eclipse-platform-bot eclipse-platform-bot commented Jun 8, 2025

The following cleanups were applied:

  • Add final modifier to private fields
  • Add missing '@Deprecated' annotations
  • Add missing '@Override' annotations
  • Add missing '@Override' annotations to implementations of interface methods
  • Convert control statement bodies to block
  • Make inner classes static where possible
  • Remove trailing white spaces on all lines
  • Remove unnecessary array creation for varargs
  • Remove unnecessary suppress warning tokens
  • Remove unused imports
  • Replace deprecated calls with inlined content where possible
  • Use pattern matching for instanceof

@eclipse-platform-bot
Copy link
Contributor Author

eclipse-platform-bot commented Jun 8, 2025

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 7438835630ff7a7e1ffbbe4d5fb5840d7f34179b Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <[email protected]>
Date: Mon, 9 Jun 2025 03:27:29 +0000
Subject: [PATCH] Version bump(s) for 4.37 stream


diff --git a/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF
index aa042e2f42..33f9280afc 100644
--- a/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF
+++ b/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.core.resources; singleton:=true
-Bundle-Version: 3.22.200.qualifier
+Bundle-Version: 3.22.300.qualifier
 Bundle-Activator: org.eclipse.core.resources.ResourcesPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
-- 
2.49.0

Further information are available in Common Build Issues - Missing version increments.

Copy link
Contributor

github-actions bot commented Jun 8, 2025

Test Results

0 files   -  1 947  0 suites   - 1 947   0s ⏱️ - 1h 31m 31s
0 tests  -  4 717  0 ✅  -  4 693  0 💤  -  24  0 ❌ ±0 
0 runs   - 14 151  0 ✅  - 13 984  0 💤  - 167  0 ❌ ±0 

Results for commit ddb78ad. ± Comparison against base commit 731e745.

♻️ This comment has been updated with latest results.

@eclipse-platform-bot eclipse-platform-bot force-pushed the clean-code/resources/bundles/org.eclipse.core.resources branch 7 times, most recently from cbfa141 to 913c00c Compare June 15, 2025 03:19
Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

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

Compilation fails because the cleanup that inlines calls to deprecated methods leads to a deprecated method that is unused afterwards. The affected method is Workspace#computeFullBuildConfigOrder:

/**
* Computes the global total ordering of all project buildConfigs in the workspace based
* on build config references. If an existing and open build config P
* references another existing and open project build config Q, then Q should come before P
* in the resulting ordering. Closed and non-existent projects/buildConfigs are
* ignored, and will not appear in the result. References to non-existent or closed
* projects/buildConfigs are also ignored, as are any self-references.
* <p>
* When there are choices, the choice is made in a reasonably stable way. For
* example, given an arbitrary choice between two project buildConfigs, the one with the
* lower collating project name and build config name will appear earlier in the list.
* </p>
* <p>
* When the build config reference graph contains cyclic references, it is
* impossible to honor all of the relationships. In this case, the result
* ignores as few relationships as possible. For example, if P2 references P1,
* P4 references P3, and P2 and P3 reference each other, then exactly one of the
* relationships between P2 and P3 will have to be ignored. The outcome will be
* either [P1, P2, P3, P4] or [P1, P3, P2, P4]. The result also contains
* complete details of any cycles present.
* </p>
*
* @return result describing the global project build configuration order
* @deprecated Use {@link #computeFullBuildConfigGraph()} instead
*/
@Deprecated
private VertexOrder<IBuildConfiguration> computeFullBuildConfigOrder() {
Digraph<IBuildConfiguration> graph = computeFullBuildConfigGraph();
return ComputeProjectOrder.computeVertexOrder(graph, IBuildConfiguration.class);
}
private Digraph<IBuildConfiguration> computeFullBuildConfigGraph() {

Technically, it is of course fine to inline the method body of the deprecated method body, but I wonder why the method was actively deprecated and not directly inlined. I guess it's because actually some further rework of the functionality may be made. And also the documentation of the deprecated method would get lost, of which I am not sure how valid and relevant it still is after previous reworks of that code.
@mickaelistria you have been reworking the calculation of the build orders in the Workspace class several years ago, which also introduced the deprecation. Do you know what is appropriate here? Can we just inline and remove the deprecated method?

@eclipse-platform-bot eclipse-platform-bot force-pushed the clean-code/resources/bundles/org.eclipse.core.resources branch from 913c00c to 96916d3 Compare June 16, 2025 03:13
@laeubi
Copy link
Contributor

laeubi commented Jun 16, 2025

Even though it turns out to be needing some investigation its the first time I see the inline feature to actually kick in, so interesting use-case example. @jjohnstn can something be made that an unused method is cleaned up as well?

@eclipse-platform-bot eclipse-platform-bot force-pushed the clean-code/resources/bundles/org.eclipse.core.resources branch from 96916d3 to 168968e Compare June 17, 2025 03:13
@jjohnstn
Copy link
Contributor

Even though it turns out to be needing some investigation its the first time I see the inline feature to actually kick in, so interesting use-case example. @jjohnstn can something be made that an unused method is cleaned up as well?

That would be beyond the scope of the cleanup to remove a deprecated method before it is scheduled to be removed. I think one simple possibility is to add a SuppressWarnings(unused).

@laeubi
Copy link
Contributor

laeubi commented Jun 17, 2025

@jjohnstn I don't think it should be one clenaup, so maybe the question is more, can we have a "remove unused methods" cleanup (that then has to run after the inlining if enabled).

@eclipse-platform-bot eclipse-platform-bot force-pushed the clean-code/resources/bundles/org.eclipse.core.resources branch 3 times, most recently from 28395d8 to 9676171 Compare June 20, 2025 03:13
@eclipse-platform-bot eclipse-platform-bot force-pushed the clean-code/resources/bundles/org.eclipse.core.resources branch from 9676171 to ddb78ad Compare June 21, 2025 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants