This is for SQ 8.9.2 with scanning through the Maven plugin.
[ERROR] Unable to run check class org.sonar.java.se.SymbolicExecutionVisitor - on file 'MyClass.java', To help improve the SonarSource Java Analyzer, please report this problem to SonarSource: see https://community.sonarsource.com/
java.lang.UnsupportedOperationException: null
at org.eclipse.jdt.internal.compiler.lookup.InferenceVariable.constantPoolName(InferenceVariable.java:144)
at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.signature(ReferenceBinding.java:1987)
at org.eclipse.jdt.internal.compiler.lookup.WildcardBinding.signature(WildcardBinding.java:891)
at org.eclipse.jdt.internal.compiler.lookup.MethodBinding.signature(MethodBinding.java:1107)
at org.eclipse.jdt.core.dom.ASTUtils.signature(ASTUtils.java:99)
at org.sonar.java.model.JMethodSymbol.<init>(JMethodSymbol.java:67)
...
This is the redacted code in the MyClass.jave
file. Sorry, someone seems to have liked generics a bit too much.
public final class MyClass {
private MyClass() {
}
public static <ID extends Serializable, E extends TechnicalIdAwareEntity, R extends TechnicalIdAwareRepository<E, ID>>
E findByTechnicalId(String technicalId, R repository) {
verifyPreconditions(technicalId, repository);
return repository.findByTechnicalId(technicalId).orElseThrow(
() -> new NotFoundException(String.format("Entity not found for id '%s' in repository %s.", technicalId,
repository.getClass().getSimpleName()), ENTITY_NOT_FOUND.getCompoundId()) {
@Override
public String getCode() {
return ENTITY_NOT_FOUND.getCompoundId();
}
});
}
public static <ID extends Serializable, E extends TechnicalIdAwareEntity, R extends TechnicalIdAwareRepository<E, ID>>
E findByTechnicalId(String technicalId, R repository, Supplier<NotFoundException> exceptionSupplier) {
verifyPreconditions(technicalId, repository);
return repository.findByTechnicalId(technicalId).orElseThrow(exceptionSupplier);
}
private static <ID extends Serializable, E extends TechnicalIdAwareEntity, R extends TechnicalIdAwareRepository<E
, ID>> void verifyPreconditions(String technicalId, R repository) {
Preconditions.checkArgument(StringUtils.isNotBlank(technicalId));
Preconditions.checkNotNull(repository);
}
}
Reference to JDT InferenceVariable.java
(master) : org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceVariable.java - jdt/eclipse.jdt.core - Gitiles