[ 
https://issues.apache.org/jira/browse/HADOOP-16386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16885790#comment-16885790
 ] 

Masatake Iwasaki commented on HADOOP-16386:
-------------------------------------------

We got the error on branch-2 but not on trunk. There is no defference in the 
code of GlobalStorageStatistics.java between branch-2 and trunk. Same version 
of findbugs and findbugs-maven-plugin. The diffrence is in javac.version which 
is 1.7 in branch-2 and 1.8 in trunk. I do not fully understand the reason.

Since fields of enum are implicitly transient based on [Java Object 
Serialization 
Specification|https://docs.oracle.com/javase/1.5.0/docs/guide/serialization/spec/serial-arch.html#enum],
 findbugs may be wiser based on javac.version. Marking the field as transient 
was worked for me to suppress the findbugs error and I think it is harmless.

> FindBugs warning in branch-2: GlobalStorageStatistics defines non-transient 
> non-serializable instance field map
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-16386
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16386
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 2.10.0
>            Reporter: Wei-Chiu Chuang
>            Assignee: Masatake Iwasaki
>            Priority: Major
>
> Found in HDFS-14585
> https://builds.apache.org/job/PreCommit-HDFS-Build/27024/artifact/out/branch-findbugs-hadoop-common-project_hadoop-common-warnings.html#Warnings_BAD_PRACTICE
> {quote}Class org.apache.hadoop.fs.GlobalStorageStatistics defines 
> non-transient non-serializable instance field map
> Bug type SE_BAD_FIELD (click for details) 
> In class org.apache.hadoop.fs.GlobalStorageStatistics
> Field org.apache.hadoop.fs.GlobalStorageStatistics.map
> Actual type org.apache.hadoop.fs.StorageStatistics
> In GlobalStorageStatistics.java{quote}
> {quote}SE_BAD_FIELD: Non-transient non-serializable instance field in 
> serializable class
> This Serializable class defines a non-primitive instance field which is 
> neither transient, Serializable, or java.lang.Object, and does not appear to 
> implement the Externalizable interface or the readObject() and writeObject() 
> methods.  Objects of this class will not be deserialized correctly if a 
> non-Serializable object is stored in this field.{quote}
> Looking in my inbox, this warning has been there since Feburary 9, 2019



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to