Can transient keywords mark a method?

前端 未结 5 1048
小鲜肉
小鲜肉 2021-02-01 17:45

In a java class java.util.Locale, I find that the keyword transient marked a method.

 public final class Locale
    implements Cloneable, Serializable
{
    priv         


        
5条回答
  •  名媛妹妹
    2021-02-01 18:09

    If this code has been decompiled it is most likely a result of this: Why Java methods with varargs identified as transient?

    I am quoting from there:

    Sort of an answer can be found in the code of javassist AccessFlag

    public static final int TRANSIENT = 0x0080; public static final int VARARGS = 0x0080; It appears both have the same values. And since transient means nothing for methods, while varargs means nothing for fields, it is ok for them to be the same.

提交回复
热议问题