diff --git a/images/src/org/intellij/images/index/ImageInfoIndex.java b/images/src/org/intellij/images/index/ImageInfoIndex.java index 28838b5e316d..f2db1b48fc33 100644 --- a/images/src/org/intellij/images/index/ImageInfoIndex.java +++ b/images/src/org/intellij/images/index/ImageInfoIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -46,14 +46,14 @@ public class ImageInfoIndex extends SingleEntryFileBasedIndexExtension myValueExternalizer = new DataExternalizer() { @Override - public void save(final DataOutput out, final ImageInfo info) throws IOException { + public void save(@NotNull final DataOutput out, final ImageInfo info) throws IOException { DataInputOutputUtil.writeINT(out, info.width); DataInputOutputUtil.writeINT(out, info.height); DataInputOutputUtil.writeINT(out, info.bpp); } @Override - public ImageInfo read(final DataInput in) throws IOException { + public ImageInfo read(@NotNull final DataInput in) throws IOException { return new ImageInfo(DataInputOutputUtil.readINT(in), DataInputOutputUtil.readINT(in), DataInputOutputUtil.readINT(in)); } }; @@ -83,16 +83,18 @@ public class ImageInfoIndex extends SingleEntryFileBasedIndexExtension getValueExternalizer() { return myValueExternalizer; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(ImageFileTypeManager.getInstance().getImageFileType()) { @Override - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { return file.isInLocalFileSystem() && file.getLength() / 1024 < ourMaxImageSize ; diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/StateCache.java b/java/compiler/impl/src/com/intellij/compiler/impl/StateCache.java index bd56b6653b91..631988e17577 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/StateCache.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/StateCache.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 @@ import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.EnumeratorStringDescriptor; import com.intellij.util.io.PersistentHashMap; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -92,11 +93,11 @@ public abstract class StateCache { private PersistentHashMap createMap(final File file) throws IOException { return new PersistentHashMap(file, new EnumeratorStringDescriptor(), new DataExternalizer() { - public void save(final DataOutput out, final T value) throws IOException { + public void save(@NotNull final DataOutput out, final T value) throws IOException { StateCache.this.write(value, out); } - public T read(final DataInput in) throws IOException { + public T read(@NotNull final DataInput in) throws IOException { return StateCache.this.read(in); } }); diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java index 4bd797f19558..2dd5838ccf7d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java @@ -607,7 +607,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { private void initOutputRootsFile(File rootsFile) throws IOException { myOutputRootsStorage = new PersistentHashMap>>(rootsFile, EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer>>() { - public void save(DataOutput out, TIntObjectHashMap> value) throws IOException { + public void save(@NotNull DataOutput out, TIntObjectHashMap> value) throws IOException { for (final TIntObjectIterator> it = value.iterator(); it.hasNext();) { it.advance(); DataInputOutputUtil.writeINT(out, it.key()); @@ -617,7 +617,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { } } - public TIntObjectHashMap> read(DataInput in) throws IOException { + public TIntObjectHashMap> read(@NotNull DataInput in) throws IOException { final DataInputStream _in = (DataInputStream)in; final TIntObjectHashMap> map = new TIntObjectHashMap>(); while (_in.available() > 0) { diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerCache.java b/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerCache.java index 5741b9cf7949..4db878623df7 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerCache.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -112,8 +112,8 @@ public class GenericCompilerCache { } public static class PersistentStateData { - public final SourceState mySourceState; - public final OutputState myOutputState; + @NotNull public final SourceState mySourceState; + @NotNull public final OutputState myOutputState; private PersistentStateData(@NotNull SourceState sourceState, @NotNull OutputState outputState) { mySourceState = sourceState; @@ -139,14 +139,14 @@ public class GenericCompilerCache { } @Override - public void save(DataOutput out, KeyAndTargetData value) throws IOException { + public void save(@NotNull DataOutput out, KeyAndTargetData value) throws IOException { out.writeInt(value.myTarget); myKeyDescriptor.save(out, value.myKey); } @Override - public KeyAndTargetData read(DataInput in) throws IOException { + public KeyAndTargetData read(@NotNull DataInput in) throws IOException { int target = in.readInt(); final Key item = myKeyDescriptor.read(in); return getKeyAndTargetData(item, target); @@ -163,13 +163,13 @@ public class GenericCompilerCache { } @Override - public void save(DataOutput out, PersistentStateData value) throws IOException { + public void save(@NotNull DataOutput out, PersistentStateData value) throws IOException { mySourceStateExternalizer.save(out, value.mySourceState); myOutputStateExternalizer.save(out, value.myOutputState); } @Override - public PersistentStateData read(DataInput in) throws IOException { + public PersistentStateData read(@NotNull DataInput in) throws IOException { SourceState sourceState = mySourceStateExternalizer.read(in); OutputState outputState = myOutputStateExternalizer.read(in); return new PersistentStateData(sourceState, outputState); diff --git a/java/compiler/impl/src/com/intellij/compiler/make/BackwardDependenciesStorage.java b/java/compiler/impl/src/com/intellij/compiler/make/BackwardDependenciesStorage.java index fb7a5c6eb280..006debb3b43a 100644 --- a/java/compiler/impl/src/com/intellij/compiler/make/BackwardDependenciesStorage.java +++ b/java/compiler/impl/src/com/intellij/compiler/make/BackwardDependenciesStorage.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. @@ -357,7 +357,7 @@ public class BackwardDependenciesStorage implements Flushable, Disposable { } private static class MyDataExternalizer implements DataExternalizer { - public void save(DataOutput out, DependenciesSet ds) throws IOException { + public void save(@NotNull DataOutput out, DependenciesSet ds) throws IOException { final TIntHashSet classes = new TIntHashSet(); final Map fieldsMap = new HashMap(); final Map methodsMap = new HashMap(); @@ -414,7 +414,7 @@ public class BackwardDependenciesStorage implements Flushable, Disposable { } } - public DependenciesSet read(DataInput in) throws IOException { + public DependenciesSet read(@NotNull DataInput in) throws IOException { final Set set = new THashSet(); int classesCount = in.readInt(); diff --git a/java/compiler/impl/src/com/intellij/compiler/make/Cache.java b/java/compiler/impl/src/com/intellij/compiler/make/Cache.java index 2e3d5543214b..f80cb8e5bcaa 100644 --- a/java/compiler/impl/src/com/intellij/compiler/make/Cache.java +++ b/java/compiler/impl/src/com/intellij/compiler/make/Cache.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. @@ -25,6 +25,7 @@ import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.EnumeratorIntegerDescriptor; import com.intellij.util.io.PersistentHashMap; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.DataInput; @@ -54,10 +55,10 @@ public class Cache { myStorePath = storePath; new File(storePath).mkdirs(); myQNameToClassInfoMap = new CachedPersistentHashMap(getOrCreateFile("classes"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer() { - public void save(DataOutput out, ClassInfo value) throws IOException { + public void save(@NotNull DataOutput out, ClassInfo value) throws IOException { value.save(out); } - public ClassInfo read(DataInput in) throws IOException { + public ClassInfo read(@NotNull DataInput in) throws IOException { return new ClassInfo(in); } }, cacheSize * 2) { @@ -71,11 +72,11 @@ public class Cache { myQNameToSubclassesMap = new CompilerDependencyStorage(getOrCreateFile("subclasses"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize); myRemoteQNames = new PersistentHashMap(getOrCreateFile("remote"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer() { - public void save(DataOutput out, Boolean value) throws IOException { + public void save(@NotNull DataOutput out, Boolean value) throws IOException { out.writeBoolean(value.booleanValue()); } - public Boolean read(DataInput in) throws IOException { + public Boolean read(@NotNull DataInput in) throws IOException { return in.readBoolean(); } }, cacheSize); diff --git a/java/compiler/impl/src/com/intellij/compiler/make/CompilerDependencyStorage.java b/java/compiler/impl/src/com/intellij/compiler/make/CompilerDependencyStorage.java index ea93f2193297..2466881b14fd 100644 --- a/java/compiler/impl/src/com/intellij/compiler/make/CompilerDependencyStorage.java +++ b/java/compiler/impl/src/com/intellij/compiler/make/CompilerDependencyStorage.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. @@ -40,14 +40,14 @@ public class CompilerDependencyStorage implements Flushable, Disposable { public CompilerDependencyStorage(File file, KeyDescriptor keyDescriptor, final int cacheSize) throws IOException { myMap = new PersistentHashMap(file, keyDescriptor, new DataExternalizer() { - public void save(DataOutput out, int[] array) throws IOException { + public void save(@NotNull DataOutput out, int[] array) throws IOException { out.writeInt(array.length); for (int value : array) { out.writeInt(value); } } - public int[] read(DataInput in) throws IOException { + public int[] read(@NotNull DataInput in) throws IOException { final TIntHashSet set = new TIntHashSet(); DataInputStream stream = (DataInputStream)in; while(stream.available() > 0) { diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/DummyPersistentState.java b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/DummyPersistentState.java index b3d66ce575fb..495b5a08758f 100644 --- a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/DummyPersistentState.java +++ b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/DummyPersistentState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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,7 @@ package com.intellij.openapi.compiler.generic; import com.intellij.util.io.DataExternalizer; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -33,11 +34,11 @@ public class DummyPersistentState { private static class DummyPersistentStateExternalizer implements DataExternalizer { @Override - public void save(DataOutput out, DummyPersistentState value) throws IOException { + public void save(@NotNull DataOutput out, DummyPersistentState value) throws IOException { } @Override - public DummyPersistentState read(DataInput in) throws IOException { + public DummyPersistentState read(@NotNull DataInput in) throws IOException { return INSTANCE; } } diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFilePersistentState.java b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFilePersistentState.java index e9ea9700af42..17739b154aa6 100644 --- a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFilePersistentState.java +++ b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFilePersistentState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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,7 @@ package com.intellij.openapi.compiler.generic; import com.intellij.util.io.DataExternalizer; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -38,12 +39,12 @@ public class VirtualFilePersistentState { private static class VirtualFileStateExternalizer implements DataExternalizer { @Override - public void save(DataOutput out, VirtualFilePersistentState value) throws IOException { + public void save(@NotNull DataOutput out, VirtualFilePersistentState value) throws IOException { out.writeLong(value.getSourceTimestamp()); } @Override - public VirtualFilePersistentState read(DataInput in) throws IOException { + public VirtualFilePersistentState read(@NotNull DataInput in) throws IOException { return new VirtualFilePersistentState(in.readLong()); } diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFileSetState.java b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFileSetState.java index a22e80dd77de..cf74b55f6691 100644 --- a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFileSetState.java +++ b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFileSetState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -67,7 +67,7 @@ public class VirtualFileSetState { private byte[] myBuffer = IOUtil.allocReadWriteUTFBuffer(); @Override - public void save(DataOutput out, VirtualFileSetState value) throws IOException { + public void save(@NotNull DataOutput out, VirtualFileSetState value) throws IOException { final Map dependencies = value.myTimestamps; out.writeInt(dependencies.size()); for (Map.Entry entry : dependencies.entrySet()) { @@ -77,7 +77,7 @@ public class VirtualFileSetState { } @Override - public VirtualFileSetState read(DataInput in) throws IOException { + public VirtualFileSetState read(@NotNull DataInput in) throws IOException { final VirtualFileSetState state = new VirtualFileSetState(); int size = in.readInt(); while (size-- > 0) { diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFileWithDependenciesState.java b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFileWithDependenciesState.java index 9f4a815304de..1b9aee4254a7 100644 --- a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFileWithDependenciesState.java +++ b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/VirtualFileWithDependenciesState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -63,7 +63,7 @@ public class VirtualFileWithDependenciesState { private byte[] myBuffer = IOUtil.allocReadWriteUTFBuffer(); @Override - public void save(DataOutput out, VirtualFileWithDependenciesState value) throws IOException { + public void save(@NotNull DataOutput out, VirtualFileWithDependenciesState value) throws IOException { out.writeLong(value.mySourceTimestamp); final Map dependencies = value.myDependencies; out.writeInt(dependencies.size()); @@ -74,7 +74,7 @@ public class VirtualFileWithDependenciesState { } @Override - public VirtualFileWithDependenciesState read(DataInput in) throws IOException { + public VirtualFileWithDependenciesState read(@NotNull DataInput in) throws IOException { final VirtualFileWithDependenciesState state = new VirtualFileWithDependenciesState(in.readLong()); int size = in.readInt(); while (size-- > 0) { diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java index 030e9484ba26..c0a547e817d1 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactPackagingItemExternalizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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 @@ import com.intellij.openapi.util.Pair; import com.intellij.util.SmartList; import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.IOUtil; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -31,7 +32,7 @@ public class ArtifactPackagingItemExternalizer implements DataExternalizer pair : value.myDestinations) { IOUtil.writeUTFFast(myBuffer, out, pair.getFirst()); @@ -40,7 +41,7 @@ public class ArtifactPackagingItemExternalizer implements DataExternalizer> destinations = new SmartList>(); while (size-- > 0) { diff --git a/java/java-tests/testSrc/com/intellij/index/IndexTest.java b/java/java-tests/testSrc/com/intellij/index/IndexTest.java index fba5b6e5265d..7770c5e4a1f9 100644 --- a/java/java-tests/testSrc/com/intellij/index/IndexTest.java +++ b/java/java-tests/testSrc/com/intellij/index/IndexTest.java @@ -34,6 +34,7 @@ import com.intellij.testFramework.SkipSlowTestLocally; import com.intellij.util.indexing.MapIndexStorage; import com.intellij.util.indexing.StorageException; import com.intellij.util.io.*; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -113,7 +114,7 @@ public class IndexTest extends IdeaTestCase { private PersistentHashMap> createMetaIndex(File metaIndexFile) throws IOException { return new PersistentHashMap>(metaIndexFile, new EnumeratorIntegerDescriptor(), new DataExternalizer>() { @Override - public void save(DataOutput out, Collection value) throws IOException { + public void save(@NotNull DataOutput out, Collection value) throws IOException { DataInputOutputUtil.writeINT(out, value.size()); for (String key : value) { out.writeUTF(key); @@ -121,7 +122,7 @@ public class IndexTest extends IdeaTestCase { } @Override - public Collection read(DataInput in) throws IOException { + public Collection read(@NotNull DataInput in) throws IOException { final int size = DataInputOutputUtil.readINT(in); final List list = new ArrayList(); for (int idx = 0; idx < size; idx++) { diff --git a/java/java-tests/testSrc/com/intellij/index/StringIndex.java b/java/java-tests/testSrc/com/intellij/index/StringIndex.java index a12f58fbf137..7d2dd108ceac 100644 --- a/java/java-tests/testSrc/com/intellij/index/StringIndex.java +++ b/java/java-tests/testSrc/com/intellij/index/StringIndex.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.index; import com.intellij.openapi.util.Factory; @@ -28,7 +43,7 @@ public class StringIndex { myIndex.setInputIdToDataKeysIndex(factory); } - public List getFilesByWord(String word) throws StorageException { + public List getFilesByWord(@NotNull String word) throws StorageException { return myIndex.getData(word).toValueList(); } diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ClassRepr.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ClassRepr.java index e104ffd7e630..21818f540cc7 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ClassRepr.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ClassRepr.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. @@ -380,12 +380,12 @@ public class ClassRepr extends Proto { public static DataExternalizer externalizer(final DependencyContext context) { return new DataExternalizer() { @Override - public void save(final DataOutput out, final ClassRepr value) throws IOException { + public void save(@NotNull final DataOutput out, final ClassRepr value) throws IOException { value.save(out); } @Override - public ClassRepr read(final DataInput in) throws IOException { + public ClassRepr read(@NotNull final DataInput in) throws IOException { return new ClassRepr(context, in); } }; diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/FieldRepr.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/FieldRepr.java index b72e5aa18d5b..92359612f034 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/FieldRepr.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/FieldRepr.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. @@ -16,6 +16,7 @@ package org.jetbrains.jps.builders.java.dependencyView; import com.intellij.util.io.DataExternalizer; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -57,12 +58,12 @@ class FieldRepr extends ProtoMember { public static DataExternalizer externalizer(final DependencyContext context) { return new DataExternalizer() { @Override - public void save(final DataOutput out, final FieldRepr value) throws IOException { + public void save(@NotNull final DataOutput out, final FieldRepr value) throws IOException { value.save(out); } @Override - public FieldRepr read(final DataInput in) throws IOException { + public FieldRepr read(@NotNull final DataInput in) throws IOException { return new FieldRepr(context, in); } }; diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/IntIntPersistentMultiMaplet.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/IntIntPersistentMultiMaplet.java index eb94639941ac..560c4cecc0fd 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/IntIntPersistentMultiMaplet.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/IntIntPersistentMultiMaplet.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. @@ -256,7 +256,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet { private static class IntSetExternalizer implements DataExternalizer { @Override - public void save(final DataOutput out, final TIntHashSet value) throws IOException { + public void save(@NotNull final DataOutput out, final TIntHashSet value) throws IOException { final Ref exRef = new Ref(null); value.forEach(new TIntProcedure() { @Override @@ -278,7 +278,7 @@ class IntIntPersistentMultiMaplet extends IntIntMultiMaplet { } @Override - public TIntHashSet read(final DataInput in) throws IOException { + public TIntHashSet read(@NotNull final DataInput in) throws IOException { final TIntHashSet result = new TIntHashSet(); final DataInputStream stream = (DataInputStream)in; while (stream.available() > 0) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/IntObjectPersistentMultiMaplet.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/IntObjectPersistentMultiMaplet.java index d195cbc4fc6f..3dd4d446c99a 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/IntObjectPersistentMultiMaplet.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/IntObjectPersistentMultiMaplet.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. @@ -245,14 +245,14 @@ class IntObjectPersistentMultiMaplet extends IntObjectMult } @Override - public void save(final DataOutput out, final Collection value) throws IOException { + public void save(@NotNull final DataOutput out, final Collection value) throws IOException { for (V x : value) { myElementExternalizer.save(out, x); } } @Override - public Collection read(final DataInput in) throws IOException { + public Collection read(@NotNull final DataInput in) throws IOException { final Collection result = myCollectionFactory.create(); final DataInputStream stream = (DataInputStream)in; while (stream.available() > 0) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/MethodRepr.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/MethodRepr.java index 7b55ea7aaa29..72ad7557cd0b 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/MethodRepr.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/MethodRepr.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. @@ -18,6 +18,7 @@ package org.jetbrains.jps.builders.java.dependencyView; import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.DataInputOutputUtil; import gnu.trove.THashSet; +import org.jetbrains.annotations.NotNull; import org.jetbrains.asm4.Type; import org.jetbrains.jps.builders.storage.BuildDataCorruptedException; @@ -159,12 +160,12 @@ class MethodRepr extends ProtoMember { public static DataExternalizer externalizer(final DependencyContext context) { return new DataExternalizer() { @Override - public void save(final DataOutput out, final MethodRepr value) throws IOException { + public void save(@NotNull final DataOutput out, final MethodRepr value) throws IOException { value.save(out); } @Override - public MethodRepr read(DataInput in) throws IOException { + public MethodRepr read(@NotNull DataInput in) throws IOException { return new MethodRepr(context, in); } }; diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ObjectObjectPersistentMultiMaplet.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ObjectObjectPersistentMultiMaplet.java index d94d092b13d1..26a9b7a5756f 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ObjectObjectPersistentMultiMaplet.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/ObjectObjectPersistentMultiMaplet.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. @@ -245,14 +245,14 @@ public class ObjectObjectPersistentMultiMaplet extends } @Override - public void save(final DataOutput out, final Collection value) throws IOException { + public void save(@NotNull final DataOutput out, final Collection value) throws IOException { for (V x : value) { myElementExternalizer.save(out, x); } } @Override - public Collection read(final DataInput in) throws IOException { + public Collection read(@NotNull final DataInput in) throws IOException { final Collection result = myCollectionFactory.create(); final DataInputStream stream = (DataInputStream)in; while (stream.available() > 0) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/TypeRepr.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/TypeRepr.java index dbdb7a9f1179..af85d75f344f 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/TypeRepr.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/TypeRepr.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. @@ -18,6 +18,7 @@ package org.jetbrains.jps.builders.java.dependencyView; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.DataInputOutputUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.asm4.Type; import org.jetbrains.jps.builders.storage.BuildDataCorruptedException; @@ -280,12 +281,12 @@ class TypeRepr { public static DataExternalizer externalizer(final DependencyContext context) { return new DataExternalizer() { @Override - public void save(final DataOutput out, final AbstractType value) throws IOException { + public void save(@NotNull final DataOutput out, final AbstractType value) throws IOException { value.save(out); } @Override - public AbstractType read(final DataInput in) throws IOException { + public AbstractType read(@NotNull final DataInput in) throws IOException { AbstractType elementType; int level = 0; diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/UsageRepr.java b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/UsageRepr.java index 8db8bbc11ec4..a6b6bdd143f5 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/UsageRepr.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/UsageRepr.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. @@ -19,6 +19,7 @@ import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.DataInputOutputUtil; import gnu.trove.TIntHashSet; import gnu.trove.TIntProcedure; +import org.jetbrains.annotations.NotNull; import org.jetbrains.asm4.Type; import org.jetbrains.jps.builders.storage.BuildDataCorruptedException; @@ -505,12 +506,12 @@ class UsageRepr { public static class AnnotationUsage extends Usage { public static final DataExternalizer elementTypeExternalizer = new DataExternalizer() { @Override - public void save(final DataOutput out, final ElemType value) throws IOException { + public void save(@NotNull final DataOutput out, final ElemType value) throws IOException { DataInputOutputUtil.writeINT(out, value.ordinal()); } @Override - public ElemType read(final DataInput in) throws IOException { + public ElemType read(@NotNull final DataInput in) throws IOException { final int ordinal = DataInputOutputUtil.readINT(in); for (ElemType value : ElemType.values()) { if (value.ordinal() == ordinal) { @@ -699,12 +700,12 @@ class UsageRepr { public static DataExternalizer externalizer(final DependencyContext context) { return new DataExternalizer() { @Override - public void save(final DataOutput out, final Usage value) throws IOException { + public void save(@NotNull final DataOutput out, final Usage value) throws IOException { value.save(out); } @Override - public Usage read(DataInput in) throws IOException { + public Usage read(@NotNull DataInput in) throws IOException { final byte tag = in.readByte(); switch (tag) { case CLASS_USAGE: diff --git a/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/TObjectIntHashMapExternalizer.java b/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/TObjectIntHashMapExternalizer.java index c75414079b86..eed818e08567 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/TObjectIntHashMapExternalizer.java +++ b/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/TObjectIntHashMapExternalizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -18,6 +18,7 @@ package org.jetbrains.jps.classFilesIndex; import com.intellij.util.io.DataExternalizer; import gnu.trove.TObjectIntHashMap; import gnu.trove.TObjectIntProcedure; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -34,7 +35,7 @@ public class TObjectIntHashMapExternalizer implements DataExternalizer map) throws IOException { + public void save(@NotNull final DataOutput out, final TObjectIntHashMap map) throws IOException { out.writeInt(map.size()); try { map.forEachEntry(new TObjectIntProcedure() { @@ -57,7 +58,7 @@ public class TObjectIntHashMapExternalizer implements DataExternalizer read(final DataInput in) throws IOException { + public TObjectIntHashMap read(@NotNull final DataInput in) throws IOException { final int size = in.readInt(); final TObjectIntHashMap map = new TObjectIntHashMap(size); for (int i = 0; i < size; i++) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/api/storage/ClassFilesIndexStorageBase.java b/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/api/storage/ClassFilesIndexStorageBase.java index 4d2b60446b52..1eba7b5f9512 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/api/storage/ClassFilesIndexStorageBase.java +++ b/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/api/storage/ClassFilesIndexStorageBase.java @@ -163,7 +163,7 @@ public class ClassFilesIndexStorageBase { private static DataExternalizer> createValueContainerExternalizer(final DataExternalizer valueExternalizer) { return new DataExternalizer>() { @Override - public void save(final DataOutput out, final CompiledDataValueContainer value) throws IOException { + public void save(@NotNull final DataOutput out, final CompiledDataValueContainer value) throws IOException { final TIntObjectHashMap underlying = value.myUnderlying; out.writeInt(underlying.size()); final IOException[] ioException = {null}; @@ -187,7 +187,7 @@ public class ClassFilesIndexStorageBase { } @Override - public CompiledDataValueContainer read(final DataInput in) throws IOException { + public CompiledDataValueContainer read(@NotNull final DataInput in) throws IOException { final TIntObjectHashMap map = new TIntObjectHashMap(); final int size = in.readInt(); for (int i = 0; i < size; i++) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/impl/EnumeratedMethodIncompleteSignature.java b/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/impl/EnumeratedMethodIncompleteSignature.java index fec5e9acccd7..b93a7da728f5 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/impl/EnumeratedMethodIncompleteSignature.java +++ b/jps/jps-builders/src/org/jetbrains/jps/classFilesIndex/indexer/impl/EnumeratedMethodIncompleteSignature.java @@ -53,14 +53,14 @@ public class EnumeratedMethodIncompleteSignature { public static DataExternalizer createDataExternalizer() { return new DataExternalizer() { @Override - public void save(final DataOutput out, final EnumeratedMethodIncompleteSignature value) throws IOException { + public void save(@NotNull final DataOutput out, final EnumeratedMethodIncompleteSignature value) throws IOException { out.writeInt(value.getOwner()); out.writeInt(value.getName()); out.writeBoolean(value.isStatic()); } @Override - public EnumeratedMethodIncompleteSignature read(final DataInput in) throws IOException { + public EnumeratedMethodIncompleteSignature read(@NotNull final DataInput in) throws IOException { return new EnumeratedMethodIncompleteSignature(in.readInt(), in.readInt(), in.readBoolean()); diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/artifacts/ArtifactOutputToSourceMapping.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/artifacts/ArtifactOutputToSourceMapping.java index 572433552d65..fa022448ef73 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/artifacts/ArtifactOutputToSourceMapping.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/artifacts/ArtifactOutputToSourceMapping.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. @@ -20,6 +20,7 @@ import com.intellij.util.SmartList; import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.IOUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.incremental.storage.AbstractStateStorage; import org.jetbrains.jps.incremental.storage.PathStringDescriptor; @@ -85,7 +86,7 @@ public class ArtifactOutputToSourceMapping extends AbstractStateStorage value) throws IOException { + public void save(@NotNull DataOutput out, List value) throws IOException { for (SourcePathAndRootIndex pair : value) { IOUtil.writeUTFFast(myBuffer, out, pair.myPath); out.writeInt(pair.getRootIndex()); @@ -93,7 +94,7 @@ public class ArtifactOutputToSourceMapping extends AbstractStateStorage read(DataInput in) throws IOException { + public List read(@NotNull DataInput in) throws IOException { List result = new SmartList(); final DataInputStream stream = (DataInputStream)in; while (stream.available() > 0) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/FileKeyDescriptor.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/FileKeyDescriptor.java index f467dd27c929..c1c364c22b80 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/FileKeyDescriptor.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/FileKeyDescriptor.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. @@ -18,6 +18,7 @@ package org.jetbrains.jps.incremental.storage; import com.intellij.openapi.util.io.FileUtil; import com.intellij.util.io.IOUtil; import com.intellij.util.io.KeyDescriptor; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -31,11 +32,11 @@ import java.io.IOException; public final class FileKeyDescriptor implements KeyDescriptor { private final byte[] buffer = IOUtil.allocReadWriteUTFBuffer(); - public void save(DataOutput out, File value) throws IOException { + public void save(@NotNull DataOutput out, File value) throws IOException { IOUtil.writeUTFFast(buffer, out, value.getPath()); } - public File read(DataInput in) throws IOException { + public File read(@NotNull DataInput in) throws IOException { return new File(IOUtil.readUTFFast(buffer, in)); } diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OneToManyPathsMapping.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OneToManyPathsMapping.java index 2c0516327584..6e8eb8787e00 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OneToManyPathsMapping.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OneToManyPathsMapping.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. @@ -83,13 +83,13 @@ public class OneToManyPathsMapping extends AbstractStateStorage> { private final byte[] myBuffer = IOUtil.allocReadWriteUTFBuffer(); - public void save(DataOutput out, Collection value) throws IOException { + public void save(@NotNull DataOutput out, Collection value) throws IOException { for (String str : value) { IOUtil.writeUTFFast(myBuffer, out, str); } } - public Collection read(DataInput in) throws IOException { + public Collection read(@NotNull DataInput in) throws IOException { final Set result = new THashSet(FileUtil.PATH_HASHING_STRATEGY); final DataInputStream stream = (DataInputStream)in; while (stream.available() > 0) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/TimestampStorage.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/TimestampStorage.java index 9955c6a64c83..3ebb148ebb71 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/TimestampStorage.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/TimestampStorage.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. @@ -113,7 +113,7 @@ public class TimestampStorage extends AbstractStateStorage { - public void save(DataOutput out, TimestampPerTarget[] value) throws IOException { + public void save(@NotNull DataOutput out, TimestampPerTarget[] value) throws IOException { out.writeInt(value.length); for (TimestampPerTarget target : value) { out.writeInt(target.targetId); @@ -121,7 +121,7 @@ public class TimestampStorage extends AbstractStateStorage } @Override - public void save(final DataOutput out, final TodoIndexEntry value) throws IOException { + public void save(@NotNull final DataOutput out, final TodoIndexEntry value) throws IOException { out.writeUTF(value.pattern); out.writeBoolean(value.caseSensitive); } @Override - public TodoIndexEntry read(final DataInput in) throws IOException { + public TodoIndexEntry read(@NotNull final DataInput in) throws IOException { final String pattern = in.readUTF(); final boolean caseSensitive = in.readBoolean(); return new TodoIndexEntry(pattern, caseSensitive); @@ -106,7 +106,7 @@ public class TodoIndex extends FileBasedIndexExtension private final FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() { @Override - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { if (!file.isInLocalFileSystem()) { return false; // do not index TODOs in library sources } @@ -147,16 +147,19 @@ public class TodoIndex extends FileBasedIndexExtension return myIndexer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return myKeyDescriptor; } + @NotNull @Override public DataExternalizer getValueExternalizer() { return myValueExternalizer; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return myInputFilter; diff --git a/platform/indexing-api/src/com/intellij/util/indexing/DefaultFileTypeSpecificInputFilter.java b/platform/indexing-api/src/com/intellij/util/indexing/DefaultFileTypeSpecificInputFilter.java index 6273968c678f..903c5c4992be 100644 --- a/platform/indexing-api/src/com/intellij/util/indexing/DefaultFileTypeSpecificInputFilter.java +++ b/platform/indexing-api/src/com/intellij/util/indexing/DefaultFileTypeSpecificInputFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -32,7 +32,7 @@ public class DefaultFileTypeSpecificInputFilter implements FileBasedIndex.FileTy } @Override - public boolean acceptInput(VirtualFile file) { + public boolean acceptInput(@NotNull VirtualFile file) { return true; } } diff --git a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndex.java b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndex.java index 3cdb853b6d95..6628f3c9225e 100644 --- a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndex.java +++ b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndex.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. @@ -137,7 +137,7 @@ public abstract class FileBasedIndex implements BaseComponent { * @param project it is guaranteed to return data which is up-to-date withing the project * Keys obtained from the files which do not belong to the project specified may not be up-to-date or even exist */ - public abstract boolean processAllKeys(@NotNull ID indexId, Processor processor, @Nullable Project project); + public abstract boolean processAllKeys(@NotNull ID indexId, @NotNull Processor processor, @Nullable Project project); public boolean processAllKeys(@NotNull ID indexId, @NotNull Processor processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter idFilter) { return processAllKeys(indexId, processor, scope.getProject()); @@ -156,7 +156,7 @@ public abstract class FileBasedIndex implements BaseComponent { * Author: dmitrylomov */ public interface InputFilter { - boolean acceptInput(VirtualFile file); + boolean acceptInput(@NotNull VirtualFile file); } public interface FileTypeSpecificInputFilter extends InputFilter { diff --git a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java index 91d9470bbc61..dc6091964163 100644 --- a/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.java +++ b/platform/indexing-api/src/com/intellij/util/indexing/FileBasedIndexExtension.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. @@ -39,11 +39,14 @@ public abstract class FileBasedIndexExtension { @NotNull public abstract DataIndexer getIndexer(); - + + @NotNull public abstract KeyDescriptor getKeyDescriptor(); - + + @NotNull public abstract DataExternalizer getValueExternalizer(); - + + @NotNull public abstract FileBasedIndex.InputFilter getInputFilter(); public abstract boolean dependsOnFileContent(); diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java index 4ad94f5865fc..3e96882ddea1 100644 --- a/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java +++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.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. @@ -43,19 +43,19 @@ public class IdIndex extends FileBasedIndexExtension { private final FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() { @Override - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { return isIndexable(file.getFileType()); } }; private final DataExternalizer myValueExternalizer = new DataExternalizer() { @Override - public void save(final DataOutput out, final Integer value) throws IOException { + public void save(@NotNull final DataOutput out, final Integer value) throws IOException { out.writeByte(value.intValue()); } @Override - public Integer read(final DataInput in) throws IOException { + public Integer read(@NotNull final DataInput in) throws IOException { return Integer.valueOf(in.readByte()); } }; @@ -107,16 +107,19 @@ public class IdIndex extends FileBasedIndexExtension { return myIndexer; } + @NotNull @Override public DataExternalizer getValueExternalizer() { return myValueExternalizer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return myKeyDescriptor; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return myInputFilter; diff --git a/platform/indexing-impl/src/com/intellij/psi/search/FileTypeIndex.java b/platform/indexing-impl/src/com/intellij/psi/search/FileTypeIndex.java index b0a8673ec6ed..061100b77470 100644 --- a/platform/indexing-impl/src/com/intellij/psi/search/FileTypeIndex.java +++ b/platform/indexing-impl/src/com/intellij/psi/search/FileTypeIndex.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.psi.search; import com.intellij.openapi.fileTypes.FileType; @@ -47,11 +62,13 @@ public class FileTypeIndex extends ScalarIndexExtension return this; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return this; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return this; @@ -73,17 +90,17 @@ public class FileTypeIndex extends ScalarIndexExtension } @Override - public boolean acceptInput(VirtualFile file) { + public boolean acceptInput(@NotNull VirtualFile file) { return !file.isDirectory(); } @Override - public void save(DataOutput out, FileType value) throws IOException { + public void save(@NotNull DataOutput out, FileType value) throws IOException { myEnumeratorStringDescriptor.save(out, value.getName()); } @Override - public FileType read(DataInput in) throws IOException { + public FileType read(@NotNull DataInput in) throws IOException { String read = myEnumeratorStringDescriptor.read(in); return myFileTypeManager.findFileTypeByName(read); } diff --git a/platform/indexing-impl/src/com/intellij/psi/search/FilenameIndex.java b/platform/indexing-impl/src/com/intellij/psi/search/FilenameIndex.java index 7c42954efe82..0e95aefcc0bb 100644 --- a/platform/indexing-impl/src/com/intellij/psi/search/FilenameIndex.java +++ b/platform/indexing-impl/src/com/intellij/psi/search/FilenameIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -54,11 +54,13 @@ public class FilenameIndex extends ScalarIndexExtension { return myDataIndexer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return myKeyDescriptor; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return myInputFilter; @@ -156,7 +158,7 @@ public class FilenameIndex extends ScalarIndexExtension { private static class MyInputFilter implements FileBasedIndex.InputFilter { @Override - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { return true; } } diff --git a/platform/indexing-impl/src/com/intellij/util/indexing/ScalarIndexExtension.java b/platform/indexing-impl/src/com/intellij/util/indexing/ScalarIndexExtension.java index df1550082dd7..38321417c29e 100644 --- a/platform/indexing-impl/src/com/intellij/util/indexing/ScalarIndexExtension.java +++ b/platform/indexing-impl/src/com/intellij/util/indexing/ScalarIndexExtension.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. @@ -17,6 +17,7 @@ package com.intellij.util.indexing; import com.intellij.util.io.DataExternalizer; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.DataInput; @@ -31,6 +32,7 @@ public abstract class ScalarIndexExtension extends FileBasedIndexExtension VOID_DATA_EXTERNALIZER = new VoidDataExternalizer(); + @NotNull @Override public final DataExternalizer getValueExternalizer() { return VOID_DATA_EXTERNALIZER; @@ -39,12 +41,12 @@ public abstract class ScalarIndexExtension extends FileBasedIndexExtension { @Override - public void save(final DataOutput out, final Void value) throws IOException { + public void save(@NotNull final DataOutput out, final Void value) throws IOException { } @Override @Nullable - public Void read(final DataInput in) throws IOException { + public Void read(@NotNull final DataInput in) throws IOException { return null; } } diff --git a/platform/indexing-impl/src/com/intellij/util/indexing/SingleEntryFileBasedIndexExtension.java b/platform/indexing-impl/src/com/intellij/util/indexing/SingleEntryFileBasedIndexExtension.java index 128d7d40d4fe..1e111b2d01de 100644 --- a/platform/indexing-impl/src/com/intellij/util/indexing/SingleEntryFileBasedIndexExtension.java +++ b/platform/indexing-impl/src/com/intellij/util/indexing/SingleEntryFileBasedIndexExtension.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,6 +27,7 @@ import org.jetbrains.annotations.NotNull; * Date: Feb 18, 2009 */ public abstract class SingleEntryFileBasedIndexExtension extends FileBasedIndexExtension{ + @NotNull @Override public final KeyDescriptor getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; diff --git a/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java b/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java index 9fdc87e70686..6cf661d2cc6f 100644 --- a/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java +++ b/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.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. @@ -38,13 +38,13 @@ public class TrigramIndex extends ScalarIndexExtension { private static final FileBasedIndex.InputFilter INPUT_FILTER = new FileBasedIndex.InputFilter() { @Override - public boolean acceptInput(VirtualFile file) { + public boolean acceptInput(@NotNull VirtualFile file) { return !file.getFileType().isBinary(); } }; private static final FileBasedIndex.InputFilter NO_FILES = new FileBasedIndex.InputFilter() { @Override - public boolean acceptInput(VirtualFile file) { + public boolean acceptInput(@NotNull VirtualFile file) { return false; } }; @@ -76,11 +76,13 @@ public class TrigramIndex extends ScalarIndexExtension { }; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { if (ENABLED) { diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.java index 0985d6b43171..dfd6c9c93548 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/DetectedFrameworksData.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. @@ -141,7 +141,7 @@ public class DetectedFrameworksData { private static class TIntHashSetExternalizer implements DataExternalizer { @Override - public void save(DataOutput out, TIntHashSet value) throws IOException { + public void save(@NotNull DataOutput out, TIntHashSet value) throws IOException { out.writeInt(value.size()); final TIntIterator iterator = value.iterator(); while (iterator.hasNext()) { @@ -150,7 +150,7 @@ public class DetectedFrameworksData { } @Override - public TIntHashSet read(DataInput in) throws IOException { + public TIntHashSet read(@NotNull DataInput in) throws IOException { int size = in.readInt(); final TIntHashSet set = new TIntHashSet(size); while (size-- > 0) { diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionIndex.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionIndex.java index bc6eba2bba2c..514f0777a638 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionIndex.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/FrameworkDetectionIndex.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. @@ -91,11 +91,13 @@ public class FrameworkDetectionIndex extends ScalarIndexExtension { }; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { final Set acceptedTypes = new HashSet(); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java b/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java index 43bc2facc8a8..bc1254ceca7a 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeIndex.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. @@ -108,6 +108,7 @@ public class FileIncludeIndex extends FileBasedIndexExtension getKeyDescriptor() { return new KeyDescriptor() { @@ -122,24 +123,25 @@ public class FileIncludeIndex extends FileBasedIndexExtension> getValueExternalizer() { return new DataExternalizer>() { @Override - public void save(DataOutput out, List value) throws IOException { + public void save(@NotNull DataOutput out, List value) throws IOException { out.writeInt(value.size()); for (FileIncludeInfoImpl info : value) { out.writeUTF(info.path); @@ -150,7 +152,7 @@ public class FileIncludeIndex extends FileBasedIndexExtension read(DataInput in) throws IOException { + public List read(@NotNull DataInput in) throws IOException { int size = in.readInt(); ArrayList infos = new ArrayList(size); for (int i = 0; i < size; i++) { @@ -161,11 +163,12 @@ public class FileIncludeIndex extends FileBasedIndexExtension { @Override - public void save(final DataOutput out, @NotNull final StubIdList value) throws IOException { + public void save(@NotNull final DataOutput out, @NotNull final StubIdList value) throws IOException { int size = value.size(); if (size == 0) { DataInputOutputUtil.writeINT(out, Integer.MAX_VALUE); @@ -183,7 +183,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe @NotNull @Override - public StubIdList read(final DataInput in) throws IOException { + public StubIdList read(@NotNull final DataInput in) throws IOException { int size = DataInputOutputUtil.readINT(in); if (size == Integer.MAX_VALUE) { return new StubIdList(); @@ -428,9 +428,10 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe public void updateIndex(@NotNull StubIndexKey key, int fileId, @NotNull final Map oldValues, @NotNull Map newValues) { try { final MyIndex index = (MyIndex)myIndices.get(key); - index.updateWithMap(fileId, newValues, new Callable>() { + index.updateWithMap(fileId, newValues, new NotNullComputable>() { + @NotNull @Override - public Collection call() throws Exception { + public Collection compute() { return oldValues.keySet(); } }); @@ -449,7 +450,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe @Override public void updateWithMap(final int inputId, @NotNull final Map newData, - @NotNull Callable> oldKeysGetter) throws StorageException { + @NotNull NotNullComputable> oldKeysGetter) throws StorageException { super.updateWithMap(inputId, newData, oldKeysGetter); } } diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java index 93e2b3541f41..4cb07a623f03 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.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. @@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.fileTypes.LanguageFileType; +import com.intellij.openapi.util.NotNullComputable; import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.FileAttribute; @@ -37,7 +38,6 @@ import org.jetbrains.annotations.NotNull; import java.io.*; import java.util.*; -import java.util.concurrent.Callable; /* * @author max @@ -54,13 +54,13 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi private static final DataExternalizer KEY_EXTERNALIZER = new DataExternalizer() { @Override - public void save(final DataOutput out, @NotNull final SerializedStubTree v) throws IOException { + public void save(@NotNull final DataOutput out, @NotNull final SerializedStubTree v) throws IOException { v.write(out); } @NotNull @Override - public SerializedStubTree read(final DataInput in) throws IOException { + public SerializedStubTree read(@NotNull final DataInput in) throws IOException { return new SerializedStubTree(in); } }; @@ -226,11 +226,11 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi @NotNull @Override - public UpdatableIndex createIndexImplementation(final ID indexId, @NotNull final FileBasedIndex owner, @NotNull IndexStorage storage) + public UpdatableIndex createIndexImplementation(@NotNull final ID indexId, @NotNull final FileBasedIndex owner, @NotNull IndexStorage storage) throws StorageException { if (storage instanceof MemoryIndexStorage) { final MemoryIndexStorage memStorage = (MemoryIndexStorage)storage; - memStorage.addBufferingStateListsner(new MemoryIndexStorage.BufferingStateListener() { + memStorage.addBufferingStateListener(new MemoryIndexStorage.BufferingStateListener() { @Override public void bufferingStateChanged(final boolean newState) { ((StubIndexImpl)StubIndex.getInstance()).setDataBufferingEnabled(newState); @@ -294,7 +294,7 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi @Override protected void updateWithMap(final int inputId, @NotNull final Map newData, - @NotNull Callable> oldKeysGetter) + @NotNull NotNullComputable> oldKeysGetter) throws StorageException { checkNameStorage(); 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 { @NotNull - ValueContainer getData(Key key) throws StorageException; + ValueContainer getData(@NotNull Key key) throws StorageException; - boolean processAllKeys(Processor processor, GlobalSearchScope scope, @Nullable IdFilter idFilter) throws StorageException; + boolean processAllKeys(@NotNull Processor 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 extends UpdatableValueContainer return getMergedData().size(); } + @NotNull @Override public Iterator getValueIterator() { return getMergedData().getValueIterator(); } + @NotNull @Override public List toValueList() { return getMergedData().toValueList(); @@ -87,11 +90,13 @@ class ChangeTrackingValueContainer extends UpdatableValueContainer 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 extends FileBasedIndexExtension { @NotNull - public abstract UpdatableIndex createIndexImplementation(final ID indexId, @NotNull FileBasedIndex owner, @NotNull IndexStorage storage) + public abstract UpdatableIndex createIndexImplementation(@NotNull ID indexId, @NotNull FileBasedIndex owner, @NotNull IndexStorage 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 boolean registerIndexer(@NotNull final FileBasedIndexExtension extension, final boolean isCurrentVersionCorrupted) @@ -394,7 +392,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { return versionChanged; } - private void initIndexStorage(final FileBasedIndexExtension extension, int version, File versionFile) + private void initIndexStorage(@NotNull FileBasedIndexExtension extension, int version, @NotNull File versionFile) throws IOException { MapIndexStorage storage = null; final ID 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 storage) throws IOException { final File indexStorageFile = IndexInfrastructure.getInputIndexStorageFile(indexId); - final Ref isBufferingMode = new Ref(false); + final AtomicBoolean isBufferingMode = new AtomicBoolean(); final TIntObjectHashMap> tempMap = new TIntObjectHashMap>(); final DataExternalizer> dataExternalizer = new DataExternalizer>() { @Override - public void save(DataOutput out, @NotNull Collection value) throws IOException { + public void save(@NotNull DataOutput out, @NotNull Collection 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 read(DataInput in) throws IOException { + public Collection read(@NotNull DataInput in) throws IOException { try { final int size = DataInputOutputUtil.readINT(in); final List list = new ArrayList(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 boolean processAllKeys(@NotNull final ID indexId, Processor processor, @Nullable Project project) { - return processAllKeys(indexId, processor, project != null ? GlobalSearchScope.allScope(project) : new EverythingGlobalScope(), null); + public boolean processAllKeys(@NotNull final ID indexId, @NotNull Processor processor, @Nullable Project project) { + return processAllKeys(indexId, processor, project == null ? new EverythingGlobalScope() : GlobalSearchScope.allScope(project), null); } + @Override public boolean processAllKeys(@NotNull ID indexId, @NotNull Processor processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter idFilter) { try { final UpdatableIndex index = getIndex(indexId); @@ -949,7 +949,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { return null; } - private boolean processValuesImpl(@NotNull final ID indexId, final K dataKey, final boolean ensureValueProcessedOnce, + private boolean processValuesImpl(@NotNull final ID indexId, @NotNull final K dataKey, final boolean ensureValueProcessedOnce, @Nullable final VirtualFile restrictToFile, @NotNull final ValueProcessor processor, @NotNull final GlobalSearchScope scope, @Nullable final IdFilter idFilter) { ThrowableConvertor, 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)pair.getFirst(); } - private InputFilter getInputFilter(ID indexId) { + private InputFilter getInputFilter(@NotNull ID indexId) { final Pair, 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 createUpdateComputableWithBufferingDisabled(final Computable update) { + @NotNull + private Computable createUpdateComputableWithBufferingDisabled(@NotNull final Computable update) { return new Computable() { @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 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 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 read(Key key) throws StorageException; - boolean processKeys(Processor processor, GlobalSearchScope scope, @Nullable IdFilter idFilter) throws StorageException; + boolean processKeys(@NotNull Processor processor, GlobalSearchScope scope, @Nullable IdFilter idFilter) throws StorageException; + @NotNull Collection getKeys() throws StorageException; void close() throws StorageException; 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 implements IndexStorage 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 implements IndexStorage implements IndexStorage 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 implements IndexStorage implements IndexStorage processor, GlobalSearchScope scope, final IdFilter idFilter) throws StorageException { + public boolean processKeys(@NotNull final Processor 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 implements IndexStorage implements IndexStorage implements IndexStorage implements IndexStorage implements IndexStorage, 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 implements UpdatableIndex processor, GlobalSearchScope scope, IdFilter idFilter) throws StorageException { + public boolean processAllKeys(@NotNull Processor processor, @NotNull GlobalSearchScope scope, IdFilter idFilter) throws StorageException { final Lock lock = getReadLock(); try { lock.lock(); @@ -170,7 +175,7 @@ public class MapReduceIndex implements UpdatableIndex getData(final Key key) throws StorageException { + public ValueContainer getData(@NotNull final Key key) throws StorageException { final Lock lock = getReadLock(); try { lock.lock(); @@ -203,6 +208,7 @@ public class MapReduceIndex implements UpdatableIndex update(final int inputId, @Nullable final Input content) { @@ -219,17 +225,24 @@ public class MapReduceIndex implements UpdatableIndex>() { + updateWithMap(inputId, data, new NotNullComputable>() { + @NotNull @Override - public Collection call() throws Exception { + public Collection compute() { if (myInputsIndex == null) { return new SmartList((Key)(Integer)inputId); } - final Collection oldKeys = myInputsIndex.get(inputId); - return oldKeys == null? Collections.emptyList() : oldKeys; + try { + Collection oldKeys = myInputsIndex.get(inputId); + return oldKeys == null? Collections.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 implements UpdatableIndex newData, - @NotNull Callable> oldKeysGetter) throws StorageException { + @NotNull NotNullComputable> 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 implements UpdatableIndex 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 implements IndexStorage { private final Map> myMap = new HashMap>(); + @NotNull private final IndexStorage myBackendStorage; private final List myListeners = ContainerUtil.createLockFreeCopyOnWriteList(); private final AtomicBoolean myBufferingEnabled = new AtomicBoolean(false); @@ -44,19 +45,20 @@ public class MemoryIndexStorage implements IndexStorage void memoryStorageCleared(); } - public MemoryIndexStorage(IndexStorage backend) { + public MemoryIndexStorage(@NotNull IndexStorage backend) { myBackendStorage = backend; } + @NotNull public IndexStorage 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 implements IndexStorage myBackendStorage.flush(); } + @NotNull @Override public Collection getKeys() throws StorageException { final Set keys = new HashSet(); @@ -107,7 +110,7 @@ public class MemoryIndexStorage implements IndexStorage } @Override - public boolean processKeys(final Processor processor, GlobalSearchScope scope, IdFilter idFilter) throws StorageException { + public boolean processKeys(@NotNull final Processor processor, GlobalSearchScope scope, IdFilter idFilter) throws StorageException { final Set stopList = new HashSet(); Processor decoratingProcessor = new Processor() { @@ -129,7 +132,7 @@ public class MemoryIndexStorage implements IndexStorage } 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 implements IndexStorage } @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 extends AbstractIndex 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 { 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 getValueIterator(); + @NotNull public abstract List toValueList(); public abstract int size(); @@ -53,7 +59,7 @@ public abstract class ValueContainer { boolean perform(int id, T value); } - public final boolean forEach(final ContainerAction action) { + public final boolean forEach(@NotNull ContainerAction action) { for (final Iterator 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 extends UpdatableValueContainer implement return true; } + @NotNull @Override public Iterator getValueIterator() { if (myInputIdMapping != null) { @@ -190,6 +192,7 @@ class ValueContainerImpl extends UpdatableValueContainer implement } } + @NotNull @Override public List toValueList() { if (myInputIdMapping == null) { @@ -216,6 +219,7 @@ class ValueContainerImpl extends UpdatableValueContainer implement return false; } + @NotNull @Override public IntPredicate getValueAssociationPredicate(Value value) { final Object input = getInput(value); @@ -247,6 +251,7 @@ class ValueContainerImpl extends UpdatableValueContainer implement }; } + @NotNull @Override public IntIterator getInputIdsIterator(Value value) { final Object input = getInput(value); @@ -335,6 +340,7 @@ class ValueContainerImpl extends UpdatableValueContainer implement } }; + @NotNull public ValueContainerImpl copy() { ValueContainerImpl container = new ValueContainerImpl(); 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 extends PersistentHashMap container) throws IOException { + public void save(@NotNull final DataOutput out, @NotNull final ValueContainer container) throws IOException { saveImpl(out, container); } @@ -79,29 +94,24 @@ class ValueContainerMap extends PersistentHashMap container) throws IOException { + private void saveImpl(@NotNull DataOutput out, @NotNull final ValueContainer container) throws IOException { DataInputOutputUtil.writeSINT(out, container.size()); for (final Iterator 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 read(final DataInput in) throws IOException { + public ValueContainerImpl read(@NotNull final DataInput in) throws IOException { DataInputStream stream = (DataInputStream)in; final ValueContainerImpl valueContainer = new ValueContainerImpl(); diff --git a/platform/platform-api/src/com/intellij/ide/caches/CacheUpdater.java b/platform/platform-api/src/com/intellij/ide/caches/CacheUpdater.java index 219f23bced4f..359924225981 100644 --- a/platform/platform-api/src/com/intellij/ide/caches/CacheUpdater.java +++ b/platform/platform-api/src/com/intellij/ide/caches/CacheUpdater.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. @@ -18,13 +18,15 @@ package com.intellij.ide.caches; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; public interface CacheUpdater { int getNumberOfPendingUpdateJobs(); - VirtualFile[] queryNeededFiles(ProgressIndicator indicator); + @NotNull + VirtualFile[] queryNeededFiles(@NotNull ProgressIndicator indicator); - void processFile(FileContent fileContent); + void processFile(@NotNull FileContent fileContent); void updatingDone(); diff --git a/platform/platform-impl/src/com/intellij/internal/ToggleDumbModeAction.java b/platform/platform-impl/src/com/intellij/internal/ToggleDumbModeAction.java index 14e6d9265f07..855c898ae207 100644 --- a/platform/platform-impl/src/com/intellij/internal/ToggleDumbModeAction.java +++ b/platform/platform-impl/src/com/intellij/internal/ToggleDumbModeAction.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. @@ -27,6 +27,7 @@ import com.intellij.openapi.project.DumbServiceImpl; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.TimeoutUtil; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; @@ -50,14 +51,15 @@ public class ToggleDumbModeAction extends AnAction implements DumbAware { return 0; } - public VirtualFile[] queryNeededFiles(ProgressIndicator indicator) { + @NotNull + public VirtualFile[] queryNeededFiles(@NotNull ProgressIndicator indicator) { while (myDumb) { TimeoutUtil.sleep(100); } return VirtualFile.EMPTY_ARRAY; } - public void processFile(FileContent fileContent) { + public void processFile(@NotNull FileContent fileContent) { } public void updatingDone() { diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java index 7f0b5e8a4e9d..e12d756d901e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -260,14 +260,14 @@ public class JarHandler extends JarHandlerBase { private final byte[] myBuffer = IOUtil.allocReadWriteUTFBuffer(); @Override - public void save(DataOutput out, CacheLibraryInfo value) throws IOException { + public void save(@NotNull DataOutput out, CacheLibraryInfo value) throws IOException { IOUtil.writeUTFFast(myBuffer, out, value.mySnapshotPath); out.writeLong(value.myModificationTime); out.writeLong(value.myFileLength); } @Override - public CacheLibraryInfo read(DataInput in) throws IOException { + public CacheLibraryInfo read(@NotNull DataInput in) throws IOException { return new CacheLibraryInfo(IOUtil.readUTFFast(myBuffer, in), in.readLong(), in.readLong()); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java index c1c7cd6371fb..de9a6d51b498 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.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. @@ -543,12 +543,12 @@ public class FSRecords implements Forceable { private static class ContentHashesDescriptor implements KeyDescriptor, DifferentSerializableBytesImplyNonEqualityPolicy { @Override - public void save(DataOutput out, byte[] value) throws IOException { + public void save(@NotNull DataOutput out, byte[] value) throws IOException { out.write(value); } @Override - public byte[] read(DataInput in) throws IOException { + public byte[] read(@NotNull DataInput in) throws IOException { byte[] b = new byte[SIGNATURE_LENGTH]; in.readFully(b); return b; diff --git a/platform/platform-tests/testSrc/com/intellij/util/io/PersistentMapTest.java b/platform/platform-tests/testSrc/com/intellij/util/io/PersistentMapTest.java index f40716bbecc8..7a4173039a8c 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/io/PersistentMapTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/io/PersistentMapTest.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.io; import com.intellij.openapi.util.io.FileUtil; @@ -8,6 +23,7 @@ import com.intellij.util.containers.IntObjectCache; import com.intellij.util.io.storage.AbstractStorage; import gnu.trove.THashSet; import junit.framework.TestCase; +import org.jetbrains.annotations.NotNull; import java.io.*; import java.util.*; @@ -424,13 +440,13 @@ public class PersistentMapTest extends TestCase { FileUtil.createParentDirs(file); EnumeratorStringDescriptor stringDescriptor = new EnumeratorStringDescriptor(); class PathCollectionExternalizer implements DataExternalizer> { - public void save(DataOutput out, Collection value) throws IOException { + public void save(@NotNull DataOutput out, Collection value) throws IOException { for (String str : value) { IOUtil.writeString(str, out); } } - public Collection read(DataInput in) throws IOException { + public Collection read(@NotNull DataInput in) throws IOException { final Set result = new THashSet(FileUtil.PATH_HASHING_STRATEGY); final DataInputStream stream = (DataInputStream)in; while (stream.available() > 0) { diff --git a/platform/util/src/com/intellij/util/io/DataExternalizer.java b/platform/util/src/com/intellij/util/io/DataExternalizer.java index 44454294e398..f252424466be 100644 --- a/platform/util/src/com/intellij/util/io/DataExternalizer.java +++ b/platform/util/src/com/intellij/util/io/DataExternalizer.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. @@ -15,12 +15,14 @@ */ package com.intellij.util.io; +import org.jetbrains.annotations.NotNull; + import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; public interface DataExternalizer { - void save(DataOutput out, T value) throws IOException; + void save(@NotNull DataOutput out, T value) throws IOException; - T read(DataInput in) throws IOException; + T read(@NotNull DataInput in) throws IOException; } diff --git a/platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java b/platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java index 1621cf3bc22c..a662aae3f527 100644 --- a/platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java +++ b/platform/util/src/com/intellij/util/io/EnumeratorStringDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -37,13 +37,13 @@ public class EnumeratorStringDescriptor implements KeyDescriptor { } @Override - public void save(final DataOutput storage, @NotNull final String value) throws IOException { + public void save(@NotNull final DataOutput storage, @NotNull final String value) throws IOException { final byte[] buffer = IOUtil.allocReadWriteUTFBuffer(); IOUtil.writeUTFFast(buffer, storage, value); } @Override - public String read(final DataInput storage) throws IOException { + public String read(@NotNull final DataInput storage) throws IOException { final byte[] buffer = IOUtil.allocReadWriteUTFBuffer(); return IOUtil.readUTFFast(buffer, storage); } diff --git a/platform/util/src/com/intellij/util/io/ExternalIntegerKeyDescriptor.java b/platform/util/src/com/intellij/util/io/ExternalIntegerKeyDescriptor.java index 009581e5a098..cb3e1466295a 100644 --- a/platform/util/src/com/intellij/util/io/ExternalIntegerKeyDescriptor.java +++ b/platform/util/src/com/intellij/util/io/ExternalIntegerKeyDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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,8 @@ */ package com.intellij.util.io; +import org.jetbrains.annotations.NotNull; + import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -35,12 +37,12 @@ public class ExternalIntegerKeyDescriptor implements KeyDescriptor { } @Override - public void save(final DataOutput out, final Integer value) throws IOException { + public void save(@NotNull final DataOutput out, final Integer value) throws IOException { DataInputOutputUtil.writeINT(out, value.intValue()); } @Override - public Integer read(final DataInput in) throws IOException { + public Integer read(@NotNull final DataInput in) throws IOException { return DataInputOutputUtil.readINT(in); } } \ No newline at end of file diff --git a/platform/util/src/com/intellij/util/io/InlineKeyDescriptor.java b/platform/util/src/com/intellij/util/io/InlineKeyDescriptor.java index 8cf030a5d975..d64df97e574b 100644 --- a/platform/util/src/com/intellij/util/io/InlineKeyDescriptor.java +++ b/platform/util/src/com/intellij/util/io/InlineKeyDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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,8 @@ */ package com.intellij.util.io; +import org.jetbrains.annotations.NotNull; + import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -41,14 +43,14 @@ public abstract class InlineKeyDescriptor implements KeyDescriptor { } @Override - public final void save(DataOutput out, T value) throws IOException { + public final void save(@NotNull DataOutput out, T value) throws IOException { int v = toInt(value); if (myCompactFormat) DataInputOutputUtil.writeINT(out, v); else out.writeInt(v); } @Override - public final T read(DataInput in) throws IOException { + public final T read(@NotNull DataInput in) throws IOException { int n; if (myCompactFormat) n = DataInputOutputUtil.readINT(in); else n = in.readInt(); diff --git a/platform/util/src/com/intellij/util/io/NullableDataExternalizer.java b/platform/util/src/com/intellij/util/io/NullableDataExternalizer.java index 7f8bba853fb4..897fa7d2084b 100644 --- a/platform/util/src/com/intellij/util/io/NullableDataExternalizer.java +++ b/platform/util/src/com/intellij/util/io/NullableDataExternalizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -15,6 +15,7 @@ */ package com.intellij.util.io; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.DataOutput; @@ -32,7 +33,7 @@ public class NullableDataExternalizer implements DataExternalizer { } @Override - public void save(DataOutput out, T value) throws IOException { + public void save(@NotNull DataOutput out, T value) throws IOException { if (value == null) { out.writeBoolean(false); } else { @@ -43,7 +44,7 @@ public class NullableDataExternalizer implements DataExternalizer { @Override @Nullable - public T read(DataInput in) throws IOException { + public T read(@NotNull DataInput in) throws IOException { final boolean isDefined = in.readBoolean(); if (isDefined) { return myNotNullExternalizer.read(in); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogHashMap.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogHashMap.java index 26a26725fd90..a3a520376909 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogHashMap.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogHashMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -79,12 +79,12 @@ class VcsLogHashMap implements Disposable { private static class MyHashKeyDescriptor implements KeyDescriptor { @Override - public void save(DataOutput out, Hash value) throws IOException { + public void save(@NotNull DataOutput out, Hash value) throws IOException { out.writeUTF(value.asString()); } @Override - public Hash read(DataInput in) throws IOException { + public Hash read(@NotNull DataInput in) throws IOException { return HashImpl.build(in.readUTF()); } diff --git a/plugins/ant/src/com/intellij/lang/ant/AntImportsIndex.java b/plugins/ant/src/com/intellij/lang/ant/AntImportsIndex.java index be3dc676245b..6c8e413fae95 100644 --- a/plugins/ant/src/com/intellij/lang/ant/AntImportsIndex.java +++ b/plugins/ant/src/com/intellij/lang/ant/AntImportsIndex.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. @@ -98,11 +98,13 @@ public class AntImportsIndex extends ScalarIndexExtension{ return DATA_INDEXER; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return EnumeratorIntegerDescriptor.INSTANCE; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(StdFileTypes.XML); diff --git a/plugins/git4idea/src/git4idea/history/NewGitUsersComponent.java b/plugins/git4idea/src/git4idea/history/NewGitUsersComponent.java index 2afb3c821223..89ccaa51d195 100644 --- a/plugins/git4idea/src/git4idea/history/NewGitUsersComponent.java +++ b/plugins/git4idea/src/git4idea/history/NewGitUsersComponent.java @@ -1,9 +1,12 @@ /* - * Copyright 2000-2010 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. * 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. @@ -88,7 +91,7 @@ public class NewGitUsersComponent { private static class MyDataExternalizer implements DataExternalizer> { @Override - public List read(DataInput in) throws IOException { + public List read(@NotNull DataInput in) throws IOException { final int size = in.readInt(); final ArrayList result = new ArrayList(size); for (int i = 0; i < size; i++) { @@ -98,7 +101,7 @@ public class NewGitUsersComponent { } @Override - public void save(DataOutput out, List value) throws IOException { + public void save(@NotNull DataOutput out, List value) throws IOException { out.writeInt(value.size()); for (String s : value) { out.writeUTF(s); diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/GitCommitsSequentialIndex.java b/plugins/git4idea/src/git4idea/history/wholeTree/GitCommitsSequentialIndex.java index 70239c1b1a5d..0c69e45f6ae2 100644 --- a/plugins/git4idea/src/git4idea/history/wholeTree/GitCommitsSequentialIndex.java +++ b/plugins/git4idea/src/git4idea/history/wholeTree/GitCommitsSequentialIndex.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. @@ -39,6 +39,7 @@ import com.intellij.util.io.EnumeratorStringDescriptor; import git4idea.GitRevisionNumber; import git4idea.history.GitHistoryUtils; import git4idea.history.browser.SHAHash; +import org.jetbrains.annotations.NotNull; import java.io.*; import java.util.*; @@ -120,12 +121,12 @@ public class GitCommitsSequentialIndex implements GitCommitsSequentially { private DataExternalizer createExternalizer() { return new DataExternalizer() { @Override - public void save(DataOutput out, String value) throws IOException { + public void save(@NotNull DataOutput out, String value) throws IOException { out.writeUTF(value); } @Override - public String read(DataInput in) throws IOException { + public String read(@NotNull DataInput in) throws IOException { return in.readUTF(); } }; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java index 82cfe11991df..3322dc9e7527 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java @@ -131,11 +131,13 @@ public class GroovyDslFileIndex extends ScalarIndexExtension { return myDataIndexer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return myKeyDescriptor; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new MyInputFilter(); @@ -513,7 +515,7 @@ public class GroovyDslFileIndex extends ScalarIndexExtension { } @Override - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { return "gdsl".equals(file.getExtension()); } } diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/FxmlDataExternalizer.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/FxmlDataExternalizer.java index 2de1bc61d599..384d0859f82d 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/FxmlDataExternalizer.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/FxmlDataExternalizer.java @@ -16,6 +16,7 @@ package org.jetbrains.plugins.javaFX; import com.intellij.util.io.DataExternalizer; +import org.jetbrains.annotations.NotNull; import java.io.DataInput; import java.io.DataOutput; @@ -29,7 +30,7 @@ import java.util.Set; */ public class FxmlDataExternalizer implements DataExternalizer> { @Override - public void save(DataOutput out, Set value) throws IOException { + public void save(@NotNull DataOutput out, Set value) throws IOException { out.writeInt(value.size()); for (String s : value) { out.writeUTF(s); @@ -37,7 +38,7 @@ public class FxmlDataExternalizer implements DataExternalizer> { } @Override - public Set read(DataInput in) throws IOException { + public Set read(@NotNull DataInput in) throws IOException { final int size = in.readInt(); final Set result = new HashSet(size); diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxControllerClassIndex.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxControllerClassIndex.java index 1caf0a037fb3..e5c39157ae8e 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxControllerClassIndex.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxControllerClassIndex.java @@ -58,11 +58,13 @@ public class JavaFxControllerClassIndex extends ScalarIndexExtension { return myDataIndexer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return myKeyDescriptor; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return myInputFilter; @@ -133,7 +135,7 @@ public class JavaFxControllerClassIndex extends ScalarIndexExtension { super(StdFileTypes.XML); } @Override - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { return JavaFxFileTypeFactory.isFxml(file); } } diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxCustomComponentsIndex.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxCustomComponentsIndex.java index 50c8b8493970..2178fd89a7d9 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxCustomComponentsIndex.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxCustomComponentsIndex.java @@ -81,11 +81,13 @@ public class JavaFxCustomComponentsIndex extends FileBasedIndexExtension> getValueExternalizer() { return myDataExternalizer; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return myInputFilter; @@ -97,6 +99,7 @@ public class JavaFxCustomComponentsIndex extends FileBasedIndexExtension getKeyDescriptor() { return myKeyDescriptor; diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxIdsIndex.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxIdsIndex.java index e0fe90a2ea79..fcaaada562ca 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxIdsIndex.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/JavaFxIdsIndex.java @@ -42,11 +42,13 @@ public class JavaFxIdsIndex extends FileBasedIndexExtension> return myDataIndexer; } + @NotNull @Override public DataExternalizer> getValueExternalizer() { return myDataExternalizer; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return myInputFilter; @@ -58,6 +60,7 @@ public class JavaFxIdsIndex extends FileBasedIndexExtension> return KEY; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return myKeyDescriptor; diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndex.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndex.java index 614332fcadd4..e80920890f48 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndex.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndex.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. @@ -666,14 +666,14 @@ public class MavenIndex { } private static class SetDescriptor implements DataExternalizer> { - public void save(DataOutput s, Set set) throws IOException { + public void save(@NotNull DataOutput s, Set set) throws IOException { s.writeInt(set.size()); for (String each : set) { s.writeUTF(each); } } - public Set read(DataInput s) throws IOException { + public Set read(@NotNull DataInput s) throws IOException { int count = s.readInt(); Set result = new THashSet(count); while (count-- > 0) { diff --git a/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIndex.java b/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIndex.java index 370f07fab505..de96b39705e7 100644 --- a/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIndex.java +++ b/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIndex.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.lang.properties.xml; import com.intellij.ide.highlighter.XmlFileType; @@ -52,16 +67,19 @@ public class XmlPropertiesIndex extends FileBasedIndexExtension getKeyDescriptor() { return this; } + @NotNull @Override public DataExternalizer getValueExternalizer() { return ENUMERATOR_STRING_DESCRIPTOR; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return this; @@ -78,7 +96,7 @@ public class XmlPropertiesIndex extends FileBasedIndexExtension>> createExternalizer() { return new DataExternalizer>>() { @Override - public void save(DataOutput out, Map> value) throws IOException { + public void save(@NotNull DataOutput out, Map> value) throws IOException { out.writeInt(value.size()); ArrayList keys = new ArrayList(value.keySet()); Collections.sort(keys); @@ -117,7 +118,7 @@ public class SvnLoadedBrachesStorage { } @Override - public Map> read(DataInput in) throws IOException { + public Map> read(@NotNull DataInput in) throws IOException { final HashMap> map = new HashMap>(); int mapSize = in.readInt(); for (int i = 0; i < mapSize; i++) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnBranchPointsCalculator.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnBranchPointsCalculator.java index 2fd8b8b6dfa8..5d7bd6d3aa61 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnBranchPointsCalculator.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnBranchPointsCalculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -28,6 +28,7 @@ import com.intellij.util.containers.MultiMap; import com.intellij.util.continuation.TaskDescriptor; import com.intellij.util.io.DataExternalizer; import com.intellij.util.io.EnumeratorStringDescriptor; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnVcs; import org.jetbrains.idea.svn.history.CopyData; @@ -88,7 +89,7 @@ public class SvnBranchPointsCalculator { } private static class BranchDataExternalizer implements DataExternalizer> { - public void save(DataOutput out, TreeMap value) throws IOException { + public void save(@NotNull DataOutput out, TreeMap value) throws IOException { out.writeInt(value.size()); for (Map.Entry entry : value.entrySet()) { out.writeUTF(entry.getKey()); @@ -100,7 +101,7 @@ public class SvnBranchPointsCalculator { } } - public TreeMap read(DataInput in) throws IOException { + public TreeMap read(@NotNull DataInput in) throws IOException { final TreeMap result = new TreeMap(); final int num = in.readInt(); diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormClassIndex.java b/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormClassIndex.java index 18f23044ac0f..c9702518612f 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormClassIndex.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormClassIndex.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. @@ -55,11 +55,13 @@ public class FormClassIndex extends ScalarIndexExtension { return myDataIndexer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return myKeyDescriptor; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(StdFileTypes.GUI_DESIGNER_FORM); diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltSymbolIndex.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltSymbolIndex.java index 82e218ff65c1..f34f0fd67cb4 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltSymbolIndex.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltSymbolIndex.java @@ -132,21 +132,24 @@ public class XsltSymbolIndex extends FileBasedIndexExtension getValueExternalizer() { return new EnumDataDescriptor(Kind.class); } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return new EnumeratorStringDescriptor(); } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(StdFileTypes.XML) { @Override - public boolean acceptInput(VirtualFile file) { + public boolean acceptInput(@NotNull VirtualFile file) { return !(file.getFileSystem() instanceof JarFileSystem); } }; diff --git a/python/src/com/jetbrains/python/psi/stubs/PyModuleNameIndex.java b/python/src/com/jetbrains/python/psi/stubs/PyModuleNameIndex.java index 105aec5c0f7b..f743b8ec19f2 100644 --- a/python/src/com/jetbrains/python/psi/stubs/PyModuleNameIndex.java +++ b/python/src/com/jetbrains/python/psi/stubs/PyModuleNameIndex.java @@ -70,11 +70,13 @@ public class PyModuleNameIndex extends ScalarIndexExtension { return myDataIndexer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return myKeyDescriptor; } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(PythonFileType.INSTANCE); diff --git a/xml/dom-impl/src/com/intellij/util/xml/DomFileIndex.java b/xml/dom-impl/src/com/intellij/util/xml/DomFileIndex.java index 493f6a50ccda..7ca36a62c2f2 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/DomFileIndex.java +++ b/xml/dom-impl/src/com/intellij/util/xml/DomFileIndex.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. @@ -84,11 +84,13 @@ public class DomFileIndex extends ScalarIndexExtension{ return myDataIndexer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return new EnumeratorStringDescriptor(); } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(StdFileTypes.XML); diff --git a/xml/impl/src/com/intellij/html/index/Html5CustomAttributesIndex.java b/xml/impl/src/com/intellij/html/index/Html5CustomAttributesIndex.java index ed0538bf6820..984bd4997ba0 100644 --- a/xml/impl/src/com/intellij/html/index/Html5CustomAttributesIndex.java +++ b/xml/impl/src/com/intellij/html/index/Html5CustomAttributesIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -86,16 +86,18 @@ public class Html5CustomAttributesIndex extends ScalarIndexExtension { return myIndexer; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return new EnumeratorStringDescriptor(); } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(StdFileTypes.HTML, StdFileTypes.XHTML) { @Override - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { return file.isInLocalFileSystem(); } }; diff --git a/xml/impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java b/xml/impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java index 515522185339..f504b66ba754 100644 --- a/xml/impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java +++ b/xml/impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.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. @@ -133,11 +133,12 @@ public class SchemaTypeInheritanceIndex extends XmlIndex> { }; } + @NotNull @Override public DataExternalizer> getValueExternalizer() { return new DataExternalizer>() { @Override - public void save(DataOutput out, Set value) throws IOException { + public void save(@NotNull DataOutput out, Set value) throws IOException { out.writeInt(value.size()); for (SchemaTypeInfo key : value) { out.writeUTF(key.getNamespaceUri()); @@ -147,7 +148,7 @@ public class SchemaTypeInheritanceIndex extends XmlIndex> { } @Override - public Set read(DataInput in) throws IOException { + public Set read(@NotNull DataInput in) throws IOException { final Set set = new HashSet(); final int size = in.readInt(); for (int i = 0; i < size; i++) { diff --git a/xml/impl/src/com/intellij/xml/index/XmlTagNamesIndex.java b/xml/impl/src/com/intellij/xml/index/XmlTagNamesIndex.java index 97fb7c0d3d53..b3fc55c1a857 100644 --- a/xml/impl/src/com/intellij/xml/index/XmlTagNamesIndex.java +++ b/xml/impl/src/com/intellij/xml/index/XmlTagNamesIndex.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. @@ -70,6 +70,7 @@ public class XmlTagNamesIndex extends XmlIndex { }; } + @NotNull @Override public DataExternalizer getValueExternalizer() { return ScalarIndexExtension.VOID_DATA_EXTERNALIZER; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxSymbolIndex.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxSymbolIndex.java index eede27a5a2b9..a00d40dd1172 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxSymbolIndex.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxSymbolIndex.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 org.intellij.plugins.relaxNG.model.resolve; import com.intellij.ide.highlighter.XmlFileType; @@ -129,16 +144,18 @@ public class RelaxSymbolIndex extends ScalarIndexExtension { }; } + @NotNull @Override public KeyDescriptor getKeyDescriptor() { return new EnumeratorStringDescriptor(); } + @NotNull @Override public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(StdFileTypes.XML, RncFileType.getInstance()) { @Override - public boolean acceptInput(VirtualFile file) { + public boolean acceptInput(@NotNull VirtualFile file) { return !(file.getFileSystem() instanceof JarFileSystem); } }; diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java index 1e549442011a..fb5242cb3e51 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 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. @@ -95,13 +95,15 @@ public abstract class XmlIndex extends FileBasedIndexExtension { }; } + @NotNull public KeyDescriptor getKeyDescriptor() { return KEY_DESCRIPTOR; } + @NotNull public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(XmlFileType.INSTANCE, DTDFileType.INSTANCE) { - public boolean acceptInput(final VirtualFile file) { + public boolean acceptInput(@NotNull final VirtualFile file) { FileType fileType = file.getFileType(); final String extension = file.getExtension(); return XmlFileType.INSTANCE.equals(fileType) && "xsd".equals(extension) || diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/XmlNamespaceIndex.java b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlNamespaceIndex.java index 55cde705430c..923a5cfce4e0 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/index/XmlNamespaceIndex.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlNamespaceIndex.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. @@ -107,11 +107,12 @@ public class XmlNamespaceIndex extends XmlIndex { }; } + @NotNull @Override public DataExternalizer getValueExternalizer() { return new DataExternalizer() { @Override - public void save(DataOutput out, XsdNamespaceBuilder value) throws IOException { + public void save(@NotNull DataOutput out, XsdNamespaceBuilder value) throws IOException { out.writeUTF(value.getNamespace() == null ? "" : value.getNamespace()); out.writeUTF(value.getVersion() == null ? "" : value.getVersion()); out.writeInt(value.getTags().size()); @@ -121,7 +122,7 @@ public class XmlNamespaceIndex extends XmlIndex { } @Override - public XsdNamespaceBuilder read(DataInput in) throws IOException { + public XsdNamespaceBuilder read(@NotNull DataInput in) throws IOException { int count; XsdNamespaceBuilder builder = new XsdNamespaceBuilder(in.readUTF(), in.readUTF(), new ArrayList(count = in.readInt()));