Create account / Log in

"Out Of Date Custom Code"

Topics related to the main Vassal engine.

Moderators: uckelman, Tim M

"Out Of Date Custom Code"

Postby stroar » September 17th, 2020, 7:30 pm

Hi.

Upon upgrading to Vassal 3.4.2, when I opened one of my Up Front modules, I got the following "warning":

- [Out Of Date Custom Code] This module contains custom code that is calling the VASSAL function VASSAL.build.GameModule.getFrame. This function is scheduled to be removed from VASSAL after 6-Aug-2021 and this module will cease to function.

What does this mean and how do I go about fixing it? And why are you going to remove the function it refers to? This seems to be a problem in all the modules based on and including the original Up Front module. Both those I have tweaked and those I have kept in their original form (Up Front and Up Front Nam).

Will I just have to roll back to an older version of Vassal when next August comes?

Cheers!

Roar
stroar
 
Posts: 14
Joined: December 5th, 2008, 4:34 pm
Location: Norway

Re: "Out Of Date Custom Code"

Postby Flint1b » September 17th, 2020, 8:39 pm

This means that the method "public JFrame VASSAL.build.GameModule.getFrame()" is scheduled to be removed after 6-Aug-2021, and the module will cease to function with Vassal versions released after that date.

We will remove this method because it is too generic, and we offer a better method as a replacement: "public PlayerWindow Vassal.build.GameModule.getPlayerWindow()". The PlayerWindow is also a JFrame. We documented this in Vassal's code, right on top of the deprecated method: https://github.com/vassalengine/vassal/ ... .java#L245. Note how it says "@deprecated use {@link #getPlayerWindow()}"

The best you can do is to replace the call to "getFrame()" with a call to "getPlayerWindow()", as suggested in the Javadoc.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: "Out Of Date Custom Code"

Postby Flint1b » September 17th, 2020, 9:24 pm

In case this is too technical, the source for the custom code is not available anymore, decompiling the bytecode is next to impossible, and everything I wrote sounds like gibberish, please say so and we will think about another way of helping you.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: "Out Of Date Custom Code"

Postby stroar » September 18th, 2020, 5:23 pm

Thanks for the answer, but I didn't understand a thing of it. Sorry.
I don't know what custom code is. I don't know what it does in the game. And I don't have the faintest idea of how I have to go about to replace the call "getFrame()" with "getPlayerWindow()" as I cannot recall to ever have seen these phrases when I have worked in any of the modules.

Hope you are able to enlighten me. The best would be a step by step description "for dummies". Do this, then this, then that etc.

Roar
stroar
 
Posts: 14
Joined: December 5th, 2008, 4:34 pm
Location: Norway

Re: "Out Of Date Custom Code"

Postby Flint1b » September 18th, 2020, 10:28 pm

Well, this was an interesting experience. I looked up these modules, two hours later I have learned some new stuff about Java internals, and fixed the custom code for you. In theory. I have not actually tested it, I do not guarantee that it will run.

I was not aware of how involved this can be, now in retrospect, I recommend the following, a step by step guide:

1) If you maintain a module which has custom code, and you don't know what custom code is, run away
2) If you are still there, and you know roughly what Java is, or any other high-level programming language, still run away
3) If you are still there, know some Java basics, run away
4) If you are still there, know how to setup a Java project, use a Java IDE, and are willing to learn Java internals, only then you are actually able to maintain such a module

I present you two files:
upfront-custom-code.zip
Source code
(5.78 KiB) Downloaded 84 times
this is the source for the custom code, it is for future reference and maintaining the module, you can (=should) put it right inside the module zip file for future maintainers

UpFront-compiled.zip
Compiled code
(13.02 KiB) Downloaded 84 times
this is the compiled custom code, you will see an /UpFront folder inside the modules and several .class files in there, remove them all and replace with the files from this zip
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: "Out Of Date Custom Code"

Postby Tim M » September 18th, 2020, 11:46 pm

I maintain this module and yes I do know how to do step 4.

I have not done so because
1. I have been waiting for V4 (+10 years now). I stopped working in Eclipse 6+ years back

2. As I recall this custom class "messenger" was written by Brent and this was done back on Vassal 1.2 (I still have a copy of 1.2. We go back a very long way with vassal, was 2002 iirc), the class was a simple thing for reporting and had long since been incorporated into vassal after 2.0 i think, but it never broke until now after Vassal 3.4 so there never was a need to update it.

3. Since the development plan has now been updated referring to V3.5 and V3.6 but alas no V4, I've just given up. After 18 years, Im just happy to manage the module pages these past 10.
Tim,
Vassal Uber Geek/Guru

Problems? post your OS, Physical Mem, version of Vassal and Java plus the Module in question.
No developer can help with out that info, thx!
User avatar
Tim M
 
Posts: 1817
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Re: "Out Of Date Custom Code"

Postby uckelman » September 19th, 2020, 10:48 am

Thus spake Tim M:
>
> 3. Since the development plan has now been updated referring to V3.5 and
> V3.6 but alas no V4, I've just given up. After 18 years, Im just happy
> to manage the module pages these past 10.

V4 planning is waiting on me, and it's next on my list after 3.4.3 is
released. I haven't put anything on that planning page myself yet.

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

Re: "Out Of Date Custom Code"

Postby stroar » September 20th, 2020, 5:54 pm

Flint1b wrote:
this is the compiled custom code, you will see an /UpFront folder inside the modules and several .class files in there, remove them all and replace with the files from this zip


I decided to try this, but the module I opened had more .class files in it that what I could find in the zip file from Flint1b.

Now what?

Roar
stroar
 
Posts: 14
Joined: December 5th, 2008, 4:34 pm
Location: Norway

Re: "Out Of Date Custom Code"

Postby Cattlesquat » September 20th, 2020, 9:23 pm

That's actually fine in this case -- what Flint said to do (remove all the old ones and insert all the new ones) will work right. Java compilers sometimes split classes into multiple files, and I think Flint cleaned some stuff up, but it looks like the right number of "main" files to me.
User avatar
Cattlesquat
 
Posts: 940
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: "Out Of Date Custom Code"

Postby Flint1b » September 21st, 2020, 1:06 am

Yes, good that you noticed it, means you found all the right folders and files and paid attention to what you're doing. And in this case it's normal that there are fewer class files.

If you're interested in details: I turned some anonymous classes into lambdas, and the compiler doesn't generate .class files for lambdas like it does for anonymous classes.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests