diff --git a/bundles/com.e1c.v8codestyle.bsl.ui/src/com/e1c/v8codestyle/internal/bsl/ui/views/BslDocCommentView.java b/bundles/com.e1c.v8codestyle.bsl.ui/src/com/e1c/v8codestyle/internal/bsl/ui/views/BslDocCommentView.java index d83e19cc..dbedc2ef 100644 --- a/bundles/com.e1c.v8codestyle.bsl.ui/src/com/e1c/v8codestyle/internal/bsl/ui/views/BslDocCommentView.java +++ b/bundles/com.e1c.v8codestyle.bsl.ui/src/com/e1c/v8codestyle/internal/bsl/ui/views/BslDocCommentView.java @@ -14,8 +14,6 @@ package com.e1c.v8codestyle.internal.bsl.ui.views; import java.text.MessageFormat; -import com.google.inject.Inject; - import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; @@ -32,8 +30,8 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.ui.IActionBars; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.ViewPart; import org.eclipse.xtext.resource.EObjectAtOffsetHelper; @@ -68,9 +66,6 @@ public class BslDocCommentView */ public static final String ID = "com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"; //$NON-NLS-1$ - @Inject - private IWorkbench workbench; - private TreeViewer viewer; private ISelectionListener listener; @@ -254,7 +249,7 @@ public class BslDocCommentView { imageKey = ISharedImages.IMG_OBJ_FOLDER; } - return workbench.getSharedImages().getImage(imageKey); + return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey); } } diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/strict/check/FunctionCtorReturnSectionCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/strict/check/FunctionCtorReturnSectionCheck.java index 7c64a0a9..1729dc6e 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/strict/check/FunctionCtorReturnSectionCheck.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/strict/check/FunctionCtorReturnSectionCheck.java @@ -48,6 +48,7 @@ import com._1c.g5.v8.dt.bsl.model.Function; import com._1c.g5.v8.dt.bsl.model.ReturnStatement; import com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer; import com._1c.g5.v8.dt.bsl.resource.TypesComputer; +import com._1c.g5.v8.dt.bsl.util.BslUtil; import com._1c.g5.v8.dt.core.platform.IBmModelManager; import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8Project; @@ -183,10 +184,7 @@ public class FunctionCtorReturnSectionCheck Set checkTypes = getCheckTypes(parameters); - Set computedReturnTypeNames = computedReturnTypes.stream() - .map(McoreUtil::getTypeName) - .filter(Objects::nonNull) - .collect(Collectors.toSet()); + Collection computedReturnTypeNames = BslUtil.computeTypeNames(computedReturnTypes, method); if (isUserDataTypes(computedReturnTypeNames, checkTypes)) { @@ -269,11 +267,8 @@ public class FunctionCtorReturnSectionCheck { String propertyName = useRussianScript ? declaredProperty.getNameRu() : declaredProperty.getName(); declaredProertyNames.add(propertyName); - List declaredType = declaredProperty.getTypes() - .stream() - .map(McoreUtil::getTypeName) - .filter(Objects::nonNull) - .collect(Collectors.toList()); + Collection declaredType = + com._1c.g5.v8.dt.bsl.util.BslUtil.computeTypeNames(declaredProperty.getTypes(), function); if (declaredType.isEmpty()) { continue; @@ -287,7 +282,7 @@ public class FunctionCtorReturnSectionCheck .collect(Collectors.toList()); List missingTypes = types.stream().filter(t -> { - String typeName = McoreUtil.getTypeName(t); + String typeName = McoreUtil.getTypeCategory(t); if (typeName != null) { if (!declaredType.contains(typeName)) diff --git a/tests/com.e1c.v8codestyle.bsl.itests/resources/strict/constructor-function-return-section.bsl b/tests/com.e1c.v8codestyle.bsl.itests/resources/strict/constructor-function-return-section.bsl index 1f36fed3..96254f6b 100644 --- a/tests/com.e1c.v8codestyle.bsl.itests/resources/strict/constructor-function-return-section.bsl +++ b/tests/com.e1c.v8codestyle.bsl.itests/resources/strict/constructor-function-return-section.bsl @@ -41,5 +41,15 @@ Function CorrectCheckForCommonModule() Export return new Structure("Key1, Key2", 10, CommonModule); EndFunction +// Returns: +// Structure - complaint: +// * Ref - CatalogRef - +Function CorrectCheckForTypeSets() Export + EmptyRef = Catalogs.Catalog1.EmptyRef(); + Str = Новый Structure; + Str.Вставить("Ref", EmptyRef); + Возврат Str; +EndFunction + diff --git a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/strict/check/itests/CommonModuleStrictTypesTest.java b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/strict/check/itests/CommonModuleStrictTypesTest.java index a8ae4b39..6e372bb0 100644 --- a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/strict/check/itests/CommonModuleStrictTypesTest.java +++ b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/strict/check/itests/CommonModuleStrictTypesTest.java @@ -387,8 +387,8 @@ public class CommonModuleStrictTypesTest Module module = updateAndGetModule(checkId); - List finctions = EcoreUtil2.eAllOfType(module, Function.class); - assertEquals(4, finctions.size()); + List functions = EcoreUtil2.eAllOfType(module, Function.class); + assertEquals(5, functions.size()); List markers = getMarters(checkId, module);