A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd-designer/issues/28 below:

TypeResolution is enabled by default in designer, but exported rule does not enable it · Issue #28 · pmd/pmd-designer · GitHub

Describe the bug
When using a rule that has pmd-java:typeIs checks, the rules are working fine in the designer, however the exported rules are not working later on when testing the rules in Java unit tests.
The rule would look something like:

//PrimaryPrefix/Name[@Image[ends-with(., 'Instant.now')]][pmd-java:typeIs('java.time.Instant')]

and the example code:

package foo;

public class Hello {

public static void main(String[] args) {
    java.time.Instant.now();
}
}

This file fails validation as expected in the designer, but when the rule is exported, the rule no longer works, and violation is no longer reported. After debugging TypeIsFunction, it turned out that this happened because the rule was not set up to perform typeResolution. Manually adding the typeResolution="true" attribute to the rule definition appears to fix this problem.

To Reproduce
Steps to reproduce the behavior:

  1. Launch the designer from run.sh designer
  2. Specify the above code snippet for the example
  3. Use the rule listed above
  4. There should be a matching node
  5. Try to Export XPath to XML rule
  6. Notice how the exported rule does not have typeResolution="true" flag

Expected behavior
Either the UI should run the queries with typeResolution disabled (and have a visible enable flag), or the export view should add the required attribute to the rule definition.

Screenshots
Let me know if you need one.

Desktop (please complete the following information):


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4