Project: JDT
Bug 154337 [quick fix] should suggest final for initialized static variable in inner class
Reported: 2006-08-18 05:55:06 | Status: resolved fixed

public static void main( String[] args ) { class In { static int a = 21; // ^^ } new In(); } In an inner class the quickfix should suggest final for the static variable "a". The compiler is correct with his message "The field a cannot be declared static; static fields can only be declared in static or top level types..." but the editor should be able to fix it. Maybe the error message should be extended in a way that static final values are valid in an inner class.

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ModifierCorrectionsQuickFixTest.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/CorrectionMessages.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ModifierCorrectionSubProcessor.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java