get rid of JdkNames
This commit is contained in:
@@ -39,7 +39,6 @@ import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
|||||||
import org.jetbrains.jet.lang.resolve.OverridingUtil;
|
import org.jetbrains.jet.lang.resolve.OverridingUtil;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.ResolvedCall;
|
import org.jetbrains.jet.lang.resolve.calls.ResolvedCall;
|
||||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JdkNames;
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||||
@@ -99,7 +98,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
isAbstract = true;
|
isAbstract = true;
|
||||||
isInterface = true;
|
isInterface = true;
|
||||||
isAnnotation = true;
|
isAnnotation = true;
|
||||||
signature.getInterfaces().add(JdkNames.JLA_ANNOTATION.getInternalName());
|
signature.getInterfaces().add("java/lang/annotation/Annotation");
|
||||||
}
|
}
|
||||||
else if (jetClass.hasModifier(JetTokens.ENUM_KEYWORD)) {
|
else if (jetClass.hasModifier(JetTokens.ENUM_KEYWORD)) {
|
||||||
isEnum = true;
|
isEnum = true;
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import org.jetbrains.jet.lang.psi.JetScript;
|
|||||||
import org.jetbrains.jet.lang.psi.JetTypeParameterListOwner;
|
import org.jetbrains.jet.lang.psi.JetTypeParameterListOwner;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.ScriptNameUtil;
|
import org.jetbrains.jet.lang.resolve.ScriptNameUtil;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JdkNames;
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -113,7 +112,7 @@ public class ScriptCodegen {
|
|||||||
Opcodes.ACC_PUBLIC,
|
Opcodes.ACC_PUBLIC,
|
||||||
className.getInternalName(),
|
className.getInternalName(),
|
||||||
null,
|
null,
|
||||||
JdkNames.JL_OBJECT.getInternalName(),
|
"java/lang/Object",
|
||||||
new String[0]);
|
new String[0]);
|
||||||
|
|
||||||
genMembers(scriptDeclaration, context, classBuilder);
|
genMembers(scriptDeclaration, context, classBuilder);
|
||||||
@@ -154,7 +153,7 @@ public class ScriptCodegen {
|
|||||||
JvmClassName className = codegenAnnotator.classNameForClassDescriptor(classDescriptorForScript);
|
JvmClassName className = codegenAnnotator.classNameForClassDescriptor(classDescriptorForScript);
|
||||||
|
|
||||||
instructionAdapter.load(0, className.getAsmType());
|
instructionAdapter.load(0, className.getAsmType());
|
||||||
instructionAdapter.invokespecial(JdkNames.JL_OBJECT.getInternalName(), "<init>", "()V");
|
instructionAdapter.invokespecial("java/lang/Object", "<init>", "()V");
|
||||||
|
|
||||||
instructionAdapter.load(0, className.getAsmType());
|
instructionAdapter.load(0, className.getAsmType());
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -65,6 +65,8 @@ import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getClassObjectName;
|
|||||||
*/
|
*/
|
||||||
public class JavaDescriptorResolver implements DependencyClassByQualifiedNameResolver {
|
public class JavaDescriptorResolver implements DependencyClassByQualifiedNameResolver {
|
||||||
|
|
||||||
|
private static final FqName OBJECT_FQ_NAME = new FqName("java.lang.Object");
|
||||||
|
|
||||||
public static final Name JAVA_ROOT = Name.special("<java_root>");
|
public static final Name JAVA_ROOT = Name.special("<java_root>");
|
||||||
|
|
||||||
public static final ModuleDescriptor FAKE_ROOT_MODULE = new ModuleDescriptor(JAVA_ROOT);
|
public static final ModuleDescriptor FAKE_ROOT_MODULE = new ModuleDescriptor(JAVA_ROOT);
|
||||||
@@ -305,7 +307,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private ClassDescriptor resolveJavaLangObject() {
|
private ClassDescriptor resolveJavaLangObject() {
|
||||||
ClassDescriptor clazz = resolveClass(JdkNames.JL_OBJECT.getFqName(), DescriptorSearchRule.IGNORE_IF_FOUND_IN_KOTLIN);
|
ClassDescriptor clazz = resolveClass(OBJECT_FQ_NAME, DescriptorSearchRule.IGNORE_IF_FOUND_IN_KOTLIN);
|
||||||
if (clazz == null) {
|
if (clazz == null) {
|
||||||
// TODO: warning
|
// TODO: warning
|
||||||
}
|
}
|
||||||
@@ -641,7 +643,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
|||||||
static boolean isJavaLangObject(JetType type) {
|
static boolean isJavaLangObject(JetType type) {
|
||||||
ClassifierDescriptor classifierDescriptor = type.getConstructor().getDeclarationDescriptor();
|
ClassifierDescriptor classifierDescriptor = type.getConstructor().getDeclarationDescriptor();
|
||||||
return classifierDescriptor instanceof ClassDescriptor &&
|
return classifierDescriptor instanceof ClassDescriptor &&
|
||||||
DescriptorUtils.getFQName(classifierDescriptor).equalsTo(JdkNames.JL_OBJECT.getFqName());
|
DescriptorUtils.getFQName(classifierDescriptor).equalsTo(OBJECT_FQ_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -715,7 +717,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
|||||||
|
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
if (classData.kotlin
|
if (classData.kotlin
|
||||||
|| JdkNames.JL_OBJECT.getFqName().equalsTo(psiClass.getQualifiedName())
|
|| OBJECT_FQ_NAME.equalsTo(psiClass.getQualifiedName())
|
||||||
// TODO: annotations
|
// TODO: annotations
|
||||||
|| classDescriptor.getKind() == ClassKind.ANNOTATION_CLASS) {
|
|| classDescriptor.getKind() == ClassKind.ANNOTATION_CLASS) {
|
||||||
result.add(JetStandardClasses.getAnyType());
|
result.add(JetStandardClasses.getAnyType());
|
||||||
@@ -1498,7 +1500,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
|||||||
if (scopeData.kotlin) {
|
if (scopeData.kotlin) {
|
||||||
// TODO: unless maybe class explicitly extends Object
|
// TODO: unless maybe class explicitly extends Object
|
||||||
String ownerClassName = method.getPsiMethod().getContainingClass().getQualifiedName();
|
String ownerClassName = method.getPsiMethod().getContainingClass().getQualifiedName();
|
||||||
if (JdkNames.JL_OBJECT.getFqName().getFqName().equals(ownerClassName)) {
|
if (OBJECT_FQ_NAME.getFqName().equals(ownerClassName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2012 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.lang.resolve.java;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Stepan Koltsov
|
|
||||||
*/
|
|
||||||
public class JdkNames {
|
|
||||||
|
|
||||||
public static final JvmClassName JL_OBJECT = JvmClassName.byInternalName("java/lang/Object");
|
|
||||||
public static final JvmClassName JL_STRING = JvmClassName.byInternalName("java/lang/String");
|
|
||||||
public static final JvmClassName JLA_ANNOTATION = JvmClassName.byInternalName("java/lang/annotation/Annotation");
|
|
||||||
public static final JvmClassName JLA_ENUM = JvmClassName.byInternalName("java/lang/Enum");
|
|
||||||
|
|
||||||
private JdkNames() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user