Compare commits
117 Commits
push/pdn_b
...
master_162
2
.idea/libraries/asm.xml
generated
|
|
@@ -8,7 +8,7 @@
|
|||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
4
.idea/libraries/guava.xml
generated
|
|
@@ -4,11 +4,11 @@
|
|||
<root url="file://$PROJECT_DIR$/annotations" />
|
||||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/guava-19.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/guava-17.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
4
.idea/libraries/idea_full.xml
generated
|
|
@@ -9,9 +9,9 @@
|
|||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/lib" recursive="false" />
|
||||
</library>
|
||||
|
|
|
|||
7
.idea/libraries/intellij_core.xml
generated
|
|
@@ -7,7 +7,6 @@
|
|||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/annotations.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/asm-all.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/guava-19.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/intellij-core.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/jdom.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/jna.jar!/" />
|
||||
|
|
@@ -18,13 +17,15 @@
|
|||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/util.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/xpp3-1.1.4-min.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/xstream-1.4.8.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/guava-17.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/jsr305.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/core/guava-17.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/jsr305.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
|
|
|
|||
1
.idea/libraries/properties.xml
generated
|
|
@@ -5,7 +5,6 @@
|
|||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/properties/lib/properties.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/properties/lib/resources_en.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
|
|
|
|||
59
.idea/libraries/robolectric.xml
generated
|
|
@@ -1,59 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="robolectric">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/accessibility-test-framework-2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/ant-1.8.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/ant-launcher-1.8.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/asm-5.0.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/asm-commons-5.0.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/asm-tree-5.0.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/assertj-core-2.6.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/backport-util-concurrent-3.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/bcprov-jdk16-1.46.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/classworlds-1.1-alpha-2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/guava-20.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/hamcrest-core-1.3.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/hamcrest-library-1.3.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/icu4j-53.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-ant-tasks-2.1.3.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-artifact-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-artifact-manager-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-error-diagnostics-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-model-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-plugin-registry-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-profile-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-project-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-repository-metadata-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/maven-settings-2.2.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/nekohtml-1.9.6.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/plexus-container-default-1.0-alpha-9-stable-1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/plexus-interpolation-1.11.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/plexus-utils-1.5.15.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/protobuf-java-2.6.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-3.3.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-annotations-3.3.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-junit-3.3.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-resources-3.3.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-sandbox-3.3.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-utils-3.3.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/shadow-api-3.3.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/shadows-core-3.3.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/sqlite4java-0.282.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/wagon-file-1.0-beta-6.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/wagon-http-lightweight-1.0-beta-6.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/wagon-http-shared-1.0-beta-6.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/wagon-provider-api-1.0-beta-6.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/xercesMinimal-1.9.6.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/xmlpull-1.1.3.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/xpp3_min-1.1.4c.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/xstream-1.4.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-3.3.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-3.3.2-sources-source.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/robolectric/robolectric-3.3.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
1
.idea/misc.xml
generated
|
|
@@ -6,6 +6,7 @@
|
|||
</properties>
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="javax.inject.Inject" />
|
||||
</list>
|
||||
|
|
|
|||
|
|
@@ -1,28 +0,0 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Codegen Tests with JVM target 9 on JDK 9 " type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="org.jetbrains.kotlin.codegen.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<module name="compiler-tests" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="9-ea" />
|
||||
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin.codegen" />
|
||||
<option name="MAIN_CLASS_NAME" value="org.jetbrains.kotlin.codegen.CodegenJdkCommonTestSuite" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" value="-Dkotlin.test.default.jvm.target=1.8 -Dkotlin.test.substitute.bytecode.1.8.to.1.9=true -ea -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true --add-opens java.desktop/javax.swing=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
|
|
@@ -25,7 +25,7 @@
|
|||
<property environment="env"/>
|
||||
<property name="tools.jar" value="${env.JDK_18}/lib/tools.jar"/>
|
||||
|
||||
<property name="java.target" value="1.8"/>
|
||||
<property name="java.target" value="1.6"/>
|
||||
|
||||
<condition property="bootstrap.or.local.build" value="true" else="false">
|
||||
<or>
|
||||
|
|
@@ -387,7 +387,7 @@
|
|||
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
|
||||
<zipfileset src="${basedir}/ideaSDK/core/annotations.jar"/>
|
||||
<zipfileset src="${basedir}/ideaSDK/core/asm-all.jar"/>
|
||||
<zipfileset src="${basedir}/ideaSDK/core/guava-19.0.jar"/>
|
||||
<zipfileset src="${basedir}/ideaSDK/core/guava-17.0.jar"/>
|
||||
<zipfileset src="${basedir}/ideaSDK/core/intellij-core.jar"/>
|
||||
<zipfileset src="${basedir}/ideaSDK/core/jdom.jar" excludes="META-INF/jb/** META-INF/LICENSE"/>
|
||||
<zipfileset src="${basedir}/ideaSDK/core/jna.jar"/>
|
||||
|
|
|
|||
|
|
@@ -29,8 +29,8 @@ public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
|
|||
|
||||
public void doTest() {
|
||||
initProject();
|
||||
rebuildAllModules();
|
||||
buildAllModules().assertSuccessful();
|
||||
rebuildAll();
|
||||
makeAll().assertSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@@ -20,9 +20,9 @@ import com.intellij.openapi.vfs.StandardFileSystems
|
|||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.psi.PsiJavaModule
|
||||
//import com.intellij.psi.PsiJavaModule
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.impl.light.LightJavaModule
|
||||
//import com.intellij.psi.impl.light.LightJavaModule
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
|
||||
|
|
@@ -100,6 +100,8 @@ internal class ClasspathRootsResolver(
|
|||
}
|
||||
|
||||
private fun modularSourceRoot(root: VirtualFile): JavaModule.Explicit? {
|
||||
return null
|
||||
/*
|
||||
val moduleInfoFile =
|
||||
when {
|
||||
root.isDirectory -> root.findChild(PsiJavaModule.MODULE_INFO_FILE)
|
||||
|
|
@@ -110,19 +112,14 @@ internal class ClasspathRootsResolver(
|
|||
val psiFile = psiManager.findFile(moduleInfoFile) ?: return null
|
||||
val psiJavaModule = psiFile.children.singleOrNull { it is PsiJavaModule } as? PsiJavaModule ?: return null
|
||||
return JavaModule.Explicit(JavaModuleInfo.create(psiJavaModule), root, moduleInfoFile, isBinary = false)
|
||||
*/
|
||||
}
|
||||
|
||||
private fun modularBinaryRoot(root: VirtualFile, originalFile: File): JavaModule? {
|
||||
val isJar = root.fileSystem.protocol == StandardFileSystems.JAR_PROTOCOL
|
||||
val manifest: Attributes? by lazy(NONE) { readManifestAttributes(root) }
|
||||
|
||||
val moduleInfoFile =
|
||||
root.findChild(PsiJavaModule.MODULE_INFO_CLS_FILE)
|
||||
?: root.takeIf { isJar }?.findFileByRelativePath(MULTI_RELEASE_MODULE_INFO_CLS_FILE)?.takeIf {
|
||||
manifest?.getValue(IS_MULTI_RELEASE)?.equals("true", ignoreCase = true) == true
|
||||
}
|
||||
|
||||
if (moduleInfoFile != null) {
|
||||
return null
|
||||
/*
|
||||
val moduleInfoFile = root.findChild(PsiJavaModule.MODULE_INFO_CLS_FILE)
|
||||
return if (moduleInfoFile != null) {
|
||||
val moduleInfo = JavaModuleInfo.read(moduleInfoFile) ?: return null
|
||||
return JavaModule.Explicit(moduleInfo, root, moduleInfoFile, isBinary = true)
|
||||
}
|
||||
|
|
@@ -141,8 +138,6 @@ internal class ClasspathRootsResolver(
|
|||
}
|
||||
return JavaModule.Automatic(moduleName, root)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
private fun readManifestAttributes(jarRoot: VirtualFile): Attributes? {
|
||||
|
|
@@ -153,6 +148,7 @@ internal class ClasspathRootsResolver(
|
|||
catch (e: IOException) {
|
||||
null
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private fun addModularRoots(modules: List<JavaModule>, result: MutableList<JavaRoot>) {
|
||||
|
|
@@ -264,7 +260,6 @@ internal class ClasspathRootsResolver(
|
|||
}
|
||||
|
||||
private companion object {
|
||||
const val MULTI_RELEASE_MODULE_INFO_CLS_FILE = "META-INF/versions/9/${PsiJavaModule.MODULE_INFO_CLS_FILE}"
|
||||
const val AUTOMATIC_MODULE_NAME = "Automatic-Module-Name"
|
||||
const val IS_MULTI_RELEASE = "Multi-Release"
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -235,11 +235,6 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
|
|||
return result
|
||||
}
|
||||
|
||||
override fun findModules(moduleName: String, scope: GlobalSearchScope): Collection<PsiJavaModule> {
|
||||
// TODO
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
override fun getNonTrivialPackagePrefixes(): Collection<String> = emptyList()
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@@ -26,7 +26,6 @@ import com.intellij.core.JavaCoreApplicationEnvironment
|
|||
import com.intellij.core.JavaCoreProjectEnvironment
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.ide.plugins.PluginManagerCore
|
||||
import com.intellij.lang.MetaLanguage
|
||||
import com.intellij.lang.java.JavaParserDefinition
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
|
|
@@ -121,28 +120,6 @@ class KotlinCoreEnvironment private constructor(
|
|||
override fun preregisterServices() {
|
||||
registerProjectExtensionPoints(Extensions.getArea(project))
|
||||
}
|
||||
|
||||
override fun registerJavaPsiFacade() {
|
||||
with (project) {
|
||||
registerService(CoreJavaFileManager::class.java, ServiceManager.getService(this, JavaFileManager::class.java) as CoreJavaFileManager)
|
||||
|
||||
val cliLightClassGenerationSupport = CliLightClassGenerationSupport(this)
|
||||
registerService(LightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
|
||||
registerService(CliLightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
|
||||
registerService(CodeAnalyzerInitializer::class.java, cliLightClassGenerationSupport)
|
||||
|
||||
registerService(ExternalAnnotationsManager::class.java, MockExternalAnnotationsManager())
|
||||
registerService(InferredAnnotationsManager::class.java, MockInferredAnnotationsManager())
|
||||
|
||||
val area = Extensions.getArea(this)
|
||||
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(JavaElementFinder(this, cliLightClassGenerationSupport))
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(
|
||||
PsiElementFinderImpl(this, ServiceManager.getService(this, JavaFileManager::class.java)))
|
||||
}
|
||||
|
||||
super.registerJavaPsiFacade()
|
||||
}
|
||||
}
|
||||
|
||||
private val sourceFiles = mutableListOf<KtFile>()
|
||||
|
|
@@ -208,12 +185,12 @@ class KotlinCoreEnvironment private constructor(
|
|||
this.initialRoots = initialRoots
|
||||
|
||||
if (!configuration.getBoolean(JVMConfigurationKeys.SKIP_RUNTIME_VERSION_CHECK) && messageCollector != null) {
|
||||
JvmRuntimeVersionsConsistencyChecker.checkCompilerClasspathConsistency(
|
||||
messageCollector,
|
||||
configuration,
|
||||
initialRoots.mapNotNull { (file, type) -> if (type == JavaRoot.RootType.BINARY) file else null }
|
||||
)
|
||||
}
|
||||
JvmRuntimeVersionsConsistencyChecker.checkCompilerClasspathConsistency(
|
||||
messageCollector,
|
||||
configuration,
|
||||
initialRoots.mapNotNull { (file, type) -> if (type == JavaRoot.RootType.BINARY) file else null }
|
||||
)
|
||||
}
|
||||
|
||||
val (roots, singleJavaFileRoots) =
|
||||
initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION }
|
||||
|
|
@@ -300,7 +277,7 @@ class KotlinCoreEnvironment private constructor(
|
|||
|
||||
for (packagePartProvider in packagePartProviders) {
|
||||
packagePartProvider.addRoots(newRoots)
|
||||
}
|
||||
}
|
||||
|
||||
return rootsIndex.addNewIndexForRoots(newRoots)?.let { newIndex ->
|
||||
updateClasspathFromRootsIndex(newIndex)
|
||||
|
|
@@ -325,9 +302,9 @@ class KotlinCoreEnvironment private constructor(
|
|||
return findLocalFile(root.file.absolutePath).also {
|
||||
if (it == null) {
|
||||
report(STRONG_WARNING, "Classpath entry points to a non-existent location: ${root.file}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun findJarRoot(file: File): VirtualFile? =
|
||||
applicationEnvironment.jarFileSystem.findFileByPath("$file${URLUtil.JAR_SEPARATOR}")
|
||||
|
|
@@ -351,7 +328,7 @@ class KotlinCoreEnvironment private constructor(
|
|||
}
|
||||
|
||||
companion object {
|
||||
private val ideaCompatibleBuildNumber = "171.9999"
|
||||
private val ideaCompatibleBuildNumber = "162.9999"
|
||||
|
||||
init {
|
||||
setCompatibleBuild()
|
||||
|
|
@@ -441,6 +418,7 @@ class KotlinCoreEnvironment private constructor(
|
|||
Extensions.cleanRootArea(parentDisposable)
|
||||
registerAppExtensionPoints()
|
||||
val applicationEnvironment = object : JavaCoreApplicationEnvironment(parentDisposable) {
|
||||
@Suppress("NOTHING_TO_OVERRIDE")
|
||||
override fun createJrtFileSystem(): VirtualFileSystem? {
|
||||
val jdkHome = configuration[JVMConfigurationKeys.JDK_HOME] ?: return null
|
||||
return CoreJrtFileSystem.create(jdkHome)
|
||||
|
|
@@ -470,7 +448,6 @@ class KotlinCoreEnvironment private constructor(
|
|||
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler::class.java)
|
||||
//
|
||||
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier::class.java)
|
||||
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), MetaLanguage.EP_NAME, MetaLanguage::class.java)
|
||||
}
|
||||
|
||||
private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) {
|
||||
|
|
@@ -533,11 +510,23 @@ class KotlinCoreEnvironment private constructor(
|
|||
}
|
||||
|
||||
private fun registerProjectServicesForCLI(@Suppress("UNUSED_PARAMETER") projectEnvironment: JavaCoreProjectEnvironment) {
|
||||
/**
|
||||
* Note that Kapt may restart code analysis process, and CLI services should be aware of that.
|
||||
* Use PsiManager.getModificationTracker() to ensure that all the data you cached is still valid.
|
||||
*/
|
||||
with (projectEnvironment.project) {
|
||||
registerService(CoreJavaFileManager::class.java, ServiceManager.getService(this, JavaFileManager::class.java) as CoreJavaFileManager)
|
||||
|
||||
val cliLightClassGenerationSupport = CliLightClassGenerationSupport(this)
|
||||
registerService(LightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
|
||||
registerService(CliLightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
|
||||
registerService(CodeAnalyzerInitializer::class.java, cliLightClassGenerationSupport)
|
||||
|
||||
registerService(ExternalAnnotationsManager::class.java, MockExternalAnnotationsManager())
|
||||
registerService(InferredAnnotationsManager::class.java, MockInferredAnnotationsManager())
|
||||
|
||||
val area = Extensions.getArea(this)
|
||||
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(JavaElementFinder(this, cliLightClassGenerationSupport))
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(
|
||||
PsiElementFinderImpl(this, ServiceManager.getService(this, JavaFileManager::class.java)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -26,5 +26,11 @@ open class KotlinCoreProjectEnvironment(
|
|||
disposable: Disposable,
|
||||
applicationEnvironment: JavaCoreApplicationEnvironment
|
||||
) : JavaCoreProjectEnvironment(disposable, applicationEnvironment) {
|
||||
init {
|
||||
myProject.registerService<ControlFlowFactory>(ControlFlowFactory::class.java,
|
||||
ControlFlowFactory(myPsiManager))
|
||||
|
||||
}
|
||||
|
||||
override fun createCoreFileManager() = KotlinCliJavaFileManagerImpl(PsiManager.getInstance(project))
|
||||
}
|
||||
|
|
@@ -20,7 +20,7 @@ import com.intellij.openapi.application.ApplicationManager
|
|||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiJavaModule
|
||||
//import com.intellij.psi.PsiJavaModule
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.impl.PsiModificationTrackerImpl
|
||||
import com.intellij.psi.search.DelegatingGlobalSearchScope
|
||||
|
|
@@ -192,14 +192,15 @@ object KotlinToJVMBytecodeCompiler {
|
|||
}
|
||||
}
|
||||
|
||||
val isJava9Module = chunk.any { module ->
|
||||
val isJava9Module = false
|
||||
/*chunk.any { module ->
|
||||
module.getJavaSourceRoots().any { (path, packagePrefix) ->
|
||||
val file = File(path)
|
||||
packagePrefix == null &&
|
||||
(file.name == PsiJavaModule.MODULE_INFO_FILE ||
|
||||
(file.isDirectory && file.listFiles().any { it.name == PsiJavaModule.MODULE_INFO_FILE }))
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
for (module in chunk) {
|
||||
for (classpathRoot in module.getClasspathRoots()) {
|
||||
|
|
|
|||
|
|
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.cli.jvm.modules
|
|||
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileSystem
|
||||
import com.intellij.psi.PsiJavaModule
|
||||
//import com.intellij.psi.PsiJavaModule
|
||||
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
|
||||
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleFinder
|
||||
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo
|
||||
|
|
@@ -41,8 +41,11 @@ internal class CliJavaModuleFinder(private val jrtFileSystem: VirtualFileSystem?
|
|||
?: userModules[name]
|
||||
|
||||
private fun findSystemModule(moduleRoot: VirtualFile): JavaModule.Explicit? {
|
||||
return null
|
||||
/*
|
||||
val file = moduleRoot.findChild(PsiJavaModule.MODULE_INFO_CLS_FILE) ?: return null
|
||||
val moduleInfo = JavaModuleInfo.read(file) ?: return null
|
||||
return JavaModule.Explicit(moduleInfo, moduleRoot, file, isBinary = true)
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -46,12 +46,6 @@ messages/**)
|
|||
-dontwarn com.google.j2objc.annotations.Weak
|
||||
-dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionInputStream
|
||||
-dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionOutputStream
|
||||
-dontwarn com.google.common.util.concurrent.*
|
||||
-dontwarn org.apache.xerces.dom.**
|
||||
-dontwarn org.apache.xerces.util.**
|
||||
-dontwarn org.w3c.dom.ElementTraversal
|
||||
-dontwarn javaslang.match.annotation.Unapply
|
||||
-dontwarn javaslang.match.annotation.Patterns
|
||||
-dontwarn org.jline.builtins.Nano$Buffer
|
||||
|
||||
-libraryjars '<rtjar>'
|
||||
|
|
@@ -61,6 +55,7 @@ messages/**)
|
|||
-libraryjars '<bootstrap.script.runtime>'
|
||||
-libraryjars '<tools.jar>'
|
||||
|
||||
-target 1.6
|
||||
-dontoptimize
|
||||
-dontobfuscate
|
||||
|
||||
|
|
|
|||
|
|
@@ -23,13 +23,11 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion {
|
|||
JVM_1_8("1.8"),
|
||||
;
|
||||
|
||||
val bytecodeVersion: Int by lazy {
|
||||
when (this) {
|
||||
val bytecodeVersion: Int
|
||||
get() = when(this) {
|
||||
JVM_1_6 -> Opcodes.V1_6
|
||||
JVM_1_8 ->
|
||||
if (java.lang.Boolean.valueOf(System.getProperty("kotlin.test.substitute.bytecode.1.8.to.1.9"))) Opcodes.V1_9 else Opcodes.V1_8
|
||||
JVM_1_8 -> Opcodes.V1_8
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
|
|
@@ -42,7 +40,7 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion {
|
|||
val platformDescription = values().find { it.bytecodeVersion == bytecodeVersion }?.description ?:
|
||||
when (bytecodeVersion) {
|
||||
Opcodes.V1_7 -> "1.7"
|
||||
Opcodes.V1_9 -> "1.9"
|
||||
Opcodes.V1_8 + 1 -> "1.9"
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.load.java.structure.*
|
|||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtPsiUtil
|
||||
import org.jetbrains.kotlin.psi.psiUtil.contains
|
||||
|
||||
class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl<PsiClass>(psiClass), VirtualFileBoundJavaClass, JavaAnnotationOwnerImpl, JavaModifierListOwnerImpl {
|
||||
init {
|
||||
|
|
@@ -114,7 +115,7 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl<PsiClass>(psiClass)
|
|||
override val virtualFile: VirtualFile?
|
||||
get() = psi.containingFile?.virtualFile
|
||||
|
||||
override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = psi.containingFile.virtualFile in scope
|
||||
override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = psi.containingFile in scope
|
||||
|
||||
override fun getAnnotationOwnerPsi() = psi.modifierList
|
||||
|
||||
|
|
|
|||
|
|
@@ -22,7 +22,6 @@ import com.intellij.openapi.application.ApplicationManager
|
|||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.util.Computable
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiJavaModule
|
||||
|
||||
class KotlinBinaryClassCache : Disposable {
|
||||
private class RequestCache {
|
||||
|
|
@@ -56,8 +55,6 @@ class KotlinBinaryClassCache : Disposable {
|
|||
fun getKotlinBinaryClass(file: VirtualFile, fileContent: ByteArray? = null): KotlinJvmBinaryClass? {
|
||||
if (file.fileType !== JavaClassFileType.INSTANCE) return null
|
||||
|
||||
if (file.name == PsiJavaModule.MODULE_INFO_CLS_FILE) return null
|
||||
|
||||
val service = ServiceManager.getService(KotlinBinaryClassCache::class.java)
|
||||
val requestCache = service.cache.get()
|
||||
|
||||
|
|
|
|||
|
|
@@ -17,15 +17,16 @@
|
|||
package org.jetbrains.kotlin.resolve.jvm.modules
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiJavaModule
|
||||
//import com.intellij.psi.PsiJavaModule
|
||||
import com.intellij.psi.PsiModifier
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.utils.compact
|
||||
/*
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||
import org.jetbrains.org.objectweb.asm.ModuleVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_TRANSITIVE
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
*/
|
||||
import java.io.IOException
|
||||
|
||||
class JavaModuleInfo(
|
||||
|
|
@@ -41,6 +42,7 @@ class JavaModuleInfo(
|
|||
"Module $moduleName (${requires.size} requires, ${exports.size} exports)"
|
||||
|
||||
companion object {
|
||||
/*
|
||||
fun create(psiJavaModule: PsiJavaModule): JavaModuleInfo {
|
||||
return JavaModuleInfo(
|
||||
psiJavaModule.name,
|
||||
|
|
@@ -56,7 +58,10 @@ class JavaModuleInfo(
|
|||
}
|
||||
)
|
||||
}
|
||||
*/
|
||||
|
||||
fun read(file: VirtualFile): JavaModuleInfo? = null // unsupported with this version of ASM
|
||||
/*
|
||||
fun read(file: VirtualFile): JavaModuleInfo? {
|
||||
val contents = try { file.contentsToByteArray() } catch (e: IOException) { return null }
|
||||
|
||||
|
|
@@ -85,5 +90,6 @@ class JavaModuleInfo(
|
|||
JavaModuleInfo(moduleName!!, requires.compact(), exports.compact())
|
||||
else null
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -1,4 +1,5 @@
|
|||
warning: flag is not supported by this version of the compiler: -Xabcdefghijklm
|
||||
warning: flag is not supported by this version of the compiler: -Xnopqrstuvwxyz
|
||||
warning: flag is not supported by this version of the compiler: -XXxxxxxxxxxxxx
|
||||
warning: running the Kotlin compiler under Java 6 or 7 is unsupported and will no longer be possible in a future update.
|
||||
OK
|
||||
|
|
|
|||
|
|
@@ -2,16 +2,21 @@
|
|||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
//This front-end problem test added to box ones only cause of FULL_JDK support
|
||||
import org.w3c.dom.Element
|
||||
import org.xml.sax.InputSource
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import java.io.StringReader
|
||||
|
||||
class MyElement(e: Element): Element by e {
|
||||
fun bar() = "OK"
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val touch = MyElement::class.java
|
||||
return "OK"
|
||||
val factory = DocumentBuilderFactory.newInstance()!!;
|
||||
val builder = factory.newDocumentBuilder()!!;
|
||||
val source = InputSource(StringReader("<OK></OK>"));
|
||||
val doc = builder.parse(source)!!;
|
||||
val myElement = MyElement(doc.getDocumentElement()!!)
|
||||
return myElement.getTagName()!!
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -25,10 +25,8 @@ fun box(): String {
|
|||
|
||||
// Java class without nested classes
|
||||
assertEquals(emptyList<String>(), nestedNames(Error::class))
|
||||
// Java interface with nested classes
|
||||
assertEquals(listOf("Entry"), nestedNames(java.util.Map::class))
|
||||
// Java class with nested classes
|
||||
assertEquals(listOf("SimpleEntry", "SimpleImmutableEntry"), nestedNames(java.util.AbstractMap::class))
|
||||
assertEquals(listOf("State", "UncaughtExceptionHandler"), nestedNames(Thread::class))
|
||||
|
||||
// Built-ins
|
||||
assertEquals(emptyList<String>(), nestedNames(Array<Any>::class))
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,5 @@
|
|||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
// IGNORE_BACKEND: JS, NATIVE, JVM
|
||||
|
||||
// WITH_REFLECT
|
||||
// FULL_JDK
|
||||
|
|
|
|||
|
|
@@ -1,26 +0,0 @@
|
|||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
// FULL_JDK
|
||||
// See KT-11258 Incorrect resolution sequence for Java field
|
||||
|
||||
//SHOULD BE deleted after KT-16616 fix
|
||||
import java.util.*
|
||||
|
||||
fun box(): String {
|
||||
listOf(
|
||||
ArrayList::class,
|
||||
LinkedList::class,
|
||||
AbstractList::class,
|
||||
HashSet::class,
|
||||
TreeSet::class,
|
||||
HashMap::class,
|
||||
TreeMap::class,
|
||||
AbstractMap::class,
|
||||
AbstractMap.SimpleEntry::class
|
||||
).map {
|
||||
it.members.map(Any::toString)
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
|
@@ -1,53 +0,0 @@
|
|||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
interface ImmutableCollection<out E> : Collection<E> {
|
||||
fun add(element: @UnsafeVariance E): ImmutableCollection<E>
|
||||
fun addAll(elements: Collection<@UnsafeVariance E>): ImmutableCollection<E>
|
||||
fun remove(element: @UnsafeVariance E): ImmutableCollection<E>
|
||||
}
|
||||
|
||||
class ImmutableCollectionmpl<E> : ImmutableCollection<E> {
|
||||
override val size: Int
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun contains(element: E): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun containsAll(elements: Collection<E>): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun iterator(): Iterator<E> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun add(element: E): ImmutableCollection<E> = this
|
||||
override fun addAll(elements: Collection<E>): ImmutableCollection<E> = this
|
||||
override fun remove(element: E): ImmutableCollection<E> = this
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = ImmutableCollectionmpl<String>()
|
||||
if (c.remove("") !== c) return "fail 1"
|
||||
if (c.add("") !== c) return "fail 2"
|
||||
if (c.addAll(java.util.ArrayList()) !== c) return "fail 3"
|
||||
|
||||
val method = c.javaClass.methods.single { it.name == "remove" && it.returnType == Boolean::class.javaPrimitiveType }
|
||||
|
||||
try {
|
||||
method.invoke(c, "")
|
||||
return "fail 4"
|
||||
} catch (e: java.lang.reflect.InvocationTargetException) {
|
||||
if (e.cause!!.message != "Operation is not supported for read-only collection") return "fail 5: ${e.cause!!.message}"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
|
@@ -1,22 +0,0 @@
|
|||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
void foo(String s, int i) {}
|
||||
|
||||
static void bar(J j) {}
|
||||
}
|
||||
|
||||
// FILE: K.kt
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(listOf(null, "arg0", "arg1"), J::foo.parameters.map { it.name })
|
||||
assertEquals(listOf("arg0"), J::bar.parameters.map { it.name })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
33
compiler/testData/codegen/light-analysis/builtinStubMethods/immutableRemove.txt
vendored
Normal file
|
|
@@ -0,0 +1,33 @@
|
|||
@kotlin.Metadata
|
||||
public interface ImmutableCollection {
|
||||
public abstract @org.jetbrains.annotations.NotNull method add(p0: java.lang.Object): ImmutableCollection
|
||||
public abstract @org.jetbrains.annotations.NotNull method addAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): ImmutableCollection
|
||||
public abstract @org.jetbrains.annotations.NotNull method remove(p0: java.lang.Object): ImmutableCollection
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ImmutableCollectionmpl {
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.NotNull method add(p0: java.lang.Object): ImmutableCollection
|
||||
public method add(p0: java.lang.Object): boolean
|
||||
public @org.jetbrains.annotations.NotNull method addAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): ImmutableCollection
|
||||
public method addAll(p0: java.util.Collection): boolean
|
||||
public method clear(): void
|
||||
public method contains(p0: java.lang.Object): boolean
|
||||
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
|
||||
public method getSize(): int
|
||||
public method isEmpty(): boolean
|
||||
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
|
||||
public @org.jetbrains.annotations.NotNull method remove(p0: java.lang.Object): ImmutableCollection
|
||||
public method remove(p0: java.lang.Object): boolean
|
||||
public method removeAll(p0: java.util.Collection): boolean
|
||||
public method retainAll(p0: java.util.Collection): boolean
|
||||
public final method size(): int
|
||||
public method toArray(): java.lang.Object[]
|
||||
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ImmutableRemoveKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
4
compiler/testData/codegen/light-analysis/reflection/parameters/javaParametersHaveNoNames.txt
vendored
Normal file
|
|
@@ -0,0 +1,4 @@
|
|||
@kotlin.Metadata
|
||||
public final class KKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
13
compiler/testData/compileJavaAgainstKotlin/sealed/Derived.txt
vendored
Normal file
|
|
@@ -0,0 +1,13 @@
|
|||
package test
|
||||
|
||||
public sealed class Season {
|
||||
private constructor Season()
|
||||
|
||||
public final class Cold : test.Season {
|
||||
public constructor Cold()
|
||||
}
|
||||
|
||||
public final class Warm : test.Season {
|
||||
public constructor Warm()
|
||||
}
|
||||
}
|
||||
13
compiler/testData/compileJavaAgainstKotlin/sealed/Instance.txt
vendored
Normal file
|
|
@@ -0,0 +1,13 @@
|
|||
package test
|
||||
|
||||
public sealed class Season {
|
||||
private constructor Season()
|
||||
|
||||
public final class Cold : test.Season {
|
||||
public constructor Cold()
|
||||
}
|
||||
|
||||
public final class Warm : test.Season {
|
||||
public constructor Warm()
|
||||
}
|
||||
}
|
||||
9
compiler/testData/compileJavaAgainstKotlin/targets/annotation.txt
vendored
Normal file
|
|
@@ -0,0 +1,9 @@
|
|||
package test
|
||||
|
||||
@test.meta public/*package*/ final annotation class MyAnn : kotlin.Annotation {
|
||||
public/*package*/ constructor MyAnn()
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS}) public final annotation class meta : kotlin.Annotation {
|
||||
public constructor meta()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/classifier.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class classifier : kotlin.Annotation {
|
||||
public constructor classifier()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/constructor.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CONSTRUCTOR}) public final annotation class constructor : kotlin.Annotation {
|
||||
public constructor constructor()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/empty.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {}) public final annotation class empty : kotlin.Annotation {
|
||||
public constructor empty()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/field.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FIELD}) public final annotation class field : kotlin.Annotation {
|
||||
public constructor field()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/function.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class function : kotlin.Annotation {
|
||||
public constructor function()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/getter.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY_GETTER}) public final annotation class getter : kotlin.Annotation {
|
||||
public constructor getter()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/local.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.LOCAL_VARIABLE}) public final annotation class local : kotlin.Annotation {
|
||||
public constructor local()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/multiple.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class multiple : kotlin.Annotation {
|
||||
public constructor multiple()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/parameter.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) public final annotation class parameter : kotlin.Annotation {
|
||||
public constructor parameter()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/property.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY}) public final annotation class property : kotlin.Annotation {
|
||||
public constructor property()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/setter.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY_SETTER}) public final annotation class setter : kotlin.Annotation {
|
||||
public constructor setter()
|
||||
}
|
||||
|
|
@@ -5,11 +5,11 @@ build:
|
|||
[mkdir] Created dir: [Temp]/classes
|
||||
[javac] Compiling 1 source file to [Temp]/classes
|
||||
[javac] Running javac...
|
||||
[javac] [TestData]/J.java:3: error: cannot find symbol
|
||||
[javac] [TestData]/J.java:3: cannot find symbol
|
||||
[javac] symbol : class KClassesKt
|
||||
[javac] location: package kotlin.reflect
|
||||
[javac] import kotlin.reflect.KClassesKt;
|
||||
[javac] ^
|
||||
[javac] symbol: class KClassesKt
|
||||
[javac] location: package kotlin.reflect
|
||||
[javac] 1 error
|
||||
|
||||
ERR:
|
||||
|
|
|
|||
|
|
@@ -5,7 +5,7 @@ build:
|
|||
[mkdir] Created dir: [Temp]/classes
|
||||
[javac] Compiling 1 source file to [Temp]/classes
|
||||
[javac] Running javac...
|
||||
[javac] [TestData]/J.java:3: error: package kotlin does not exist
|
||||
[javac] [TestData]/J.java:3: package kotlin does not exist
|
||||
[javac] import kotlin.Unit;
|
||||
[javac] ^
|
||||
[javac] 1 error
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test;
|
||||
|
||||
public abstract class ClassDoesNotOverrideMethod extends java.util.Date {
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test;
|
||||
|
||||
public abstract class ClassWithTypePExtendsIterableP<P> implements java.lang.Iterable<P> {
|
||||
|
|
|
|||
14
compiler/testData/loadJava/compiledJava/InnerClassesInGeneric.runtime.txt
vendored
Normal file
|
|
@@ -0,0 +1,14 @@
|
|||
package test
|
||||
|
||||
public open class InnerClassesInGeneric</*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!> {
|
||||
public constructor InnerClassesInGeneric</*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!>()
|
||||
|
||||
public open inner class Inner /*captured type parameters: /*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!*/ {
|
||||
public constructor Inner()
|
||||
}
|
||||
|
||||
public open inner class Inner2 /*captured type parameters: /*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!*/ : test.InnerClassesInGeneric<kotlin.Any!, kotlin.Any!>.Inner {
|
||||
public constructor Inner2()
|
||||
public open operator fun iterator(): kotlin.collections.(Mutable)Iterator<P!>!
|
||||
}
|
||||
}
|
||||
28
compiler/testData/loadJava/compiledJava/InnerOfGeneric.runtime.txt
vendored
Normal file
|
|
@@ -0,0 +1,28 @@
|
|||
package test
|
||||
|
||||
public open class InnerOfGeneric {
|
||||
public constructor InnerOfGeneric()
|
||||
|
||||
public abstract inner class A</*0*/ K : kotlin.Any!> {
|
||||
public constructor A</*0*/ K : kotlin.Any!>()
|
||||
|
||||
public abstract inner class Inner /*captured type parameters: /*0*/ K : kotlin.Any!*/ : test.InnerOfGeneric.S<K!> {
|
||||
public constructor Inner()
|
||||
public open override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.(Mutable)Iterator<K!>!
|
||||
}
|
||||
}
|
||||
|
||||
public open inner class B</*0*/ L : kotlin.Any!> : test.InnerOfGeneric.A<L!> {
|
||||
public constructor B</*0*/ L : kotlin.Any!>()
|
||||
|
||||
public open inner class SubInner /*captured type parameters: /*0*/ L : kotlin.Any!*/ : test.InnerOfGeneric.A<kotlin.Any!>.Inner {
|
||||
public constructor SubInner()
|
||||
public open override /*1*/ fun iterator(): kotlin.collections.(Mutable)Iterator<L!>!
|
||||
}
|
||||
}
|
||||
|
||||
public open inner class S</*0*/ E : kotlin.Any!> {
|
||||
public constructor S</*0*/ E : kotlin.Any!>()
|
||||
public open operator fun iterator(): kotlin.collections.(Mutable)Iterator<E!>!
|
||||
}
|
||||
}
|
||||
|
|
@@ -0,0 +1,22 @@
|
|||
package test
|
||||
|
||||
public interface ReturnInnerSubclassOfSupersInner {
|
||||
|
||||
public open class Sub</*0*/ B : kotlin.Any!> : test.ReturnInnerSubclassOfSupersInner.Super<B!> {
|
||||
public constructor Sub</*0*/ B : kotlin.Any!>()
|
||||
|
||||
public/*package*/ open inner class Inner /*captured type parameters: /*0*/ B : kotlin.Any!*/ : test.ReturnInnerSubclassOfSupersInner.Super<kotlin.Any!>.Inner {
|
||||
public/*package*/ constructor Inner()
|
||||
public/*package*/ open override /*1*/ fun get(): test.ReturnInnerSubclassOfSupersInner.Sub<B!>!
|
||||
}
|
||||
}
|
||||
|
||||
public open class Super</*0*/ A : kotlin.Any!> {
|
||||
public constructor Super</*0*/ A : kotlin.Any!>()
|
||||
|
||||
public/*package*/ open inner class Inner /*captured type parameters: /*0*/ A : kotlin.Any!*/ {
|
||||
public/*package*/ constructor Inner()
|
||||
public/*package*/ open fun get(): test.ReturnInnerSubclassOfSupersInner.Super<A!>!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@@ -2,10 +2,8 @@
|
|||
|
||||
package test
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
annotation class A
|
||||
|
||||
interface Foo<T : @A Number> : @A Serializable {
|
||||
interface Foo<T : @A Number> : @A CharSequence {
|
||||
fun <E, F : @A E> bar()
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -4,6 +4,10 @@ public final annotation class A : kotlin.Annotation {
|
|||
/*primary*/ public constructor A()
|
||||
}
|
||||
|
||||
public interface Foo</*0*/ T : @test.A kotlin.Number> : @test.A java.io.Serializable {
|
||||
public interface Foo</*0*/ T : @test.A kotlin.Number> : @test.A kotlin.CharSequence {
|
||||
public abstract override /*1*/ /*fake_override*/ val length: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun <get-length>(): kotlin.Int
|
||||
public abstract fun </*0*/ E, /*1*/ F : @test.A E> bar(): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Char
|
||||
public abstract override /*1*/ /*fake_override*/ fun subSequence(/*0*/ startIndex: kotlin.Int, /*1*/ endIndex: kotlin.Int): kotlin.CharSequence
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
public abstract class ClassDoesNotOverrideMethod() : java.util.Date() {
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
public abstract class ClassWithTypePExtendsIterableP<P>() : kotlin.collections.MutableIterable<P> {
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
public interface HalfSubstitutedTypeParameters {
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
public interface SubclassOfCollection<E>: MutableCollection<E> {
|
||||
|
|
|
|||
|
|
@@ -506,9 +506,6 @@ public class KotlinTestUtils {
|
|||
configuration.put(JVMConfigurationKeys.JDK_HOME, home);
|
||||
}
|
||||
}
|
||||
else if (SystemInfo.IS_AT_LEAST_JAVA9) {
|
||||
configuration.put(JVMConfigurationKeys.JDK_HOME, new File(System.getProperty("java.home")));
|
||||
}
|
||||
else {
|
||||
JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRootsFromCurrentJre());
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -30,6 +30,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
|
|||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||
import com.intellij.openapi.fileTypes.FileTypeFactory;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.options.SchemesManagerFactory;
|
||||
import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.impl.CoreProgressManager;
|
||||
|
|
@@ -103,6 +104,7 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
|
|||
myFileFactory = new PsiFileFactoryImpl(myPsiManager);
|
||||
MutablePicoContainer appContainer = getApplication().getPicoContainer();
|
||||
registerComponentInstance(appContainer, MessageBus.class, MessageBusFactory.newMessageBus(getApplication()));
|
||||
registerComponentInstance(appContainer, SchemesManagerFactory.class, new MockSchemesManagerFactory());
|
||||
final MockEditorFactory editorFactory = new MockEditorFactory();
|
||||
registerComponentInstance(appContainer, EditorFactory.class, editorFactory);
|
||||
registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(new Function<CharSequence, Document>() {
|
||||
|
|
@@ -122,7 +124,6 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
|
|||
myProject.registerService(PsiManager.class, myPsiManager);
|
||||
|
||||
this.registerExtensionPoint(FileTypeFactory.FILE_TYPE_FACTORY_EP, FileTypeFactory.class);
|
||||
registerExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class);
|
||||
|
||||
for (ParserDefinition definition : myDefinitions) {
|
||||
addExplicitExtension(LanguageParserDefinitions.INSTANCE, definition.getFileNodeType().getLanguage(), definition);
|
||||
|
|
|
|||
|
|
@@ -37,7 +37,6 @@ import junit.framework.TestCase;
|
|||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.types.FlexibleTypeImpl;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.junit.Assert;
|
||||
|
|
@@ -98,10 +97,10 @@ public abstract class KtUsefulTestCase extends TestCase {
|
|||
testName = new File(testName).getName(); // in case the test name contains file separators
|
||||
myTempDir = new File(ORIGINAL_TEMP_DIR, TEMP_DIR_MARKER + testName).getPath();
|
||||
FileUtil.resetCanonicalTempPathCache(myTempDir);
|
||||
boolean isStressTest = isStressTest();
|
||||
ApplicationInfoImpl.setInStressTest(isStressTest);
|
||||
boolean isPerformanceTest = isPerformanceTest();
|
||||
ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest);
|
||||
// turn off Disposer debugging for performance tests
|
||||
oldDisposerDebug = Disposer.setDebugMode(Disposer.isDebugMode() && !isStressTest);
|
||||
oldDisposerDebug = Disposer.setDebugMode(Disposer.isDebugMode() && !isPerformanceTest);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@@ -453,29 +452,8 @@ public abstract class KtUsefulTestCase extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean isPerformanceTest(@Nullable String testName, @Nullable String className) {
|
||||
return testName != null && testName.contains("Performance") ||
|
||||
className != null && className.contains("Performance");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true for a test which performs A LOT of computations.
|
||||
* Such test should typically avoid performing expensive checks, e.g. data structure consistency complex validations.
|
||||
* If you want your test to be treated as "Stress", please mention one of these words in its name: "Stress", "Slow".
|
||||
* For example: {@code public void testStressPSIFromDifferentThreads()}
|
||||
*/
|
||||
|
||||
private boolean isStressTest() {
|
||||
return isStressTest(getName(), getClass().getName());
|
||||
}
|
||||
|
||||
private static boolean isStressTest(String testName, String className) {
|
||||
return isPerformanceTest(testName, className) ||
|
||||
containsStressWords(testName) ||
|
||||
containsStressWords(className);
|
||||
}
|
||||
|
||||
private static boolean containsStressWords(@Nullable String name) {
|
||||
return name != null && (name.contains("Stress") || name.contains("Slow"));
|
||||
private boolean isPerformanceTest() {
|
||||
String name = getName();
|
||||
return name != null && name.contains("Performance") || getClass().getName().contains("Performance");
|
||||
}
|
||||
}
|
||||
|
|
@@ -15,7 +15,6 @@
|
|||
*/
|
||||
package org.jetbrains.kotlin.test.testFramework.mock;
|
||||
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
|
|
@@ -149,9 +148,4 @@ public class MockPsiDocumentManager extends PsiDocumentManager {
|
|||
public void reparseFiles(@NotNull Collection<VirtualFile> files, boolean includeOpenFiles) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performLaterWhenAllCommitted(@NotNull Runnable runnable, ModalityState modalityState) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright 2010-2016 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.kotlin.test.testFramework.mock;
|
||||
|
||||
import com.intellij.openapi.components.RoamingType;
|
||||
import com.intellij.openapi.options.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class MockSchemesManagerFactory extends SchemesManagerFactory {
|
||||
private static final SchemesManager EMPTY = new EmptySchemesManager();
|
||||
|
||||
@Override
|
||||
protected <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> create(@NotNull String directoryName,
|
||||
@NotNull SchemeProcessor<E> processor,
|
||||
@NotNull RoamingType roamingType,
|
||||
@Nullable String presentableName) {
|
||||
//noinspection unchecked
|
||||
return EMPTY;
|
||||
}
|
||||
}
|
||||
|
|
@@ -1433,6 +1433,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("immutableRemove.kt")
|
||||
public void testImmutableRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("implementationInTrait.kt")
|
||||
public void testImplementationInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt");
|
||||
|
|
@@ -15892,6 +15898,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("javaParametersHaveNoNames.kt")
|
||||
public void testJavaParametersHaveNoNames() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/javaParametersHaveNoNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kinds.kt")
|
||||
public void testKinds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/kinds.kt");
|
||||
|
|
|
|||
|
|
@@ -138,21 +138,6 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/java8/box/builtinStubMethods")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class BuiltinStubMethods extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInBuiltinStubMethods() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/builtinStubMethods"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("immutableRemove.kt")
|
||||
public void testImmutableRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/builtinStubMethods/immutableRemove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/java8/box/delegationBy")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
|
@@ -622,20 +607,5 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
|||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/synthesizedParameterNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/java8/box/reflection/parameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Parameters extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInParameters() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/reflection/parameters"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaParametersHaveDefaultNames.kt")
|
||||
public void testJavaParametersHaveDefaultNames() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/parameters/javaParametersHaveDefaultNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -1433,6 +1433,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("immutableRemove.kt")
|
||||
public void testImmutableRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("implementationInTrait.kt")
|
||||
public void testImplementationInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt");
|
||||
|
|
@@ -15892,6 +15898,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("javaParametersHaveNoNames.kt")
|
||||
public void testJavaParametersHaveNoNames() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/javaParametersHaveNoNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kinds.kt")
|
||||
public void testKinds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/kinds.kt");
|
||||
|
|
|
|||
|
|
@@ -24,11 +24,10 @@ import org.jetbrains.kotlin.config.LanguageVersion
|
|||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.junit.Assert
|
||||
import org.xml.sax.Attributes
|
||||
import org.xml.sax.helpers.DefaultHandler
|
||||
import org.w3c.dom.Element
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import javax.xml.parsers.SAXParserFactory
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
|
||||
class KotlinVersionsTest : KtUsefulTestCase() {
|
||||
fun testVersionsAreConsistent() {
|
||||
|
|
@@ -67,7 +66,7 @@ class KotlinVersionsTest : KtUsefulTestCase() {
|
|||
)
|
||||
|
||||
versions.add(
|
||||
loadValueFromPomXml("libraries/pom.xml", listOf("project", "version"))
|
||||
loadValueFromPomXml("libraries/pom.xml", listOf("version"))
|
||||
?.toVersion("version in pom.xml")
|
||||
?: error("No version in libraries/pom.xml")
|
||||
)
|
||||
|
|
@@ -91,8 +90,8 @@ class KotlinVersionsTest : KtUsefulTestCase() {
|
|||
|
||||
FileUtil.processFilesRecursively(File("libraries"), Processor { file ->
|
||||
if (file.name == "pom.xml") {
|
||||
if (loadValueFromPomXml(file.path, listOf("project", "parent", "artifactId")) == "kotlin-project") {
|
||||
val version = loadValueFromPomXml(file.path, listOf("project", "parent", "version"))
|
||||
if (loadValueFromPomXml(file.path, listOf("parent", "artifactId")) == "kotlin-project") {
|
||||
val version = loadValueFromPomXml(file.path, listOf("version"))
|
||||
?: error("No version found in pom.xml at $file")
|
||||
poms.add(Pom(file.path, version))
|
||||
}
|
||||
|
|
@@ -116,29 +115,12 @@ class KotlinVersionsTest : KtUsefulTestCase() {
|
|||
private fun loadValueFromPomXml(filePath: String, query: List<String>): String? {
|
||||
assert(filePath.endsWith("pom.xml")) { filePath }
|
||||
|
||||
var result: String? = null
|
||||
val docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
|
||||
val input = docBuilder.parse(File(filePath).inputStream())
|
||||
|
||||
SAXParserFactory.newInstance().newSAXParser().parse(File(filePath), object : DefaultHandler() {
|
||||
val currentPath = mutableListOf<String>()
|
||||
|
||||
override fun startElement(uri: String, localName: String, qName: String, attributes: Attributes) {
|
||||
currentPath.add(qName)
|
||||
}
|
||||
|
||||
override fun endElement(uri: String, localName: String, qName: String) {
|
||||
assert(currentPath.lastOrNull() == qName) { "Invalid XML at $filePath: mismatched tag '$qName'" }
|
||||
currentPath.removeAt(currentPath.lastIndex)
|
||||
}
|
||||
|
||||
override fun characters(ch: CharArray, start: Int, length: Int) {
|
||||
if (currentPath == query) {
|
||||
assert(result == null) { "More than one value found for $query in $filePath" }
|
||||
result = String(ch, start, length).trim()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
return query.fold(input.documentElement) { element, tagName ->
|
||||
element?.getElementsByTagName(tagName)?.item(0) as? Element
|
||||
}?.textContent
|
||||
}
|
||||
|
||||
private fun Collection<Any>.areEqual(): Boolean = all(first()::equals)
|
||||
|
|
|
|||
|
|
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.android.folding.AbstractAndroidResourceFoldingTest
|
|||
import org.jetbrains.kotlin.android.intention.AbstractAndroidIntentionTest
|
||||
import org.jetbrains.kotlin.android.intention.AbstractAndroidResourceIntentionTest
|
||||
import org.jetbrains.kotlin.android.lint.AbstractKotlinLintTest
|
||||
import org.jetbrains.kotlin.android.parcel.AbstractParcelBytecodeListingTest
|
||||
import org.jetbrains.kotlin.android.quickfix.AbstractAndroidLintQuickfixTest
|
||||
import org.jetbrains.kotlin.android.quickfix.AbstractAndroidQuickFixMultiFileTest
|
||||
import org.jetbrains.kotlin.asJava.AbstractCompilerLightClassTest
|
||||
|
|
@@ -1250,10 +1249,6 @@ fun main(args: Array<String>) {
|
|||
testClass<AbstractAndroidBytecodeShapeTest> {
|
||||
model("codegen/bytecodeShape", recursive = false, extension = null)
|
||||
}
|
||||
|
||||
testClass<AbstractParcelBytecodeListingTest> {
|
||||
model("parcel/codegen")
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("plugins/plugins-tests/tests", "plugins/annotation-collector/testData") {
|
||||
|
|
|
|||
|
|
@@ -16,16 +16,11 @@
|
|||
|
||||
package org.jetbrains.kotlin.idea.highlighter
|
||||
|
||||
import com.intellij.codeHighlighting.RainbowHighlighter
|
||||
import com.intellij.lang.annotation.AnnotationHolder
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.kdoc.parser.KDocKnownTag
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocLink
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocTag
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.KtExpressionWithLabel
|
||||
import org.jetbrains.kotlin.psi.KtLambdaExpression
|
||||
|
|
@@ -38,7 +33,7 @@ internal class BeforeResolveHighlightingVisitor(holder: AnnotationHolder) : High
|
|||
override fun visitElement(element: PsiElement) {
|
||||
val elementType = element.node.elementType
|
||||
val attributes = when {
|
||||
element is KDocLink && !willApplyRainbowHighlight(element) -> KotlinHighlightingColors.KDOC_LINK
|
||||
element is KDocLink -> KotlinHighlightingColors.KDOC_LINK
|
||||
|
||||
elementType in KtTokens.SOFT_KEYWORDS -> {
|
||||
when (elementType) {
|
||||
|
|
@@ -53,14 +48,6 @@ internal class BeforeResolveHighlightingVisitor(holder: AnnotationHolder) : High
|
|||
createInfoAnnotation(element, null).textAttributes = attributes
|
||||
}
|
||||
|
||||
private fun willApplyRainbowHighlight(element: KDocLink): Boolean {
|
||||
if (!RainbowHighlighter.isRainbowEnabledWithInheritance(EditorColorsManager.getInstance().globalScheme, KotlinLanguage.INSTANCE)) {
|
||||
return false
|
||||
}
|
||||
// Can't use resolve because it will access indices
|
||||
return (element.parent as? KDocTag)?.knownTag == KDocKnownTag.PARAM
|
||||
}
|
||||
|
||||
override fun visitLambdaExpression(lambdaExpression: KtLambdaExpression) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode) return
|
||||
|
||||
|
|
|
|||
|
|
@@ -16,27 +16,27 @@
|
|||
|
||||
package org.jetbrains.kotlin.idea.modules
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil
|
||||
//import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiJavaModule
|
||||
//import com.intellij.psi.PsiJavaModule
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.impl.light.LightJavaModule
|
||||
//import com.intellij.psi.impl.light.LightJavaModule
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleResolver
|
||||
|
||||
class IdeJavaModuleResolver(project: Project) : JavaModuleResolver {
|
||||
private val psiManager = PsiManager.getInstance(project)
|
||||
/*private val psiManager = PsiManager.getInstance(project)
|
||||
|
||||
private fun findJavaModule(file: VirtualFile): PsiJavaModule? {
|
||||
return psiManager.findFile(file)?.let(JavaModuleGraphUtil::findDescriptorByElement)
|
||||
}
|
||||
}*/
|
||||
|
||||
override fun checkAccessibility(
|
||||
fileFromOurModule: VirtualFile?, referencedFile: VirtualFile, referencedPackage: FqName?
|
||||
): JavaModuleResolver.AccessError? {
|
||||
val ourModule = fileFromOurModule?.let(this::findJavaModule)
|
||||
/*val ourModule = fileFromOurModule?.let(this::findJavaModule)
|
||||
val theirModule = this.findJavaModule(referencedFile)
|
||||
|
||||
// If we're both in the unnamed module, it's OK, no error should be reported
|
||||
|
|
@@ -58,13 +58,13 @@ class IdeJavaModuleResolver(project: Project) : JavaModuleResolver {
|
|||
val fqName = referencedPackage?.asString() ?: return null
|
||||
if (!exports(theirModule, fqName, ourModule)) {
|
||||
return JavaModuleResolver.AccessError.ModuleDoesNotExportPackage(theirModule.name)
|
||||
}
|
||||
}*/
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
// Returns whether or not [source] exports [packageName] to [target]
|
||||
private fun exports(source: PsiJavaModule, packageName: String, target: PsiJavaModule?): Boolean {
|
||||
/*private fun exports(source: PsiJavaModule, packageName: String, target: PsiJavaModule?): Boolean {
|
||||
if (source is LightJavaModule) {
|
||||
return true
|
||||
}
|
||||
|
|
@@ -76,5 +76,5 @@ class IdeJavaModuleResolver(project: Project) : JavaModuleResolver {
|
|||
return source.exports.any { statement ->
|
||||
statement.moduleNames.isEmpty() && statement.packageName == packageName
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -162,9 +162,4 @@ val KtElement.languageVersionSettings: LanguageVersionSettings
|
|||
}
|
||||
|
||||
val KtElement.jvmTarget: JvmTarget
|
||||
get() {
|
||||
if (ServiceManager.getService(containingKtFile.project, ProjectFileIndex::class.java) == null) {
|
||||
return JvmTarget.DEFAULT
|
||||
}
|
||||
return ModuleUtilCore.findModuleForPsiElement(this)?.targetPlatform?.version as? JvmTarget ?: JvmTarget.DEFAULT
|
||||
}
|
||||
get() = ModuleUtilCore.findModuleForPsiElement(this)?.targetPlatform?.version as? JvmTarget ?: JvmTarget.DEFAULT
|
||||
|
|
|
|||
|
|
@@ -5,7 +5,7 @@
|
|||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="gradle-and-groovy-plugin" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-plugin" level="project" />
|
||||
|
|
|
|||
|
|
@@ -25,5 +25,6 @@
|
|||
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
||||
<orderEntry type="module" module-name="light-classes" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="dx-android" level="project" />
|
||||
<orderEntry type="module" module-name="android-annotations" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@@ -20,10 +20,9 @@ import com.android.SdkConstants
|
|||
import com.android.resources.ResourceType.*
|
||||
import com.android.tools.idea.AndroidPsiUtils.ResourceReferenceType.FRAMEWORK
|
||||
import com.android.tools.idea.rendering.GutterIconRenderer
|
||||
import com.android.tools.idea.res.ResourceHelper
|
||||
import com.android.tools.idea.rendering.ResourceHelper
|
||||
import com.intellij.lang.annotation.AnnotationHolder
|
||||
import com.intellij.lang.annotation.Annotator
|
||||
import com.intellij.openapi.module.ModuleUtilCore
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.android.AndroidColorAnnotator
|
||||
import org.jetbrains.android.facet.AndroidFacet
|
||||
|
|
|
|||
|
|
@@ -23,10 +23,9 @@ import com.android.ide.common.resources.ResourceRepository;
|
|||
import com.android.ide.common.resources.ResourceResolver;
|
||||
import com.android.resources.ResourceType;
|
||||
import com.android.tools.idea.configurations.Configuration;
|
||||
import com.android.tools.idea.res.AppResourceRepository;
|
||||
import com.android.tools.idea.res.LocalResourceRepository;
|
||||
import com.android.tools.idea.res.ResourceHelper;
|
||||
import com.android.tools.idea.ui.resourcechooser.ColorPicker;
|
||||
import com.android.tools.idea.rendering.AppResourceRepository;
|
||||
import com.android.tools.idea.rendering.LocalResourceRepository;
|
||||
import com.android.tools.idea.rendering.ResourceHelper;
|
||||
import com.android.utils.XmlUtils;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.Files;
|
||||
|
|
@@ -47,8 +46,8 @@ import com.intellij.psi.xml.XmlAttributeValue;
|
|||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.ui.ColorIcon;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.uipreview.ColorPicker;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.w3c.dom.Document;
|
||||
|
|
@@ -61,15 +60,14 @@ import java.awt.*;
|
|||
import java.io.File;
|
||||
|
||||
import static com.android.SdkConstants.*;
|
||||
import static com.android.SdkConstants.ANDROID_URI;
|
||||
import static com.android.SdkConstants.ATTR_DRAWABLE;
|
||||
import static com.android.tools.idea.uibuilder.property.renderer.NlDefaultRenderer.ICON_SIZE;
|
||||
import static org.jetbrains.android.AndroidColorAnnotator.pickLayoutFile;
|
||||
|
||||
/**
|
||||
* Contains copied privates from AndroidColorAnnotator, so we could use them for Kotlin AndroidResourceReferenceAnnotator
|
||||
*/
|
||||
public class ResourceReferenceAnnotatorUtil {
|
||||
private static final int ICON_SIZE = 8;
|
||||
|
||||
@Nullable
|
||||
public static File pickBitmapFromXml(@NotNull File file, @NotNull ResourceResolver resourceResolver, @NotNull Project project) {
|
||||
try {
|
||||
|
|
@@ -195,8 +193,8 @@ public class ResourceReferenceAnnotatorUtil {
|
|||
@NotNull
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
Color color = getCurrentColor();
|
||||
return JBUI.scale(color == null ? EmptyIcon.create(ICON_SIZE) : new ColorIcon(ICON_SIZE, color));
|
||||
final Color color = getCurrentColor();
|
||||
return color == null ? EmptyIcon.create(ICON_SIZE) : new ColorIcon(ICON_SIZE, color);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
|||
|
|
@@ -57,9 +57,7 @@ class AndroidDexerImpl(val project: Project) : AndroidDexer {
|
|||
for (module in ModuleManager.getInstance(project).modules) {
|
||||
val androidFacet = AndroidFacet.getInstance(module) ?: continue
|
||||
val sdkData = androidFacet.sdkData ?: continue
|
||||
val latestBuildTool = sdkData.getLatestBuildTool(/* allowPreview = */ false)
|
||||
?: sdkData.getLatestBuildTool(/* allowPreview = */ true)
|
||||
?: continue
|
||||
val latestBuildTool = sdkData.getLatestBuildTool() ?: continue
|
||||
|
||||
val dxJar = File(latestBuildTool.location, "lib/dx.jar")
|
||||
if (dxJar.exists()) {
|
||||
|
|
|
|||
|
|
@@ -21,8 +21,8 @@ import com.android.ide.common.resources.configuration.FolderConfiguration
|
|||
import com.android.ide.common.resources.configuration.LocaleQualifier
|
||||
import com.android.resources.ResourceType
|
||||
import com.android.tools.idea.folding.AndroidFoldingSettings
|
||||
import com.android.tools.idea.res.AppResourceRepository
|
||||
import com.android.tools.idea.res.LocalResourceRepository
|
||||
import com.android.tools.idea.rendering.AppResourceRepository
|
||||
import com.android.tools.idea.rendering.LocalResourceRepository
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.lang.folding.FoldingBuilderEx
|
||||
import com.intellij.lang.folding.FoldingDescriptor
|
||||
|
|
|
|||
|
|
@@ -16,7 +16,6 @@
|
|||
|
||||
package org.jetbrains.kotlin.android.inspection
|
||||
|
||||
import com.android.resources.ResourceFolderType
|
||||
import com.android.resources.ResourceType
|
||||
import com.intellij.codeInsight.daemon.QuickFixActionRegistrar
|
||||
import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider
|
||||
|
|
@@ -50,10 +49,7 @@ class KotlinAndroidResourceQuickFixProvider : UnresolvedReferenceQuickFixProvide
|
|||
registrar.register(CreateValueResourceQuickFix(facet, resourceType, info.fieldName, contextFile, true))
|
||||
}
|
||||
if (AndroidResourceUtil.XML_FILE_RESOURCE_TYPES.contains(resourceType)) {
|
||||
val resourceFolderType = ResourceFolderType.getTypeByName(resourceType.getName());
|
||||
if (resourceFolderType != null) {
|
||||
registrar.register(CreateFileResourceQuickFix(facet, resourceFolderType, info.fieldName, contextFile, true))
|
||||
}
|
||||
registrar.register(CreateFileResourceQuickFix(facet, resourceType, info.fieldName, contextFile, true))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@@ -17,7 +17,6 @@
|
|||
package org.jetbrains.kotlin.android.intention
|
||||
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
|
||||
|
||||
val CREATE_XML_RESOURCE_PARAMETERS_NAME_KEY = Key<String>("CREATE_XML_RESOURCE_PARAMETERS_NAME_KEY")
|
||||
|
|
@@ -25,5 +24,4 @@ val CREATE_XML_RESOURCE_PARAMETERS_NAME_KEY = Key<String>("CREATE_XML_RESOURCE_P
|
|||
class CreateXmlResourceParameters(val name: String,
|
||||
val value: String,
|
||||
val fileName: String,
|
||||
val resourceDirectory: VirtualFile,
|
||||
val directoryNames: List<String>)
|
||||
|
|
@@ -26,14 +26,12 @@ import com.intellij.openapi.command.undo.UndoUtil
|
|||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.android.actions.CreateXmlResourceDialog
|
||||
import org.jetbrains.android.facet.AndroidFacet
|
||||
import org.jetbrains.android.util.AndroidBundle
|
||||
import org.jetbrains.android.util.AndroidResourceUtil
|
||||
import org.jetbrains.android.util.AndroidUtils
|
||||
import org.jetbrains.kotlin.builtins.isExtensionFunctionType
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
|
|
@@ -58,7 +56,6 @@ class KotlinAndroidAddStringResource : SelfTargetingIntention<KtLiteralStringTem
|
|||
private val GET_STRING_METHOD = "getString"
|
||||
private val EXTRACT_RESOURCE_DIALOG_TITLE = "Extract Resource"
|
||||
private val PACKAGE_NOT_FOUND_ERROR = "package.not.found.error"
|
||||
private val RESOURCE_DIR_ERROR = "check.resource.dir.error"
|
||||
}
|
||||
|
||||
override fun startInWriteAction(): Boolean = false
|
||||
|
|
@@ -92,10 +89,10 @@ class KotlinAndroidAddStringResource : SelfTargetingIntention<KtLiteralStringTem
|
|||
return
|
||||
}
|
||||
|
||||
val parameters = getCreateXmlResourceParameters(facet.module, element, file.virtualFile) ?: return
|
||||
val parameters = getCreateXmlResourceParameters(facet.module, element) ?: return
|
||||
|
||||
runWriteAction {
|
||||
if (!AndroidResourceUtil.createValueResource(project, parameters.resourceDirectory, parameters.name, ResourceType.STRING,
|
||||
if (!AndroidResourceUtil.createValueResource(facet.module, parameters.name, ResourceType.STRING,
|
||||
parameters.fileName, parameters.directoryNames, parameters.value)) {
|
||||
return@runWriteAction
|
||||
}
|
||||
|
|
@@ -106,14 +103,13 @@ class KotlinAndroidAddStringResource : SelfTargetingIntention<KtLiteralStringTem
|
|||
}
|
||||
}
|
||||
|
||||
private fun getCreateXmlResourceParameters(module: Module, element: KtLiteralStringTemplateEntry,
|
||||
contextFile: VirtualFile): CreateXmlResourceParameters? {
|
||||
private fun getCreateXmlResourceParameters(module: Module, element: KtLiteralStringTemplateEntry): CreateXmlResourceParameters? {
|
||||
val stringValue = element.text
|
||||
|
||||
val showDialog = !ApplicationManager.getApplication().isUnitTestMode
|
||||
val resourceName = element.getUserData(CREATE_XML_RESOURCE_PARAMETERS_NAME_KEY)
|
||||
|
||||
val dialog = CreateXmlResourceDialog(module, ResourceType.STRING, resourceName, stringValue, true, null, contextFile)
|
||||
val dialog = CreateXmlResourceDialog(module, ResourceType.STRING, resourceName, stringValue, true)
|
||||
dialog.title = EXTRACT_RESOURCE_DIALOG_TITLE
|
||||
if (showDialog) {
|
||||
if (!dialog.showAndGet()) {
|
||||
|
|
@@ -124,16 +120,9 @@ class KotlinAndroidAddStringResource : SelfTargetingIntention<KtLiteralStringTem
|
|||
dialog.close(0)
|
||||
}
|
||||
|
||||
val resourceDirectory = dialog.resourceDirectory
|
||||
if (resourceDirectory == null) {
|
||||
AndroidUtils.reportError(module.project, AndroidBundle.message(RESOURCE_DIR_ERROR, module))
|
||||
return null
|
||||
}
|
||||
|
||||
return CreateXmlResourceParameters(dialog.resourceName,
|
||||
dialog.value,
|
||||
dialog.fileName,
|
||||
resourceDirectory,
|
||||
dialog.dirNames)
|
||||
}
|
||||
|
||||
|
|
@@ -243,4 +232,4 @@ class KotlinAndroidAddStringResource : SelfTargetingIntention<KtLiteralStringTem
|
|||
private fun ClassifierDescriptor.isStrictSubclassOf(className: String) = defaultType.constructor.supertypes.any {
|
||||
it.constructor.declarationDescriptor?.isSubclassOf(className) ?: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@@ -16,7 +16,7 @@
|
|||
package org.jetbrains.kotlin.android;
|
||||
|
||||
import com.android.sdklib.IAndroidTarget;
|
||||
import com.android.tools.idea.res.ResourceHelper;
|
||||
import com.android.tools.idea.rendering.ResourceHelper;
|
||||
import com.android.tools.idea.startup.ExternalAnnotationsSupport;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
|
|
|
|||
|
|
@@ -17,7 +17,7 @@
|
|||
package org.jetbrains.kotlin.android;
|
||||
|
||||
import com.android.SdkConstants;
|
||||
import com.android.tools.idea.rendering.RenderSecurityManager;
|
||||
import com.android.ide.common.rendering.RenderSecurityManager;
|
||||
import com.android.tools.idea.startup.AndroidCodeStyleSettingsModifier;
|
||||
import com.intellij.analysis.AnalysisScope;
|
||||
import com.intellij.codeInspection.GlobalInspectionTool;
|
||||
|
|
|
|||
|
|
@@ -29,14 +29,14 @@ import org.jetbrains.kotlin.idea.test.KotlinTestImportFilter;
|
|||
public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuickFixMultiFileTest {
|
||||
|
||||
@Override
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
addAndroidFacet();
|
||||
Extensions.getRootArea().getExtensionPoint(ImportFilter.EP_NAME).registerExtension(KotlinTestImportFilter.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() {
|
||||
protected void tearDown() throws Exception {
|
||||
Extensions.getRootArea().getExtensionPoint(ImportFilter.EP_NAME).unregisterExtension(KotlinTestImportFilter.INSTANCE);
|
||||
AndroidFacet facet = FacetManager.getInstance(myModule).getFacetByType(AndroidFacet.getFacetType().getId());
|
||||
FacetUtil.deleteFacet(facet);
|
||||
|
|
@@ -49,6 +49,12 @@ public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuick
|
|||
super.doTestWithExtraFile(beforeFileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doTestWithoutExtraFile(String beforeFileName) throws Exception {
|
||||
addManifest();
|
||||
super.doTestWithoutExtraFile(beforeFileName);
|
||||
}
|
||||
|
||||
private void addAndroidFacet() {
|
||||
FacetManager facetManager = FacetManager.getInstance(myModule);
|
||||
AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), "Android", null);
|
||||
|
|
@@ -64,6 +70,6 @@ public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuick
|
|||
}
|
||||
|
||||
private void addManifest() throws Exception {
|
||||
myFixture.configureByFile("idea/testData/android/AndroidManifest.xml");
|
||||
configureByFile("idea/testData/android/AndroidManifest.xml");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -413,7 +413,6 @@ fun ImportableFqNameClassifier.isImportableDescriptorImported(descriptor: Declar
|
|||
|
||||
fun OffsetMap.tryGetOffset(key: OffsetKey): Int? {
|
||||
try {
|
||||
if (!containsOffset(key)) return null
|
||||
return getOffset(key).takeIf { it != -1 } // prior to IDEA 2016.3 getOffset() returned -1 if not found, now it throws exception
|
||||
}
|
||||
catch(e: Exception) {
|
||||
|
|
|
|||
|
|
@@ -50,6 +50,8 @@ class KotlinCompletionContributor : CompletionContributor() {
|
|||
|
||||
companion object {
|
||||
val DEFAULT_DUMMY_IDENTIFIER: String = CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED + "$" // add '$' to ignore context after the caret
|
||||
|
||||
private val STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET = OffsetKey.create("STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET")
|
||||
}
|
||||
|
||||
init {
|
||||
|
|
@@ -80,6 +82,7 @@ class KotlinCompletionContributor : CompletionContributor() {
|
|||
val prefix = tokenBefore.text.substring(0, offset - tokenBefore.startOffset)
|
||||
context.dummyIdentifier = "{" + expression.text + prefix + CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED + "}"
|
||||
context.offsetMap.addOffset(CompletionInitializationContext.START_OFFSET, expression.startOffset)
|
||||
context.offsetMap.addOffset(STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET, offset + 1)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@@ -238,13 +241,8 @@ class KotlinCompletionContributor : CompletionContributor() {
|
|||
val expression = (position.parent as KtBlockStringTemplateEntry).expression
|
||||
if (expression is KtDotQualifiedExpression) {
|
||||
val correctedPosition = (expression.selectorExpression as KtNameReferenceExpression).firstChild
|
||||
// Workaround for KT-16848
|
||||
// ex:
|
||||
// expression: some.IntellijIdeaRulezzz
|
||||
// correctedOffset: ^
|
||||
// expression: some.funcIntellijIdeaRulezzz
|
||||
// correctedOffset ^
|
||||
val correctedOffset = correctedPosition.endOffset - CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED.length
|
||||
val context = position.getUserData(CompletionContext.COMPLETION_CONTEXT_KEY)!!
|
||||
val correctedOffset = context.offsetMap.getOffset(STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET)
|
||||
val correctedParameters = parameters.withPosition(correctedPosition, correctedOffset)
|
||||
doComplete(correctedParameters, toFromOriginalFileMapper, result,
|
||||
lookupElementPostProcessor = { wrapLookupElementForStringTemplateAfterDotCompletion(it) })
|
||||
|
|
|
|||
|
|
@@ -22,6 +22,8 @@ import com.intellij.codeInsight.lookup.LookupElementPresentation
|
|||
import com.intellij.codeInsight.lookup.LookupEvent
|
||||
import com.intellij.codeInsight.lookup.LookupManager
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl
|
||||
import com.intellij.openapi.application.Result
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
||||
import org.jetbrains.kotlin.idea.completion.test.ExpectedCompletionUtils
|
||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||
|
|
@@ -115,7 +117,14 @@ abstract class CompletionHandlerTestBase() : KotlinLightCodeInsightFixtureTestCa
|
|||
}
|
||||
lookup.focusDegree = LookupImpl.FocusDegree.FOCUSED
|
||||
if (LookupEvent.isSpecialCompletionChar(completionChar)) {
|
||||
lookup.finishLookup(completionChar)
|
||||
(object : WriteCommandAction.Simple<Any>(project) {
|
||||
override fun run(result: Result<Any>) {
|
||||
run()
|
||||
}
|
||||
override fun run() {
|
||||
lookup.finishLookup(completionChar)
|
||||
}
|
||||
}).execute().throwException()
|
||||
}
|
||||
else {
|
||||
fixture.type(completionChar)
|
||||
|
|
|
|||
|
|
@@ -19,14 +19,14 @@ package org.jetbrains.kotlin.idea.core.script
|
|||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileWithId
|
||||
import com.intellij.util.io.DataInputOutputUtil.readSeq
|
||||
import com.intellij.util.io.DataInputOutputUtil.writeSeq
|
||||
import com.intellij.util.io.DataInputOutputUtil.*
|
||||
import com.intellij.util.io.IOUtil.readUTF
|
||||
import com.intellij.util.io.IOUtil.writeUTF
|
||||
import org.jetbrains.kotlin.idea.caches.FileAttributeService
|
||||
import java.io.DataInput
|
||||
import java.io.DataOutput
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import kotlin.script.dependencies.ScriptDependencies
|
||||
|
||||
object ScriptDependenciesFileAttribute {
|
||||
|
|
@@ -104,4 +104,22 @@ private fun <T : Any> DataOutput.writeNullable(nullable: T?, writeT: DataOutput.
|
|||
private fun <T : Any> DataInput.readNullable(readT: DataInput.() -> T): T? {
|
||||
val hasValue = readBoolean()
|
||||
return if (hasValue) readT() else null
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
private fun <T> readSeq(`in`: DataInput, readElement: () -> T): List<T> {
|
||||
val size = readINT(`in`)
|
||||
val result = ArrayList<T>(size)
|
||||
for (i in 0 until size) {
|
||||
result.add(readElement())
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
private fun <T> writeSeq(out: DataOutput, collection: Collection<T>, writeElement: (T) -> Unit) {
|
||||
writeINT(out, collection.size)
|
||||
for (t in collection) {
|
||||
writeElement(t)
|
||||
}
|
||||
}
|
||||
|
|
@@ -50,8 +50,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||
|
||||
protected val module: Module get() = myFixture.module
|
||||
|
||||
protected open val captureExceptions = true
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivities()
|
||||
|
|
@@ -64,14 +62,13 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||
|
||||
invalidateLibraryCache(project)
|
||||
|
||||
if (captureExceptions) {
|
||||
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
|
||||
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
|
||||
exceptions.addIfNotNull(t)
|
||||
super.processError(message, t, details, logger)
|
||||
}
|
||||
})
|
||||
}
|
||||
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
|
||||
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
|
||||
exceptions.addIfNotNull(t)
|
||||
super.processError(message, t, details, logger)
|
||||
}
|
||||
})
|
||||
|
||||
CodeInsightTestCase.fixTemplates()
|
||||
}
|
||||
|
||||
|
|
@@ -122,9 +119,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_KOTLIN_TEST")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_KOTLIN_TEST
|
||||
}
|
||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_FULL_JDK")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK
|
||||
}
|
||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
|
||||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
|
|
|
|||
|
|
@@ -16,6 +16,7 @@
|
|||
|
||||
package org.jetbrains.kotlin.idea.test
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.editor.Document
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
|
|
@@ -81,7 +82,8 @@ fun KtFile.dumpTextWithErrors(): String {
|
|||
return header + text
|
||||
}
|
||||
|
||||
fun closeAndDeleteProject() = LightPlatformTestCase.closeAndDeleteProject()
|
||||
fun closeAndDeleteProject(): Unit =
|
||||
ApplicationManager.getApplication().runWriteAction { LightPlatformTestCase.closeAndDeleteProject() }
|
||||
|
||||
fun doKotlinTearDown(project: Project, runnable: RunnableWithException) {
|
||||
doKotlinTearDown(project) { runnable.run() }
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 758 B After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 626 B After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 627 B |