diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/TraceBasedJavaResolverCache.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/TraceBasedJavaResolverCache.java index 9496178235b..22d32dd7a34 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/TraceBasedJavaResolverCache.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/TraceBasedJavaResolverCache.java @@ -16,8 +16,6 @@ package org.jetbrains.jet.lang.resolve.java.resolver; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.PsiExpression; import com.intellij.psi.PsiField; import com.intellij.psi.impl.JavaConstantExpressionEvaluator; @@ -40,18 +38,12 @@ import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaElementImpl; import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaFieldImpl; import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaMethodImpl; import org.jetbrains.jet.lang.resolve.name.FqName; -import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns; -import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; import javax.inject.Inject; import static org.jetbrains.jet.lang.resolve.BindingContext.*; -import static org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils.fqNameByClass; public class TraceBasedJavaResolverCache implements JavaResolverCache { - private static final Logger LOG = Logger.getInstance(TraceBasedJavaResolverCache.class); - private static final FqName ASSERT_INVISIBLE_IN_RESOLVER_ANNOTATION = fqNameByClass(AssertInvisibleInResolver.class); - private BindingTrace trace; @Inject @@ -80,17 +72,6 @@ public class TraceBasedJavaResolverCache implements JavaResolverCache { @Nullable @Override public ClassDescriptor getClass(@NotNull JavaClass javaClass) { - FqName fqName = javaClass.getFqName(); - if (fqName != null && KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME.equals(fqName.parent())) { - if (javaClass.findAnnotation(ASSERT_INVISIBLE_IN_RESOLVER_ANNOTATION) != null) { - if (ApplicationManager.getApplication().isInternal()) { - LOG.error("Classpath is configured incorrectly:" + - " class " + fqName + " from runtime must not be loaded by compiler"); - } - return null; - } - } - return trace.get(CLASS, ((JavaClassImpl) javaClass).getPsi()); } diff --git a/runtime/src/jet/Range.java b/runtime/kt/Progression.kt similarity index 68% rename from runtime/src/jet/Range.java rename to runtime/kt/Progression.kt index 863540d8da5..7d8327f0d3b 100644 --- a/runtime/src/jet/Range.java +++ b/runtime/kt/Progression.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 JetBrains s.r.o. + * 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. @@ -14,13 +14,12 @@ * limitations under the License. */ -package jet; +package jet -import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; +public trait Progression : Iterable { + public val start: N -@AssertInvisibleInResolver -public interface Range> { - T getStart(); - T getEnd(); - boolean contains(T item); + public val end: N + + public val increment: Number } diff --git a/runtime/src/jet/Progression.java b/runtime/kt/Range.kt similarity index 68% rename from runtime/src/jet/Progression.java rename to runtime/kt/Range.kt index b54fe7b29f7..94b314ed103 100644 --- a/runtime/src/jet/Progression.java +++ b/runtime/kt/Range.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 JetBrains s.r.o. + * 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. @@ -14,13 +14,12 @@ * limitations under the License. */ -package jet; +package jet -import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; +public trait Range> { + public val start: T -@AssertInvisibleInResolver -public interface Progression extends Iterable { - N getStart(); - N getEnd(); - Number getIncrement(); + public val end: T + + public fun contains(item: T): Boolean } diff --git a/runtime/src/org/jetbrains/jet/rt/annotation/AssertInvisibleInResolver.java b/runtime/kt/Unit.kt similarity index 61% rename from runtime/src/org/jetbrains/jet/rt/annotation/AssertInvisibleInResolver.java rename to runtime/kt/Unit.kt index 6a01c8a9788..ee2c92e1e14 100644 --- a/runtime/src/org/jetbrains/jet/rt/annotation/AssertInvisibleInResolver.java +++ b/runtime/kt/Unit.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 JetBrains s.r.o. + * 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. @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.jetbrains.jet.rt.annotation; +package jet -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +public class Unit private() { + fun toString() = "Unit.VALUE" -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.CLASS) -public @interface AssertInvisibleInResolver { + class object { + // TODO: remove suppression after a successful bootstrap + suppress("INVISIBLE_MEMBER") + public val VALUE: Unit = Unit() + } } diff --git a/runtime/src/jet/Unit.java b/runtime/src/jet/Unit.java deleted file mode 100644 index 5dc741f535d..00000000000 --- a/runtime/src/jet/Unit.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2010-2013 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 jet; - -import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; - -@AssertInvisibleInResolver -public class Unit { - public static final Unit VALUE = new Unit(); - - public static final object object$ = new object(); - - private Unit() { - } - - @Override - public String toString() { - return "Unit.VALUE"; - } - - @Override - public boolean equals(Object o) { - return o == VALUE; - } - - @Override - public int hashCode() { - return 239; - } - - public static class object { - private object() { - } - } -}