BytecodeAnalysisIntegrationTest: depend on exact versions of velocity and collections

This commit is contained in:
Tagir Valeev
2018-10-26 16:00:05 +07:00
parent 5ceda3102a
commit 5422868682
6 changed files with 38 additions and 56 deletions
@@ -823,7 +823,10 @@
<item name='org.apache.commons.collections.CollectionUtils java.util.Collection removeAll(java.util.Collection, java.util.Collection) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.CollectionUtils java.util.Collection retainAll(java.util.Collection, java.util.Collection)'>
<item name='org.apache.commons.collections.CollectionUtils java.util.Collection removeAll(java.util.Collection, java.util.Collection) 1'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.CollectionUtils java.util.Collection retainAll(java.util.Collection, java.util.Collection)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;_,_-&gt;new&quot;"/>
</annotation>
@@ -402,7 +402,12 @@
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.bidimap.TreeBidiMap org.apache.commons.collections.bidimap.TreeBidiMap.Node getGrandParent(org.apache.commons.collections.bidimap.TreeBidiMap.Node, int)'>
<item name='org.apache.commons.collections.bidimap.TreeBidiMap java.util.Set entrySet()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.collections.bidimap.TreeBidiMap org.apache.commons.collections.bidimap.TreeBidiMap.Node getGrandParent(org.apache.commons.collections.bidimap.TreeBidiMap.Node, int)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
@@ -133,12 +133,6 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.collections.functors.CloneTransformer void readObject(java.io.ObjectInputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.CloneTransformer void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.ClosureTransformer ClosureTransformer(org.apache.commons.collections.Closure)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -372,12 +366,6 @@
<item name='org.apache.commons.collections.functors.ForClosure org.apache.commons.collections.Closure getInstance(int, org.apache.commons.collections.Closure) 1'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='org.apache.commons.collections.functors.ForClosure void readObject(java.io.ObjectInputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.ForClosure void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.FunctorUtils FunctorUtils()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -555,12 +543,6 @@
<item name='org.apache.commons.collections.functors.InstantiateFactory org.apache.commons.collections.Factory getInstance(java.lang.Class, java.lang.Class[], java.lang.Object[]) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.InstantiateFactory void readObject(java.io.ObjectInputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.InstantiateFactory void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.InstantiateTransformer InstantiateTransformer()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -574,12 +556,6 @@
<item name='org.apache.commons.collections.functors.InstantiateTransformer java.lang.Object transform(java.lang.Object) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.InstantiateTransformer void readObject(java.io.ObjectInputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.InstantiateTransformer void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.InvokerTransformer InvokerTransformer(java.lang.String)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -618,12 +594,6 @@
<item name='org.apache.commons.collections.functors.InvokerTransformer org.apache.commons.collections.Transformer getInstance(java.lang.String, java.lang.Class[], java.lang.Object[]) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.InvokerTransformer void readObject(java.io.ObjectInputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.InvokerTransformer void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.MapTransformer MapTransformer(java.util.Map)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -1149,10 +1119,4 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.collections.functors.WhileClosure void readObject(java.io.ObjectInputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.functors.WhileClosure void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
</root>
@@ -106,22 +106,13 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.collections.keyvalue.MultiKey java.lang.Object readResolve()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;-&gt;this&quot;"/>
</annotation>
</item>
<item name='org.apache.commons.collections.keyvalue.MultiKey java.lang.String toString()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.keyvalue.MultiKey void calculateHashCode(java.lang.Object[]) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.keyvalue.TiedMapEntry TiedMapEntry(java.util.Map, java.lang.Object)'>
<item name='org.apache.commons.collections.keyvalue.TiedMapEntry TiedMapEntry(java.util.Map, java.lang.Object)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
@@ -569,9 +569,6 @@
</item>
<item name='org.apache.commons.collections.list.SetUniqueList java.util.List subList(int, int)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;_,_-&gt;new&quot;"/>
</annotation>
</item>
<item name='org.apache.commons.collections.list.SetUniqueList java.util.ListIterator listIterator()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -584,9 +581,6 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.collections.list.SetUniqueList java.util.Set createSetBasedOnList(java.util.Set, java.util.List) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.list.SetUniqueList org.apache.commons.collections.list.SetUniqueList decorate(java.util.List)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;_-&gt;new&quot;"/>
@@ -8,6 +8,8 @@ import com.intellij.codeInsight.daemon.GutterMark;
import com.intellij.codeInspection.bytecodeAnalysis.BytecodeAnalysisConverter;
import com.intellij.codeInspection.bytecodeAnalysis.ClassDataIndexer;
import com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis;
import com.intellij.jarRepository.JarRepositoryManager;
import com.intellij.jarRepository.RemoteRepositoryDescription;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Document;
@@ -16,6 +18,8 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
@@ -30,10 +34,12 @@ import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import com.intellij.util.containers.ContainerUtil;
import one.util.streamex.EntryStream;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.utils.library.RepositoryLibraryProperties;
import org.jetbrains.java.decompiler.IdeaDecompiler;
import java.security.MessageDigest;
@@ -56,8 +62,12 @@ public class BytecodeAnalysisIntegrationTest extends LightCodeInsightFixtureTest
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
super.configureModule(module, model, contentEntry);
PsiTestUtil.addProjectLibrary(model, "velocity", IntelliJProjectConfiguration.getProjectLibraryClassesRootPaths("Velocity"));
PsiTestUtil.addProjectLibrary(model, "commons-collections", IntelliJProjectConfiguration.getProjectLibraryClassesRootPaths("commons-collections"));
List<RemoteRepositoryDescription> remoteRepositoryDescriptions =
ContainerUtil.map(IntelliJProjectConfiguration.getRemoteRepositoryDescriptions(), repository ->
new RemoteRepositoryDescription(repository.getId(), repository.getName(), repository.getUrl()));
addFromMaven(module, model, "org.apache.velocity:velocity:1.7", remoteRepositoryDescriptions);
addFromMaven(module, model, "commons-collections:commons-collections:3.2.1", remoteRepositoryDescriptions);
VirtualFile annotationsRoot = getAnnotationsRoot();
for (OrderEntry entry : model.getOrderEntries()) {
@@ -75,6 +85,21 @@ public class BytecodeAnalysisIntegrationTest extends LightCodeInsightFixtureTest
Registry.get(ProjectBytecodeAnalysis.NULLABLE_METHOD).setValue(true, module);
}
public void addFromMaven(@NotNull Module module,
@NotNull ModifiableRootModel model,
String mavenCoordinates, List<RemoteRepositoryDescription> remoteRepositoryDescriptions) {
RepositoryLibraryProperties libraryProperties = new RepositoryLibraryProperties(mavenCoordinates, true);
Collection<OrderRoot> roots = JarRepositoryManager
.loadDependenciesModal(module.getProject(), libraryProperties, false, false, null, remoteRepositoryDescriptions);
LibraryTable.ModifiableModel tableModel = model.getModuleLibraryTable().getModifiableModel();
Library.ModifiableModel libraryModel = tableModel.createLibrary(mavenCoordinates).getModifiableModel();
for (OrderRoot root : roots) {
libraryModel.addRoot(root.getFile(), root.getType());
}
libraryModel.commit();
tableModel.commit();
}
};
private static VirtualFile getAnnotationsRoot() {