/*package-local*/ void clearStateCache() { if (cacheStates) { try { stateCacheLock.writeLock().lock(); stateCache.clear(); if (TRACE) { System.err.println("Clear State Cache in file " + file.getName()); } } finally { stateCacheLock.writeLock().unlock(); } } }
/*package-local*/ PreprocessorStatePair getCachedVisitedState( APTPreprocHandler.State inputState) { PreprocessorStatePair res = null; if (cacheStates && inputState.isCompileContext()) { if (TRACE) { stateCacheAttempt++; } stateCacheLock.readLock().lock(); APTPreprocHandler.StateKey key = null; try { if (isCacheableState(inputState)) { key = createKey(inputState); Value value = stateCache.get(key); if (value != null) { res = value.value.get(); value.count++; } } } finally { stateCacheLock.readLock().unlock(); } if (TRACE && res != null) { stateCacheSuccessAttempt++; System.err.println( "State Cache Attempt=" + stateCacheAttempt + " successful=" + stateCacheSuccessAttempt + " cache size=" + stateCache.size() + " in file " + file.getName()); System.err.println(" Key=" + key); System.err.println(" Res=" + createKey(res.state)); } } return res; }
FileSnapshot(FileImpl impl) { absPath = impl.getAbsolutePath(); project = impl.getProject(); name = impl.getName(); includes = impl.getIncludes(); errors = impl.getErrors(); declarations = impl.getDeclarations(); macros = impl.getMacros(); scoped = impl.getScopeElements(); isSource = impl.isSourceFile(); isHeader = impl.isHeaderFile(); fileType = impl.getFileType(); fileObject = impl.getFileObject(); delegate = impl; }
@Override public CharSequence getText(int start, int end) { assert false; return delegate.getText(start, end); }
@Override public CharSequence getText() { assert false; return delegate.getText(); }