static synchronized String sourceLine(Location location, int lineNumber) throws IOException { if (lineNumber == -1) { throw new IllegalArgumentException(); } try { String fileName = location.sourceName(); Iterator<SourceCode> iter = sourceCache.iterator(); SourceCode code = null; while (iter.hasNext()) { SourceCode candidate = iter.next(); if (candidate.fileName().equals(fileName)) { code = candidate; iter.remove(); break; } } if (code == null) { BufferedReader reader = sourceReader(location); if (reader == null) { throw new FileNotFoundException(fileName); } code = new SourceCode(fileName, reader); if (sourceCache.size() == SOURCE_CACHE_SIZE) { sourceCache.remove(sourceCache.size() - 1); } } sourceCache.add(0, code); return code.sourceLine(lineNumber); } catch (AbsentInformationException e) { throw new IllegalArgumentException(); } }