Closed KimGenius closed 5 years ago
+1
any solution?
Using Butterknife and Kotlin I am able to compile:
@NotEmpty
@Email
@BindView(R.id.emailTextField)
lateinit var emailTextField: EditText
@NotEmpty
@Password(min = 8, scheme = Password.Scheme.ALPHA_NUMERIC_MIXED_CASE)
@BindView(R.id.passwordTextField)
lateinit var passwordTextField: EditText
private lateinit var validator: Validator
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.login)
presenter?.onCreate(intent.extras)
validator = Validator(this)
validator.setValidationListener(this)
}
However, when I call validator.validate() I receive an exception on Validator.java line 549 (Annotation[] annotations = field.getAnnotations();).
I can see in debug that it does have the reference to the correct field that I added the Email annotation to, and then in createAnnotation I see that it does recognize the email rule correctly, but after that the error thrown is:
{AnnotationFactory init 110} Method threw 'java.lang.NullPointerException' exception. Cannot evaluate libcore.reflect.AnnotationFactory.toString()
Any help you can offer is appreciated.
Kotlin is not supported yet, would appreciate if someone sends a PR.
@NotEmpty @Email private EditText emailEditText;
@Password(min = 6, scheme = Password.Scheme.ALPHA_NUMERIC_MIXED_CASE_SYMBOLS) private EditText passwordEditText;
@ConfirmPassword private EditText confirmPasswordEditText;
@Checked(message = "You must agree to the terms.") private CheckBox iAgreeCheckBox;
Kotlin gets the xml id and uses view, how do you handle this part?