Implementation of Kotlin's 'target' annotation mapping to Java's 'Target' annotation + tests

This commit is contained in:
Mikhail Glukhikh
2015-07-14 19:42:05 +03:00
parent 2a1058ed63
commit af5e7f58da
62 changed files with 547 additions and 54 deletions
@@ -553,4 +553,97 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
doTest(fileName);
}
}
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/targets")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Targets extends AbstractCompileJavaAgainstKotlinTest {
public void testAllFilesPresentInTargets() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/compileJavaAgainstKotlin/targets"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("annotation.kt")
public void testAnnotation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/annotation.kt");
doTest(fileName);
}
@TestMetadata("base.kt")
public void testBase() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/base.kt");
doTest(fileName);
}
@TestMetadata("classifier.kt")
public void testClassifier() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/classifier.kt");
doTest(fileName);
}
@TestMetadata("constructor.kt")
public void testConstructor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/constructor.kt");
doTest(fileName);
}
@TestMetadata("empty.kt")
public void testEmpty() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/empty.kt");
doTest(fileName);
}
@TestMetadata("field.kt")
public void testField() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/field.kt");
doTest(fileName);
}
@TestMetadata("function.kt")
public void testFunction() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/function.kt");
doTest(fileName);
}
@TestMetadata("getter.kt")
public void testGetter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/getter.kt");
doTest(fileName);
}
@TestMetadata("local.kt")
public void testLocal() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/local.kt");
doTest(fileName);
}
@TestMetadata("multiple.kt")
public void testMultiple() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/multiple.kt");
doTest(fileName);
}
@TestMetadata("package-info.kt")
public void testPackage_info() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/package-info.kt");
doTest(fileName);
}
@TestMetadata("parameter.kt")
public void testParameter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/parameter.kt");
doTest(fileName);
}
@TestMetadata("property.kt")
public void testProperty() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/property.kt");
doTest(fileName);
}
@TestMetadata("setter.kt")
public void testSetter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/setter.kt");
doTest(fileName);
}
}
}
@@ -41,6 +41,7 @@ import org.junit.Assert;
import java.io.File;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.*;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry;
@@ -52,6 +53,7 @@ public class RecursiveDescriptorComparator {
static {
excludedAnnotations.add(new FqName(ExpectedLoadErrorsUtil.ANNOTATION_CLASS_NAME));
excludedAnnotations.add(new FqName(Retention.class.getName()));
excludedAnnotations.add(new FqName(Target.class.getName()));
}
private static final DescriptorRenderer DEFAULT_RENDERER = DescriptorRenderer.Companion.withOptions(