All `CompilationTestHelper`, `BugCheckerRefactoringTestHelper` and
`Compilation` test code is now specified using a single text block.
These changes were automated thanks to the new text block support added
to the `TestHelperSourceFormat` check (renamed from
`ErrorProneTestHelperSourceFormat`).
This new `Extractor` implementation collects Refaster example input and
output code from rule collection tests.
This change also introduces explicit compilation steps for the test
code. As a side-effect this produces faster feedback in case of invalid
input or output code.
By raising this baseline the project can now use Java 17 language features such
as text blocks, switch expressions and `instanceof` pattern matching. The code
has been updated to make use of these constructs.
Note that the project can still be used by builds that target an older version
of Java, as long as those builds are executed using JDK 17+.
As we're moving to a Java-based website generator located in the same
package as the `Extractor` implementations, there is no need to validate
the exact format of generated files; only that the data can be
deserialized again.
While there, track the source file from which data is extracted.
This new `Extractor` implementation collects identification and
replacement source code from `BugChecker` unit tests.
While there:
- Refactor the existing `Extractor` setup such that instances are
service-loaded and need to implement only a single method, thereby
avoiding the need to align logic between multiple source code
locations.
- Extend the validation performed by the `Compilation` test helper
class.
- Extend the `ErrorProneTestHelperSourceFormat` check to support source
code passed to the `Compilation` test helper class.
This new module provides the initial version of a framework for the extraction
of data from bug checkers and Refaster rules, to be used as input for website
generation.