[logback-dev] [JIRA] Commented: (LBCORE-229) Compiler error (I have the compiler set to "sensitive") because of missing enum case in switch statement in PropertySetter.computeAggregationType()
David Tonhofer (JIRA)
noreply-jira at qos.ch
Wed Oct 26 14:08:12 CEST 2011
[ http://jira.qos.ch/browse/LBCORE-229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12234#action_12234 ]
David Tonhofer commented on LBCORE-229:
---------------------------------------
Hi Ceki,
Yes, Eclipse, with Prefernces->Java->Compiler->Errors/Warnings->Potential programming problems->Enum type constant not covered in switch := 'ERROR'
> Compiler error (I have the compiler set to "sensitive") because of missing enum case in switch statement in PropertySetter.computeAggregationType()
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: LBCORE-229
> URL: http://jira.qos.ch/browse/LBCORE-229
> Project: logback-core
> Issue Type: Bug
> Affects Versions: 0.9.30
> Reporter: David Tonhofer
> Assignee: Logback dev list
> Priority: Minor
>
> In PropertySetter.computeAggregationType(), the switch statement should be completed:
> if (addMethod != null) {
> AggregationType type = computeRawAggregationType(addMethod);
> switch (type) {
> case NOT_FOUND:
> return AggregationType.NOT_FOUND;
> case AS_BASIC_PROPERTY:
> return AggregationType.AS_BASIC_PROPERTY_COLLECTION;
> case AS_COMPLEX_PROPERTY:
> return AggregationType.AS_COMPLEX_PROPERTY_COLLECTION;
> }
> }
> to something like this (unsure whether logic correct, which is why switch statements should be completed, right?):
> if (addMethod != null) {
> AggregationType type = computeRawAggregationType(addMethod);
> switch (type) {
> case NOT_FOUND:
> return AggregationType.NOT_FOUND;
> case AS_BASIC_PROPERTY:
> return AggregationType.AS_BASIC_PROPERTY_COLLECTION;
> case AS_COMPLEX_PROPERTY:
> return AggregationType.AS_COMPLEX_PROPERTY_COLLECTION;
> case AS_BASIC_PROPERTY_COLLECTION:
> // FALL-THROUGH
> case AS_COMPLEX_PROPERTY_COLLECTION:
> throw new IllegalStateException(""Can't happen: " + type);
> break;
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev
mailing list