RFR: 7231: JMC createReport for JMC8 Automated Analysis fails to evaluate several rules [v4]

Alex Macdonald aptmac at openjdk.java.net
Mon Oct 4 19:47:09 UTC 2021


On Mon, 4 Oct 2021 19:05:14 GMT, Henrik Dafgård <hdafgard at openjdk.org> wrote:

>> Alex Macdonald has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>> 
>>  - update copyright year and javadoc for RulesToolkit.evaluateErrorResult()
>>  - run mvn spotless:apply
>>  - clean up if statement
>>  - ensure rule dependency is evaluated before evaluating rules that depend on it
>>  - 7231: JMC createReport for JMC8 Automated Analysis fails to evaluate several rules
>
> core/org.openjdk.jmc.flightrecorder.rules/src/main/java/org/openjdk/jmc/flightrecorder/rules/util/RulesToolkit.java line 1244:
> 
>> 1242: 					break;
>> 1243: 				}
>> 1244: 			}
> 
> This is not enough to determine whether or not a rule should be evaluated. The `@dependsOn` annotation specifies both a class and an optional minimum severity that the prior rule must return for the current rule to evaluate. If we disregard this we risk running into NPEs for later rules as they attempt to access results that might not be present in the RulesProvider.

Right, thanks for pointing that out. I'll put a severity check into there similar to how it's done in RuleManager: https://github.com/openjdk/jmc/blob/master/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/RuleManager.java#L114

-------------

PR: https://git.openjdk.java.net/jmc/pull/311


More information about the jmc-dev mailing list