Package processing.mode.java.preproc
Class PreprocessIssueMessageSimplifier.RegexTemplateMessageSimplifierStrategy
java.lang.Object
processing.mode.java.preproc.PreprocessIssueMessageSimplifier.RegexTemplateMessageSimplifierStrategy
- All Implemented Interfaces:
PreprocessIssueMessageSimplifier.PreprocIssueMessageSimplifierStrategy
- Enclosing class:
- PreprocessIssueMessageSimplifier
protected static class PreprocessIssueMessageSimplifier.RegexTemplateMessageSimplifierStrategy
extends Object
implements PreprocessIssueMessageSimplifier.PreprocIssueMessageSimplifierStrategy
Strategy that cleans up errors based on a regex matching the error message.
-
Constructor Summary
ConstructorsConstructorDescriptionRegexTemplateMessageSimplifierStrategy(String newRegex, String newHintTemplate) Create a new instance of this strategy. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if this issue should be attributed to the prior token.Attempt to simplify an error message.
-
Constructor Details
-
RegexTemplateMessageSimplifierStrategy
Create a new instance of this strategy.- Parameters:
newRegex- The regex that should be matched in order to activate this strategy.newHintTemplate- template string with a "%s" where the "offending snippet of code" can be inserted where the resulting rendered template can be used as an error hint for the user. For example, "Invalid identifier near %s" may be rendered to the user like "Syntax error. Hint: Invalid identifier near ,1a);".
-
-
Method Details
-
simplify
Description copied from interface:PreprocessIssueMessageSimplifier.PreprocIssueMessageSimplifierStrategyAttempt to simplify an error message.- Specified by:
simplifyin interfacePreprocessIssueMessageSimplifier.PreprocIssueMessageSimplifierStrategy- Parameters:
message- The message to be simplified.- Returns:
- An optional with an improved message or an empty optional if no improvements could be made by this strategy.
-
getAttributeToPrior
public boolean getAttributeToPrior()Determine if this issue should be attributed to the prior token.- Returns:
- True if should be attributed to prior token. False otherwise.
-