typetools / checker-framework

Pluggable type-checking for Java
http://checkerframework.org/
Other
1.03k stars 356 forks source link

Purity warning checker name #2581

Open mernst opened 5 years ago

mernst commented 5 years ago

It is surprising that when -AcheckPurityAnnotations and -ArequirePrefixInWarningSuppressions are supplied, purity warnings are prefixed by a specific checker name, such as "fenum:purity..." or "formatter:purity...". I feel it would be better if they were prefixed by "purity:".

mernst commented 5 years ago

The Purity Checker is not a subchecker, but is run by other mechanisms, because it was built before the subchecker mechanism existed.

The Purity Checker could be a subchecker of other type systems. (A subchecker must be a BaseTypeChecker and have a type system, but the Purity Checker does have a fake one-element type system to enable this.) An advantage of a subchecker is that it runs only once, no matter how many different type systems include it.

Here are some steps: Move 3 files from org.checkerframework.framework.util to org.checkerframework.common.purity. Then, move the call to check purity from BaseTypeChecker to a new purity visitor.

This change would also solve #2582.