Rewrite Progression, Range, Unit to Kotlin
Delete useless (by now) AssertInvisibleInResolver
This commit is contained in:
-19
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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<N : Any> : Iterable<N> {
|
||||
public val start: N
|
||||
|
||||
@AssertInvisibleInResolver
|
||||
public interface Range<T extends Comparable<T>> {
|
||||
T getStart();
|
||||
T getEnd();
|
||||
boolean contains(T item);
|
||||
public val end: N
|
||||
|
||||
public val increment: Number
|
||||
}
|
||||
@@ -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<in T : Comparable<T>> {
|
||||
public val start: T
|
||||
|
||||
@AssertInvisibleInResolver
|
||||
public interface Progression<N> extends Iterable<N> {
|
||||
N getStart();
|
||||
N getEnd();
|
||||
Number getIncrement();
|
||||
public val end: T
|
||||
|
||||
public fun contains(item: T): Boolean
|
||||
}
|
||||
+9
-9
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user