Home > Mobile >  BindView fields must not be private or static, the location of the source code?
BindView fields must not be private or static, the location of the source code?

Time:11-20

Because use ButterKnife, use private modify the fields, so an error, want to find in the source ButterKnife framework "@ BindView fields must not be private or static", but didn't find it? This sentence is not in ButterKnife source code? The compiler is given?

CodePudding user response:

Can consider to use the public

CodePudding user response:

Please refer to the source:
Private static & lt; T extends AccessibleObject & amp; Member> Void validateMember (T object) {
Int modifiers=object. GetModifiers ();
If ((modifiers & amp; (PRIVATE | STATIC))!=0) {
throw new an IllegalStateException (object. The getDeclaringClass (). The getName ()
+ ". "
+ object. The getName ()
+ "must not be private or static");

}
If ((modifiers & amp; PUBLIC)==0) {
Object. SetAccessible (true);
}
}

CodePudding user response:

Using the public modifier can ~

CodePudding user response:

Butter knife can't use private modifiers, and other public, Default and protected, the principle of butter knife is the same directory to generate a class, so can't use private modifiers butter knife annotations

CodePudding user response:

You don't in the fart of company and Hegel

CodePudding user response:

Somebody else's tip don't use a private or static, then let's again with somebody else, just listen to a somebody else need not private
  • Related