filtering incorrect annotation from idea jdk annotations, filtering problematic class javax.management.openmbean.TabularDataSupport from ValidityTest
This commit is contained in:
committed by
Andrey Breslav
parent
ca5cf6f3cc
commit
5fb81aaa8b
@@ -78,6 +78,11 @@ public class IdeaJdkAnnotationsReflectedTest extends KotlinTestWithEnvironment {
|
||||
for (FqName classFqName : JdkAnnotationsValidityTest.getAffectedClasses("jar://ideaSDK/lib/jdkAnnotations.jar!/")) {
|
||||
if (new FqName("org.jdom").equals(classFqName.parent())) continue; // filter unrelated jdom annotations
|
||||
if (new FqName("java.util.concurrent.TransferQueue").equals(classFqName)) continue; // filter JDK7-specific class
|
||||
// the following idea annotation is incorrect
|
||||
// <item name="java.io.StringWriter void write(java.lang.String) 0">
|
||||
// <annotation name="org.jetbrains.annotations.NotNull" />
|
||||
// </item>
|
||||
if (new FqName("java.io.StringWriter").equals(classFqName)) continue;
|
||||
|
||||
PsiClass psiClass = javaPsiFacade.findClass(classFqName.asString(), allScope);
|
||||
assertNotNull("Class has annotation, but it is not found: " + classFqName, psiClass);
|
||||
|
||||
@@ -53,9 +53,7 @@ import org.jetbrains.jet.renderer.DescriptorRenderer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -65,6 +63,26 @@ public class JdkAnnotationsValidityTest extends UsefulTestCase {
|
||||
|
||||
private static final int CLASSES_IN_CHUNK = 500;
|
||||
|
||||
// KT-4359 Alternative signature checking problem: Set<?> is incompatible with Set<Object>
|
||||
//
|
||||
// <item name='javax.management.openmbean.TabularDataSupport java.util.Set<java.lang.Object> keySet()'>
|
||||
// <annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
// </item>
|
||||
// <item name='java.util.Map java.util.Set<K> keySet()'>
|
||||
// <annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
// <annotation name='jet.runtime.typeinfo.KotlinSignature'>
|
||||
// <val name="value" val=""fun keySet() : Set<K>""/>
|
||||
// </annotation>
|
||||
// </item>
|
||||
// <item name='javax.management.openmbean.TabularData java.util.Set<?> keySet()'>
|
||||
// <annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
// </item>
|
||||
//
|
||||
// KAnnotator produces above annotations and validation of TabularDataSupport results into:
|
||||
// public open fun keySet(): jet.MutableSet<jet.Any> defined in javax.management.openmbean.TabularDataSupport :
|
||||
// [Incompatible types in superclasses: [Any?, Any, Any], Incompatible projection kinds in type arguments of super methods' return types: [out Any?, Any, Any]]
|
||||
private static final Set<String> classesToIgnore = new HashSet<String>(Arrays.asList("javax.management.openmbean.TabularDataSupport"));
|
||||
|
||||
private static JetCoreEnvironment createEnvironment(Disposable parentDisposable) {
|
||||
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
||||
ConfigurationKind.JDK_AND_ANNOTATIONS, TestJdkKind.FULL_JDK, JetTestUtils.getAnnotationsJar());
|
||||
@@ -152,7 +170,10 @@ public class JdkAnnotationsValidityTest extends UsefulTestCase {
|
||||
String text = StreamUtil.readText(file.getInputStream());
|
||||
Matcher matcher = Pattern.compile("<item name=['\"]([\\w\\d\\.]+)[\\s'\"]").matcher(text);
|
||||
while (matcher.find()) {
|
||||
result.add(new FqName(matcher.group(1)));
|
||||
String className = matcher.group(1);
|
||||
if (!classesToIgnore.contains(className)) {
|
||||
result.add(new FqName(className));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user