Extract descriptor.loader.java module from frontend.java

Will be used in runtime to load reflected classes
This commit is contained in:
Alexander Udalov
2013-08-21 16:12:09 +04:00
parent 4fa35047b0
commit 2b9225fdd4
107 changed files with 97 additions and 37 deletions
+1
View File
@@ -8,6 +8,7 @@
<element id="module-output" name="backend" />
<element id="module-output" name="frontend" />
<element id="module-output" name="frontend.java" />
<element id="module-output" name="descriptor.loader.java" />
<element id="module-output" name="idea" />
<element id="module-output" name="jet.as.java.psi" />
<element id="module-output" name="runtime" />
+1
View File
@@ -11,6 +11,7 @@
<module fileurl="file://$PROJECT_DIR$/compiler/cli/cli-common/cli-common.iml" filepath="$PROJECT_DIR$/compiler/cli/cli-common/cli-common.iml" group="compiler/cli" />
<module fileurl="file://$PROJECT_DIR$/compiler/integration-tests/compiler-integration-tests.iml" filepath="$PROJECT_DIR$/compiler/integration-tests/compiler-integration-tests.iml" group="compiler/cli" />
<module fileurl="file://$PROJECT_DIR$/compiler/tests/compiler-tests.iml" filepath="$PROJECT_DIR$/compiler/tests/compiler-tests.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/core/descriptor.loader.java/descriptor.loader.java.iml" filepath="$PROJECT_DIR$/core/descriptor.loader.java/descriptor.loader.java.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/compiler/frontend/frontend.iml" filepath="$PROJECT_DIR$/compiler/frontend/frontend.iml" group="compiler" />
<module fileurl="file://$PROJECT_DIR$/compiler/frontend.java/frontend.java.iml" filepath="$PROJECT_DIR$/compiler/frontend.java/frontend.java.iml" group="compiler/java" />
<module fileurl="file://$PROJECT_DIR$/generators/generators.iml" filepath="$PROJECT_DIR$/generators/generators.iml" group="infrastructure" />
+3
View File
@@ -25,6 +25,7 @@
<dirset id="compilerSources.dirset" dir="${basedir}/">
<include name="compiler/frontend/src"/>
<include name="compiler/frontend/serialization/src"/>
<include name="core/descriptor.loader.java/src"/>
<include name="compiler/frontend.java/src"/>
<include name="compiler/frontend.java/serialization.java/src"/>
<include name="compiler/backend/src"/>
@@ -43,6 +44,7 @@
<patternset id="compilerClassesFromIDEA.fileset">
<include name="frontend/**"/>
<include name="serialization/**"/>
<include name="descriptor.loader.java/**"/>
<include name="frontend.java/**"/>
<include name="backend/**"/>
<include name="cli/**"/>
@@ -127,6 +129,7 @@
<jar jarfile="${output}/kotlin-compiler-sources.jar">
<!-- TODO How to convert it from pathset or dirset ? -->
<fileset dir="compiler/frontend/src"/>
<fileset dir="core/descriptor.loader.java/src"/>
<fileset dir="compiler/frontend.java/src"/>
<fileset dir="compiler/backend/src"/>
<fileset dir="compiler/cli/src"/>
+1
View File
@@ -15,6 +15,7 @@
<orderEntry type="module" module-name="serialization" />
<orderEntry type="library" name="protobuf-java" level="project" />
<orderEntry type="module" module-name="serialization.java" />
<orderEntry type="module" module-name="descriptor.loader.java" />
</component>
</module>
+1
View File
@@ -16,6 +16,7 @@
<orderEntry type="module" module-name="js.translator" />
<orderEntry type="library" name="jline" level="project" />
<orderEntry type="module" module-name="cli-common" exported="" />
<orderEntry type="module" module-name="descriptor.loader.java" />
</component>
</module>
@@ -0,0 +1,39 @@
/*
* 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 org.jetbrains.jet.cli.jvm.compiler;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public final class ClassPath implements Iterable<VirtualFile> {
@NotNull
private final List<VirtualFile> roots = new ArrayList<VirtualFile>();
@Override
public Iterator<VirtualFile> iterator() {
return roots.iterator();
}
public void add(@NotNull VirtualFile root) {
roots.add(root);
}
}
@@ -1,4 +1,20 @@
package org.jetbrains.jet.lang.resolve.java.vfilefinder;
/*
* 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 org.jetbrains.jet.cli.jvm.compiler;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.GlobalSearchScope;
@@ -6,6 +22,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.cli.jvm.compiler.ClassPath;
import org.jetbrains.jet.lang.resolve.java.resolver.KotlinClassFileHeader;
import org.jetbrains.jet.lang.resolve.java.vfilefinder.VirtualFileFinder;
import org.jetbrains.jet.lang.resolve.name.FqName;
public class CliVirtualFileFinder implements VirtualFileFinder {
@@ -51,7 +51,6 @@ import org.jetbrains.jet.lang.parsing.JetParserDefinition;
import org.jetbrains.jet.lang.parsing.JetScriptDefinitionProvider;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.java.JetFilesProvider;
import org.jetbrains.jet.lang.resolve.java.vfilefinder.CliVirtualFileFinder;
import org.jetbrains.jet.lang.resolve.java.vfilefinder.VirtualFileFinder;
import org.jetbrains.jet.plugin.JetFileType;
import org.jetbrains.jet.utils.PathUtil;
+1
View File
@@ -14,6 +14,7 @@
<orderEntry type="library" name="javax.inject" level="project" />
<orderEntry type="module" module-name="serialization" />
<orderEntry type="module" module-name="serialization.java" />
<orderEntry type="module" module-name="descriptor.loader.java" />
</component>
</module>
@@ -1,23 +0,0 @@
package org.jetbrains.jet.cli.jvm.compiler;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public final class ClassPath implements Iterable<VirtualFile> {
@NotNull
private final List<VirtualFile> roots = new ArrayList<VirtualFile>();
@Override
public Iterator<VirtualFile> iterator() {
return roots.iterator();
}
public void add(@NotNull VirtualFile root) {
roots.add(root);
}
}
@@ -11,6 +11,7 @@
<orderEntry type="module" module-name="frontend" />
<orderEntry type="module" module-name="frontend.java" />
<orderEntry type="library" scope="PROVIDED" name="intellij-core" level="project" />
<orderEntry type="module" module-name="descriptor.loader.java" />
</component>
</module>
+1
View File
@@ -18,6 +18,7 @@
<orderEntry type="library" name="dx-android" level="project" />
<orderEntry type="module" module-name="serialization" />
<orderEntry type="module" module-name="serialization.java" />
<orderEntry type="module" module-name="descriptor.loader.java" />
</component>
</module>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="frontend" />
<orderEntry type="module" module-name="serialization" />
<orderEntry type="module" module-name="serialization.java" />
<orderEntry type="library" name="javax.inject" level="project" />
<orderEntry type="library" name="annotations" level="project" />
<orderEntry type="library" scope="PROVIDED" name="intellij-core" level="project" />
<orderEntry type="module" module-name="runtime" />
</component>
</module>
@@ -30,7 +30,6 @@ public class AsmTypeConstants {
public static final Type JAVA_THROWABLE_TYPE = getType(Throwable.class);
public static final Type JAVA_ARRAY_GENERIC_TYPE = getType(Object[].class);
public static final Type JET_NOTHING_TYPE = Type.getObjectType("jet/Nothing");
public static final Type JET_UNIT_TYPE = Type.getObjectType("jet/Unit");
public static final Type JET_FUNCTION0_TYPE = Type.getObjectType("jet/Function0");
public static final Type JET_FUNCTION1_TYPE = Type.getObjectType("jet/Function1");
@@ -32,7 +32,10 @@ import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.resolve.constants.EnumValue;
import org.jetbrains.jet.lang.resolve.java.*;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.java.PsiClassFinder;
import org.jetbrains.jet.lang.resolve.java.vfilefinder.VirtualFileFinder;
import org.jetbrains.jet.lang.resolve.lazy.storage.LockBasedStorageManager;
import org.jetbrains.jet.lang.resolve.lazy.storage.MemoizedFunctionToNotNull;
@@ -40,7 +43,6 @@ import org.jetbrains.jet.lang.resolve.lazy.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.utils.ExceptionUtils;
import javax.inject.Inject;
import java.io.IOException;
@@ -71,7 +73,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
return loadMemberAnnotationsFromFile(file);
}
catch (IOException e) {
throw ExceptionUtils.rethrow(e);
throw new RuntimeException(e);
}
}
}, StorageManager.ReferenceKind.STRONG);
@@ -99,7 +101,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
return loadClassAnnotationsFromFile(virtualFile);
}
catch (IOException e) {
throw ExceptionUtils.rethrow(e);
throw new RuntimeException(e);
}
}
@@ -36,7 +36,6 @@ import java.util.*;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isEnumClassObject;
public final class DescriptorResolverUtils {
private DescriptorResolverUtils() {
}
@@ -24,7 +24,6 @@ import org.jetbrains.jet.lang.descriptors.impl.ConstructorDescriptorImpl;
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
import org.jetbrains.jet.lang.resolve.DescriptorResolver;
import org.jetbrains.jet.lang.resolve.java.JavaVisibilities;
import org.jetbrains.jet.lang.resolve.java.descriptor.SamAdapterDescriptor;
import org.jetbrains.jet.lang.resolve.java.structure.JavaArrayType;
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass;
import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod;
@@ -14,7 +14,6 @@ import org.jetbrains.jet.lang.resolve.java.AbiVersionUtil;
import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.utils.ExceptionUtils;
import java.io.IOException;
import java.io.InputStream;
@@ -40,7 +39,7 @@ public final class KotlinClassFileHeader {
}
}
catch (IOException e) {
throw ExceptionUtils.rethrow(e);
throw new RuntimeException(e);
}
}
@@ -35,7 +35,6 @@ import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import java.util.*;
import static org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils.erasure;
import static org.jetbrains.jet.lang.types.Variance.INVARIANT;
public class SingleAbstractMethodUtils {
@@ -406,8 +405,8 @@ public class SingleAbstractMethodUtils {
if (parameters1.size() != parameters2.size()) return false;
for (Iterator<JavaValueParameter> it1 = parameters1.iterator(), it2 = parameters2.iterator(); it1.hasNext(); ) {
JavaType type1 = erasure(substitutor1.substitute(it1.next().getType()), substitutor1);
JavaType type2 = erasure(substitutor2.substitute(it2.next().getType()), substitutor2);
JavaType type1 = DescriptorResolverUtils.erasure(substitutor1.substitute(it1.next().getType()), substitutor1);
JavaType type2 = DescriptorResolverUtils.erasure(substitutor2.substitute(it2.next().getType()), substitutor2);
if (!(type1 == null ? type2 == null : type1.equals(type2))) return false;
}

Some files were not shown because too many files have changed in this diff Show More