diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/AsmUtil.java b/compiler/backend/src/org/jetbrains/jet/codegen/AsmUtil.java index 63880fdecc8..1d4ee47deb6 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/AsmUtil.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/AsmUtil.java @@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.codegen.binding.CalculatedClosure; import org.jetbrains.jet.codegen.binding.CodegenBinding; +import org.jetbrains.jet.codegen.context.CodegenContext; import org.jetbrains.jet.codegen.state.GenerationState; import org.jetbrains.jet.codegen.state.JetTypeMapper; import org.jetbrains.jet.lang.descriptors.*; @@ -165,11 +166,13 @@ public class AsmUtil { && !isStaticMethod(kind, functionDescriptor); } - public static boolean isStaticMethod(OwnerKind kind, FunctionDescriptor functionDescriptor) { - return isStatic(kind) || JetTypeMapper.isAccessor(functionDescriptor); + public static boolean isStaticMethod(OwnerKind kind, CallableMemberDescriptor functionDescriptor) { + return isStaticKind(kind) || + JetTypeMapper.isAccessor(functionDescriptor) || + JvmCodegenUtil.isPlatformStaticInObject(functionDescriptor); } - public static boolean isStatic(OwnerKind kind) { + public static boolean isStaticKind(OwnerKind kind) { return kind == OwnerKind.PACKAGE || kind == OwnerKind.TRAIT_IMPL; } @@ -791,4 +794,10 @@ public class AsmUtil { public static Type getArrayOf(@NotNull String internalClassName) { return Type.getType("[L" + internalClassName + ";"); } + + public static int getReceiverIndex(@NotNull CodegenContext context, @NotNull CallableMemberDescriptor descriptor) { + OwnerKind kind = context.getContextKind(); + //Trait always should have this descriptor + return kind != OwnerKind.TRAIT_IMPL && isStaticMethod(kind, descriptor) ? 0 : 1; + } } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index 22b516924f3..03f3588fd78 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -1390,7 +1390,7 @@ public class ExpressionCodegen extends JetVisitor implem JetType captureReceiver = closure.getCaptureReceiverType(); if (captureReceiver != null) { Type asmType = typeMapper.mapType(captureReceiver); - StackValue.Local capturedReceiver = StackValue.local(context.isStatic() ? 0 : 1, asmType); + StackValue.Local capturedReceiver = StackValue.local(AsmUtil.getReceiverIndex(context, context.getContextDescriptor()), asmType); callGenerator.putCapturedValueOnStack(capturedReceiver, capturedReceiver.type, paramIndex++); } } @@ -2305,7 +2305,9 @@ public class ExpressionCodegen extends JetVisitor implem public StackValue generateThisOrOuter(@NotNull ClassDescriptor calleeContainingClass, boolean isSuper) { boolean isSingleton = calleeContainingClass.getKind().isSingleton(); if (isSingleton) { - if (context.hasThisDescriptor() && context.getThisDescriptor().equals(calleeContainingClass)) { + if (context.hasThisDescriptor() && + context.getThisDescriptor().equals(calleeContainingClass) && + !isPlatformStaticInObject(context.getContextDescriptor())) { return StackValue.local(0, typeMapper.mapType(calleeContainingClass)); } else { diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java index 8f9af00ca19..0858286b8c8 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java @@ -149,6 +149,12 @@ public class FunctionCodegen extends ParentCodegenAware { generateBridges(functionDescriptor); + + if (JvmCodegenUtil.isPlatformStaticInClassObject(functionDescriptor)) { + MemberCodegen codegen = getParentCodegen().getParentCodegen(); + ((ImplementationBodyCodegen) codegen).addAdditionalTask(new PlatformStaticGenerator(functionDescriptor, origin, state)); + } + if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES || isAbstractMethod(functionDescriptor, methodContextKind)) { generateLocalVariableTable( mv, @@ -294,7 +300,8 @@ public class FunctionCodegen extends ParentCodegenAware { generateStaticDelegateMethodBody(mv, signature.getAsmMethod(), (PackageFacadeContext) context.getParentContext()); } else { - FrameMap frameMap = createFrameMap(parentCodegen.state, functionDescriptor, signature, isStatic(context.getContextKind())); + FrameMap frameMap = createFrameMap(parentCodegen.state, functionDescriptor, signature, isStaticMethod(context.getContextKind(), + functionDescriptor)); Label methodEntry = new Label(); mv.visitLabel(methodEntry); @@ -582,7 +589,7 @@ public class FunctionCodegen extends ParentCodegenAware { endVisit(mv, "default method delegation", callableDescriptorToDeclaration(functionDescriptor)); } else { - generateDefaultImpl(owner, signature, functionDescriptor, isStatic(kind), mv, loadStrategy, function); + generateDefaultImpl(owner, signature, functionDescriptor, isStaticMethod(kind, functionDescriptor), mv, loadStrategy, function); } } } @@ -791,7 +798,7 @@ public class FunctionCodegen extends ParentCodegenAware { final ClassDescriptor toClass, final StackValue field, final JvmMethodSignature jvmDelegateMethodSignature, - final JvmMethodSignature jvmOverriddenMethodSignature + final JvmMethodSignature jvmDelegatingMethodSignature ) { generateMethod( OtherOrigin(functionDescriptor), jvmDelegateMethodSignature, functionDescriptor, @@ -804,7 +811,7 @@ public class FunctionCodegen extends ParentCodegenAware { @NotNull MethodContext context, @NotNull MemberCodegen parentCodegen ) { - Method overriddenMethod = jvmOverriddenMethodSignature.getAsmMethod(); + Method overriddenMethod = jvmDelegatingMethodSignature.getAsmMethod(); Method delegateMethod = jvmDelegateMethodSignature.getAsmMethod(); Type[] argTypes = delegateMethod.getArgumentTypes(); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java index 95b8f746520..7e625bd4f93 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java @@ -20,9 +20,7 @@ import com.google.common.collect.Lists; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.psi.PsiElement; import com.intellij.util.ArrayUtil; -import kotlin.Function0; -import kotlin.Function1; -import kotlin.KotlinPackage; +import kotlin.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.backend.common.CodegenUtil; @@ -94,6 +92,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { private List classObjectPropertiesToCopy; + private List> additionalTasks; + public ImplementationBodyCodegen( @NotNull JetClassOrObject aClass, @NotNull ClassContext context, @@ -103,6 +103,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { ) { super(aClass, context, v, state, parentCodegen); this.classAsmType = typeMapper.mapClass(descriptor); + additionalTasks = new ArrayList>(); } @Override @@ -1731,6 +1732,15 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { classObjectPropertiesToCopy.add(new PropertyAndDefaultValue(descriptor, defaultValue)); } + @Override + protected void done() { + for (Function2 task : additionalTasks) { + task.invoke(this, v); + } + + super.done(); + } + private static class PropertyAndDefaultValue { public final PropertyDescriptor descriptor; public final Object defaultValue; @@ -1740,4 +1750,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { this.defaultValue = defaultValue; } } + + public void addAdditionalTask(Function2 additionalTask) { + additionalTasks.add(additionalTask); + } } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/JvmCodegenUtil.java b/compiler/backend/src/org/jetbrains/jet/codegen/JvmCodegenUtil.java index af81fc9e514..a2f1dcbb8e3 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/JvmCodegenUtil.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/JvmCodegenUtil.java @@ -301,4 +301,18 @@ public class JvmCodegenUtil { ? ((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty() : descriptor; } + + public static boolean isPlatformStaticInObject(CallableDescriptor descriptor) { + if (DescriptorUtils.isObject(descriptor.getContainingDeclaration())) { + return KotlinBuiltIns.getInstance().isPlatformStatic(descriptor); + } + return false; + } + + public static boolean isPlatformStaticInClassObject(CallableDescriptor descriptor) { + if (DescriptorUtils.isClassObject(descriptor.getContainingDeclaration())) { + return KotlinBuiltIns.getInstance().isPlatformStatic(descriptor); + } + return false; + } } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/MemberCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/MemberCodegen.java index 5f2ae2a55f3..7b359dc0a40 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/MemberCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/MemberCodegen.java @@ -106,7 +106,7 @@ public abstract class MemberCodegen getContext() { + return context; + } } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt b/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt new file mode 100644 index 00000000000..aff1238f213 --- /dev/null +++ b/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt @@ -0,0 +1,63 @@ +/* + * 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 org.jetbrains.jet.codegen + +import org.jetbrains.jet.lang.descriptors.FunctionDescriptor +import org.jetbrains.jet.lang.psi.JetNamedFunction +import org.jetbrains.jet.codegen.state.JetTypeMapper +import org.jetbrains.jet.codegen.context.CodegenContext +import org.jetbrains.org.objectweb.asm.Opcodes +import org.jetbrains.jet.lang.resolve.java.diagnostics.OtherOrigin +import org.jetbrains.jet.codegen.state.GenerationState +import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodParameterKind +import org.jetbrains.org.objectweb.asm.Type +import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter +import org.jetbrains.jet.lang.psi.JetClassOrObject +import org.jetbrains.jet.lang.descriptors.ClassDescriptor +import org.jetbrains.jet.lang.resolve.java.diagnostics.JvmDeclarationOrigin + +class PlatformStaticGenerator( + val descriptor: FunctionDescriptor, + val declarationOrigin: JvmDeclarationOrigin, + val state: GenerationState +) : Function2 { + + override fun invoke(p1: ImplementationBodyCodegen, p2: ClassBuilder) { + val typeMapper = state.getTypeMapper() + val callable = typeMapper.mapToCallableMethod(descriptor, false, p1.getContext()) + val asmMethod = callable.getAsmMethod() + val methodVisitor = p2.newMethod(OtherOrigin(declarationOrigin.element, declarationOrigin.descriptor), Opcodes.ACC_STATIC or AsmUtil.getMethodAsmFlags(descriptor, OwnerKind.IMPLEMENTATION), asmMethod.getName()!!, asmMethod.getDescriptor()!!, null, null) + + AnnotationCodegen.forMethod(methodVisitor, typeMapper)!!.genAnnotations(descriptor, asmMethod.getReturnType()) + + if (state.getClassBuilderMode() == ClassBuilderMode.FULL) { + methodVisitor.visitCode(); + val iv = InstructionAdapter(methodVisitor) + val classDescriptor = descriptor.getContainingDeclaration() as ClassDescriptor + val singletonValue = StackValue.singleton(classDescriptor, typeMapper)!! + singletonValue.put(singletonValue.`type`, iv); + var index = 0; + for (paramType in asmMethod.getArgumentTypes()) { + iv.load(index, paramType); + index += paramType.getSize(); + } + callable.invokeWithoutAssertions(iv) + iv.areturn(asmMethod.getReturnType()); + methodVisitor.visitEnd(); + } + } +} \ No newline at end of file diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java index d6f407a6424..b63d15135f8 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/StackValue.java @@ -1127,22 +1127,23 @@ public abstract class StackValue { ReceiverValue thisObject = resolvedCall.getThisObject(); ReceiverValue receiverArgument = resolvedCall.getReceiverArgument(); - int depth; + int depth = 0; if (thisObject.exists()) { - if (receiverArgument.exists()) { - //noinspection ConstantConditions - Type resultType = - callableMethod != null ? - callableMethod.getOwner() : - codegen.typeMapper.mapType(descriptor.getExpectedThisObject().getType()); + if (!JvmCodegenUtil.isPlatformStaticInObject(descriptor)) { + if (receiverArgument.exists()) { + //noinspection ConstantConditions + Type resultType = + callableMethod != null ? + callableMethod.getOwner() : + codegen.typeMapper.mapType(descriptor.getExpectedThisObject().getType()); - codegen.generateReceiverValue(thisObject, resultType); + codegen.generateReceiverValue(thisObject, resultType); + } + else { + genReceiver(v, thisObject, type, null, 0); + } + depth = 1; } - else { - genReceiver(v, thisObject, type, null, 0); - } - - depth = 1; } else if (isLocalFunCall(callableMethod)) { assert receiver == none() || receiverArgument.exists() : @@ -1153,9 +1154,6 @@ public abstract class StackValue { depth = 1; } - else { - depth = 0; - } if (putReceiverArgumentOnStack && receiverArgument.exists()) { genReceiver(v, receiverArgument, type, descriptor.getReceiverParameter(), depth); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/context/CodegenContext.java b/compiler/backend/src/org/jetbrains/jet/codegen/context/CodegenContext.java index 3abc7967834..78e24e56f99 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/context/CodegenContext.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/context/CodegenContext.java @@ -260,13 +260,6 @@ public abstract class CodegenContext { return accessor; } - public StackValue getReceiverExpression(JetTypeMapper typeMapper) { - assert getCallableDescriptorWithReceiver() != null; - @SuppressWarnings("ConstantConditions") - Type asmType = typeMapper.mapType(getCallableDescriptorWithReceiver().getReceiverParameter().getType()); - return hasThisDescriptor() ? StackValue.local(1, asmType) : StackValue.local(0, asmType); - } - public abstract boolean isStatic(); protected void initOuterExpression(@NotNull final JetTypeMapper typeMapper, @NotNull final ClassDescriptor classDescriptor) { diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/context/MethodContext.java b/compiler/backend/src/org/jetbrains/jet/codegen/context/MethodContext.java index d8d7d21e5f1..5778fa94169 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/context/MethodContext.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/context/MethodContext.java @@ -18,14 +18,20 @@ package org.jetbrains.jet.codegen.context; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.codegen.AsmUtil; import org.jetbrains.jet.codegen.JvmCodegenUtil; import org.jetbrains.jet.codegen.OwnerKind; import org.jetbrains.jet.codegen.StackValue; import org.jetbrains.jet.codegen.binding.MutableClosure; import org.jetbrains.jet.codegen.state.GenerationState; -import org.jetbrains.jet.lang.descriptors.*; +import org.jetbrains.jet.codegen.state.JetTypeMapper; +import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor; +import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; +import org.jetbrains.jet.lang.descriptors.FunctionDescriptor; +import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor; import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants; import org.jetbrains.org.objectweb.asm.Label; +import org.jetbrains.org.objectweb.asm.Type; public class MethodContext extends CodegenContext { private final boolean isInliningLambda; @@ -50,6 +56,13 @@ public class MethodContext extends CodegenContext { return super.getParentContext(); } + public StackValue getReceiverExpression(JetTypeMapper typeMapper) { + assert getCallableDescriptorWithReceiver() != null; + @SuppressWarnings("ConstantConditions") + Type asmType = typeMapper.mapType(getCallableDescriptorWithReceiver().getReceiverParameter().getType()); + return StackValue.local(AsmUtil.getReceiverIndex(this, getContextDescriptor()), asmType); + } + @Override public StackValue lookupInContext(DeclarationDescriptor d, @Nullable StackValue result, GenerationState state, boolean ignoreNoOuter) { if (getContextDescriptor() == d) { diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/inline/InlineCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/inline/InlineCodegen.java index 6f4a93234cf..ab19b5bdffb 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/inline/InlineCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/inline/InlineCodegen.java @@ -183,7 +183,7 @@ public class InlineCodegen implements CallGenerator { MethodContext methodContext = context.getParentContext().intoFunction(functionDescriptor); MemberCodegen parentCodegen = codegen.getParentCodegen(); if (callDefault) { - boolean isStatic = isStatic(context.getContextKind()); + boolean isStatic = AsmUtil.isStaticMethod(context.getContextKind(), functionDescriptor); FunctionCodegen.generateDefaultImplBody( methodContext, jvmSignature, functionDescriptor, isStatic, maxCalcAdapter, DefaultParameterValueLoader.DEFAULT, (JetNamedFunction) element, parentCodegen, state diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java b/compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java index 905d38752e7..3768d157fd4 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java @@ -62,7 +62,7 @@ import java.util.List; import java.util.Map; import static org.jetbrains.jet.codegen.AsmUtil.boxType; -import static org.jetbrains.jet.codegen.AsmUtil.isStatic; +import static org.jetbrains.jet.codegen.AsmUtil.isStaticMethod; import static org.jetbrains.jet.codegen.JvmCodegenUtil.*; import static org.jetbrains.jet.codegen.binding.CodegenBinding.*; import static org.jetbrains.jet.lang.resolve.BindingContextUtils.isVarCapturedInClosure; @@ -447,7 +447,7 @@ public class JetTypeMapper { thisClass = mapClass(currentOwner); } else { - if (isAccessor(functionDescriptor)) { + if (isAccessor(functionDescriptor) || isPlatformStaticInObject(functionDescriptor)) { invokeOpcode = INVOKESTATIC; } else if (isInterface) { @@ -632,7 +632,7 @@ public class JetTypeMapper { Type ownerType = mapOwner(functionDescriptor, isCallInsideSameModuleAsDeclared(functionDescriptor, context, getOutDirectory())); String descriptor = getDefaultDescriptor(jvmSignature, functionDescriptor.getReceiverParameter() != null); boolean isConstructor = "".equals(jvmSignature.getName()); - if (!isStatic(kind) && !isConstructor) { + if (!isStaticMethod(kind, functionDescriptor) && !isConstructor) { descriptor = descriptor.replace("(", "(" + ownerType.getDescriptor()); } diff --git a/compiler/testData/codegen/box/traits/traitWithPrivateExtension.kt b/compiler/testData/codegen/box/traits/traitWithPrivateExtension.kt new file mode 100644 index 00000000000..64b307eb1f9 --- /dev/null +++ b/compiler/testData/codegen/box/traits/traitWithPrivateExtension.kt @@ -0,0 +1,28 @@ +open class B { + val p = "OK" +} + +class BB : B() + +trait Z { + fun T.getString() : String { + return p + } + + fun test(s: T) : String { + return s.extension() + } + + private fun T.extension(): String { + return getString() + } +} + +object Z2 : Z { + +} + +fun box() : String { + return Z2.test(BB()) +} + diff --git a/compiler/testData/codegen/boxWithJava/platformStatic/annotations/Test.java b/compiler/testData/codegen/boxWithJava/platformStatic/annotations/Test.java new file mode 100644 index 00000000000..e207ad6cad1 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/platformStatic/annotations/Test.java @@ -0,0 +1,28 @@ +import java.lang.String; +import java.lang.annotation.Annotation; + +class Test { + + public static String test1() throws NoSuchMethodException { + Annotation[] test1s = A.class.getMethod("test1").getAnnotations(); + for (Annotation test : test1s) { + String name = test.toString(); + if (name.contains("testAnnotation")) { + return "OK"; + } + } + return "fail"; + } + + public static String test2() throws NoSuchMethodException { + Annotation[] test2s = B.class.getMethod("test1").getAnnotations(); + for (Annotation test : test2s) { + String name = test.toString(); + if (name.contains("testAnnotation")) { + return "OK"; + } + } + return "fail"; + } + +} diff --git a/compiler/testData/codegen/boxWithJava/platformStatic/annotations/simpleClassObject.kt b/compiler/testData/codegen/boxWithJava/platformStatic/annotations/simpleClassObject.kt new file mode 100644 index 00000000000..550e0f00eba --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/platformStatic/annotations/simpleClassObject.kt @@ -0,0 +1,28 @@ +import java.lang.annotation.Retention +import java.lang.annotation.RetentionPolicy + +Retention(RetentionPolicy.RUNTIME) +annotation class testAnnotation + +class A { + + class object { + val b: String = "OK" + + platformStatic testAnnotation fun test1() = b + } +} + +object B { + val b: String = "OK" + + platformStatic testAnnotation fun test1() = b +} + +fun box(): String { + if (Test.test1() != "OK") return "fail 1" + + if (Test.test2() != "OK") return "fail 2" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/platformStatic/classObject/Test.java b/compiler/testData/codegen/boxWithJava/platformStatic/classObject/Test.java new file mode 100644 index 00000000000..b120d37aff9 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/platformStatic/classObject/Test.java @@ -0,0 +1,15 @@ +class Test { + + public static String test1() { + return A.test1(); + } + + public static String test2() { + return A.test2(); + } + + public static String test3() { + return A.test3("JAVA"); + } + +} diff --git a/compiler/testData/codegen/boxWithJava/platformStatic/classObject/simpleClassObject.kt b/compiler/testData/codegen/boxWithJava/platformStatic/classObject/simpleClassObject.kt new file mode 100644 index 00000000000..6031ebd4b29 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/platformStatic/classObject/simpleClassObject.kt @@ -0,0 +1,22 @@ +class A { + + class object { + val b: String = "OK" + + platformStatic fun test1() = b + + platformStatic fun test2() = b + + platformStatic fun String.test3() = this + b + } +} + +fun box(): String { + if (Test.test1() != "OK") return "fail 1" + + if (Test.test2() != "OK") return "fail 2" + + if (Test.test3() != "JAVAOK") return "fail 3" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/platformStatic/object/Test.java b/compiler/testData/codegen/boxWithJava/platformStatic/object/Test.java new file mode 100644 index 00000000000..b120d37aff9 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/platformStatic/object/Test.java @@ -0,0 +1,15 @@ +class Test { + + public static String test1() { + return A.test1(); + } + + public static String test2() { + return A.test2(); + } + + public static String test3() { + return A.test3("JAVA"); + } + +} diff --git a/compiler/testData/codegen/boxWithJava/platformStatic/object/simpleObject.kt b/compiler/testData/codegen/boxWithJava/platformStatic/object/simpleObject.kt new file mode 100644 index 00000000000..15b8ec8db35 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/platformStatic/object/simpleObject.kt @@ -0,0 +1,20 @@ +object A { + + val b: String = "OK" + + platformStatic fun test1() = b + + platformStatic fun test2() = b + + platformStatic fun String.test3() = this + b +} + +fun box(): String { + if (Test.test1() != "OK") return "fail 1" + + if (Test.test2() != "OK") return "fail 2" + + if (Test.test3() != "JAVAOK") return "fail 3" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/platformStatic/callableRef.kt b/compiler/testData/codegen/boxWithStdlib/platformStatic/callableRef.kt new file mode 100644 index 00000000000..816e4b4504d --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/platformStatic/callableRef.kt @@ -0,0 +1,36 @@ +object A { + + val b: String = "OK" + + platformStatic fun test1() : String { + return b + } + + platformStatic fun test2() : String { + return test1() + } + + fun test3(): String { + return "1".test5() + } + + platformStatic fun test4(): String { + return "1".test5() + } + + platformStatic fun String.test5() : String { + return this + b + } +} + +fun box(): String { + if (A.(A::test1)() != "OK") return "fail 1" + + if (A.(A::test2)() != "OK") return "fail 2" + + if (A.(A::test3)() != "1OK") return "fail 3" + + if (A.(A::test4)() != "1OK") return "fail 4" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/platformStatic/closure.kt b/compiler/testData/codegen/boxWithStdlib/platformStatic/closure.kt new file mode 100644 index 00000000000..dab5cfccaa1 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/platformStatic/closure.kt @@ -0,0 +1,38 @@ +object A { + + val b: String = "OK" + + platformStatic fun test1() : String { + return {b}() + } + + platformStatic fun test2() : String { + return {test1()}() + } + + fun test3(): String { + return {"1".test5()}() + } + + platformStatic fun test4(): String { + return {"1".test5()}() + } + + platformStatic fun String.test5() : String { + return {this + b}() + } +} + +fun box(): String { + if (A.test1() != "OK") return "fail 1" + + if (A.test2() != "OK") return "fail 2" + + if (A.test3() != "1OK") return "fail 3" + + if (A.test4() != "1OK") return "fail 4" + + if (with(A) {"1".test5()} != "1OK") return "fail 5" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/platformStatic/convention.kt b/compiler/testData/codegen/boxWithStdlib/platformStatic/convention.kt new file mode 100644 index 00000000000..6010aa5ba74 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/platformStatic/convention.kt @@ -0,0 +1,31 @@ +class B(var s: Int = 0) { + +} + +object A { + + fun test1(v: B) { + v += B(1000) + } + + platformStatic fun B.plusAssign(b: B) { + this.s += b.s + } +} + +fun box(): String { + + val b1 = B(11) + + with(A) { + b1 += B(1000) + } + + if (b1.s != 1011) return "fail 1" + + val b = B(11) + A.test1(b) + if (b.s != 1011) return "fail 2" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/platformStatic/default.kt b/compiler/testData/codegen/boxWithStdlib/platformStatic/default.kt new file mode 100644 index 00000000000..4d73ba984f3 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/platformStatic/default.kt @@ -0,0 +1,14 @@ + +object A { + + platformStatic fun test(b: String = "OK") : String { + return b + } +} + +fun box(): String { + + if (A.test() != "OK") return "fail 1" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/platformStatic/explicitObject.kt b/compiler/testData/codegen/boxWithStdlib/platformStatic/explicitObject.kt new file mode 100644 index 00000000000..9ed5be8f2cc --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/platformStatic/explicitObject.kt @@ -0,0 +1,24 @@ +object AX { + + platformStatic fun aStatic(): String { + return AX.b() + } + + fun aNonStatic(): String { + return AX.b() + } + + platformStatic fun b(): String { + return "OK" + } + +} + +fun box() : String { + + if (AX.aStatic() != "OK") return "fail 1" + + if (AX.aNonStatic() != "OK") return "fail 1" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/platformStatic/inline.kt b/compiler/testData/codegen/boxWithStdlib/platformStatic/inline.kt new file mode 100644 index 00000000000..d1422283c87 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/platformStatic/inline.kt @@ -0,0 +1,14 @@ + +object A { + + platformStatic inline fun test(b: String = "OK") : String { + return b + } +} + +fun box(): String { + + if (A.test() != "OK") return "fail 1" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithStdlib/platformStatic/simple.kt b/compiler/testData/codegen/boxWithStdlib/platformStatic/simple.kt new file mode 100644 index 00000000000..e633e42fbcd --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/platformStatic/simple.kt @@ -0,0 +1,38 @@ +object A { + + val b: String = "OK" + + platformStatic fun test1() : String { + return b + } + + platformStatic fun test2() : String { + return test1() + } + + fun test3(): String { + return "1".test5() + } + + platformStatic fun test4(): String { + return "1".test5() + } + + platformStatic fun String.test5() : String { + return this + b + } +} + +fun box(): String { + if (A.test1() != "OK") return "fail 1" + + if (A.test2() != "OK") return "fail 2" + + if (A.test3() != "1OK") return "fail 3" + + if (A.test4() != "1OK") return "fail 4" + + if (with(A) {"1".test5()} != "1OK") return "fail 5" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleClassObject.java b/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleClassObject.java new file mode 100644 index 00000000000..52e9f77ae42 --- /dev/null +++ b/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleClassObject.java @@ -0,0 +1,11 @@ +package test; + +class Test { + + public static void main(String[] args) { + A.test1(); + A.test2(); + A.test4(""); + } + +} diff --git a/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleClassObject.kt b/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleClassObject.kt new file mode 100644 index 00000000000..5ca73bb37e2 --- /dev/null +++ b/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleClassObject.kt @@ -0,0 +1,36 @@ +package test + +class A { + + class object { + val b: String = "OK" + + platformStatic fun test1() { + b + test2() + test3() + "".test4() + } + + platformStatic fun test2() { + b + } + + fun test3() { + + } + + platformStatic fun String.test4() { + b + } + } +} + +fun main(args: Array) { + A.test1() + A.test2() + A.test3() + with(A) { + A.test1() + } +} \ No newline at end of file diff --git a/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleObject.java b/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleObject.java new file mode 100644 index 00000000000..52e9f77ae42 --- /dev/null +++ b/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleObject.java @@ -0,0 +1,11 @@ +package test; + +class Test { + + public static void main(String[] args) { + A.test1(); + A.test2(); + A.test4(""); + } + +} diff --git a/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleObject.kt b/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleObject.kt new file mode 100644 index 00000000000..d047b580a43 --- /dev/null +++ b/compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleObject.kt @@ -0,0 +1,34 @@ +package test + +object A { + + val b: String = "OK" + + platformStatic fun test1() { + b + test2() + test3() + "".test4() + } + + platformStatic fun test2() { + b + } + + fun test3() { + + } + + platformStatic fun String.test4() { + b + } +} + +fun main(args: Array) { + A.test1() + A.test2() + A.test3() + with(A) { + A.test1() + } +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java index cf747558de1..bbf0207ef26 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java @@ -6062,6 +6062,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("traitWithPrivateExtension.kt") + public void testTraitWithPrivateExtension() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/traitWithPrivateExtension.kt"); + doTest(fileName); + } + @TestMetadata("compiler/testData/codegen/box/traits/withRequired") @TestDataPath("$PROJECT_ROOT") @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java index ef3493bd0e1..6db0b1b85b8 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java @@ -32,10 +32,11 @@ import java.util.regex.Pattern; @SuppressWarnings("all") @TestMetadata("compiler/testData/codegen/boxWithJava") @TestDataPath("$PROJECT_ROOT") +@InnerTestClasses({BlackBoxWithJavaCodegenTestGenerated.PlatformStatic.class}) @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInBoxWithJava() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^([^\\.]+)$"), false); + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^([^\\.]+)$"), true); } @TestMetadata("referenceToJavaFieldOfKotlinSubclass") @@ -44,4 +45,33 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege doTestWithJava(fileName); } + @TestMetadata("compiler/testData/codegen/boxWithJava/platformStatic") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({}) + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class PlatformStatic extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInPlatformStatic() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/platformStatic"), Pattern.compile("^([^\\.]+)$"), true); + } + + @TestMetadata("annotations") + public void testAnnotations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/platformStatic/annotations/"); + doTestWithJava(fileName); + } + + @TestMetadata("classObject") + public void testClassObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/platformStatic/classObject/"); + doTestWithJava(fileName); + } + + @TestMetadata("object") + public void testObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/platformStatic/object/"); + doTestWithJava(fileName); + } + + } + } diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java index fe729251ac6..51559008d09 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java @@ -32,7 +32,7 @@ import java.util.regex.Pattern; @SuppressWarnings("all") @TestMetadata("compiler/testData/codegen/boxWithStdlib") @TestDataPath("$PROJECT_ROOT") -@InnerTestClasses({BlackBoxWithStdlibCodegenTestGenerated.Annotations.class, BlackBoxWithStdlibCodegenTestGenerated.Arrays.class, BlackBoxWithStdlibCodegenTestGenerated.BoxingOptimization.class, BlackBoxWithStdlibCodegenTestGenerated.CallableReference.class, BlackBoxWithStdlibCodegenTestGenerated.Casts.class, BlackBoxWithStdlibCodegenTestGenerated.DataClasses.class, BlackBoxWithStdlibCodegenTestGenerated.DefaultArguments.class, BlackBoxWithStdlibCodegenTestGenerated.Evaluate.class, BlackBoxWithStdlibCodegenTestGenerated.FullJdk.class, BlackBoxWithStdlibCodegenTestGenerated.HashPMap.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, BlackBoxWithStdlibCodegenTestGenerated.WhenEnumOptimization.class, BlackBoxWithStdlibCodegenTestGenerated.WhenStringOptimization.class}) +@InnerTestClasses({BlackBoxWithStdlibCodegenTestGenerated.Annotations.class, BlackBoxWithStdlibCodegenTestGenerated.Arrays.class, BlackBoxWithStdlibCodegenTestGenerated.BoxingOptimization.class, BlackBoxWithStdlibCodegenTestGenerated.CallableReference.class, BlackBoxWithStdlibCodegenTestGenerated.Casts.class, BlackBoxWithStdlibCodegenTestGenerated.DataClasses.class, BlackBoxWithStdlibCodegenTestGenerated.DefaultArguments.class, BlackBoxWithStdlibCodegenTestGenerated.Evaluate.class, BlackBoxWithStdlibCodegenTestGenerated.FullJdk.class, BlackBoxWithStdlibCodegenTestGenerated.HashPMap.class, BlackBoxWithStdlibCodegenTestGenerated.JdkAnnotations.class, BlackBoxWithStdlibCodegenTestGenerated.PlatformNames.class, BlackBoxWithStdlibCodegenTestGenerated.PlatformStatic.class, BlackBoxWithStdlibCodegenTestGenerated.Ranges.class, BlackBoxWithStdlibCodegenTestGenerated.Reflection.class, BlackBoxWithStdlibCodegenTestGenerated.Regressions.class, BlackBoxWithStdlibCodegenTestGenerated.Strings.class, BlackBoxWithStdlibCodegenTestGenerated.ToArray.class, BlackBoxWithStdlibCodegenTestGenerated.Vararg.class, BlackBoxWithStdlibCodegenTestGenerated.When.class, BlackBoxWithStdlibCodegenTestGenerated.WhenEnumOptimization.class, BlackBoxWithStdlibCodegenTestGenerated.WhenStringOptimization.class}) @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInBoxWithStdlib() throws Exception { @@ -1430,6 +1430,58 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode } + @TestMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class PlatformStatic extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInPlatformStatic() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/platformStatic"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("callableRef.kt") + public void testCallableRef() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/callableRef.kt"); + doTestWithStdlib(fileName); + } + + @TestMetadata("closure.kt") + public void testClosure() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/closure.kt"); + doTestWithStdlib(fileName); + } + + @TestMetadata("convention.kt") + public void testConvention() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/convention.kt"); + doTestWithStdlib(fileName); + } + + @TestMetadata("default.kt") + public void testDefault() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/default.kt"); + doTestWithStdlib(fileName); + } + + @TestMetadata("explicitObject.kt") + public void testExplicitObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/explicitObject.kt"); + doTestWithStdlib(fileName); + } + + @TestMetadata("inline.kt") + public void testInline() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/inline.kt"); + doTestWithStdlib(fileName); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformStatic/simple.kt"); + doTestWithStdlib(fileName); + } + + } + @TestMetadata("compiler/testData/codegen/boxWithStdlib/ranges") @TestDataPath("$PROJECT_ROOT") @InnerTestClasses({Ranges.Expression.class, Ranges.Literal.class}) diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java index defa5a3a518..62d2387eae6 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java @@ -32,7 +32,7 @@ import java.util.regex.Pattern; @SuppressWarnings("all") @TestMetadata("compiler/testData/compileJavaAgainstKotlin") @TestDataPath("$PROJECT_ROOT") -@InnerTestClasses({CompileJavaAgainstKotlinTestGenerated.Class.class, CompileJavaAgainstKotlinTestGenerated.Method.class, CompileJavaAgainstKotlinTestGenerated.Property.class, CompileJavaAgainstKotlinTestGenerated.StaticFields.class}) +@InnerTestClasses({CompileJavaAgainstKotlinTestGenerated.Class.class, CompileJavaAgainstKotlinTestGenerated.Method.class, CompileJavaAgainstKotlinTestGenerated.PlatformStatic.class, CompileJavaAgainstKotlinTestGenerated.Property.class, CompileJavaAgainstKotlinTestGenerated.StaticFields.class}) @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAgainstKotlinTest { public void testAllFilesPresentInCompileJavaAgainstKotlin() throws Exception { @@ -420,6 +420,28 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg } + @TestMetadata("compiler/testData/compileJavaAgainstKotlin/platformStatic") + @TestDataPath("$PROJECT_ROOT") + @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class) + public static class PlatformStatic extends AbstractCompileJavaAgainstKotlinTest { + public void testAllFilesPresentInPlatformStatic() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/compileJavaAgainstKotlin/platformStatic"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("simpleClassObject.kt") + public void testSimpleClassObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleClassObject.kt"); + doTest(fileName); + } + + @TestMetadata("simpleObject.kt") + public void testSimpleObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/platformStatic/simpleObject.kt"); + doTest(fileName); + } + + } + @TestMetadata("compiler/testData/compileJavaAgainstKotlin/property") @TestDataPath("$PROJECT_ROOT") @InnerTestClasses({Property.PlatformName.class}) diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java b/core/descriptors/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java index 62c883d406e..4cbf3f41e2f 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java @@ -334,7 +334,7 @@ public class KotlinBuiltIns { } @NotNull - public ClassDescriptor getPlatforStaticAnnotationClass() { + public ClassDescriptor getPlatformStaticAnnotationClass() { return getBuiltInClassByName("platformStatic"); } @@ -868,7 +868,7 @@ public class KotlinBuiltIns { } public boolean isPlatformStatic(@NotNull CallableDescriptor callableDescriptor) { - return containsAnnotation(callableDescriptor, getPlatforStaticAnnotationClass()); + return containsAnnotation(callableDescriptor, getPlatformStaticAnnotationClass()); } public boolean isSuppressAnnotation(@NotNull AnnotationDescriptor annotationDescriptor) { diff --git a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index 3936fbda67e..d7af63ee5fe 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -177,7 +177,7 @@ fun main(args: Array) { } testClass(javaClass(), "BlackBoxWithJavaCodegenTestGenerated") { - model("codegen/boxWithJava", testMethod = "doTestWithJava", extension = null, recursive = false) + model("codegen/boxWithJava", testMethod = "doTestWithJava", extension = null, recursive = true, excludeParentDirs = true) } testClass(javaClass(), "BlackBoxWithStdlibCodegenTestGenerated") {