[
https://issues.apache.org/jira/browse/RATIS-691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16953392#comment-16953392
]
Tsz-wo Sze commented on RATIS-691:
----------------------------------
Oops, just found that I was wrong about switch-case without default. According
to https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.11 ,
bq. A Java compiler is encouraged (but not required) to provide a warning if a
switch on an enum-valued expression lacks a default label and lacks case labels
for one or more of the enum's constants. Such a switch will silently do nothing
if the expression evaluates to one of the missing constants.
Then, the 002 patch with empty default is correct. We should not throw an
exception in order to preserve the logic.
> Fix checkstyle violations in ratis-logservice
> ---------------------------------------------
>
> Key: RATIS-691
> URL: https://issues.apache.org/jira/browse/RATIS-691
> Project: Ratis
> Issue Type: Sub-task
> Components: LogService
> Reporter: Dinesh Chitlangia
> Assignee: Dinesh Chitlangia
> Priority: Minor
> Attachments: RATIS-691.001.patch, RATIS-691.002.patch
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Checkstyle found 83 item(s) in 22 file(s)
> * ArchiveHdfsLogReader.java : 3 item(s)
> ** Unused import - java.io.File. (21:8) [UnusedImportsCheck]
> ** Unused import - java.nio.Buffer. (24:8) [UnusedImportsCheck]
> ** Unused import - org.apache.ratis.logservice.api.LogName. (39:8)
> [UnusedImportsCheck]
> * ArchiveHdfsLogWriter.java : 1 item(s)
> ** Unused import - org.apache.ratis.util.LogUtils. (32:8)
> [UnusedImportsCheck]
> * ArchivedLogStreamImpl.java : 3 item(s)
> ** Variable 'name' must be private and have accessor methods. (45:11)
> [VisibilityModifierCheck]
> ** Variable 'config' must be private and have accessor methods. (49:27)
> [VisibilityModifierCheck]
> ** Variable 'state' must be private and have accessor methods. (53:9)
> [VisibilityModifierCheck]
> * CommandFactory.java : 1 item(s)
> ** Class CommandFactory should be declared as final. (35:0) [FinalClassCheck]
> * Constants.java : 1 item(s)
> ** Utility classes should not have a public or default constructor. (25:1)
> [HideUtilityClassConstructorCheck]
> * LogMessage.java : 1 item(s)
> ** Variable 'logName' must be private and have accessor methods. (27:21)
> [VisibilityModifierCheck]
> * LogName.java : 1 item(s)
> ** Class LogName should be declared as final. (31:0) [FinalClassCheck]
> * LogReaderImpl.java : 2 item(s)
> ** Variable 'currentRecordId' must be private and have accessor methods.
> (61:8) [VisibilityModifierCheck]
> ** File contains tab characters (this is the first instance). (126:1)
> [FileTabCharacterCheck]
> * LogServer.java : 2 item(s)
> ** Variable 'peer' must be private and have accessor methods. (192:18)
> [VisibilityModifierCheck]
> ** Redundant 'public' modifier. (193:9) [RedundantModifierCheck]
> * LogServiceClient.java : 3 item(s)
> ** 'private' modifier out of order with the JLS suggestions. (57:11)
> [ModifierOrderCheck]
> ** 'private' modifier out of order with the JLS suggestions. (58:11)
> [ModifierOrderCheck]
> ** 'config' hides a field. (269:68) [HiddenFieldCheck]
> * LogServiceMetricsRegistry.java : 2 item(s)
> ** Utility classes should not have a public or default constructor. (28:1)
> [HideUtilityClassConstructorCheck]
> ** Variable 'metricsReporting' must be private and have accessor methods.
> (35:27) [VisibilityModifierCheck]
> * LogServiceShell.java : 1 item(s)
> ** Name 'LOG' must match pattern '^[a-z][a-zA-Z0-9]*$'. (46:25)
> [StaticVariableNameCheck]
> * LogServiceShellOpts.java : 1 item(s)
> ** Variable 'metaQuorum' must be private and have accessor methods. (24:17)
> [VisibilityModifierCheck]
> * LogServiceUtils.java : 1 item(s)
> ** Utility classes should not have a public or default constructor. (32:1)
> [HideUtilityClassConstructorCheck]
> * LogStateMachine.java : 13 item(s)
> ** 'state' hides a field. (185:19) [HiddenFieldCheck]
> ** Redundant 'final' modifier. (199:9) [RedundantModifierCheck]
> ** Redundant 'final' modifier. (206:9) [RedundantModifierCheck]
> ** Redundant 'final' modifier. (207:9) [RedundantModifierCheck]
> ** Redundant 'final' modifier. (236:9) [RedundantModifierCheck]
> ** Redundant 'final' modifier. (237:9) [RedundantModifierCheck]
> ** 'archivalInfo' hides a field. (334:9) [HiddenFieldCheck]
> ** '{' at column 3 should be on the previous line. (347:3) [LeftCurlyCheck]
> ** '{' at column 3 should be on the previous line. (362:3) [LeftCurlyCheck]
> ** Redundant 'final' modifier. (464:12) [RedundantModifierCheck]
> ** switch without "default" clause. (538:0) [MissingSwitchDefaultCheck]
> ** 'state' hides a field. (576:16) [HiddenFieldCheck]
> ** 'state' hides a field. (747:45) [HiddenFieldCheck]
> * LogStream.java : 1 item(s)
> ** Redundant 'public' modifier. (33:3) [RedundantModifierCheck]
> * LogStreamImpl.java : 6 item(s)
> ** Variable 'listeners' must be private and have accessor methods. (51:24)
> [VisibilityModifierCheck]
> ** Variable 'name' must be private and have accessor methods. (55:11)
> [VisibilityModifierCheck]
> ** Variable 'raftClient' must be private and have accessor methods. (59:14)
> [VisibilityModifierCheck]
> ** Variable 'config' must be private and have accessor methods. (63:27)
> [VisibilityModifierCheck]
> ** Variable 'state' must be private and have accessor methods. (67:19)
> [VisibilityModifierCheck]
> ** Variable 'length' must be private and have accessor methods. (72:8)
> [VisibilityModifierCheck]
> * MetaServiceProtoUtil.java : 3 item(s)
> ** Unused import - org.apache.ratis.proto.RaftProtos. (27:8)
> [UnusedImportsCheck]
> ** Utility classes should not have a public or default constructor. (40:1)
> [HideUtilityClassConstructorCheck]
> ** Variable 'i' must be private and have accessor methods. (192:38)
> [VisibilityModifierCheck]
> * MetaStateMachine.java : 18 item(s)
> ** Unused import - org.apache.ratis.metrics.impl.RatisMetricRegistryImpl.
> (53:8) [UnusedImportsCheck]
> ** Name 'LOG' must match pattern '^[a-z][a-zA-Z0-9]*$'. (78:12)
> [MemberNameCheck]
> ** Variable 'LOG' must be private and have accessor methods. (78:12)
> [VisibilityModifierCheck]
> ** Must have at least one statement. (163:43) [EmptyBlockCheck]
> ** 'properties' hides a field. (218:28) [HiddenFieldCheck]
> ** 'peers' hides a field. (260:34) [HiddenFieldCheck]
> ** Line is longer than 120 characters (found 124). (294:0) [LineLengthCheck]
> ** Redundant 'final' modifier. (315:14) [RedundantModifierCheck]
> ** Line is longer than 120 characters (found 124). (331:0) [LineLengthCheck]
> ** 'peers' hides a field. (332:32) [HiddenFieldCheck]
> ** Variable 'peer' must be private and have accessor methods. (402:18)
> [VisibilityModifierCheck]
> ** Variable 'groups' must be private and have accessor methods. (403:24)
> [VisibilityModifierCheck]
> ** Redundant 'public' modifier. (405:9) [RedundantModifierCheck]
> ** Line is longer than 120 characters (found 123). (437:0) [LineLengthCheck]
> ** Line is longer than 120 characters (found 130). (456:0) [LineLengthCheck]
> ** 'if' construct must use '{}'s. (496:0) [NeedBracesCheck]
> ** 'if' construct must use '{}'s. (497:0) [NeedBracesCheck]
> ** 'if' construct must use '{}'s. (502:0) [NeedBracesCheck]
> * MetadataServer.java : 1 item(s)
> ** Variable 'metaStateMachine' must be private and have accessor methods.
> (54:18) [VisibilityModifierCheck]
> * RaftLogReader.java : 7 item(s)
> ** Unused import - org.apache.ratis.server.raftlog.RaftLogIOException.
> (22:8) [UnusedImportsCheck]
> ** Unused import -
> org.apache.ratis.thirdparty.com.google.protobuf.ByteString. (23:8)
> [UnusedImportsCheck]
> ** Unused import -
> org.apache.ratis.thirdparty.com.google.protobuf.InvalidProtocolBufferException.
> (24:8) [UnusedImportsCheck]
> ** Redundant 'public' modifier. (32:3) [RedundantModifierCheck]
> ** Redundant 'public' modifier. (37:3) [RedundantModifierCheck]
> ** Redundant 'public' modifier. (43:3) [RedundantModifierCheck]
> ** Redundant 'public' modifier. (49:3) [RedundantModifierCheck]
> * VerificationTool.java : 11 item(s)
> ** Line is longer than 120 characters (found 121). (71:0) [LineLengthCheck]
> ** Line is longer than 120 characters (found 144). (73:0) [LineLengthCheck]
> ** Line is longer than 120 characters (found 142). (79:0) [LineLengthCheck]
> ** Line is longer than 120 characters (found 162). (85:0) [LineLengthCheck]
> ** Line has trailing spaces. (96:0) [RegexpSinglelineCheck]
> ** 'abstract' modifier out of order with the JLS suggestions. (178:12)
> [ModifierOrderCheck]
> ** Variable 'logName' must be private and have accessor methods. (180:21)
> [VisibilityModifierCheck]
> ** Variable 'client' must be private and have accessor methods. (181:30)
> [VisibilityModifierCheck]
> ** Variable 'numRecords' must be private and have accessor methods. (182:17)
> [VisibilityModifierCheck]
> ** Variable 'logFreq' must be private and have accessor methods. (183:17)
> [VisibilityModifierCheck]
> ** Variable 'valueSize' must be private and have accessor methods. (184:17)
> [VisibilityModifierCheck]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)