Bug 88313 [quick fix] Quickfix for qualifying field and inheritance
I'm using I20050219-1500. I have a Java project with the following two files: A.java 1 package xyz; 2 3 public class A 4 { 5 protected Object someObject = new Object(); 6 } B.java 1 package xyz; 2 3 public class B extends A 4 { 5 public void someCode() { 6 Object obj = new Object() { 7 public String toString() { 8 return someObject.getClass().getName(); 9 } 10 }; 11 } 12 } and the compiler settings are such that I get a warning for 'Unqualified access to instance field'. Now I get a warning and a quickfix to 'Qualify with A.this' at line 8. I trigger the quickfix and the result is 8 return A.this.someObject.getClass().getName(); which gives a compiler error ('No enclosing instance').
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
if (binding != null) {
				ITypeBinding[] methodExceptions= binding.getExceptionTypes();
				ArrayList unhandledExceptions= new ArrayList(uncaughtExceptions.length);
				for (int i= 0; i < uncaughtExceptions.length; i++) {
					ITypeBinding curr= uncaughtExceptions[i];
					if (!canRemoveException(curr, methodExceptions)) {
						unhandledExceptions.add(curr);
					}
				}
				uncaughtExceptions= (ITypeBinding[]) unhandledExceptions.toArray(new ITypeBinding[unhandledExceptions.size()]);
				List exceptions= methodDecl.thrownExceptions();
				int nExistingExceptions= exceptions.size();
				ChangeDescription[] desc= new ChangeDescription[nExistingExceptions + uncaughtExceptions.length];
				for (int i= 0; i < exceptions.size(); i++) {
					Name elem= (Name) exceptions.get(i);
					if (canRemoveException(elem.resolveTypeBinding(), uncaughtExceptions)) {
						desc[i]= new RemoveDescription();
					}
				}
				for (int i = 0; i < uncaughtExceptions.length; i++) {
					desc[i + nExistingExceptions]= new InsertDescription(uncaughtExceptions[i], ""); 
				}
				
				String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addthrows.description"); 
				Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);
				
				ChangeMethodSignatureProposal proposal= new ChangeMethodSignatureProposal(label, cu, astRoot, binding, null, desc, 6, image);
				for (int i= 0; i < uncaughtExceptions.length; i++) {
					addExceptionTypeLinkProposals(proposal, uncaughtExceptions[i], proposal.getExceptionTypeGroupId(i));
				}