From 6f3ba198de468b9cd031a3307e5bb6737c4127dd Mon Sep 17 00:00:00 2001 From: Nikolay Babin Date: Wed, 25 Jun 2025 16:42:48 +0300 Subject: [PATCH 1/6] =?UTF-8?q?G5V8DT-26726=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=B2=D0=B0=D0=BB=D0=B8=D0=B4?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D1=82=D0=B0=D1=86=D0=B8=D0=B9=20=D1=82=D0=B8=D0=BF?= =?UTF-8?q?=D0=BE=D0=B2=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=BE=D0=B2=D1=8B?= =?UTF-8?q?=D1=85=20=D0=BB=D0=B8=D1=82=D0=B5=D1=80=D0=B0=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Добавлена валидация размещения аннотаций типизации * Добавлен тест --- .../META-INF/MANIFEST.MF | 1 + bundles/com.e1c.v8codestyle.bsl/plugin.xml | 4 + .../e1c/v8codestyle/bsl/check/Messages.java | 5 +- .../StringLiteralTypeAnnotationCheck.java | 228 ++++++++++++++++++ .../v8codestyle/bsl/check/messages.properties | 4 + .../bsl/check/messages_ru.properties | 4 + .../bsl/ExternalDependenciesModule.java | 3 + ...-literal-annotations-invalid-locations.bsl | 36 +++ .../StringLiteralTypeAnnotationCheckTest.java | 74 ++++++ 9 files changed, 358 insertions(+), 1 deletion(-) create mode 100644 bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/resources/string-literal-annotations-invalid-locations.bsl create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java diff --git a/bundles/com.e1c.v8codestyle.bsl/META-INF/MANIFEST.MF b/bundles/com.e1c.v8codestyle.bsl/META-INF/MANIFEST.MF index ee3388a50..14c9914ed 100644 --- a/bundles/com.e1c.v8codestyle.bsl/META-INF/MANIFEST.MF +++ b/bundles/com.e1c.v8codestyle.bsl/META-INF/MANIFEST.MF @@ -29,6 +29,7 @@ Import-Package: com._1c.g5.v8.bm.core;version="[9.0.0,10.0.0)", com._1c.g5.v8.dt.bsl.model.util;version="[4.0.0,5.0.0)", com._1c.g5.v8.dt.bsl.resource;version="[15.0.0,16.0.0)", com._1c.g5.v8.dt.bsl.services;version="[7.0.0,8.0.0)", + com._1c.g5.v8.dt.bsl.stringliteral.contenttypes;version="[1.2.0,2.0.0)", com._1c.g5.v8.dt.bsl.typesystem;version="[10.0.0,11.0.0)", com._1c.g5.v8.dt.bsl.typesystem.util;version="[11.0.0,12.0.0)", com._1c.g5.v8.dt.bsl.util;version="[8.0.0,9.0.0)", diff --git a/bundles/com.e1c.v8codestyle.bsl/plugin.xml b/bundles/com.e1c.v8codestyle.bsl/plugin.xml index 84f46c157..20d13a226 100644 --- a/bundles/com.e1c.v8codestyle.bsl/plugin.xml +++ b/bundles/com.e1c.v8codestyle.bsl/plugin.xml @@ -391,6 +391,10 @@ category="com.e1c.v8codestyle.bsl" class="com.e1c.v8codestyle.bsl.check.OptionalFormParameterAccessCheck"> + + diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java index f5d3b1d22..7995b6729 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java @@ -453,7 +453,7 @@ final class Messages public static String IsInRoleMethodRoleExistCheck_Role_named_not_exists_in_configuration; public static String IsInRoleMethodRoleExistCheck_title; - + public static String ModuleUndefinedVariableCheck_Title; public static String ModuleUndefinedVariableCheck_Description; public static String ModuleUndefinedVariable_msg; @@ -484,6 +484,9 @@ final class Messages public static String VariableNameInvalidCheck_variable_name_must_start_with_a_capital_letter; public static String VariableNameInvalidCheck_variable_name_starts_with_an_underline; + public static String StringLiteralTypeAnnotationCheck_title; + public static String StringLiteralTypeAnnotationCheck_incorrect_annotation_location; + static { // initialize resource bundle diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java new file mode 100644 index 000000000..b99cf1a6d --- /dev/null +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java @@ -0,0 +1,228 @@ +/** + * Copyright (C) 2025, 1C + */ +package com.e1c.v8codestyle.bsl.check; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.xtext.nodemodel.ICompositeNode; +import org.eclipse.xtext.nodemodel.ILeafNode; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.nodemodel.util.NodeModelUtils; + +import com._1c.g5.v8.dt.bsl.documentation.comment.BslCommentUtils; +import com._1c.g5.v8.dt.bsl.model.Conditional; +import com._1c.g5.v8.dt.bsl.model.IfStatement; +import com._1c.g5.v8.dt.bsl.model.LoopStatement; +import com._1c.g5.v8.dt.bsl.model.Module; +import com._1c.g5.v8.dt.bsl.model.PreprocessorItem; +import com._1c.g5.v8.dt.bsl.model.RegionPreprocessor; +import com._1c.g5.v8.dt.bsl.model.StringLiteral; +import com._1c.g5.v8.dt.bsl.model.TryExceptStatement; +import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.BslBuiltInLanguagePreferences; +import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.IStringLiteralTypeComputer; +import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.TypeUtil; +import com._1c.g5.v8.dt.common.StringUtils; +import com._1c.g5.v8.dt.core.platform.IV8Project; +import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; +import com.e1c.g5.v8.dt.check.BslDirectLocationIssue; +import com.e1c.g5.v8.dt.check.CheckComplexity; +import com.e1c.g5.v8.dt.check.DirectLocation; +import com.e1c.g5.v8.dt.check.ICheckParameters; +import com.e1c.g5.v8.dt.check.components.BasicCheck; +import com.e1c.g5.v8.dt.check.settings.IssueSeverity; +import com.e1c.g5.v8.dt.check.settings.IssueType; +import com.e1c.v8codestyle.check.CommonSenseCheckExtension; +import com.e1c.v8codestyle.internal.bsl.BslPlugin; +import com.google.inject.Inject; + +/** + * Checks the correct placement of annotations for typing string literals. + * + * @author Babin Nikolay + * + */ +public class StringLiteralTypeAnnotationCheck + extends BasicCheck +{ + private static final String CHECK_ID = "string-literal-type-annotation-invalid-place"; //$NON-NLS-1$ + + @Inject + private IV8ProjectManager projectManager; + + @Inject + private IStringLiteralTypeComputer typeComputer; + + private List annotations = null; + + @Override + public String getCheckId() + { + return CHECK_ID; + } + + @Override + protected void configureCheck(CheckConfigurer builder) + { + builder.title(Messages.StringLiteralTypeAnnotationCheck_title) + .complexity(CheckComplexity.NORMAL) + .severity(IssueSeverity.MAJOR) + .issueType(IssueType.ERROR) + .extension(new CommonSenseCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID)) + .module(); + } + + @Override + protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters, + IProgressMonitor monitor) + { + if (!(object instanceof Module)) + return; + + Module module = (Module)object; + + if (!isApplyTagsToEntireExpression(module)) + return; + + ICompositeNode moduleNode = NodeModelUtils.findActualNodeFor(module); + List moduleStringLiterals = new ArrayList<>(); + List moduleAnnotations = new ArrayList<>(); + if (moduleNode != null) + { + for (ILeafNode child : moduleNode.getLeafNodes()) + { + if (monitor.isCanceled()) + return; + + EObject semantic = NodeModelUtils.findActualSemanticObjectFor(child); + if (semantic instanceof StringLiteral literal) + { + moduleStringLiterals.add(literal); + } + if (child.isHidden() && BslCommentUtils.isCommentNode(child) && isAnnotation(child.getText())) + { + moduleAnnotations.add(child); + } + } + } + + List invalidAnnotations = getInvalidAnnotations(monitor, moduleStringLiterals, moduleAnnotations); + + addIssues(resultAceptor, monitor, module, invalidAnnotations); + } + + private void addIssues(ResultAcceptor resultAceptor, IProgressMonitor monitor, Module module, + List invalidAnnotations) + { + for (INode annotation : invalidAnnotations) + { + if (monitor.isCanceled()) + return; + + int index = annotation.getText().indexOf("@"); //$NON-NLS-1$ + int offset = annotation.getTotalOffset() + index; + + int length = annotation.getText() + .trim() + .replaceFirst(BslCommentUtils.START_COMMENT_TAG_BSL, StringUtils.EMPTY) + .trim() + .toLowerCase() + .length(); + + DirectLocation directLocation = new DirectLocation(offset, length, annotation.getStartLine(), module); + BslDirectLocationIssue directLocationIssue = + new BslDirectLocationIssue( + Messages.StringLiteralTypeAnnotationCheck_incorrect_annotation_location, directLocation); + + resultAceptor.addIssue(directLocationIssue); + } + } + + private List getInvalidAnnotations(IProgressMonitor monitor, List moduleStringLiterals, + List moduleAnnotations) + { + List invalidAnnotations = new ArrayList<>(); + + List correctAnnotations = new ArrayList<>(); + for (StringLiteral literal : moduleStringLiterals) + { + if (monitor.isCanceled()) + return invalidAnnotations; + + EObject literalParent = findLiteralParent(literal); + + List rightLines = new ArrayList<>(); + if (literalParent != null) + { + rightLines = TypeUtil.getCommentLinesFromRight(literalParent) + .stream() + .filter(node -> isAnnotation(node.getText())) + .toList(); + correctAnnotations.addAll(rightLines); + } + } + + for (INode node : moduleAnnotations) + { + if (monitor.isCanceled()) + return invalidAnnotations; + + if (!correctAnnotations.contains(node)) + { + invalidAnnotations.add(node); + } + } + return invalidAnnotations; + } + + private boolean isApplyTagsToEntireExpression(EObject object) + { + IV8Project project = projectManager.getProject(object); + + return project != null && project.getProject() != null + && BslBuiltInLanguagePreferences.isApplyTagsToEntireExpression(project.getProject()); + } + + private EObject findLiteralParent(StringLiteral literal) + { + for (EObject e = literal; e != null; e = e.eContainer()) + { + EObject container = e.eContainer(); + //@formatter:off + if (container instanceof com._1c.g5.v8.dt.bsl.model.Method + || container instanceof RegionPreprocessor + || container instanceof PreprocessorItem + || container instanceof Conditional + || container instanceof IfStatement + || container instanceof TryExceptStatement + || container instanceof LoopStatement) + { + //@formatter:on + return e; + } + } + return null; + } + + private boolean isAnnotation(String text) + { + String comment = + text.trim().replaceFirst(BslCommentUtils.START_COMMENT_TAG_BSL, StringUtils.EMPTY).trim().toLowerCase(); + + if (annotations == null) + annotations = typeComputer.allTypes() + .stream() + .map(type -> String.format("@%s", type.getName()).toLowerCase()) //$NON-NLS-1$ + .toList(); + + for (String annotation : annotations) + { + if (comment.startsWith(annotation)) + return true; + } + return false; + } +} diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties index 2b2d397bb..141993346 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties @@ -513,3 +513,7 @@ VariableNameInvalidCheck_variable_name_is_invalid = Variable name {0} is invalid VariableNameInvalidCheck_variable_name_must_start_with_a_capital_letter = variable name must start with a capital letter VariableNameInvalidCheck_variable_name_starts_with_an_underline = variable name starts with an underline + +StringLiteralTypeAnnotationCheck_title=The annotation is placed in the wrong location. + +StringLiteralTypeAnnotationCheck_incorrect_annotation_location=Incorrect location for placing the annotation. diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties index 9eadbaf33..61617dccc 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties @@ -513,3 +513,7 @@ VariableNameInvalidCheck_variable_name_is_invalid = Имя переменной VariableNameInvalidCheck_variable_name_must_start_with_a_capital_letter = имя переменной должно начинаться с заглавной буквы VariableNameInvalidCheck_variable_name_starts_with_an_underline = имя переменной начинается с символа подчеркивания + +StringLiteralTypeAnnotationCheck_title = Неправильное размещение аннотации строковых литералов. + +StringLiteralTypeAnnotationCheck_incorrect_annotation_location=Неправильное размещение аннотации типов строковых литералов. diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/internal/bsl/ExternalDependenciesModule.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/internal/bsl/ExternalDependenciesModule.java index 6db7a9208..60d4fa170 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/internal/bsl/ExternalDependenciesModule.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/internal/bsl/ExternalDependenciesModule.java @@ -36,6 +36,7 @@ import com._1c.g5.v8.dt.bsl.resource.ExportMethodProvider; import com._1c.g5.v8.dt.bsl.resource.TypesComputer; import com._1c.g5.v8.dt.bsl.services.BslGrammarAccess; +import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.IStringLiteralTypeComputer; import com._1c.g5.v8.dt.bsl.typesystem.ExportMethodTypeProvider; import com._1c.g5.v8.dt.core.naming.ITopObjectFqnGenerator; import com._1c.g5.v8.dt.core.platform.IBmModelManager; @@ -76,12 +77,14 @@ protected void doConfigure() bind(INamingService.class).toService(); bind(ITopObjectFqnGenerator.class).toService(); + bind(ICheckRepository.class).toService(); bind(IFixRepository.class).toService(); URI uri = URI.createURI("*.bsl"); //$NON-NLS-1$ final IResourceServiceProvider rsp = IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(uri); + bind(IStringLiteralTypeComputer.class).toProvider(() -> rsp.get(IStringLiteralTypeComputer.class)); bind(IResourceDescription.Manager.class).toProvider(() -> rsp.get(IResourceDescription.Manager.class)); bind(BslEventsService.class).toProvider(() -> rsp.get(BslEventsService.class)); bind(TypesComputer.class).toProvider(() -> rsp.get(TypesComputer.class)); diff --git a/tests/com.e1c.v8codestyle.bsl.itests/resources/string-literal-annotations-invalid-locations.bsl b/tests/com.e1c.v8codestyle.bsl.itests/resources/string-literal-annotations-invalid-locations.bsl new file mode 100644 index 000000000..5f8521a7a --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/resources/string-literal-annotations-invalid-locations.bsl @@ -0,0 +1,36 @@ + +// Новая процедура. +// +// Параметры: +// ЯвляетсяЗаявкойНаОплату Является заявкой на оплату +// ИмяСвойства Имя свойства +// ЗначенияСвойства Значения свойства +// ОбъектXDTO Объект XDTO +Процедура НоваяПроцедура(ЯвляетсяЗаявкойНаОплату, ИмяСвойства, ЗначенияСвойства, ОбъектXDTO) + + Значение = ""; // Дата1, Число какое то число + // yj dsq + + Сообщить(Значение); + + Если ЯвляетсяЗаявкойНаОплату И ИмяСвойства = "recipient" //@non-nls + Тогда // @fqn + + ЗначенияСвойства.Добавить(ОбъектXDTO, "Получатель"); // @nOn-nls + ИначеЕсли ТипЗнч(ОбъектXDTO[ИмяСвойства]) = Тип("СписокXDTO") + + Тогда // @noN-nls-1 + Для //@form + Каждого ЭлементСпискаXDTO + //@non-nls + Из ОбъектXDTO[ИмяСвойства] Цикл + + ЗначенияСвойства.Добавить("ыва"); //@non-Nls + ЗначенияСвойства.Добавить("Литерал"); //@non-nLs + + КонецЦикла; + Иначе + ЗначенияСвойства.Добавить(ОбъектXDTO[ИмяСвойства]); + КонецЕсли; + +КонецПроцедуры diff --git a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java new file mode 100644 index 000000000..297445774 --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2025, 1C + */ +package com.e1c.v8codestyle.bsl.check.itests; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.junit.Test; + +import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.BslBuiltInLanguagePreferences; +import com._1c.g5.v8.dt.core.platform.IDtProject; +import com._1c.g5.v8.dt.validation.marker.Marker; +import com._1c.g5.v8.dt.validation.marker.StandardExtraInfo; +import com.e1c.v8codestyle.bsl.check.StringLiteralTypeAnnotationCheck; + +/** + * A class for testing {@code StringLiteralTypeAnnotationCheck} + * + * @author Babin Nikolay + * + */ +public class StringLiteralTypeAnnotationCheckTest + extends AbstractSingleModuleTestBase +{ + + private static final String PROJECT_NAME = "CommonModule"; + + private static final String MODULE_FILE_NAME = "/src/CommonModules/CommonModule/Module.bsl"; + + public StringLiteralTypeAnnotationCheckTest() + { + super(StringLiteralTypeAnnotationCheck.class); + } + + @Override + protected String getTestConfigurationName() + { + return PROJECT_NAME; + } + + @Override + protected String getModuleFileName() + { + return MODULE_FILE_NAME; + } + + /** + * Checks invalid annotations locations. + * + * @throws Exception the exception + */ + @Test + public void testInvalidAnnotationsLocationsMarkers() throws Exception + { + IDtProject project = getProject(); + + IEclipsePreferences preferences = BslBuiltInLanguagePreferences.getPreferences(project.getWorkspaceProject()); + preferences.putBoolean(BslBuiltInLanguagePreferences.APPLY_TAGS_TO_ENTIRE_EXPRESSION, true); + preferences.flush(); + + updateModule(FOLDER_RESOURCE + "string-literal-annotations-invalid-locations.bsl"); + + List markers = getModuleMarkers(); + assertEquals(4, markers.size()); + + assertEquals(Integer.valueOf(17), markers.get(0).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); + assertEquals(Integer.valueOf(22), markers.get(1).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); + assertEquals(Integer.valueOf(23), markers.get(2).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); + assertEquals(Integer.valueOf(25), markers.get(3).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); + } +} From 1d6ba6de3b27b885a6d6086eb5cdfefe4251c110 Mon Sep 17 00:00:00 2001 From: Nikolay Babin Date: Mon, 30 Jun 2025 15:42:12 +0300 Subject: [PATCH 2/6] =?UTF-8?q?G5V8DT-26726=20=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D1=8F=D0=BC=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../check/StringLiteralTypeAnnotationCheck.java | 15 ++++++++------- .../StringLiteralTypeAnnotationCheckTest.java | 10 +++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java index b99cf1a6d..98d7439d3 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java @@ -4,7 +4,9 @@ package com.e1c.v8codestyle.bsl.check; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject; @@ -70,7 +72,7 @@ protected void configureCheck(CheckConfigurer builder) builder.title(Messages.StringLiteralTypeAnnotationCheck_title) .complexity(CheckComplexity.NORMAL) .severity(IssueSeverity.MAJOR) - .issueType(IssueType.ERROR) + .issueType(IssueType.WARNING) .extension(new CommonSenseCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID)) .module(); } @@ -111,11 +113,11 @@ protected void check(Object object, ResultAcceptor resultAceptor, ICheckParamete List invalidAnnotations = getInvalidAnnotations(monitor, moduleStringLiterals, moduleAnnotations); - addIssues(resultAceptor, monitor, module, invalidAnnotations); + addIssues(resultAceptor, module, invalidAnnotations, monitor); } - private void addIssues(ResultAcceptor resultAceptor, IProgressMonitor monitor, Module module, - List invalidAnnotations) + private void addIssues(ResultAcceptor resultAceptor, Module module, List invalidAnnotations, + IProgressMonitor monitor) { for (INode annotation : invalidAnnotations) { @@ -146,7 +148,7 @@ private List getInvalidAnnotations(IProgressMonitor monitor, List invalidAnnotations = new ArrayList<>(); - List correctAnnotations = new ArrayList<>(); + Set correctAnnotations = new HashSet<>(); for (StringLiteral literal : moduleStringLiterals) { if (monitor.isCanceled()) @@ -154,10 +156,9 @@ private List getInvalidAnnotations(IProgressMonitor monitor, List rightLines = new ArrayList<>(); if (literalParent != null) { - rightLines = TypeUtil.getCommentLinesFromRight(literalParent) + List rightLines = TypeUtil.getCommentLinesFromRight(literalParent) .stream() .filter(node -> isAnnotation(node.getText())) .toList(); diff --git a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java index 297445774..3194e9abd 100644 --- a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java +++ b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java @@ -30,11 +30,6 @@ public class StringLiteralTypeAnnotationCheckTest private static final String MODULE_FILE_NAME = "/src/CommonModules/CommonModule/Module.bsl"; - public StringLiteralTypeAnnotationCheckTest() - { - super(StringLiteralTypeAnnotationCheck.class); - } - @Override protected String getTestConfigurationName() { @@ -47,6 +42,11 @@ protected String getModuleFileName() return MODULE_FILE_NAME; } + public StringLiteralTypeAnnotationCheckTest() + { + super(StringLiteralTypeAnnotationCheck.class); + } + /** * Checks invalid annotations locations. * From c2450bdeb848084cc3bc2331130aac48fd55a3df Mon Sep 17 00:00:00 2001 From: Nikolay Babin Date: Tue, 1 Jul 2025 12:06:14 +0300 Subject: [PATCH 3/6] =?UTF-8?q?G5V8DT-26726=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=8C=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80?= =?UTF-8?q?=20=D0=BF=D0=BE=20=D0=B0=D0=BD=D0=BD=D0=BE=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java index 98d7439d3..89d328297 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java @@ -26,6 +26,7 @@ import com._1c.g5.v8.dt.bsl.model.TryExceptStatement; import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.BslBuiltInLanguagePreferences; import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.IStringLiteralTypeComputer; +import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.LiteralType; import com._1c.g5.v8.dt.bsl.stringliteral.contenttypes.TypeUtil; import com._1c.g5.v8.dt.common.StringUtils; import com._1c.g5.v8.dt.core.platform.IV8Project; @@ -216,6 +217,7 @@ private boolean isAnnotation(String text) if (annotations == null) annotations = typeComputer.allTypes() .stream() + .filter(LiteralType::allowAnnotation) .map(type -> String.format("@%s", type.getName()).toLowerCase()) //$NON-NLS-1$ .toList(); From b31bc666f70629bfa574e5dbe5dc6abee08d003b Mon Sep 17 00:00:00 2001 From: Nikolay Babin Date: Tue, 1 Jul 2025 17:04:43 +0300 Subject: [PATCH 4/6] =?UTF-8?q?G5V8DT-26726=20=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D1=8F=D0=BC=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../e1c/v8codestyle/bsl/check/Messages.java | 4 +- .../StringLiteralTypeAnnotationCheck.java | 45 +++++++++++-------- .../v8codestyle/bsl/check/messages.properties | 4 +- .../bsl/check/messages_ru.properties | 4 +- .../StringLiteralTypeAnnotationCheckTest.java | 28 ++++++------ 5 files changed, 46 insertions(+), 39 deletions(-) diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java index 7995b6729..73d961c58 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java @@ -484,8 +484,8 @@ final class Messages public static String VariableNameInvalidCheck_variable_name_must_start_with_a_capital_letter; public static String VariableNameInvalidCheck_variable_name_starts_with_an_underline; - public static String StringLiteralTypeAnnotationCheck_title; - public static String StringLiteralTypeAnnotationCheck_incorrect_annotation_location; + public static String StringLiteralTypeAnnotationCheck_Title; + public static String StringLiteralTypeAnnotationCheck_Incorrect_annotation_location; static { diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java index 89d328297..7e65f65fb 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.concurrent.atomic.AtomicReference; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject; @@ -14,6 +15,7 @@ import org.eclipse.xtext.nodemodel.ILeafNode; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; +import org.eclipse.xtext.util.Triple; import com._1c.g5.v8.dt.bsl.documentation.comment.BslCommentUtils; import com._1c.g5.v8.dt.bsl.model.Conditional; @@ -49,7 +51,7 @@ * */ public class StringLiteralTypeAnnotationCheck - extends BasicCheck + extends BasicCheck { private static final String CHECK_ID = "string-literal-type-annotation-invalid-place"; //$NON-NLS-1$ @@ -59,7 +61,7 @@ public class StringLiteralTypeAnnotationCheck @Inject private IStringLiteralTypeComputer typeComputer; - private List annotations = null; + private final AtomicReference> annotations = new AtomicReference<>(); @Override public String getCheckId() @@ -70,7 +72,7 @@ public String getCheckId() @Override protected void configureCheck(CheckConfigurer builder) { - builder.title(Messages.StringLiteralTypeAnnotationCheck_title) + builder.title(Messages.StringLiteralTypeAnnotationCheck_Title) .complexity(CheckComplexity.NORMAL) .severity(IssueSeverity.MAJOR) .issueType(IssueType.WARNING) @@ -105,7 +107,7 @@ protected void check(Object object, ResultAcceptor resultAceptor, ICheckParamete { moduleStringLiterals.add(literal); } - if (child.isHidden() && BslCommentUtils.isCommentNode(child) && isAnnotation(child.getText())) + if (child.isHidden() && BslCommentUtils.isCommentNode(child) && isAllowAnnotation(child.getText())) { moduleAnnotations.add(child); } @@ -138,7 +140,7 @@ private void addIssues(ResultAcceptor resultAceptor, Module module, List DirectLocation directLocation = new DirectLocation(offset, length, annotation.getStartLine(), module); BslDirectLocationIssue directLocationIssue = new BslDirectLocationIssue( - Messages.StringLiteralTypeAnnotationCheck_incorrect_annotation_location, directLocation); + Messages.StringLiteralTypeAnnotationCheck_Incorrect_annotation_location, directLocation); resultAceptor.addIssue(directLocationIssue); } @@ -161,7 +163,7 @@ private List getInvalidAnnotations(IProgressMonitor monitor, List rightLines = TypeUtil.getCommentLinesFromRight(literalParent) .stream() - .filter(node -> isAnnotation(node.getText())) + .filter(node -> isAllowAnnotation(node.getText())) .toList(); correctAnnotations.addAll(rightLines); } @@ -209,23 +211,30 @@ private EObject findLiteralParent(StringLiteral literal) return null; } - private boolean isAnnotation(String text) + private boolean isAllowAnnotation(String text) { - String comment = - text.trim().replaceFirst(BslCommentUtils.START_COMMENT_TAG_BSL, StringUtils.EMPTY).trim().toLowerCase(); + List> commentAnnotations = TypeUtil.parseHeaderAnnotations(text); + for (Triple commentAnnotation : commentAnnotations) + { + if (getAllowAnnotations().contains(commentAnnotation.getFirst().toLowerCase())) + return true; + } + return false; + } - if (annotations == null) - annotations = typeComputer.allTypes() + private List getAllowAnnotations() + { + List list = annotations.get(); + if (list == null) + { + list = typeComputer.allTypes() .stream() .filter(LiteralType::allowAnnotation) - .map(type -> String.format("@%s", type.getName()).toLowerCase()) //$NON-NLS-1$ + .map(type -> type.getName().toLowerCase()) .toList(); - - for (String annotation : annotations) - { - if (comment.startsWith(annotation)) - return true; + if (!annotations.compareAndSet(null, list)) + list = annotations.get(); } - return false; + return list; } } diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties index 141993346..1bd32e0ce 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties @@ -514,6 +514,6 @@ VariableNameInvalidCheck_variable_name_must_start_with_a_capital_letter = variab VariableNameInvalidCheck_variable_name_starts_with_an_underline = variable name starts with an underline -StringLiteralTypeAnnotationCheck_title=The annotation is placed in the wrong location. +StringLiteralTypeAnnotationCheck_Title=The annotation is placed in the wrong location. -StringLiteralTypeAnnotationCheck_incorrect_annotation_location=Incorrect location for placing the annotation. +StringLiteralTypeAnnotationCheck_Incorrect_annotation_location=Incorrect location for placing the annotation. diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties index 61617dccc..a78102bde 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties @@ -514,6 +514,6 @@ VariableNameInvalidCheck_variable_name_must_start_with_a_capital_letter = имя VariableNameInvalidCheck_variable_name_starts_with_an_underline = имя переменной начинается с символа подчеркивания -StringLiteralTypeAnnotationCheck_title = Неправильное размещение аннотации строковых литералов. +StringLiteralTypeAnnotationCheck_Title = Неправильное размещение аннотации строковых литералов. -StringLiteralTypeAnnotationCheck_incorrect_annotation_location=Неправильное размещение аннотации типов строковых литералов. +StringLiteralTypeAnnotationCheck_Incorrect_annotation_location=Неправильное размещение аннотации типов строковых литералов. diff --git a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java index 3194e9abd..0e3c4c000 100644 --- a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java +++ b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java @@ -30,18 +30,6 @@ public class StringLiteralTypeAnnotationCheckTest private static final String MODULE_FILE_NAME = "/src/CommonModules/CommonModule/Module.bsl"; - @Override - protected String getTestConfigurationName() - { - return PROJECT_NAME; - } - - @Override - protected String getModuleFileName() - { - return MODULE_FILE_NAME; - } - public StringLiteralTypeAnnotationCheckTest() { super(StringLiteralTypeAnnotationCheck.class); @@ -64,11 +52,21 @@ public void testInvalidAnnotationsLocationsMarkers() throws Exception updateModule(FOLDER_RESOURCE + "string-literal-annotations-invalid-locations.bsl"); List markers = getModuleMarkers(); - assertEquals(4, markers.size()); + assertEquals(2, markers.size()); - assertEquals(Integer.valueOf(17), markers.get(0).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); assertEquals(Integer.valueOf(22), markers.get(1).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); - assertEquals(Integer.valueOf(23), markers.get(2).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); assertEquals(Integer.valueOf(25), markers.get(3).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); } + + @Override + protected String getTestConfigurationName() + { + return PROJECT_NAME; + } + + @Override + protected String getModuleFileName() + { + return MODULE_FILE_NAME; + } } From 7431ff72859362d93c9cf5b2109a28de1130287e Mon Sep 17 00:00:00 2001 From: Nikolay Babin Date: Tue, 1 Jul 2025 17:06:05 +0300 Subject: [PATCH 5/6] =?UTF-8?q?G5V8DT-26726=20=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=B0=D0=BC=20=D1=82?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../check/itests/StringLiteralTypeAnnotationCheckTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java index 0e3c4c000..d93061764 100644 --- a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java +++ b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java @@ -54,8 +54,8 @@ public void testInvalidAnnotationsLocationsMarkers() throws Exception List markers = getModuleMarkers(); assertEquals(2, markers.size()); - assertEquals(Integer.valueOf(22), markers.get(1).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); - assertEquals(Integer.valueOf(25), markers.get(3).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); + assertEquals(Integer.valueOf(22), markers.get(0).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); + assertEquals(Integer.valueOf(25), markers.get(1).getExtraInfo().get(StandardExtraInfo.TEXT_LINE)); } @Override From f693bfeb61d52744bcb16005c188edbc634ad003 Mon Sep 17 00:00:00 2001 From: Nikolay Babin Date: Thu, 3 Jul 2025 11:54:29 +0300 Subject: [PATCH 6/6] =?UTF-8?q?G5V8DT-26726=20=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D1=8F=D0=BC=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StringLiteralTypeAnnotationCheck.java | 22 ++++++++++--------- .../v8codestyle/bsl/check/messages.properties | 4 ++-- .../bsl/check/messages_ru.properties | 4 ++-- .../bsl/ExternalDependenciesModule.java | 1 - .../StringLiteralTypeAnnotationCheckTest.java | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java index 7e65f65fb..451fe9044 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/StringLiteralTypeAnnotationCheck.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject; @@ -61,7 +62,7 @@ public class StringLiteralTypeAnnotationCheck @Inject private IStringLiteralTypeComputer typeComputer; - private final AtomicReference> annotations = new AtomicReference<>(); + private final AtomicReference> annotations = new AtomicReference<>(); @Override public String getCheckId() @@ -140,7 +141,8 @@ private void addIssues(ResultAcceptor resultAceptor, Module module, List DirectLocation directLocation = new DirectLocation(offset, length, annotation.getStartLine(), module); BslDirectLocationIssue directLocationIssue = new BslDirectLocationIssue( - Messages.StringLiteralTypeAnnotationCheck_Incorrect_annotation_location, directLocation); + Messages.StringLiteralTypeAnnotationCheck_Incorrect_annotation_location, directLocation, + StringUtils.EMPTY); resultAceptor.addIssue(directLocationIssue); } @@ -222,19 +224,19 @@ private boolean isAllowAnnotation(String text) return false; } - private List getAllowAnnotations() + private Set getAllowAnnotations() { - List list = annotations.get(); - if (list == null) + Set allowAnnotations = annotations.get(); + if (allowAnnotations == null) { - list = typeComputer.allTypes() + allowAnnotations = typeComputer.allTypes() .stream() .filter(LiteralType::allowAnnotation) .map(type -> type.getName().toLowerCase()) - .toList(); - if (!annotations.compareAndSet(null, list)) - list = annotations.get(); + .collect(Collectors.toSet()); + if (!annotations.compareAndSet(null, allowAnnotations)) + allowAnnotations = annotations.get(); } - return list; + return allowAnnotations; } } diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties index 1bd32e0ce..4f7428431 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties @@ -514,6 +514,6 @@ VariableNameInvalidCheck_variable_name_must_start_with_a_capital_letter = variab VariableNameInvalidCheck_variable_name_starts_with_an_underline = variable name starts with an underline -StringLiteralTypeAnnotationCheck_Title=The annotation is placed in the wrong location. +StringLiteralTypeAnnotationCheck_Title=The annotation is placed in the wrong location -StringLiteralTypeAnnotationCheck_Incorrect_annotation_location=Incorrect location for placing the annotation. +StringLiteralTypeAnnotationCheck_Incorrect_annotation_location=Incorrect location for placing the annotation diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties index a78102bde..7710b4499 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties @@ -514,6 +514,6 @@ VariableNameInvalidCheck_variable_name_must_start_with_a_capital_letter = имя VariableNameInvalidCheck_variable_name_starts_with_an_underline = имя переменной начинается с символа подчеркивания -StringLiteralTypeAnnotationCheck_Title = Неправильное размещение аннотации строковых литералов. +StringLiteralTypeAnnotationCheck_Title = Неправильное размещение аннотации строковых литералов -StringLiteralTypeAnnotationCheck_Incorrect_annotation_location=Неправильное размещение аннотации типов строковых литералов. +StringLiteralTypeAnnotationCheck_Incorrect_annotation_location=Неправильное размещение аннотации типов строковых литералов diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/internal/bsl/ExternalDependenciesModule.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/internal/bsl/ExternalDependenciesModule.java index 60d4fa170..30ce2ff10 100644 --- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/internal/bsl/ExternalDependenciesModule.java +++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/internal/bsl/ExternalDependenciesModule.java @@ -77,7 +77,6 @@ protected void doConfigure() bind(INamingService.class).toService(); bind(ITopObjectFqnGenerator.class).toService(); - bind(ICheckRepository.class).toService(); bind(IFixRepository.class).toService(); diff --git a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java index d93061764..ce3c6c840 100644 --- a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java +++ b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/StringLiteralTypeAnnotationCheckTest.java @@ -17,7 +17,7 @@ import com.e1c.v8codestyle.bsl.check.StringLiteralTypeAnnotationCheck; /** - * A class for testing {@code StringLiteralTypeAnnotationCheck} + * A class for testing {@link StringLiteralTypeAnnotationCheck} * * @author Babin Nikolay *