Skip to content

Fix ClassCastException in MagicNumberDiagnostic with soft error handling #3486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 22 commits into
base: develop
Choose a base branch
from
Draft
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
337d432
Initial plan for issue
Copilot Jun 14, 2025
80a646b
Fix ClassCastException in MagicNumberDiagnostic with soft error handling
Copilot Jun 14, 2025
50e7a28
Implement general solution for ClassCastException in diagnostic confi…
Copilot Jun 14, 2025
240c0fe
Simplify ClassCastException handling to just try/catch with error log…
Copilot Jun 14, 2025
503081e
Implement localized error messages and crash test for DiagnosticBeanP…
Copilot Jun 14, 2025
d60200f
Address code review feedback: change log level, fix localization, imp…
Copilot Jun 14, 2025
ad3410a
Use getBean for DiagnosticBeanPostProcessor in test instead of manual…
Copilot Jun 14, 2025
1681c41
Add reflection-based verification of diagnostic parameter values afte…
Copilot Jun 14, 2025
d21e17d
Use DiagnosticObjectProvider and autowired DiagnosticBeanPostProcesso…
Copilot Jun 14, 2025
ea69b6e
Replace reflection with getter method for DiagnosticsOptions configur…
Copilot Jun 15, 2025
7346b69
Add verification of default authorized numbers in test as requested
Copilot Jun 15, 2025
df49d65
Implement JSON schema validation for diagnostic parameters
Copilot Jun 15, 2025
dae5993
Implement cached JSON schema validation for diagnostic parameters per…
Copilot Jun 15, 2025
0443adb
Extract DiagnosticParameterValidator class to enable Spring caching f…
Copilot Jun 15, 2025
7bdfb53
Add Javadoc to DiagnosticParameterValidator class and use @Getter(laz…
Copilot Jun 24, 2025
dafc798
Fix deprecated method usage and Spring Bean warnings in DiagnosticBea…
Copilot Jun 24, 2025
7a4c86d
Add ROLE_INFRASTRUCTURE to core infrastructure beans to resolve Sprin…
Copilot Jun 24, 2025
d69d92d
Complete Spring Bean warnings fix by adding ROLE_INFRASTRUCTURE to al…
Copilot Jun 24, 2025
7276b9d
Remove inappropriate ROLE_INFRASTRUCTURE annotations from regular bea…
Copilot Jun 24, 2025
6e38274
Fix failing tests and eliminate Spring Bean warnings by removing sche…
Copilot Jun 24, 2025
631c220
Reintegrate JSON schema validation in DiagnosticBeanPostProcessor wit…
Copilot Jun 24, 2025
291d79b
Restore DiagnosticParameterValidator component with infrastructure ro…
Copilot Jun 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.github._1c_syntax.bsl.languageserver.diagnostics.BSLDiagnostic;
import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;
Expand All @@ -33,6 +34,7 @@

@RequiredArgsConstructor
@Component
@Slf4j
public class DiagnosticBeanPostProcessor implements BeanPostProcessor {

private final LanguageServerConfiguration configuration;
Expand Down Expand Up @@ -65,7 +67,12 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {
configuration.getDiagnosticsOptions().getParameters().get(diagnostic.getInfo().getCode().getStringValue());

if (diagnosticConfiguration != null && diagnosticConfiguration.isRight()) {
diagnostic.configure(diagnosticConfiguration.getRight());
try {
diagnostic.configure(diagnosticConfiguration.getRight());
} catch (Exception e) {
LOGGER.error("Failed to configure diagnostic '{}': {}. Diagnostic will use default configuration.",
diagnostic.getInfo().getCode().getStringValue(), e.getMessage(), e);
}
}

return diagnostic;
Expand Down