Opened 4 years ago

Last modified 4 years ago

#4735 assigned defect

Identifiers for warnings and errors

Reported by: jsten Owned by: jsten
Priority: major Milestone: 2.0.x
Component: Modelica/FrontEnd Version: trunk
Keywords: #4734. Cc:


There is a need for identifying and categorizing warnings in an convenient and efficient way. This should be fixed by introducing an identifier for each problem that we can produce.
This identifier can then optionally be printed as part of the problem message (or in retrieved from the problem object if the APIs are used)

This is a part of #4734.

Change History (9)

comment:1 Changed 4 years ago by jsten

I think the best way of implementing this is to introduce an problem producer object for each of the different problems. This object then have an invoke(?) method which produces the problem message and reports it.

The signature of this method will vary depending on what the problem needs, but ideally it must at least take an ASTNode for which the problem will be reported on.

I suggest that we add all of these problem producers as static (final) fields on ASTNode and are then invoked by calling:

ASTNode.PROBLEM_IDENTIFIER.invoke(this, optional_additionalArgs)

The problem processor class is then an internal static class to ASTNode (yey, ASTNode class will grow even more!).

All of the problem processors should extend the same abstract base class which handles gathering of all of the common arguments. Additionally a basic class can be implemented for all of the basic cases which only takes a string and x parameters which are formatted into the string.

A suggestion for the format of the problem identifier is all upper-case letters with underscore separator. The identifier should contain enough information to make it unique but no to long. There will most likely be some cases where it will be tricky to full fill both of those criteria.

comment:2 Changed 4 years ago by jsten

Owner: changed from Jesper Mattsson to jsten
Status: newassigned

comment:3 Changed 4 years ago by jsten

Added support for identifiers for problems (errors and warnings). Introduced the concept of problem producers which each type of problem message should have an static instance of. This instance is the used when producing the actual problem. This way we can filter and categorize problems which will be helpful for the user when debugging models and libraries. This commit is backwards compatible with the previous methods for reporting problems, the identifier is left empty for problems reported with the old methods. We should now migrate all places where we report problems. This will be a tedious task since there are more than 300 different problems all over the compiler. However most of them will be straight forward to migrate since they only use String.format() to produce the error, which there are convenient classes for in the new framework.

comment:4 Changed 4 years ago by jsten

Fixed ordering problem introduced in r8368.

comment:5 Changed 4 years ago by jsten

Converted all errors and warnings in ComplianceCheck.jadd to the new problem producer framework. Also added some javadoc to the problem producer classes. Some additional testcases were also added (untested compliance errors).

comment:6 Changed 4 years ago by jsten

Fixed bug in error reporting where line numbers and column numbers weren't reported correctly in all instances.

comment:7 Changed 4 years ago by jsten

Big batch of errors and warnings that has been moved to the new framework. The problems were selected based on their special needs in the framework (sanity check of the design).

comment:8 Changed 4 years ago by jsten

What remains is to convert all errors and warnings left in the old system!

comment:9 Changed 4 years ago by jsten

Added identifier for missing binding expression on parameters and constants.

Note: See TracTickets for help on using tickets.