IncompatibleClassChangeError thrown by my extensions
After upgrading to Moneydance Version 5052, at least one of my own (home-grown) extensions is now throwing IncompatibleClassChangeError exceptions, in one case because com.infinitekind.moneydance.model.AcctFilter is not an interface. In the version of the developer's kit linked at https://infinitekind.com/developer (version 5.1), AcctFilter is indeed an interface. So it sounds like that has changed.
Is there a newer version of the developer's kit, so that I can recompile my extensions? If so, how do I acquire that newer version?
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by dtd on 17 Nov, 2023 05:35 AM
I don't know the answer, but yes, I think AcctFilter changed for some reason.
Someone like Stuart could help you, as I saw he changed a lot of his extensions to cover this (and changed a couple of abandoned extensions as well...)
2 Posted by dtd on 17 Nov, 2023 05:46 AM
yogi1967 is Stuart:
extension_development
APP Aug 30th at 6:00 AM
5 new commits pushed to main by yogi1967
d42bde05 - Updating build file for ratios...
45ba5058 - Updating ratios extension to fix the recent AcctFilter fix for MD2023.2(5008+)...
f1c83a9d - Updating debtinsights extension to fix the recent AcctFilter fix for MD2023.2(5008+)...
b6fa909f - Updating findandreplace extension to fix the recent AcctFilter fix for MD2023.2(5008+)...
3 Posted by Stuart Beesley ... on 17 Nov, 2023 07:23 AM
To make it work pre/post 5007 you will need to do something like this and override all the methods. Instead of using AcctFilter() use:
Basically, because DefaultAcctSearch implements AcctFilter, it can be passed to things that require AcctFilter
4 Posted by gnuite on 17 Nov, 2023 10:18 PM
Thanks, Stuart. Sounds easy enough. But what is DefaultAcctSearch? I don't see it in the API of the developer's kit v5.1.
5 Posted by Stuart Beesley ... on 17 Nov, 2023 10:35 PM
Fair point. But this is a trick to give you some forward/backwards compatible code..
Just import it from:
com.moneydance.apps.md.view.gui
It basically extends/implements AcctFilter and adds some convenience methods. But these are irrelevant as the code I gave you completely overrides the methods you need.
Try it.
6 Posted by Stuart Beesley ... on 17 Nov, 2023 10:37 PM
Ps. I don’t know if this class is in the devkit (model) jar… if not, you might have to supply a full Moneydance.jar to compile.
7 Posted by gnuite on 18 Nov, 2023 12:29 AM
Ah, I see. That's why I couldn't find it. Compiling against moneydance.jar seems a bit of a hack (and will require me to upgrade my toolchain to JDK 17). But maybe it's better than nothing.
Surely there must be a more "ordained" solution. Maybe they're waiting for 5007+ to go public (non-preview) before releasing the new dev kit? I wonder if there's a way to gain early access?
Or, I guess I could just downgrade to non-preview and just be patient.
8 Posted by Stuart Beesley ... on 18 Nov, 2023 07:17 AM
There’s lots of ways to fix it. How are you actually using AcctFilter?
9 Posted by gnuite on 18 Nov, 2023 07:28 AM
Anonymously in a call to Account.getSubAccounts:
Is there a sanctioned way to do this in v5007+ ?
10 Posted by Stuart Beesley ... on 18 Nov, 2023 07:35 AM
For example, if you were using allMatchesForSearch() on oldFilter, then something like this..
(Sorry, you’ll have to Java-ise the syntax)
Then newList matches your previous result. This will compile with model api and work forwards/backwards.
I wouldn’t wait for a new model api….
11 Posted by gnuite on 18 Nov, 2023 07:45 AM
Ah, so you're suggesting that I just stop using AcctFilter (and getSubAccounts) completely, and just do the filtering myself manually?
If there's no hope for a new dev kit, and if the old API is going away, then yeah, I guess that's probably my best option.
Thanks for all your help. :)
12 Posted by Stuart Beesley ... on 18 Nov, 2023 07:47 AM
Ah ok. Here is that code:
So perhaps make your own version…
Or:
13 Posted by Stuart Beesley ... on 18 Nov, 2023 07:48 AM
Correct. AcctFilter cannot be made backwards/forwards compatible. The developer tried. So you either pick a version and compile against that, or change the usage completely.
14 Posted by Stuart Beesley ... on 18 Nov, 2023 08:42 AM
To clarify…
You can still use
Account.getSubAccounts()
With no parameters for all sub accounts. Then iterate that list..
15 Posted by Stuart Beesley ... on 21 Nov, 2023 12:12 PM
I just spotted:
com.infinitekind.moneydance.model.BaseAcctFilter
which also extends AcctFilter. It appears to be in the model code.
I haven’t tested it but perhaps it’s a better solution to using DefaultAcctSearch?
16 Posted by gnuite on 21 Nov, 2023 05:47 PM
Sounds perfect - but I don't see it in the v5.1 dev kit. Is it in a newer version of the dev kit, or in the larger moneydance.jar ?
17 Posted by Stuart Beesley ... on 21 Nov, 2023 07:36 PM
No. Sorry. I’ve checked.
a) it’s private
b) it’s new
So of no help.
18 Posted by gnuite on 29 Nov, 2023 09:30 PM
The new Build 5061 includes "Various tweaks to maintain compatibility with pre-2023.2 extensions." I wonder if that addressed the AcctFilter change.
I already worked around it by reimplementing getSubAccounts (per Stuart's suggestion), but I'm curious.
19 Posted by Stuart Beesley ... on 29 Nov, 2023 09:42 PM
Nope. It just stops old extensions that were using AcctFilter from crashing MD. It doesn’t fix your issue and no it’s still not forwards / backwards compatible.