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

Minor clean-ups and simplifications in ExecutionEnvironment #436

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

Conversation

HannesWell
Copy link
Contributor

What it does

Clean-up the code in the org.eclipse.jdt.internal.launching.environments package in order to simplify it.

Author checklist

@HannesWell
Copy link
Contributor Author

@iloveeclipse is there anything left that should be adjusted or is this ready for submission?

@@ -453,7 +401,6 @@ private Properties getJavaProfileProperties(Bundle bundle, String path) {
URL profileURL = bundle.getEntry(path);
if (profileURL != null) {
try (InputStream is = profileURL.openStream()) {
profileURL = FileLocator.resolve(profileURL);
Copy link
Member

Choose a reason for hiding this comment

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

The original code seem to be unnecessary and actually it is a regression from de25fe2 where the profileURL = FileLocator.resolve(profileURL); was re-resolved before opening the stream.

I would move this line above "try" instead of removing it.

"OSGi/Minimum-1.0", //$NON-NLS-1$
"OSGi/Minimum-1.1", //$NON-NLS-1$
"OSGi/Minimum-1.2", //$NON-NLS-1$
"JavaSE/compact2-1.8", //$NON-NLS-1$
Copy link
Member

Choose a reason for hiding this comment

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

JavaSE/compact1-1.8 is missing now, compared to original code.

for (int major = 9; major <= targetMajor; major++) {
environments.add(JAVASE + '-' + major);
}
for (int minor = 1; minor <= javaVersion.getMinor(); minor++) {
Copy link
Member

Choose a reason for hiding this comment

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

I believe this loop can be removed, as I haven't seen or heard about JavaSE-10.1, JavaSE-17.2 etc. With that, the code will be much clearer what it is supposed to do.

}
for (int i = 0; i < participants.length; i++) {
IAccessRuleParticipant participant = participants[i];
List<List<IAccessRule>> libLists = IntStream.range(0, libraries.length) // array of lists of access rules
Copy link
Member

Choose a reason for hiding this comment

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

I personally have to read the new code more than once to understand what it is supposed to do.
I'm not sure it is worth to refactor it to streams, as this is not a hotspot or whatever what would benefit from the new code, but reading is harder now (IMO).

@akurtakov
Copy link
Contributor

@HannesWell do you plan to finish this one?

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.

3 participants