Cormac O'Mahony created MCHECKSTYLE-315:
-------------------------------------------
Summary: MismatchedTokenException occurred during the analysis of
file and build FAILS.
Key: MCHECKSTYLE-315
URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-315
Project: Maven Checkstyle Plugin
Issue Type: Bug
Components: checkstyle:check
Affects Versions: 2.17
Environment: OSX 10.11.1, java version "1.8.0_25", Apache Maven 3.1.1,
Checkstyle configuration plugin for M2Eclipse1.0.0.201503101518
Reporter: Cormac O'Mahony
Priority: Blocker
Checkstyle cannot parse an automatically initialize array in method call.
I experience the issue with both maven-checkstyle and eclipse-checksyle.
The following code causes checktyle:check to fail. The issues is cause by the
second parameter.
final SanitisingBeanRecordFieldExtractor extractor =
new SanitisingBeanRecordFieldExtractor(CreditCardRecord.class,
{ "transactionDescriptionLineText" },
AbstractTransactionRecord.DATE_FORMAT, HASH_KEY);
The checksyle:check fails with the following error.
.../SanitisingBeanRecordFieldExtractorTest.java:109:15: expecting "class",
found 'SanitisingBeanRecordFieldExtractor'
.../SanitisingBeanRecordFieldExtractorTest.java:110:78: expecting IDENT, found
','
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (default) on
project sense-batch: Failed during checkstyle configuration:
MismatchedTokenException occurred during the analysis of file
.../SanitisingBeanRecordFieldExtractorTest.java. expecting EOF, found
'extractor' -> [Help 1]
To work around the code needs to be changed to the following:
final SanitisingBeanRecordFieldExtractor extractor =
new SanitisingBeanRecordFieldExtractor(CreditCardRecord.class,
new String[] { "transactionDescriptionLineText" },
AbstractTransactionRecord.DATE_FORMAT, HASH_KEY);
For reference the constructor I am calling is defined as follows:
public SanitisingBeanRecordFieldExtractor(final Class<?> type, final String[]
fields,
final String dateFormatPattern, final String hashKey) throws
IntrospectionException {
...
}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)