False alarm: Remove this unused !unknown! local variable

IntelliJ IDEA 2020.2.3 (Ultimate Edition)
SomarLint 4.13.0.24781

        ClientBilanceStatisticTO get(final CalendarInterval month, final Integer superSportId, final Integer competitionId, ProjectionType projection) {
            return StopWatch.callSafeStartStop(SW_CALC, () -> {

                ClientStatisticsInterval stat = stats.get(month);
                ClientBilanceStatisticTO ret = new ClientBilanceStatisticTO(projection, superSportId, competitionId);
                if (stat == null) {
                    return ret;
                }
                TIntSet competitionIds = superSportId != null ? superSport2CompetitionsCache.getUnchecked(superSportId) : null;

                switch (projection) {
                    case SUPER_SPORTS:
                    case COMPETITIONS:
                    case EVENT_TYPES:
                        for (ClientBalanceStatisticsData<ClientStatisticsKeyEventType> amount : stat.eventTypes) {
                            ClientStatisticsKeyEventType key = amount.getId();

Hello Petr,

Thanks for raising this issue!

I reproduced on my side and have created a small project with the code you provided.

Repro.zip (9.0 KB)

I will ask one of my colleagues to have a closer look.

Thanks again
Damien

1 Like

@Damien_Urruty great, thanks for letting me know.
It was strange because after the first time I saw it this problem disappeared until I reloaded the project.

Petr

Hello

Thanks @Petr_Nehez for reporting this issue, and @Damien_Urruty for the reproducer.

I managed to reproduce the issue and I can confirm the wrong behavior. Ticket created: SONARJAVA-3647.

Best,
Quentin

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.