Bug 23348 Quickfix ignores read-only state [quick fix]
Build: 20020903 1. Create a new Java project. 2. Create a new Java file, A.java public class A { public void foo() { ba(); } public void bar() { } } 3. Save the file. 4. Mark it read-only. 5. Right click the error in the task list and select "Quick- fix..." 6. Select either of the options, the edits are made (in a read-only file!).
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/CorrectionMarkerResolutionGenerator.java
IResource res= marker.getResource();
		if (res instanceof IFile && res.isAccessible()) {
			return JavaCore.createCompilationUnitFrom((IFile) res);
		}
		return null;
	}
	
	private ProblemPosition findProblemPosition(IEditorInput input, IMarker marker) throws JavaModelException {
		IAnnotationModel model= JavaPlugin.getDefault().getCompilationUnitDocumentProvider().getAnnotationModel(input);
		if (model != null) {
			Iterator iter= model.getAnnotationIterator();
			while (iter.hasNext()) {
				Object curr= iter.next();
				if (curr instanceof JavaMarkerAnnotation) {
					JavaMarkerAnnotation annot= (JavaMarkerAnnotation) curr;
					
					if (marker.equals(annot.getMarker())) {
						Position pos= model.getPosition(annot);
						if (pos != null) {
							ICompilationUnit cu= getCompilationUnit(marker);
							return new ProblemPosition(pos, annot, EditorUtility.getWorkingCopy(cu));
						}
					}
				}
			}
		}
		return null;
	}
}