diff options
Diffstat (limited to 'platform/lang-impl/src/com/intellij/util')
16 files changed, 196 insertions, 130 deletions
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/AbstractIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/AbstractIndex.java index 50e87f85baab..34b7937cb7a1 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/AbstractIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/AbstractIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; */ public interface AbstractIndex<Key, Value> { @NotNull - ValueContainer<Value> getData(Key key) throws StorageException; + ValueContainer<Value> getData(@NotNull Key key) throws StorageException; - boolean processAllKeys(Processor<Key> processor, GlobalSearchScope scope, @Nullable IdFilter idFilter) throws StorageException; + boolean processAllKeys(@NotNull Processor<Key> processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter idFilter) throws StorageException; } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java b/platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java index 1648f878066c..f888981f21d4 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package com.intellij.util.indexing; import com.intellij.openapi.util.Computable; import gnu.trove.TIntHashSet; import gnu.trove.TIntProcedure; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Iterator; @@ -72,11 +73,13 @@ class ChangeTrackingValueContainer<Value> extends UpdatableValueContainer<Value> return getMergedData().size(); } + @NotNull @Override public Iterator<Value> getValueIterator() { return getMergedData().getValueIterator(); } + @NotNull @Override public List<Value> toValueList() { return getMergedData().toValueList(); @@ -87,11 +90,13 @@ class ChangeTrackingValueContainer<Value> extends UpdatableValueContainer<Value> return getMergedData().isAssociated(value, inputId); } + @NotNull @Override public IntPredicate getValueAssociationPredicate(Value value) { return getMergedData().getValueAssociationPredicate(value); } + @NotNull @Override public IntIterator getInputIdsIterator(final Value value) { return getMergedData().getInputIdsIterator(value); diff --git a/platform/lang-impl/src/com/intellij/util/indexing/CustomImplementationFileBasedIndexExtension.java b/platform/lang-impl/src/com/intellij/util/indexing/CustomImplementationFileBasedIndexExtension.java index 32b22274dced..d504daf8e808 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/CustomImplementationFileBasedIndexExtension.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/CustomImplementationFileBasedIndexExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,6 @@ import org.jetbrains.annotations.NotNull; public abstract class CustomImplementationFileBasedIndexExtension<K, V, I> extends FileBasedIndexExtension<K, V> { @NotNull - public abstract UpdatableIndex<K, V, I> createIndexImplementation(final ID<K, V> indexId, @NotNull FileBasedIndex owner, @NotNull IndexStorage<K, V> storage) + public abstract UpdatableIndex<K, V, I> createIndexImplementation(@NotNull ID<K, V> indexId, @NotNull FileBasedIndex owner, @NotNull IndexStorage<K, V> storage) throws StorageException; }
\ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java index ed0dd1b19c6b..578529352033 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -252,8 +252,8 @@ public class FileBasedIndexImpl extends FileBasedIndex { myConnection = connection; } - public static boolean isProjectOrWorkspaceFile(final VirtualFile file, - final @Nullable FileType fileType) { + public static boolean isProjectOrWorkspaceFile(@NotNull VirtualFile file, + @Nullable FileType fileType) { if (fileType instanceof InternalFileType) return true; VirtualFile parent = file.isDirectory() ? file: file.getParent(); while(parent instanceof VirtualFileSystemEntry) { @@ -369,8 +369,6 @@ public class FileBasedIndexImpl extends FileBasedIndex { } /** - * @param extension - * @param isCurrentVersionCorrupted * @return true if registered index requires full rebuild for some reason, e.g. is just created or corrupted */ private <K, V> boolean registerIndexer(@NotNull final FileBasedIndexExtension<K, V> extension, final boolean isCurrentVersionCorrupted) @@ -394,7 +392,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { return versionChanged; } - private <K, V> void initIndexStorage(final FileBasedIndexExtension<K, V> extension, int version, File versionFile) + private <K, V> void initIndexStorage(@NotNull FileBasedIndexExtension<K, V> extension, int version, @NotNull File versionFile) throws IOException { MapIndexStorage<K, V> storage = null; final ID<K, V> name = extension.getName(); @@ -429,7 +427,8 @@ public class FileBasedIndexImpl extends FileBasedIndex { ids.add(name); } }); - } else { + } + else { myIndicesWithoutFileTypeInfo.add(name); } @@ -545,12 +544,12 @@ public class FileBasedIndexImpl extends FileBasedIndex { @NotNull MemoryIndexStorage<K, ?> storage) throws IOException { final File indexStorageFile = IndexInfrastructure.getInputIndexStorageFile(indexId); - final Ref<Boolean> isBufferingMode = new Ref<Boolean>(false); + final AtomicBoolean isBufferingMode = new AtomicBoolean(); final TIntObjectHashMap<Collection<K>> tempMap = new TIntObjectHashMap<Collection<K>>(); final DataExternalizer<Collection<K>> dataExternalizer = new DataExternalizer<Collection<K>>() { @Override - public void save(DataOutput out, @NotNull Collection<K> value) throws IOException { + public void save(@NotNull DataOutput out, @NotNull Collection<K> value) throws IOException { try { DataInputOutputUtil.writeINT(out, value.size()); for (K key : value) { @@ -564,7 +563,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { @NotNull @Override - public Collection<K> read(DataInput in) throws IOException { + public Collection<K> read(@NotNull DataInput in) throws IOException { try { final int size = DataInputOutputUtil.readINT(in); final List<K> list = new ArrayList<K>(size); @@ -621,7 +620,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { } }; - storage.addBufferingStateListsner(new MemoryIndexStorage.BufferingStateListener() { + storage.addBufferingStateListener(new MemoryIndexStorage.BufferingStateListener() { @Override public void bufferingStateChanged(boolean newState) { synchronized (map) { @@ -715,10 +714,11 @@ public class FileBasedIndexImpl extends FileBasedIndex { } @Override - public <K> boolean processAllKeys(@NotNull final ID<K, ?> indexId, Processor<K> processor, @Nullable Project project) { - return processAllKeys(indexId, processor, project != null ? GlobalSearchScope.allScope(project) : new EverythingGlobalScope(), null); + public <K> boolean processAllKeys(@NotNull final ID<K, ?> indexId, @NotNull Processor<K> processor, @Nullable Project project) { + return processAllKeys(indexId, processor, project == null ? new EverythingGlobalScope() : GlobalSearchScope.allScope(project), null); } + @Override public <K> boolean processAllKeys(@NotNull ID<K, ?> indexId, @NotNull Processor<K> processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter idFilter) { try { final UpdatableIndex<K, ?, FileContent> index = getIndex(indexId); @@ -949,7 +949,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { return null; } - private <K, V> boolean processValuesImpl(@NotNull final ID<K, V> indexId, final K dataKey, final boolean ensureValueProcessedOnce, + private <K, V> boolean processValuesImpl(@NotNull final ID<K, V> indexId, @NotNull final K dataKey, final boolean ensureValueProcessedOnce, @Nullable final VirtualFile restrictToFile, @NotNull final ValueProcessor<V> processor, @NotNull final GlobalSearchScope scope, @Nullable final IdFilter idFilter) { ThrowableConvertor<UpdatableIndex<K, V, FileContent>, Boolean, StorageException> keyProcessor = @@ -1058,6 +1058,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { }); } + @Override public boolean containsFileId(int id) { if (id < myMinId) return false; if (id > myMaxId) return false; @@ -1659,7 +1660,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { return (UpdatableIndex<K, V, FileContent>)pair.getFirst(); } - private InputFilter getInputFilter(ID<?, ?> indexId) { + private InputFilter getInputFilter(@NotNull ID<?, ?> indexId) { final Pair<UpdatableIndex<?, ?, FileContent>, InputFilter> pair = myIndices.get(indexId); assert pair != null : "Index data is absent for index " + indexId; @@ -1766,7 +1767,8 @@ public class FileBasedIndexImpl extends FileBasedIndex { } } - public static FileType getFileType(VirtualFile file) { + @NotNull + public static FileType getFileType(@NotNull VirtualFile file) { FileType fileType = file.getFileType(); if (fileType == FileTypes.PLAIN_TEXT && FileTypeManagerImpl.isFileTypeDetectedFromContent(file)) { fileType = FileTypes.UNKNOWN; @@ -1803,7 +1805,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { fc.putUserData(IndexingDataKeys.PROJECT, project); } - private void updateSingleIndex(final ID<?, ?> indexId, @NotNull final VirtualFile file, @Nullable FileContent currentFC) + private void updateSingleIndex(@NotNull ID<?, ?> indexId, @NotNull final VirtualFile file, @Nullable FileContent currentFC) throws StorageException { if (ourRebuildStatus.get(indexId).get() == REQUIRES_REBUILD) { return; // the index is scheduled for rebuild, no need to update @@ -1823,8 +1825,9 @@ public class FileBasedIndexImpl extends FileBasedIndex { ); } - private Runnable createIndexedStampUpdateRunnable(final ID<?, ?> indexId, - final VirtualFile file, + @NotNull + private Runnable createIndexedStampUpdateRunnable(@NotNull final ID<?, ?> indexId, + @NotNull final VirtualFile file, final boolean hasContent) { return new Runnable() { @Override @@ -1843,7 +1846,8 @@ public class FileBasedIndexImpl extends FileBasedIndex { }; } - private Computable<Boolean> createUpdateComputableWithBufferingDisabled(final Computable<Boolean> update) { + @NotNull + private Computable<Boolean> createUpdateComputableWithBufferingDisabled(@NotNull final Computable<Boolean> update) { return new Computable<Boolean>() { @Override public Boolean compute() { @@ -2080,7 +2084,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { }); } - private void invalidateIndicesForFile(final VirtualFile file, boolean markForReindex) { + private void invalidateIndicesForFile(@NotNull final VirtualFile file, boolean markForReindex) { cleanProcessedFlag(file); IndexingStamp.flushCache(file); @@ -2439,12 +2443,12 @@ public class FileBasedIndexImpl extends FileBasedIndex { } } - private boolean shouldIndexFile(final VirtualFile file, final ID<?, ?> indexId) { + private boolean shouldIndexFile(@NotNull VirtualFile file, @NotNull ID<?, ?> indexId) { return getInputFilter(indexId).acceptInput(file) && (isMock(file) || !isFileIndexed(file, indexId)); } - private static boolean isFileIndexed(VirtualFile file, ID<?, ?> indexId) { + private static boolean isFileIndexed(VirtualFile file, @NotNull ID<?, ?> indexId) { return IndexingStamp.isFileIndexed(file, indexId, IndexInfrastructure.getIndexCreationStamp(indexId)); } @@ -2537,7 +2541,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { } @Override - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { return file instanceof VirtualFileWithId && myDelegate.acceptInput(file); } } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java index 78814029780c..110db7255f84 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexProjectHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,14 +119,15 @@ public class FileBasedIndexProjectHandler extends AbstractProjectComponent imple return myIndex.getNumberOfPendingInvalidations(); } + @NotNull @Override - public VirtualFile[] queryNeededFiles(ProgressIndicator indicator) { + public VirtualFile[] queryNeededFiles(@NotNull ProgressIndicator indicator) { Collection<VirtualFile> files = myIndex.getFilesToUpdate(myProject); return VfsUtilCore.toVirtualFileArray(files); } @Override - public void processFile(FileContent fileContent) { + public void processFile(@NotNull FileContent fileContent) { myIndex.processRefreshedFile(myProject, fileContent); } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java b/platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java index 6d168332e8c5..226542e49366 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/IndexInfrastructure.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,23 +47,28 @@ public class IndexInfrastructure { private IndexInfrastructure() { } + @NotNull public static File getVersionFile(@NotNull ID<?, ?> indexName) { return new File(getIndexDirectory(indexName, true), indexName + ".ver"); } + @NotNull public static File getStorageFile(@NotNull ID<?, ?> indexName) { return new File(getIndexRootDir(indexName), indexName.toString()); } + @NotNull public static File getInputIndexStorageFile(@NotNull ID<?, ?> indexName) { - return new File(getIndexRootDir(indexName), indexName.toString()+"_inputs"); + return new File(getIndexRootDir(indexName), indexName +"_inputs"); } + @NotNull public static File getIndexRootDir(@NotNull ID<?, ?> indexName) { return getIndexDirectory(indexName, false); } - private static File getIndexDirectory(ID<?, ?> indexName, boolean forVersion) { + @NotNull + private static File getIndexDirectory(@NotNull ID<?, ?> indexName, boolean forVersion) { final String dirName = indexName.toString().toLowerCase(Locale.US); // store StubIndices under StubUpdating index' root to ensure they are deleted // when StubUpdatingIndex version is changed @@ -76,7 +81,7 @@ public class IndexInfrastructure { private static volatile long ourLastStamp; // ensure any file index stamp increases - public static synchronized void rewriteVersion(final File file, final int version) throws IOException { + public static synchronized void rewriteVersion(@NotNull final File file, final int version) throws IOException { final long prevLastModifiedValue = file.lastModified(); if (file.exists()) { FileUtil.delete(file); @@ -108,7 +113,7 @@ public class IndexInfrastructure { } } - public static long getIndexCreationStamp(ID<?, ?> indexName) { + public static long getIndexCreationStamp(@NotNull ID<?, ?> indexName) { Long version = ourIndexIdToCreationStamp.get(indexName); if (version != null) return version.longValue(); @@ -118,7 +123,7 @@ public class IndexInfrastructure { return stamp; } - public static boolean versionDiffers(final File versionFile, final int currentIndexVersion) { + public static boolean versionDiffers(@NotNull File versionFile, final int currentIndexVersion) { try { ourLastStamp = Math.max(ourLastStamp, versionFile.lastModified()); final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(versionFile))); @@ -137,7 +142,7 @@ public class IndexInfrastructure { } @Nullable - public static VirtualFile findFileById(final PersistentFS fs, final int id) { + public static VirtualFile findFileById(@NotNull PersistentFS fs, final int id) { if (ourUnitTestMode) { final VirtualFile testFile = findTestFile(id); if (testFile != null) { @@ -159,7 +164,7 @@ public class IndexInfrastructure { } @Nullable - public static VirtualFile findFileByIdIfCached(final PersistentFS fs, final int id) { + public static VirtualFile findFileByIdIfCached(@NotNull PersistentFS fs, final int id) { if (ourUnitTestMode) { final VirtualFile testFile = findTestFile(id); if (testFile != null) { diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IndexStorage.java b/platform/lang-impl/src/com/intellij/util/indexing/IndexStorage.java index 0f8bb67f00fc..1020876ca2e4 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/IndexStorage.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/IndexStorage.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,15 +33,16 @@ public interface IndexStorage<Key, Value> extends Flushable { void addValue(Key key, int inputId, Value value) throws StorageException; - void removeAllValues(Key key, int inputId) throws StorageException; + void removeAllValues(@NotNull Key key, int inputId) throws StorageException; void clear() throws StorageException; @NotNull ValueContainer<Value> read(Key key) throws StorageException; - boolean processKeys(Processor<Key> processor, GlobalSearchScope scope, @Nullable IdFilter idFilter) throws StorageException; + boolean processKeys(@NotNull Processor<Key> processor, GlobalSearchScope scope, @Nullable IdFilter idFilter) throws StorageException; + @NotNull Collection<Key> getKeys() throws StorageException; void close() throws StorageException; diff --git a/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java b/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java index ebf6906a0d1c..79a7cb684486 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/IndexingStamp.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,14 +26,19 @@ import com.intellij.util.io.DataInputOutputUtil; import gnu.trove.TObjectLongHashMap; import gnu.trove.TObjectLongProcedure; import gnu.trove.TObjectProcedure; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.List; import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ConcurrentMap; /** * @author Eugene Zhuravlev @@ -100,16 +105,17 @@ public class IndexingStamp { } } }); - } else { + } + else { DataInputOutputUtil.writeTIME(stream, DataInputOutputUtil.timeBase); } } - public long get(ID<?, ?> id) { + private long get(ID<?, ?> id) { return myIndexStamps != null? myIndexStamps.get(id) : 0L; } - public void set(ID<?, ?> id, long tmst) { + private void set(ID<?, ?> id, long tmst) { try { if (tmst < 0) { if (myIndexStamps == null) return; @@ -130,9 +136,8 @@ public class IndexingStamp { } } - private static final ConcurrentHashMap<VirtualFile, Timestamps> myTimestampsCache = new ConcurrentHashMap<VirtualFile, Timestamps>(); - private static final int CAPACITY = 100; - private static final ArrayBlockingQueue<VirtualFile> myFinishedFiles = new ArrayBlockingQueue<VirtualFile>(CAPACITY); + private static final ConcurrentMap<VirtualFile, Timestamps> myTimestampsCache = new ConcurrentHashMap<VirtualFile, Timestamps>(); + private static final BlockingQueue<VirtualFile> ourFinishedFiles = new ArrayBlockingQueue<VirtualFile>(100); public static boolean isFileIndexed(VirtualFile file, ID<?, ?> indexName, final long indexCreationStamp) { try { @@ -148,7 +153,7 @@ public class IndexingStamp { return false; } - public static long getIndexStamp(VirtualFile file, ID<?, ?> indexName) { + public static long getIndexStamp(@NotNull VirtualFile file, ID<?, ?> indexName) { synchronized (getStripedLock(file)) { Timestamps stamp = createOrGetTimeStamp(file); if (stamp != null) return stamp.get(indexName); @@ -156,7 +161,7 @@ public class IndexingStamp { } } - private static Timestamps createOrGetTimeStamp(VirtualFile file) { + private static Timestamps createOrGetTimeStamp(@NotNull VirtualFile file) { if (file instanceof NewVirtualFile && file.isValid()) { Timestamps timestamps = myTimestampsCache.get(file); if (timestamps == null) { @@ -174,7 +179,7 @@ public class IndexingStamp { return null; } - public static void update(final VirtualFile file, final ID<?, ?> indexName, final long indexCreationStamp) { + public static void update(@NotNull VirtualFile file, @NotNull ID<?, ?> indexName, final long indexCreationStamp) { synchronized (getStripedLock(file)) { try { Timestamps stamp = createOrGetTimeStamp(file); @@ -185,7 +190,7 @@ public class IndexingStamp { } } - public static void removeAllIndexedState(VirtualFile file) { + public static void removeAllIndexedState(@NotNull VirtualFile file) { synchronized (getStripedLock(file)) { if (file instanceof NewVirtualFile && file.isValid()) { myTimestampsCache.put(file, new Timestamps()); @@ -193,7 +198,8 @@ public class IndexingStamp { } } - public static Collection<ID<?,?>> getIndexedIds(final VirtualFile file) { + @NotNull + public static Collection<ID<?,?>> getIndexedIds(@NotNull VirtualFile file) { synchronized (getStripedLock(file)) { try { Timestamps stamp = createOrGetTimeStamp(file); @@ -220,17 +226,11 @@ public class IndexingStamp { } public static void flushCache(@Nullable VirtualFile finishedFile) { - if (finishedFile == null || !myFinishedFiles.offer(finishedFile)) { - VirtualFile[] files = null; - synchronized (myFinishedFiles) { - int size = myFinishedFiles.size(); - if ((finishedFile == null && size > 0) || size == CAPACITY) { - files = myFinishedFiles.toArray(new VirtualFile[size]); - myFinishedFiles.clear(); - } - } + if (finishedFile == null || !ourFinishedFiles.offer(finishedFile)) { + List<VirtualFile> files = new ArrayList<VirtualFile>(ourFinishedFiles.size()); + ourFinishedFiles.drainTo(files); - if (files != null) { + if (!files.isEmpty()) { for(VirtualFile file:files) { synchronized (getStripedLock(file)) { Timestamps timestamp = myTimestampsCache.remove(file); @@ -248,7 +248,7 @@ public class IndexingStamp { } } } - if (finishedFile != null) myFinishedFiles.offer(finishedFile); + if (finishedFile != null) ourFinishedFiles.offer(finishedFile); } } @@ -257,7 +257,7 @@ public class IndexingStamp { for(int i = 0; i < ourLocks.length; ++i) ourLocks[i] = new Object(); } - private static Object getStripedLock(VirtualFile file) { + private static Object getStripedLock(@NotNull VirtualFile file) { if (!(file instanceof NewVirtualFile)) return 0; int id = ((NewVirtualFile)file).getId(); return ourLocks[(id & 0xFF) % ourLocks.length]; diff --git a/platform/lang-impl/src/com/intellij/util/indexing/MapIndexStorage.java b/platform/lang-impl/src/com/intellij/util/indexing/MapIndexStorage.java index 649bd25730fb..bbd015507e24 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/MapIndexStorage.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/MapIndexStorage.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu private final Lock l = new ReentrantLock(); private final DataExternalizer<Value> myDataExternalizer; - private boolean myHighKeySelectivity; + private final boolean myHighKeySelectivity; private final LowMemoryWatcher myLowMemoryFlusher = LowMemoryWatcher.register(new Runnable() { @Override public void run() { @@ -70,7 +70,8 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu myCache.clear(); if (myMap.isDirty()) myMap.force(); } - } finally { + } + finally { l.unlock(); } } @@ -89,9 +90,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu @NotNull DataExternalizer<Value> valueExternalizer, final int cacheSize, boolean highKeySelectivity, - boolean buildKeyHashToVirtualFileMapping - ) throws IOException { - + boolean buildKeyHashToVirtualFileMapping) throws IOException { myStorageFile = storageFile; myKeyDescriptor = keyDescriptor; myCacheSize = cacheSize; @@ -150,6 +149,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu myKeyHashToVirtualFileMapping = myBuildKeyHashToVirtualFileMapping ? new KeyHash2VirtualFileEnumerator(getProjectFile()) : null; } + @NotNull private File getProjectFile() { return new File(myStorageFile.getPath() + ".project"); } @@ -222,7 +222,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu } @Override - public boolean processKeys(final Processor<Key> processor, GlobalSearchScope scope, final IdFilter idFilter) throws StorageException { + public boolean processKeys(@NotNull final Processor<Key> processor, GlobalSearchScope scope, final IdFilter idFilter) throws StorageException { l.lock(); try { myCache.clear(); // this will ensure that all new keys are made into the map @@ -298,7 +298,8 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu } } - private static TIntHashSet loadHashedIds(File fileWithCaches) throws IOException { + @NotNull + private static TIntHashSet loadHashedIds(@NotNull File fileWithCaches) throws IOException { DataInputStream inputStream = null; try { inputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(fileWithCaches))); @@ -315,12 +316,13 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu if (inputStream != null) { try { inputStream.close(); - } catch (IOException ex) {} + } + catch (IOException ignored) {} } } } - private void saveHashedIds(TIntHashSet hashMaskSet, int largestId, GlobalSearchScope scope) { + private void saveHashedIds(@NotNull TIntHashSet hashMaskSet, int largestId, @NotNull GlobalSearchScope scope) { File newFileWithCaches = getSavedProjectFileValueIds(largestId, scope); assert newFileWithCaches != null; DataOutputStream stream = null; @@ -341,17 +343,22 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu } }); if (result) myLastScannedId = largestId; - } catch (IOException ex) {} + } + catch (IOException ignored) { + + } finally { if (stream != null) { try { stream.close(); - } catch (IOException ex) {} + } + catch (IOException ignored) {} } } } - private @Nullable File getSavedProjectFileValueIds(int id, GlobalSearchScope scope) { + @Nullable + private File getSavedProjectFileValueIds(int id, @NotNull GlobalSearchScope scope) { Project project = scope.getProject(); if (project == null) return null; return new File(myStorageFile.getPath() + ".project."+project.hashCode() + "."+id + "." + scope.isSearchInLibraries()); @@ -423,7 +430,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu } @Override - public void removeAllValues(Key key, int inputId) throws StorageException { + public void removeAllValues(@NotNull Key key, int inputId) throws StorageException { try { myMap.markDirty(); // important: assuming the key exists in the index @@ -436,13 +443,13 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu private static class IntPairInArrayKeyDescriptor implements KeyDescriptor<int[]>, DifferentSerializableBytesImplyNonEqualityPolicy { @Override - public void save(DataOutput out, int[] value) throws IOException { + public void save(@NotNull DataOutput out, int[] value) throws IOException { DataInputOutputUtil.writeINT(out, value[0]); DataInputOutputUtil.writeINT(out, value[1]); } @Override - public int[] read(DataInput in) throws IOException { + public int[] read(@NotNull DataInput in) throws IOException { return new int[] {DataInputOutputUtil.readINT(in), DataInputOutputUtil.readINT(in)}; } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java index f49f70db83bd..a19e2d92cddf 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Factory; +import com.intellij.openapi.util.NotNullComputable; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.io.FileUtil; import com.intellij.psi.search.GlobalSearchScope; @@ -33,8 +34,10 @@ import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; -import java.util.*; -import java.util.concurrent.Callable; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Set; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -146,18 +149,20 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val } } + @NotNull @Override public final Lock getReadLock() { return myLock.readLock(); } + @NotNull @Override public final Lock getWriteLock() { return myLock.writeLock(); } @Override - public boolean processAllKeys(Processor<Key> processor, GlobalSearchScope scope, IdFilter idFilter) throws StorageException { + public boolean processAllKeys(@NotNull Processor<Key> processor, @NotNull GlobalSearchScope scope, IdFilter idFilter) throws StorageException { final Lock lock = getReadLock(); try { lock.lock(); @@ -170,7 +175,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val @Override @NotNull - public ValueContainer<Value> getData(final Key key) throws StorageException { + public ValueContainer<Value> getData(@NotNull final Key key) throws StorageException { final Lock lock = getReadLock(); try { lock.lock(); @@ -203,6 +208,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val return null; } + @NotNull @Override public final Computable<Boolean> update(final int inputId, @Nullable final Input content) { @@ -219,17 +225,24 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val @Override public void run() { try { - updateWithMap(inputId, data, new Callable<Collection<Key>>() { + updateWithMap(inputId, data, new NotNullComputable<Collection<Key>>() { + @NotNull @Override - public Collection<Key> call() throws Exception { + public Collection<Key> compute() { if (myInputsIndex == null) { return new SmartList<Key>((Key)(Integer)inputId); } - final Collection<Key> oldKeys = myInputsIndex.get(inputId); - return oldKeys == null? Collections.<Key>emptyList() : oldKeys; + try { + Collection<Key> oldKeys = myInputsIndex.get(inputId); + return oldKeys == null? Collections.<Key>emptyList() : oldKeys; + } + catch (IOException e) { + throw new RuntimeException(e); + } } }); - } catch (StorageException ex) { + } + catch (StorageException ex) { exRef.set(ex); } } @@ -239,20 +252,19 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val LOG.info(exRef.get()); FileBasedIndex.getInstance().requestRebuild(myIndexId); return Boolean.FALSE; - } else { - return Boolean.TRUE; } + return Boolean.TRUE; } }; } protected void updateWithMap(final int inputId, @NotNull Map<Key, Value> newData, - @NotNull Callable<Collection<Key>> oldKeysGetter) throws StorageException { + @NotNull NotNullComputable<Collection<Key>> oldKeysGetter) throws StorageException { getWriteLock().lock(); try { try { - for (Key key : oldKeysGetter.call()) { + for (Key key : oldKeysGetter.compute()) { myStorage.removeAllValues(key, inputId); } } @@ -277,7 +289,8 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val } }); if (!b) throw exceptionRef.get(); - } else { + } + else { for (Map.Entry<Key, Value> entry : newData.entrySet()) { myStorage.addValue(entry.getKey(), inputId, entry.getValue()); } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/MemoryIndexStorage.java b/platform/lang-impl/src/com/intellij/util/indexing/MemoryIndexStorage.java index 3ef7d2ac4e98..2ae474b73858 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/MemoryIndexStorage.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/MemoryIndexStorage.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import java.util.concurrent.atomic.AtomicBoolean; */ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value> { private final Map<Key, ChangeTrackingValueContainer<Value>> myMap = new HashMap<Key, ChangeTrackingValueContainer<Value>>(); + @NotNull private final IndexStorage<Key, Value> myBackendStorage; private final List<BufferingStateListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList(); private final AtomicBoolean myBufferingEnabled = new AtomicBoolean(false); @@ -44,19 +45,20 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value> void memoryStorageCleared(); } - public MemoryIndexStorage(IndexStorage<Key, Value> backend) { + public MemoryIndexStorage(@NotNull IndexStorage<Key, Value> backend) { myBackendStorage = backend; } + @NotNull public IndexStorage<Key, Value> getBackendStorage() { return myBackendStorage; } - public void addBufferingStateListsner(BufferingStateListener listener) { + public void addBufferingStateListener(@NotNull BufferingStateListener listener) { myListeners.add(listener); } - public void removeBufferingStateListsner(BufferingStateListener listener) { + public void removeBufferingStateListener(@NotNull BufferingStateListener listener) { myListeners.remove(listener); } @@ -99,6 +101,7 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value> myBackendStorage.flush(); } + @NotNull @Override public Collection<Key> getKeys() throws StorageException { final Set<Key> keys = new HashSet<Key>(); @@ -107,7 +110,7 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value> } @Override - public boolean processKeys(final Processor<Key> processor, GlobalSearchScope scope, IdFilter idFilter) throws StorageException { + public boolean processKeys(@NotNull final Processor<Key> processor, GlobalSearchScope scope, IdFilter idFilter) throws StorageException { final Set<Key> stopList = new HashSet<Key>(); Processor<Key> decoratingProcessor = new Processor<Key>() { @@ -129,7 +132,7 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value> } stopList.add(key); } - return myBackendStorage.processKeys(stopList.size() == 0 && myMap.size() == 0 ? processor : decoratingProcessor, scope, idFilter); + return myBackendStorage.processKeys(stopList.isEmpty() && myMap.isEmpty() ? processor : decoratingProcessor, scope, idFilter); } @Override @@ -147,7 +150,7 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value> } @Override - public void removeAllValues(Key key, int inputId) throws StorageException { + public void removeAllValues(@NotNull Key key, int inputId) throws StorageException { if (myBufferingEnabled.get()) { getMemValueContainer(key).removeAssociatedValue(inputId); return; diff --git a/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java b/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java index 2a18906d80f8..a4975f100d96 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.CollectingContentIterator; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -49,8 +50,9 @@ public class UnindexedFilesUpdater implements CacheUpdater { return myIndex.getNumberOfPendingInvalidations(); } + @NotNull @Override - public VirtualFile[] queryNeededFiles(ProgressIndicator indicator) { + public VirtualFile[] queryNeededFiles(@NotNull ProgressIndicator indicator) { myIndex.filesUpdateStarted(myProject); CollectingContentIterator finder = myIndex.createContentIterator(indicator); long l = System.currentTimeMillis(); @@ -66,10 +68,11 @@ public class UnindexedFilesUpdater implements CacheUpdater { } @Override - public void processFile(final FileContent fileContent) { + public void processFile(@NotNull FileContent fileContent) { try { myIndex.indexFileContent(myProject, fileContent); - } finally { + } + finally { IndexingStamp.flushCache(fileContent.getVirtualFile()); } } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/UpdatableIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/UpdatableIndex.java index 589db0f47e58..4b431eddb5d7 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/UpdatableIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/UpdatableIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package com.intellij.util.indexing; import com.intellij.openapi.util.Computable; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.concurrent.locks.Lock; @@ -31,12 +32,13 @@ public interface UpdatableIndex<Key, Value, Input> extends AbstractIndex<Key,Val void flush() throws StorageException; - /** - */ + @NotNull Computable<Boolean> update(int inputId, @Nullable Input content); - + + @NotNull Lock getReadLock(); - + + @NotNull Lock getWriteLock(); void dispose(); diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainer.java b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainer.java index d901751fadf4..47efe30fbf84 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainer.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package com.intellij.util.indexing; +import org.jetbrains.annotations.NotNull; + import java.util.Iterator; import java.util.List; @@ -35,15 +37,19 @@ public abstract class ValueContainer<Value> { abstract static class IntPredicate { abstract boolean contains(int id); } - + + @NotNull public abstract IntIterator getInputIdsIterator(Value value); public abstract boolean isAssociated(Value value, int inputId); + @NotNull public abstract IntPredicate getValueAssociationPredicate(Value value); + @NotNull public abstract Iterator<Value> getValueIterator(); + @NotNull public abstract List<Value> toValueList(); public abstract int size(); @@ -53,7 +59,7 @@ public abstract class ValueContainer<Value> { boolean perform(int id, T value); } - public final boolean forEach(final ContainerAction<Value> action) { + public final boolean forEach(@NotNull ContainerAction<Value> action) { for (final Iterator<Value> valueIterator = getValueIterator(); valueIterator.hasNext();) { final Value value = valueIterator.next(); for (final IntIterator intIterator = getInputIdsIterator(value); intIterator.hasNext();) { diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java index ae9424d7733e..ddc538154177 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.util.SmartList; import com.intellij.util.containers.EmptyIterator; import gnu.trove.*; +import org.jetbrains.annotations.NotNull; import java.util.*; @@ -139,6 +140,7 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement return true; } + @NotNull @Override public Iterator<Value> getValueIterator() { if (myInputIdMapping != null) { @@ -190,6 +192,7 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement } } + @NotNull @Override public List<Value> toValueList() { if (myInputIdMapping == null) { @@ -216,6 +219,7 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement return false; } + @NotNull @Override public IntPredicate getValueAssociationPredicate(Value value) { final Object input = getInput(value); @@ -247,6 +251,7 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement }; } + @NotNull @Override public IntIterator getInputIdsIterator(Value value) { final Object input = getInput(value); @@ -335,6 +340,7 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement } }; + @NotNull public ValueContainerImpl<Value> copy() { ValueContainerImpl<Value> container = new ValueContainerImpl<Value>(); diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerMap.java b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerMap.java index c4385b491733..3bf0ece67a99 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerMap.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerMap.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.util.indexing; import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream; @@ -71,7 +86,7 @@ class ValueContainerMap<Key, Value> extends PersistentHashMap<Key, ValueContaine } @Override - public void save(final DataOutput out, @NotNull final ValueContainer<T> container) throws IOException { + public void save(@NotNull final DataOutput out, @NotNull final ValueContainer<T> container) throws IOException { saveImpl(out, container); } @@ -79,29 +94,24 @@ class ValueContainerMap<Key, Value> extends PersistentHashMap<Key, ValueContaine DataInputOutputUtil.writeSINT(out, -inputId); } - private void saveImpl(final DataOutput out, @NotNull final ValueContainer<T> container) throws IOException { + private void saveImpl(@NotNull DataOutput out, @NotNull final ValueContainer<T> container) throws IOException { DataInputOutputUtil.writeSINT(out, container.size()); for (final Iterator<T> valueIterator = container.getValueIterator(); valueIterator.hasNext();) { final T value = valueIterator.next(); myExternalizer.save(out, value); final ValueContainer.IntIterator ids = container.getInputIdsIterator(value); - if (ids != null) { - DataInputOutputUtil.writeSINT(out, ids.size()); - while (ids.hasNext()) { - final int id = ids.next(); - DataInputOutputUtil.writeSINT(out, id); - } - } - else { - DataInputOutputUtil.writeSINT(out, 0); + DataInputOutputUtil.writeSINT(out, ids.size()); + while (ids.hasNext()) { + final int id = ids.next(); + DataInputOutputUtil.writeSINT(out, id); } } } @NotNull @Override - public ValueContainerImpl<T> read(final DataInput in) throws IOException { + public ValueContainerImpl<T> read(@NotNull final DataInput in) throws IOException { DataInputStream stream = (DataInputStream)in; final ValueContainerImpl<T> valueContainer = new ValueContainerImpl<T>(); |