Skip to content

Conversation

@Cokemonkey11
Copy link
Collaborator

😱

In updating w3libs for reforged I took a look at how WurstScript uses it, and wasn't quite satisfied that updating w3libs would be sufficient to improve stability.

This PR bundles a few things all in one 💩:

  • w3libs update (better handling of wc3 installations, both reforged and for backwards compat)
  • refactoring W3utils (no longer static; should be easier to reason about)
  • removed dependency on shell-exec for git (wasn't working for me in vscode so I rewrote to use jgit)
  • some cleanup (dead code, commented-out code, 120-column line limit
  • reworked some key workflows to use Optional instead of @nullable and @notnulll

@Cokemonkey11 Cokemonkey11 requested a review from peq May 11, 2020 20:50
@Frotty
Copy link
Member

Frotty commented May 11, 2020

This PR bundles a few things all in one

Why? just makes review more difficult. way too many changes.

if (e instanceof ExprNewObject) {
ExprNewObject enew = (ExprNewObject) e;
if (e.isEmpty()) {
// TODO non simple TypeRef
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Where did this line come from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah it's copy-pasted from the final return in this function. Unclear to me if the TODO is relevant here as well.


if (elem instanceof ExprIntVal
&& elem.getParent() != null) {
&& Optional.ofNullable(elem.getParent()).isPresent()) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@peq I see that Wscope.java is AST-generated. Is there any way to make it return Optional for getParent?

@Cokemonkey11
Copy link
Collaborator Author

@peq @Frotty I see that the build failed because Optional::isEmpty was added in Java 11.

Is an older java compat needed, or is it possible to upgrade?

@Cokemonkey11
Copy link
Collaborator Author

This PR bundles a few things all in one

Why? just makes review more difficult. way too many changes.

Hey @Frotty thanks for the comment. I agree, it's not good that it ended up this way. I was going down a rabbit hole and elected not to think about it much and just kept digging.

I am hoping that it won't be too contentious since commit volume on the compiler is relatively low.

@Frotty
Copy link
Member

Frotty commented May 17, 2020

yes, target is 8.

@Cokemonkey11
Copy link
Collaborator Author

Thanks @Frotty

I didn't realise that Java works in a way that sourceCompatibility is ignored during compile time. I will push a commit to fix this shortly.

@coveralls
Copy link

coveralls commented May 17, 2020

Coverage Status

Coverage decreased (-0.03%) to 59.805% when pulling c6864a5 on Cokemonkey11:reforged into ea19790 on wurstscript:master.


private class TestTimeOutException extends Throwable {

private static final long serialVersionUID = -7080085729129882874L;
Copy link
Member

Choose a reason for hiding this comment

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

?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's a generated value for a serialisable class. IDE flagged it, I'm not sure if it's actually needed or not

Copy link
Member

Choose a reason for hiding this comment

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

It's a generated value for a serialisable class

Is this class serialized?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know sorry, but my language server flagged it, so maybe yes?

import java.io.IOException;
import java.util.Optional;

public class W3Utils {
Copy link
Member

Choose a reason for hiding this comment

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

Is there any circumstance where this class not being a singleton is required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It wasn't a singleton before, it was static

@Frotty
Copy link
Member

Frotty commented May 22, 2020

I guess this could be nice, but it really contains too many irrelevant changes for the actual content to be properly reviewed.

@Cokemonkey11
Copy link
Collaborator Author

I disagree, I reviewed it myself in one evening. There is a lot of repetition and the interesting content is sparse

I suggest to use this tooling to make it more digestible:

image

@Cokemonkey11
Copy link
Collaborator Author

Hey, I didn't see any comments here in a while. It seems that review is stalling here because it's not clear who is expected to review and also because of the burden of high number of changes.

I can do some surgery and PR one change at a time, but before spending time on that it would be good to know what changes people are on-board with and if it will even get a review on that form.

@Frotty @peq are you prepared to spend time on reviewing? Am I right that splitting this up will get 👀 sooner? Are there any changes here that you're not on-board with?

I do not think this should be needed tbh. You should just review this PR - it's not even 1000 lines.

@Frotty
Copy link
Member

Frotty commented Jun 7, 2020

it's not even 1000 lines.

True, then it should be no problem for you to separate features from refactorings 👍

@Cokemonkey11
Copy link
Collaborator Author

No, it would be quite painful. These changes are not purely orthogonal.

I think the onus is on you the maintainers to at least review this at a high level. I have provided bullet points of the 5 main changes.

@Frotty Frotty mentioned this pull request Jun 18, 2020
@Frotty
Copy link
Member

Frotty commented Jun 18, 2020

I made the missing changes on another branch because github desktop didn't let me push to this one.
see #958

@Frotty Frotty closed this Jun 18, 2020
@Cokemonkey11 Cokemonkey11 mentioned this pull request Nov 21, 2020
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