Behavior change in month name formatting for some languages

Some languages differentiate between month names in a complete date format and month names in a standalone form. In Java 8, the getMonthNames and the getShortMonthNames methods of DateFormatSymbols return month names in the formatting form for those languages that have a difference. In Java 7 and prior versions, these methods return the standalone form of the month names.

In Java 8, formatting date-time values using the DateFormat and SimpleDateFormat classes also uses the month names preferred for formatting rather than the standalone version. Depending on the language and the date pattern, using the format method might return different month names.

In Java 7, only M represents the month in date formatting patterns such as "yyyyy.MMMMM.dd". In Java 8, L is introduced for the standalone form and can be used to change the behavior back to that of Java 7.

    M   Month in year (context sensitive)
    L   Month in year (standalone form)

This rule flags the following date-related APIs:

Review the flagged code to verify that the correct month name will display at run time. If a month name is now appearing in the formatting form where the standalone form must be used, use L instead of M to represent the month name. If you are not using an affected language or you are formatting months as a number, you can ignore the flags or turn off this rule.

For additional information, see the Java documentation for the following classes: