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

A small stopgap regarding extensibility/inheritance #342

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

Lilianne-Blaze
Copy link
Contributor

Could you please change the variables near the top, the ones specifying launch4j group/artifact,
so they're non-static non-final?

Rationale: it doesn't matter in normal use, but it hardcodes the plugin to specific launch4j
artifact. With the change it would be possible to extend the plugin declaring it as dependency,
instead of having to fork it as it is now. Plenty of things can be hacked into via reflection,
but not static final fields, there were some hacks but they aren't working in recent versions
of Java.

Right now if you change the dependency to a fork of launch4j, everything just stops working.
With this it would be enough to, at minimum, change these fields in constructor via reflection,
and in an extending class, with no further changes required to the plugin itself, and with a very
high chance it will work with the future versions of the plugin (with no guarantees obviously,
since they're still private so not part of the api).

I have some other more, no pun intended, extensive ideas regarding that subject, but this is the
minimum so it can be used that way via dependency and inheritance instead of full forking.

Comment on lines 75 to 79
private static final String LAUNCH4J_ARTIFACT_ID = "launch4j";
// intentionally non-static non-final, so they can be changed
// via reflection if someone absolutely positively needs to
private String LAUNCH4J_ARTIFACT_ID = "launch4j";

private static final String LAUNCH4J_GROUP_ID = "net.sf.launch4j";
private String LAUNCH4J_GROUP_ID = "net.sf.launch4j";
Copy link
Collaborator

@lukaszlenart lukaszlenart Jan 7, 2024

Choose a reason for hiding this comment

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

Wouldn't be better to use parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I may be a little sleep-deprived. It would certainly be less spaghettish. I can't think of anything right now when 'normal' users would need to change it, so not sure if there's a point in completely exposing it, but I guess there's no harm either.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is one - you ;-)

@lukaszlenart lukaszlenart merged commit 7fcbfe2 into orphan-oss:master Jan 15, 2024
4 checks passed
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.

2 participants