Create account / Log in

Questions about ModuleManager

Discussion area for the development team.

Moderators: uckelman, Tim M

Re: Questions about ModuleManager

Postby Flint1b » July 18th, 2020, 12:34 pm

Brent Easton wrote:Tiresome and unnecessary Yan. Please.


Sorry. Hours spent on untangling spaghetti instead of doing useful things makes me an angry Yan :D

About the wizard lib, yes from a technical point of view we can maintain it ourselves. I was looking at this from a project management perspective, we hardly have the resources, or better, we do not have enough resources to maintain Vassal itself. The PR queue is getting bigger every day and not smaller, and there is still more to do in Vassal than we can ever manage if things stay the way they are. Almost anything we touch uncovers some hidden and previously unknown problem that also needs to be solved, just yesterday we came upon some very dubious network/socket code that needs to be cleaned up.. half the world's enterprise backends run on Java sockets, Twitter's backend runs on Java sockets, Netflix runs on Java sockets, Minecraft servers/clients run on them, but Vassal devs are smarter than everyone else and feel that Java sockets are not reliable enough...

And we see how good the maintenance of half the wizard library and the beanshell library has worked in the past - it has not worked at all, the code of these two libraries was added once and not maintained anymore.

And, from the technical perspective, 3 panels with an embedded image and 3-5 buttons per panel do not need any library, it's easier to do that manually. Wizard library makes sense for applications like MS Office where there are many different wizards and they need to look consistent.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Questions about ModuleManager

Postby uckelman » July 18th, 2020, 12:57 pm

Thus spake Flint1b:
> I was looking at this from a project management
> perspective, we hardly have the resources, or better, we do not have
> enough resources to maintain Vassal itself.

This is why we need to bulid something which doesn't consume so many
resources just for fixing problems...

The way forward is to get to a point where we draw a line under the
current code base, rather than dumping more effort into a bottomless
pit.

> just yesterday we came upon some very
> dubious network/socket code that needs to be cleaned up.. half the
> world's enterprise backends run on Java sockets, Twitter's backend runs
> on Java sockets, Netflix runs on Java sockets, Minecraft servers/clients
> run on them, but Vassal devs are smarter than everyone else and feel
> that Java sockets are not reliable enough...

We don't know that code needs to be cleaned up. It migth be correct
as written---beacause as I said, Java's sockets implementation is _weird_.
I've written a lot of sockets code before. Java makes it awkward to manage
normal occurances with sockets. I stand behind that.

> And we see how good the maintenance of half the wizard library and the
> beanshell library has worked in the past - it has not worked at all, the
> code of these two libraries was added once and not maintained anymore.

This is one of the reasons I'd like to be rid of the wizard library, yes.

(And also why I would like to explore if we can update BeanShell and
have only our modifications as part of our codebase.)

> And, from the technical perspective, 3 panels with an embedded image and
> 3-5 buttons per panel do not need any library, it's easier to do that
> manually. Wizard library makes sense for applications like MS Office
> where there are many different wizards and they need to look consistent.

Agree.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 8980
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Questions about ModuleManager

Postby Flint1b » July 18th, 2020, 1:56 pm

uckelman wrote:update BeanShell and have only our modifications as part of our codebase


Should be possible, usually the Generation gap pattern (https://en.wikipedia.org/wiki/Generation_gap_(pattern)) us used for that, the library would be the "generated code" and our modification would be subclasses of it.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Questions about ModuleManager

Postby Brent Easton » July 19th, 2020, 12:15 am

You can try, but I had to modify the grammar and re-generate the Parser using JavaCC/JJTree to add support for the Regular Expression operators. This generates quite a few of the source files.

Apart from that, I seem to remember it was just some changes to the implementation of the + operator to handle Vassals numbers as strings. Plus adding the Regular Expression handling.

beanshell 2 has reached end of life with the 2.0b6 update. Work is underway on Beanshell 3.0 which seems like a bit of a rabbit hole, they are chasing along behind the Java releases trying to implement everything that Java is implementing. I think they are up to about Java 11 so far.

Here's an interim compromise.

I am happy to work on updating our beanshell implementation from 2.0b4 to 2.0b6, keeping the structure the same and implementing the same Vassal changes. I know where the bodies are buried. That should be relatively straight-forward and cause a minimum of disruption (even though the Beanshell 2.0b6 repository refuses to build out of the box atm). There appear to have been some performance optimisations applied as well which will help us. That will give us the latest current Beanshell implentation with minimum work.

When Beanshell 3.0 is released, you can review the situation and look at changing the structure of the implentation.
User avatar
Brent Easton
 
Posts: 3225
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Questions about ModuleManager

Postby Flint1b » July 19th, 2020, 12:52 am

I ran a quick diff between our internal beanshell code and the 2.0b4 sources, it shows that 17 files are different and a bit over 90 files are the same.

Is it not possible to subclass the 17 files/classes that we want to change and just reference the other 90 classes from the beanshell jar?
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Questions about ModuleManager

Postby Brent Easton » July 19th, 2020, 3:13 am

I don't see how subclassing those classes will help as we don't call them, they are all internal (except 1) to Beanshell, our code doesn't go anywhere near them.

We could do what the WizardSupport code does and duplicate them in a duplicate package structure inside our source tree so that the ClassLoader finds our copies before the jar copies? But doesn't this raise Access issues to protected class members as the 2 sets of codes are in different Jars?
User avatar
Brent Easton
 
Posts: 3225
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Questions about ModuleManager

Postby Flint1b » July 19th, 2020, 12:50 pm

Brent Easton wrote:We could do what the WizardSupport code does and duplicate them in a duplicate package structure inside our source tree so that the ClassLoader finds our copies before the jar copies? But doesn't this raise Access issues to protected class members as the 2 sets of codes are in different Jars?


Have a look here https://github.com/yanlyub/beanshell-example

Classloader doesn't care about different Jars, all packages/classes from all Jars are put into the same "namespace" before the classloader begins it's work, and only the order matters. And the application is first in that order so the classes in it are found first, before the classes in the library Jars are found.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Questions about ModuleManager

Postby Brent Easton » July 19th, 2020, 11:54 pm

Yes, that is what I thought, you had me confused talking about subclassing.

Since the 2.0b6 beanshell library in the maven repository is out of date and the only recommended version to use (according to the github Beanshell page) is a manual build of the github repository, which is also version 2.0b6, then I'm not sure we are going to gain anything out of this. We would have to manually build our own Beanshell library to distribute, just so we can add replacement classes of it in our Vassal code.

How about as a stage 1, I update out current beanshell 2.0b4 implementation to 2.0b6 without any structure changes and check that it will actually work. We can the look at restructuring as a stage 2.

By the way, the 2.0b4 you found is not the 2.0b4 I used, the Beanshell people seem to like keeping the version number the same and just pumping in more and more changes! I only update 2 classes, plus the parser grammar change, which results in 8 more updated classes.

My recent reading about Modules indicated that the Java VM will place classes loaded from different jar files in different modules and generate IllegalAccessErrors if you try and access protected methods from one in the other, even if the packages have the same name. Of course, I can no longer find the discussions about this issue.
User avatar
Brent Easton
 
Posts: 3225
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Questions about ModuleManager

Postby Flint1b » July 20th, 2020, 1:18 am

Brent Easton wrote:How about as a stage 1, I update out current beanshell 2.0b4 implementation to 2.0b6 without any structure changes and check that it will actually work. We can the look at restructuring as a stage 2.


Sounds good!

Brent Easton wrote:By the way, the 2.0b4 you found is not the 2.0b4 I used, the Beanshell people seem to like keeping the version number the same and just pumping in more and more changes!


Yea because why the hell not, why use version numbers at all, just build new releases of a product and use your dog's name as the version number for all of them.. That's some specialists at work there.

Brent Easton wrote:My recent reading about Modules indicated that the Java VM will place classes loaded from different jar files in different modules and generate IllegalAccessErrors if you try and access protected methods from one in the other, even if the packages have the same name. Of course, I can no longer find the discussions about this issue.

To be honest I haven't fully understood this whole jigsaw/modules system yet, yes it adds way more restrictions for even more encapsulation, but only works in full when all the dependencies are java-modules-enabled, while older dependencies somehow keep playing outside of this new-and-stricter playing field. Vassal is not modules-enabled right now, most of its dependencies are in the old module-less format, and I think we don't have to worry about these java-modules intricacies yet. Question is for how long.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Previous

Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest