Do not treat strings as JavaScriptObject in AuthInfo
The editable_account_fields field of AuthInfo is a list of strings. Treat it as one. Noticed at run-time when built by gwt without -XdisableCastChecking. Bug: Issue 3389 Change-Id: Ied12db0dcdb4cd724b27d2e7dba50635dc93c831
This commit is contained in:
parent
ebf36d70b3
commit
3da3b8d05d
@ -18,7 +18,7 @@ import com.google.gerrit.client.rpc.Natives;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AuthType;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -54,8 +54,8 @@ public class AuthInfo extends JavaScriptObject {
|
||||
|
||||
public final List<Account.FieldName> editableAccountFields() {
|
||||
List<Account.FieldName> fields = new ArrayList<>();
|
||||
for (AccountFieldNameInfo f : Natives.asList(_editableAccountFields())) {
|
||||
fields.add(f.get());
|
||||
for (String f : Natives.asList(_editableAccountFields())) {
|
||||
fields.add(Account.FieldName.valueOf(f));
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
@ -63,20 +63,9 @@ public class AuthInfo extends JavaScriptObject {
|
||||
public final native boolean useContributorAgreements()
|
||||
/*-{ return this.use_contributor_agreements || false; }-*/;
|
||||
private final native String authTypeRaw() /*-{ return this.auth_type; }-*/;
|
||||
private final native JsArray<AccountFieldNameInfo> _editableAccountFields()
|
||||
private final native JsArrayString _editableAccountFields()
|
||||
/*-{ return this.editable_account_fields; }-*/;
|
||||
|
||||
protected AuthInfo() {
|
||||
}
|
||||
|
||||
private static class AccountFieldNameInfo extends JavaScriptObject {
|
||||
final Account.FieldName get() {
|
||||
return Account.FieldName.valueOf(getRaw());
|
||||
}
|
||||
|
||||
private final native String getRaw() /*-{ return this; }-*/;
|
||||
|
||||
protected AccountFieldNameInfo() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user