1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2024-12-12 13:25:29 +02:00

1041: ClassCastException в проверке

form-list-ref-use-always-flag-disabled
This commit is contained in:
Vadim Geraskin 2022-06-15 19:47:57 +07:00
parent dea9703a0b
commit e22610c7d4

View File

@ -25,8 +25,8 @@ import org.eclipse.emf.common.util.EList;
import com._1c.g5.v8.dt.form.model.AbstractDataPath; import com._1c.g5.v8.dt.form.model.AbstractDataPath;
import com._1c.g5.v8.dt.form.model.DynamicListExtInfo; import com._1c.g5.v8.dt.form.model.DynamicListExtInfo;
import com._1c.g5.v8.dt.form.model.FormAttribute; import com._1c.g5.v8.dt.form.model.FormAttribute;
import com._1c.g5.v8.dt.metadata.dbview.DbViewDef;
import com._1c.g5.v8.dt.metadata.dbview.DbViewFieldDef; import com._1c.g5.v8.dt.metadata.dbview.DbViewFieldDef;
import com._1c.g5.v8.dt.metadata.dbview.DbViewTableDef;
import com.e1c.g5.v8.dt.check.CheckComplexity; import com.e1c.g5.v8.dt.check.CheckComplexity;
import com.e1c.g5.v8.dt.check.ICheckParameters; import com.e1c.g5.v8.dt.check.ICheckParameters;
import com.e1c.g5.v8.dt.check.components.BasicCheck; import com.e1c.g5.v8.dt.check.components.BasicCheck;
@ -43,7 +43,6 @@ import com.e1c.v8codestyle.internal.form.CorePlugin;
public class FormListRefUseAlwaysFlagDisabledCheck public class FormListRefUseAlwaysFlagDisabledCheck
extends BasicCheck extends BasicCheck
{ {
private static final String CHECK_ID = "form-list-ref-use-always-flag-disabled"; //$NON-NLS-1$ private static final String CHECK_ID = "form-list-ref-use-always-flag-disabled"; //$NON-NLS-1$
private static final List<String> REF_ABSTRACT_DATA_PATH = List.of("Ref", "Список"); //$NON-NLS-1$ //$NON-NLS-2$ private static final List<String> REF_ABSTRACT_DATA_PATH = List.of("Ref", "Список"); //$NON-NLS-1$ //$NON-NLS-2$
@ -89,8 +88,8 @@ public class FormListRefUseAlwaysFlagDisabledCheck
FormAttribute formAttribute = (FormAttribute)object; FormAttribute formAttribute = (FormAttribute)object;
if (formAttribute.getExtInfo() instanceof DynamicListExtInfo) if (formAttribute.getExtInfo() instanceof DynamicListExtInfo)
{ {
DbViewTableDef tableDef = (DbViewTableDef)((DynamicListExtInfo)formAttribute.getExtInfo()).getMainTable(); DbViewDef dbViewDef = ((DynamicListExtInfo)formAttribute.getExtInfo()).getMainTable();
if (tableDef != null && tableDef.getFields().stream().anyMatch(NAME_CHECK) if (dbViewDef != null && !dbViewDef.eIsProxy() && dbViewDef.getFields().stream().anyMatch(NAME_CHECK)
&& formAttribute.getNotDefaultUseAlwaysAttributes().stream().noneMatch(pathCheck)) && formAttribute.getNotDefaultUseAlwaysAttributes().stream().noneMatch(pathCheck))
{ {
resultAceptor.addIssue( resultAceptor.addIssue(