-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
by splitting and merging it into compiler-plugin and kotlin-analysis-api.
- Loading branch information
Showing
23 changed files
with
727 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
kotlin-analysis-api/compiler/cli/cli-common/resources/META-INF/extensions/compiler.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<idea-plugin> | ||
<id>org.jetbrains.kotlin</id> | ||
|
||
<extensionPoints> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.analyzeCompleteHandlerExtension" | ||
interface="org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension" | ||
area="IDEA_PROJECT"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.extensions.internal.callResolutionInterceptorExtension" | ||
interface="org.jetbrains.kotlin.extensions.internal.CallResolutionInterceptorExtension" | ||
area="IDEA_PROJECT"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.extensions.internal.typeResolutionInterceptorExtension" | ||
interface="org.jetbrains.kotlin.extensions.internal.TypeResolutionInterceptorExtension" | ||
area="IDEA_PROJECT"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.extensions.typeAttributeTranslatorExtension" | ||
interface="org.jetbrains.kotlin.extensions.TypeAttributeTranslatorExtension" | ||
area="IDEA_PROJECT"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.diagnosticSuppressor" | ||
interface="org.jetbrains.kotlin.resolve.diagnostics.DiagnosticSuppressor" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.expressionCodegenExtension" | ||
interface="org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.syntheticResolveExtension" | ||
interface="org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.assignResolutionAltererExtension" | ||
interface="org.jetbrains.kotlin.resolve.extensions.AssignResolutionAltererExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.jsSyntheticTranslateExtension" | ||
interface="org.jetbrains.kotlin.js.translate.extensions.JsSyntheticTranslateExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.irGenerationExtension" | ||
interface="org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.simpleNameReferenceExtension" | ||
interface="org.jetbrains.kotlin.plugin.references.SimpleNameReferenceExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.classBuilderFactoryInterceptorExtension" | ||
interface="org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.classGeneratorExtension" | ||
interface="org.jetbrains.kotlin.backend.jvm.extensions.ClassGeneratorExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.packageFragmentProviderExtension" | ||
interface="org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.storageComponentContainerContributor" | ||
interface="org.jetbrains.kotlin.extensions.StorageComponentContainerContributor" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.extraImportsProviderExtension" | ||
interface="org.jetbrains.kotlin.resolve.extensions.ExtraImportsProviderExtension" | ||
area="IDEA_PROJECT" dynamic="true"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.fir.extensions.firExtensionRegistrar" | ||
interface="org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter" | ||
area="IDEA_PROJECT"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.DescriptorSerializerPlugin" | ||
interface="org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin" | ||
area="IDEA_PROJECT"/> | ||
<extensionPoint qualifiedName="org.jetbrains.kotlin.defaultErrorMessages" | ||
interface="org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages.Extension"/> | ||
</extensionPoints> | ||
</idea-plugin> |
Binary file added
BIN
+11.4 KB
kotlin-analysis-api/compiler/testData/mockJDK/jre/lib/annotations.jar
Binary file not shown.
File renamed without changes.
68 changes: 68 additions & 0 deletions
68
...is-api/src/test/kotlin/com/google/devtools/ksp/processor/RecordJavaAsMemberOfProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
* | ||
* 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 com.google.devtools.ksp.processor | ||
|
||
import com.google.devtools.ksp.impl.ResolverAAImpl | ||
import com.google.devtools.ksp.processing.Resolver | ||
import com.google.devtools.ksp.symbol.* | ||
|
||
class RecordJavaAsMemberOfProcessor : AbstractTestProcessor() { | ||
val results = mutableListOf<String>() | ||
|
||
override fun toResult(): List<String> { | ||
val finalResult = mutableListOf(results[0]) | ||
finalResult.addAll(results.subList(1, results.size).sorted()) | ||
return finalResult | ||
} | ||
|
||
override fun process(resolver: Resolver): List<KSAnnotated> { | ||
var function: KSFunctionDeclaration? = null | ||
var type: KSType? = null | ||
resolver.getAllFiles().forEach { | ||
if (it.fileName == "C.kt") { | ||
type = ( | ||
it.declarations.single { | ||
it is KSPropertyDeclaration && it.simpleName.asString() == "a" | ||
} as KSPropertyDeclaration | ||
).type.resolve() | ||
} else if (it.fileName == "B.java") { | ||
function = ( | ||
it.declarations.single { | ||
it is KSClassDeclaration && it.simpleName.asString() == "B" | ||
} as KSClassDeclaration | ||
).declarations.single { | ||
it is KSFunctionDeclaration && it.simpleName.asString() == "f" | ||
} as KSFunctionDeclaration | ||
} | ||
} | ||
|
||
function!!.asMemberOf(type!!) | ||
|
||
val m = when (resolver) { | ||
is ResolverAAImpl -> resolver.incrementalContext.dumpLookupRecords().toSortedMap() | ||
else -> throw IllegalStateException("Unknown Resolver: $resolver") | ||
} | ||
m.forEach { symbol, files -> | ||
files.filter { it.endsWith(".java") }.sorted().forEach { | ||
val fn = it.substringAfterLast("java-sources/") | ||
results.add("$symbol: $fn") | ||
} | ||
} | ||
return emptyList() | ||
} | ||
} |
Oops, something went wrong.