Project

General

Profile

Feature #5746

More meaningful error message on conversion errors with OO references

Added by Marian Edu over 2 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
version:

History

#1 Updated by Marian Edu over 2 years ago

That one bugged me for a long time already and now looking for alternatives on POLY set method found the cause of the nuisance during debugging, it's probably only useful when implementing the OO sdk and not when converting application code but anyway.

When accessing a method or property from a class that is missing in skeleton or FWD implementation the conversion throw a class not found exception from loadConvertedClass because the fileName there was actually null and that was because the found-in-source-file note was missing. Now that doesn't give any indication as of what went wrong there, I've added one extra loadConvertedClass method in CommonAstSupport to pass in the actual AST node and if file name is null have the toStringVerbose method of the AST node added into the exception message. This can work for method/event references in oo_references.rules.

#2 Updated by Marian Edu over 2 years ago

Never mind, it does look like the info is available in RULE output only the stack-trace was taking all of my screen space and I've got that bad habit to start from the stack trace (and I usually don't like NPEs).

#3 Updated by Greg Shah over 2 years ago

If you have a better approach we are happy to try it.

#4 Updated by Marian Edu over 2 years ago

Greg Shah wrote:

If you have a better approach we are happy to try it.

As said for me just looking at the exception the message `Can not find class associated with null` doesn't tell me much, if we pass the 'AST' to the CommonAstSupport.loadConvertedClass methods the error could be `Can not find associated class for member setPropertyValue` in case the fileName is null there is nothing to load anyway.

#5 Updated by Greg Shah over 2 years ago

As said for me just looking at the exception the message `Can not find class associated with null` doesn't tell me much, if we pass the 'AST' to the CommonAstSupport.loadConvertedClass methods the error could be `Can not find associated class for member setPropertyValue` in case the fileName is null there is nothing to load anyway.

It is a good idea. Please go ahead with this change.

#6 Updated by Marian Edu over 2 years ago

Greg Shah wrote:

It is a good idea. Please go ahead with this change.

Greg, that was pushed as part of the POLY commit - #rev12945, changes in rules/annotations/naming.rules and rules/annotations/oo_references.rules and the loadConvertedClass in CommonAstSupport.

Also available in: Atom PDF