KT-5214 Annotation to provide platform name to avoid signature conflict
#KT-5214 Fixed
This commit is contained in:
@@ -27,6 +27,8 @@ import org.jetbrains.jet.codegen.signature.BothSignatureWriter;
|
||||
import org.jetbrains.jet.config.IncrementalCompilation;
|
||||
import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedCallableMemberDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.AnonymousFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetDelegatorToSuperCall;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
@@ -34,6 +36,8 @@ import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.OverrideResolver;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.constants.StringValue;
|
||||
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||
@@ -42,6 +46,7 @@ import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodParameterSignature;
|
||||
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodSignature;
|
||||
import org.jetbrains.jet.lang.resolve.java.mapping.KotlinToJavaTypesMap;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
@@ -50,6 +55,7 @@ import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.jet.codegen.JvmCodegenUtil.*;
|
||||
@@ -512,6 +518,9 @@ public class JetTypeMapper {
|
||||
|
||||
@NotNull
|
||||
private static String mapFunctionName(@NotNull FunctionDescriptor descriptor) {
|
||||
String platformName = getPlatformName(descriptor);
|
||||
if (platformName != null) return platformName;
|
||||
|
||||
if (descriptor instanceof PropertyAccessorDescriptor) {
|
||||
PropertyDescriptor property = ((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty();
|
||||
if (isAnnotationClass(property.getContainingDeclaration())) {
|
||||
@@ -533,6 +542,20 @@ public class JetTypeMapper {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getPlatformName(@NotNull Annotated descriptor) {
|
||||
AnnotationDescriptor platformNameAnnotation = descriptor.getAnnotations().findAnnotation(new FqName("kotlin.platform.platformName"));
|
||||
if (platformNameAnnotation == null) return null;
|
||||
|
||||
Map<ValueParameterDescriptor, CompileTimeConstant<?>> arguments = platformNameAnnotation.getAllValueArguments();
|
||||
if (arguments.isEmpty()) return null;
|
||||
|
||||
CompileTimeConstant<?> name = arguments.values().iterator().next();
|
||||
if (!(name instanceof StringValue)) return null;
|
||||
|
||||
return ((StringValue) name).getValue();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JvmMethodSignature mapSignature(@NotNull FunctionDescriptor descriptor) {
|
||||
return mapSignature(descriptor, OwnerKind.IMPLEMENTATION);
|
||||
|
||||
@@ -106,7 +106,8 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory1<PsiElement, Collection<JetModifierKeywordToken>> INCOMPATIBLE_MODIFIERS = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<PsiElement, JetModifierKeywordToken> ILLEGAL_MODIFIER = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, JetModifierKeywordToken> REDUNDANT_MODIFIER = DiagnosticFactory2.create(Severity.WARNING);
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, JetModifierKeywordToken> REDUNDANT_MODIFIER = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory0<PsiElement> INAPPLICABLE_ANNOTATION = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
// Annotations
|
||||
|
||||
|
||||
+1
@@ -65,6 +65,7 @@ public class DefaultErrorMessages {
|
||||
}
|
||||
});
|
||||
MAP.put(ILLEGAL_MODIFIER, "Illegal modifier ''{0}''", TO_STRING);
|
||||
MAP.put(INAPPLICABLE_ANNOTATION, "Inapplicable annotation");
|
||||
|
||||
MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING);
|
||||
MAP.put(ABSTRACT_MODIFIER_IN_TRAIT, "Modifier ''abstract'' is redundant in trait");
|
||||
|
||||
@@ -25,11 +25,10 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
import org.jetbrains.jet.lang.psi.JetClass;
|
||||
import org.jetbrains.jet.lang.psi.JetEnumEntry;
|
||||
import org.jetbrains.jet.lang.psi.JetModifierList;
|
||||
import org.jetbrains.jet.lang.psi.JetModifierListOwner;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lexer.JetModifierKeywordToken;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -37,6 +36,7 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.lang.diagnostics.Errors.ILLEGAL_MODIFIER;
|
||||
import static org.jetbrains.jet.lang.diagnostics.Errors.INAPPLICABLE_ANNOTATION;
|
||||
import static org.jetbrains.jet.lexer.JetTokens.*;
|
||||
|
||||
public class ModifiersChecker {
|
||||
@@ -78,11 +78,13 @@ public class ModifiersChecker {
|
||||
checkModalityModifiers(modifierList);
|
||||
checkVisibilityModifiers(modifierList, descriptor);
|
||||
checkInnerModifier(modifierListOwner, descriptor);
|
||||
checkPlatformNameApplicability(descriptor);
|
||||
}
|
||||
|
||||
public void checkModifiersForLocalDeclaration(@NotNull JetModifierListOwner modifierListOwner) {
|
||||
public void checkModifiersForLocalDeclaration(@NotNull JetModifierListOwner modifierListOwner, @NotNull DeclarationDescriptor descriptor) {
|
||||
checkIllegalModalityModifiers(modifierListOwner);
|
||||
checkIllegalVisibilityModifiers(modifierListOwner);
|
||||
checkPlatformNameApplicability(descriptor);
|
||||
}
|
||||
|
||||
public void checkIllegalModalityModifiers(@NotNull JetModifierListOwner modifierListOwner) {
|
||||
@@ -149,6 +151,27 @@ public class ModifiersChecker {
|
||||
return containingClass.isInner() || containingClass.getContainingDeclaration() instanceof FunctionDescriptor;
|
||||
}
|
||||
|
||||
private void checkPlatformNameApplicability(@NotNull DeclarationDescriptor descriptor) {
|
||||
if (!DescriptorUtils.isTopLevelDeclaration(descriptor) || !(descriptor instanceof FunctionDescriptor)) {
|
||||
AnnotationDescriptor annotation = descriptor.getAnnotations().findAnnotation(new FqName("kotlin.platform.platformName"));
|
||||
if (annotation != null) {
|
||||
JetAnnotationEntry annotationEntry = trace.get(BindingContext.ANNOTATION_DESCRIPTOR_TO_PSI_ELEMENT, annotation);
|
||||
if (annotationEntry != null) {
|
||||
trace.report(INAPPLICABLE_ANNOTATION.on(annotationEntry));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (descriptor instanceof PropertyDescriptor) {
|
||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
|
||||
if (propertyDescriptor.getGetter() != null) {
|
||||
checkPlatformNameApplicability(propertyDescriptor.getGetter());
|
||||
}
|
||||
if (propertyDescriptor.getSetter() != null) {
|
||||
checkPlatformNameApplicability(propertyDescriptor.getSetter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCompatibility(@Nullable JetModifierList modifierList, Collection<JetModifierKeywordToken> availableModifiers, Collection<JetModifierKeywordToken>... availableCombinations) {
|
||||
if (modifierList == null) return;
|
||||
Collection<JetModifierKeywordToken> presentModifiers = Sets.newLinkedHashSet();
|
||||
|
||||
+2
-2
@@ -137,7 +137,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
}
|
||||
|
||||
scope.addVariableDescriptor(propertyDescriptor);
|
||||
ModifiersChecker.create(context.trace).checkModifiersForLocalDeclaration(property);
|
||||
ModifiersChecker.create(context.trace).checkModifiersForLocalDeclaration(property, propertyDescriptor);
|
||||
return DataFlowUtils.checkStatementType(property, context, dataFlowInfo);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
components.expressionTypingServices.resolveValueParameters(function.getValueParameters(), functionDescriptor.getValueParameters(),
|
||||
scope, context.dataFlowInfo, context.trace, /* needCompleteAnalysis = */ true);
|
||||
|
||||
ModifiersChecker.create(context.trace).checkModifiersForLocalDeclaration(function);
|
||||
ModifiersChecker.create(context.trace).checkModifiersForLocalDeclaration(function, functionDescriptor);
|
||||
return DataFlowUtils.checkStatementType(function, context, context.dataFlowInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
[platformName("bar")]
|
||||
fun foo() = "foo"
|
||||
|
||||
fun box(): String {
|
||||
val f = (::foo)()
|
||||
if (f != "foo") return "Fail: $f"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
fun <T> List<T>.foo() = "foo"
|
||||
|
||||
[platformName("fooInt")]
|
||||
fun List<Int>.foo() = "fooInt"
|
||||
|
||||
fun box(): String {
|
||||
val strings = listOf("", "").foo()
|
||||
if (strings != "foo") return "Fail: $strings"
|
||||
|
||||
val ints = listOf(1, 2).foo()
|
||||
if (ints != "fooInt") return "Fail: $ints"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
[platformName("bar")]
|
||||
fun foo() = "foo"
|
||||
|
||||
fun box(): String {
|
||||
val f = foo()
|
||||
if (f != "foo") return "Fail: $f"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
var v: Int = 1
|
||||
[platformName("vget")]
|
||||
get
|
||||
[platformName("vset")]
|
||||
set
|
||||
|
||||
fun box(): String {
|
||||
v += 1
|
||||
if (v != 2) return "Fail: $v"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class PlatformName {
|
||||
public static void main(String[] args) {
|
||||
TestPackage.bar();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
import kotlin.platform.*
|
||||
|
||||
[platformName("bar")]
|
||||
fun foo() {}
|
||||
@@ -0,0 +1,8 @@
|
||||
package test;
|
||||
|
||||
public class PlatformName {
|
||||
public static void main(String[] args) {
|
||||
int x = TestPackage.vget();
|
||||
TestPackage.vset(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
import kotlin.platform.*
|
||||
|
||||
var v: Int = 1
|
||||
[platformName("vget")]
|
||||
get
|
||||
[platformName("vset")]
|
||||
set
|
||||
@@ -0,0 +1,12 @@
|
||||
package lib
|
||||
|
||||
import kotlin.platform.*
|
||||
|
||||
[platformName("bar")]
|
||||
fun foo() = "foo"
|
||||
|
||||
var v: Int = 1
|
||||
[platformName("vget")]
|
||||
get
|
||||
[platformName("vset")]
|
||||
set
|
||||
@@ -0,0 +1,8 @@
|
||||
import lib.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
foo()
|
||||
|
||||
v = 1
|
||||
println(v)
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
import kotlin.platform.*
|
||||
|
||||
[platformName("a")]
|
||||
fun foo() {}
|
||||
|
||||
[platformName("b")]
|
||||
fun Any.foo() {}
|
||||
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("c")<!>]
|
||||
val px = 1
|
||||
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("d")<!>]
|
||||
val Any.px : Int
|
||||
get() = 1
|
||||
|
||||
val valx: Int
|
||||
[platformName("e")]
|
||||
get() = 1
|
||||
|
||||
var varx: Int
|
||||
[platformName("f")]
|
||||
get() = 1
|
||||
[platformName("g")]
|
||||
set(v) {}
|
||||
|
||||
var vardef: Int = 1
|
||||
[platformName("f")]
|
||||
get
|
||||
[platformName("g")]
|
||||
set
|
||||
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("C")<!>]
|
||||
class C {
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("a")<!>]
|
||||
fun foo() {}
|
||||
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("b")<!>]
|
||||
fun Any.foo() {}
|
||||
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("c")<!>]
|
||||
val px = 1
|
||||
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("d")<!>]
|
||||
val Any.px : Int
|
||||
get() = 1
|
||||
|
||||
val valx: Int
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("e")<!>]
|
||||
get() = 1
|
||||
|
||||
var varx: Int
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("f")<!>]
|
||||
get() = 1
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("g")<!>]
|
||||
set(v) {}
|
||||
}
|
||||
|
||||
fun foo1() {
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("a")<!>]
|
||||
fun foo() {}
|
||||
|
||||
[<!INAPPLICABLE_ANNOTATION!>platformName("a")<!>]
|
||||
val x = 1
|
||||
}
|
||||
+15
-1
@@ -38,7 +38,7 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
||||
@InnerTestClasses({Annotations.AnnotationParameterMustBeConstant.class})
|
||||
@InnerTestClasses({Annotations.AnnotationApplicability.class, Annotations.AnnotationParameterMustBeConstant.class})
|
||||
public static class Annotations extends AbstractJetDiagnosticsTestWithStdLib {
|
||||
public void testAllFilesPresentInAnnotations() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/testsWithStdLib/annotations"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@@ -49,6 +49,19 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
|
||||
doTest("compiler/testData/diagnostics/testsWithStdLib/annotations/ClassObjectAnnotatedWithItsClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability")
|
||||
public static class AnnotationApplicability extends AbstractJetDiagnosticsTestWithStdLib {
|
||||
public void testAllFilesPresentInAnnotationApplicability() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("platformName.kt")
|
||||
public void testPlatformName() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability/platformName.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant")
|
||||
public static class AnnotationParameterMustBeConstant extends AbstractJetDiagnosticsTestWithStdLib {
|
||||
public void testAllFilesPresentInAnnotationParameterMustBeConstant() throws Exception {
|
||||
@@ -80,6 +93,7 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("Annotations");
|
||||
suite.addTestSuite(Annotations.class);
|
||||
suite.addTestSuite(AnnotationApplicability.class);
|
||||
suite.addTestSuite(AnnotationParameterMustBeConstant.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
+30
-1
@@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib")
|
||||
@InnerTestClasses({BlackBoxWithStdlibCodegenTestGenerated.Annotations.class, BlackBoxWithStdlibCodegenTestGenerated.Arrays.class, BlackBoxWithStdlibCodegenTestGenerated.CallableReference.class, BlackBoxWithStdlibCodegenTestGenerated.Casts.class, BlackBoxWithStdlibCodegenTestGenerated.DataClasses.class, BlackBoxWithStdlibCodegenTestGenerated.Evaluate.class, BlackBoxWithStdlibCodegenTestGenerated.FullJdk.class, BlackBoxWithStdlibCodegenTestGenerated.JdkAnnotations.class, BlackBoxWithStdlibCodegenTestGenerated.Ranges.class, BlackBoxWithStdlibCodegenTestGenerated.Reflection.class, BlackBoxWithStdlibCodegenTestGenerated.Regressions.class, BlackBoxWithStdlibCodegenTestGenerated.Strings.class, BlackBoxWithStdlibCodegenTestGenerated.ToArray.class, BlackBoxWithStdlibCodegenTestGenerated.Vararg.class, BlackBoxWithStdlibCodegenTestGenerated.When.class})
|
||||
@InnerTestClasses({BlackBoxWithStdlibCodegenTestGenerated.Annotations.class, BlackBoxWithStdlibCodegenTestGenerated.Arrays.class, BlackBoxWithStdlibCodegenTestGenerated.CallableReference.class, BlackBoxWithStdlibCodegenTestGenerated.Casts.class, BlackBoxWithStdlibCodegenTestGenerated.DataClasses.class, BlackBoxWithStdlibCodegenTestGenerated.Evaluate.class, BlackBoxWithStdlibCodegenTestGenerated.FullJdk.class, BlackBoxWithStdlibCodegenTestGenerated.JdkAnnotations.class, BlackBoxWithStdlibCodegenTestGenerated.PlatformNames.class, BlackBoxWithStdlibCodegenTestGenerated.Ranges.class, BlackBoxWithStdlibCodegenTestGenerated.Reflection.class, BlackBoxWithStdlibCodegenTestGenerated.Regressions.class, BlackBoxWithStdlibCodegenTestGenerated.Strings.class, BlackBoxWithStdlibCodegenTestGenerated.ToArray.class, BlackBoxWithStdlibCodegenTestGenerated.Vararg.class, BlackBoxWithStdlibCodegenTestGenerated.When.class})
|
||||
public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInBoxWithStdlib() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithStdlib"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@@ -883,6 +883,34 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/platformNames")
|
||||
public static class PlatformNames extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInPlatformNames() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithStdlib/platformNames"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("callableReference.kt")
|
||||
public void testCallableReference() throws Exception {
|
||||
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/platformNames/callableReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("clashingErasure.kt")
|
||||
public void testClashingErasure() throws Exception {
|
||||
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/platformNames/clashingErasure.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionName.kt")
|
||||
public void testFunctionName() throws Exception {
|
||||
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/platformNames/functionName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("propertyName.kt")
|
||||
public void testPropertyName() throws Exception {
|
||||
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/platformNames/propertyName.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/ranges")
|
||||
@InnerTestClasses({Ranges.Expression.class, Ranges.Literal.class})
|
||||
public static class Ranges extends AbstractBlackBoxCodegenTest {
|
||||
@@ -1578,6 +1606,7 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
suite.addTestSuite(Evaluate.class);
|
||||
suite.addTestSuite(FullJdk.class);
|
||||
suite.addTestSuite(JdkAnnotations.class);
|
||||
suite.addTestSuite(PlatformNames.class);
|
||||
suite.addTest(Ranges.innerSuite());
|
||||
suite.addTest(Reflection.innerSuite());
|
||||
suite.addTestSuite(Regressions.class);
|
||||
|
||||
+36
-2
@@ -106,7 +106,7 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/method")
|
||||
@InnerTestClasses({Method.PrimitiveOverride.class, Method.Throws.class})
|
||||
@InnerTestClasses({Method.PlatformName.class, Method.PrimitiveOverride.class, Method.Throws.class})
|
||||
public static class Method extends AbstractCompileJavaAgainstKotlinTest {
|
||||
@TestMetadata("AccessorGenericSignature.kt")
|
||||
public void testAccessorGenericSignature() throws Exception {
|
||||
@@ -227,6 +227,19 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/Void.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/method/platformName")
|
||||
public static class PlatformName extends AbstractCompileJavaAgainstKotlinTest {
|
||||
public void testAllFilesPresentInPlatformName() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/compileJavaAgainstKotlin/method/platformName"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("PlatformName.kt")
|
||||
public void testPlatformName() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/method/platformName/PlatformName.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/method/primitiveOverride")
|
||||
public static class PrimitiveOverride extends AbstractCompileJavaAgainstKotlinTest {
|
||||
public void testAllFilesPresentInPrimitiveOverride() throws Exception {
|
||||
@@ -336,6 +349,7 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("Method");
|
||||
suite.addTestSuite(Method.class);
|
||||
suite.addTestSuite(PlatformName.class);
|
||||
suite.addTestSuite(PrimitiveOverride.class);
|
||||
suite.addTestSuite(Throws.class);
|
||||
return suite;
|
||||
@@ -343,6 +357,7 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/property")
|
||||
@InnerTestClasses({Property.PlatformName.class})
|
||||
public static class Property extends AbstractCompileJavaAgainstKotlinTest {
|
||||
public void testAllFilesPresentInProperty() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/compileJavaAgainstKotlin/property"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@@ -358,6 +373,25 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/property/GenericProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/property/platformName")
|
||||
public static class PlatformName extends AbstractCompileJavaAgainstKotlinTest {
|
||||
public void testAllFilesPresentInPlatformName() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/compileJavaAgainstKotlin/property/platformName"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("PlatformName.kt")
|
||||
public void testPlatformName() throws Exception {
|
||||
doTest("compiler/testData/compileJavaAgainstKotlin/property/platformName/PlatformName.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("Property");
|
||||
suite.addTestSuite(Property.class);
|
||||
suite.addTestSuite(PlatformName.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/staticFields")
|
||||
@@ -398,7 +432,7 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
|
||||
suite.addTestSuite(CompileJavaAgainstKotlinTestGenerated.class);
|
||||
suite.addTestSuite(Class.class);
|
||||
suite.addTest(Method.innerSuite());
|
||||
suite.addTestSuite(Property.class);
|
||||
suite.addTest(Property.innerSuite());
|
||||
suite.addTestSuite(StaticFields.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
+5
@@ -96,6 +96,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
||||
doTest("compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.A.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("PlatformNames.A.kt")
|
||||
public void testPlatformNames() throws Exception {
|
||||
doTest("compiler/testData/compileKotlinAgainstKotlin/PlatformNames.A.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Simple.A.kt")
|
||||
public void testSimple() throws Exception {
|
||||
doTest("compiler/testData/compileKotlinAgainstKotlin/Simple.A.kt");
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-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 kotlin.platform
|
||||
|
||||
public annotation class platformName(val name: String)
|
||||
Reference in New Issue
Block a user