Describe the bug
When using one of the two options Add class qualifier to static member access or Add class qualifier to static member access outside declaring class, you will get an error when using a Java enum switch.
An enum switch infers the type of the case from the value and doesn't need a qualifier. Therefor you get an error when save actions adds those.
Code input:
@Override
public void drawProgressBar(MatrixStack matrix, int posX, int posY, int uOffset, int height, PROGRESS_TYPE type) {
if (menu.isProcessing()) {
int progress = (int) menu.getProgress();
int processTime = menu.getProcessTime();
int length;
switch (type) {
case PRIMARY:
length = (progress - processTime / 2) * 22 / (processTime / 2);
break;
case SECONDARY:
length = progress * 2 * 22 / processTime;
break;
default:
length = progress * 22 / processTime;
break;
}
length += 2;
blit(matrix, posX, posY, uOffset, 0, MathHelper.clamp(length, 0, 22), height);
}
}
protected enum PROGRESS_TYPE {
PRIMARY,
SECONDARY,
SINGLE
}
Describe the bug When using one of the two options
Add class qualifier to static member access
orAdd class qualifier to static member access outside declaring class
, you will get an error when using a Java enum switch. An enum switch infers the type of the case from the value and doesn't need a qualifier. Therefor you get an error when save actions adds those.Code input:
Result (only contains the interesting part):
What triggered the plugin CTRL + S
Versions IntelliJ IDEA 2021.1.1 (Ultimate Edition) Build #IU-211.7142.45, built on April 30, 2021 Licensed to Martin
Subscription is active until December 16, 2021.
For educational use only.
Runtime version: 11.0.10+9-b1341.41 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: ide.intellij.laf.enable.animation=true, ide.balloon.shadow.size=0
Non-Bundled Plugins: Key Promoter X (2021.1.1), color.scheme.Relentless-Colors (1.1.0), com.intellij.plugins.vscodekeymap (211.4961.30), com.intellij.plugins.watcher (211.6693.44), com.mallowigi (36.0), com.mallowigi.idea (15.1), net.vektah.codeglance (1.5.4), org.igu.plugins.bettercomments (1.0), com.almightyalpaca.intellij.plugins.discord (1.6.1), mobi.hsz.idea.gitignore (4.1.0), org.toml.lang (0.2.147.3871-211), com.dubreuia (2.2.0), com.github.setial (4.0.2), org.sonarlint.idea (4.16.0.31683), com.demonwav.minecraft-dev (2021.1-1.5.10), org.jetbrains.kotlin (211-1.5.0-release-759-IJ6693.72), intellij.prettierJS (211.7142.13), com.codota.csp.intellij (4.2.6), izhangzhihao.rainbow.brackets (6.17)
Kotlin: 211-1.5.0-release-759-IJ6693.72