CARiSMA-Tool / carisma-tool

Implementation of the CARiSMA Tool
https://github.com/CARiSMA-Tool/carisma-tool
Eclipse Public License 1.0
3 stars 5 forks source link

Propose fix for ADF editor #5

Closed seiferma closed 3 years ago

seiferma commented 4 years ago

Adding an empty default constructor fixes #2 for me. I am not sure if this is the correct solution but it looks reasonable to me.

seiferma commented 4 years ago

This PR only solves the issue for an ADF file without any checks. As soon as a check is contained and the editor is opened, the same error appears but with another domain class. The fix should apply in the same way for other domain classes as well but it does not really makes sence to look for all domain classes before deciding about the proposed fix in general.

SvenPeldszus commented 4 years ago

Commit 09857e2 should be a general solution to this issue.

It seems like in newer Java or Eclipse versions the direct cast of the read object leads to problems:

Analysis readAnalysis = (Analysis) xStream.fromXML(isr);

However, the following seems to work:

Object object = xStream.fromXML(isr);
Analysis readAnalysis = (Analysis) object;

I also updated the library to prevent more issues.

Does this fix the issue for you, too?

seiferma commented 3 years ago

I will have a look at the fix. It looks strange to me that a direct cast does not work but casting a temporary variable does but if that fixes the issue, it is fine.

Before I can test the fix: Could you please add jakarta.xml.bind-api-2.3.3.jar to carisma.core.io?

SvenPeldszus commented 3 years ago

I added the missing library.

I will have a look at the fix. It looks strange to me that a direct cast does not work but casting a temporary variable does but if that fixes the issue, it is fine.

This was also surprising for me. If the called method uses type parameters, the cast could lead to a different binding in the bytecode. But this is only a speculation. Let us see what happens for you.

seiferma commented 3 years ago

Indeed, the editor now works like a charm. Thanks for fixing the issue.