New J2K: Add dependency to idea-core in j2k
This commit is contained in:
committed by
Ilya Kirillov
parent
29c536579f
commit
41640e1a15
@@ -14,7 +14,6 @@ dependencies {
|
||||
compile(project(":compiler:frontend.script"))
|
||||
compile(project(":compiler:light-classes"))
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":j2k"))
|
||||
compile(project(":idea:ide-common"))
|
||||
compile(project(":idea:idea-jps-common"))
|
||||
compile(project(":plugins:android-extensions-compiler"))
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.j2k
|
||||
|
||||
import com.intellij.psi.JavaDocTokenType
|
||||
import com.intellij.psi.PsiWhiteSpace
|
||||
import com.intellij.psi.javadoc.PsiDocComment
|
||||
import com.intellij.psi.javadoc.PsiDocTag
|
||||
|
||||
interface DocCommentConverter {
|
||||
fun convertDocComment(docComment: PsiDocComment): String
|
||||
}
|
||||
|
||||
object EmptyDocCommentConverter : DocCommentConverter {
|
||||
override fun convertDocComment(docComment: PsiDocComment) = docComment.text
|
||||
}
|
||||
|
||||
|
||||
fun PsiDocTag.content(): String =
|
||||
children
|
||||
.dropWhile { it?.node?.elementType == JavaDocTokenType.DOC_TAG_NAME }
|
||||
.dropWhile { it is PsiWhiteSpace }
|
||||
.filterNot { it?.node?.elementType == JavaDocTokenType.DOC_COMMENT_LEADING_ASTERISKS }
|
||||
.joinToString("") { it.text }
|
||||
@@ -28,8 +28,8 @@ import com.intellij.psi.xml.XmlFile
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.psi.xml.XmlText
|
||||
import com.intellij.psi.xml.XmlTokenType
|
||||
import org.jetbrains.kotlin.j2k.DocCommentConverter
|
||||
import org.jetbrains.kotlin.j2k.content
|
||||
import org.jetbrains.kotlin.idea.j2k.DocCommentConverter
|
||||
import org.jetbrains.kotlin.idea.j2k.content
|
||||
|
||||
object IdeaDocCommentConverter : DocCommentConverter {
|
||||
override fun convertDocComment(docComment: PsiDocComment): String {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.NullableNotNullManager
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
|
||||
import org.jetbrains.kotlin.idea.j2k.content
|
||||
import org.jetbrains.kotlin.j2k.ast.*
|
||||
import org.jetbrains.kotlin.j2k.ast.Annotation
|
||||
import org.jetbrains.kotlin.load.java.components.JavaAnnotationTargetMapper
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.javadoc.PsiDocComment
|
||||
import com.intellij.util.SmartList
|
||||
import org.jetbrains.kotlin.idea.j2k.DocCommentConverter
|
||||
import org.jetbrains.kotlin.j2k.ast.CommentsAndSpacesInheritance
|
||||
import org.jetbrains.kotlin.j2k.ast.Element
|
||||
import org.jetbrains.kotlin.j2k.ast.SpacesInheritance
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.j2k
|
||||
|
||||
import com.intellij.psi.JavaDocTokenType
|
||||
import com.intellij.psi.PsiWhiteSpace
|
||||
import com.intellij.psi.javadoc.PsiDocComment
|
||||
import com.intellij.psi.javadoc.PsiDocTag
|
||||
|
||||
interface DocCommentConverter {
|
||||
fun convertDocComment(docComment: PsiDocComment): String
|
||||
}
|
||||
|
||||
object EmptyDocCommentConverter: DocCommentConverter {
|
||||
override fun convertDocComment(docComment: PsiDocComment) = docComment.text
|
||||
}
|
||||
|
||||
fun PsiDocTag.content(): String =
|
||||
children
|
||||
.dropWhile { it?.node?.elementType == JavaDocTokenType.DOC_TAG_NAME }
|
||||
.dropWhile { it is PsiWhiteSpace }
|
||||
.filterNot { it?.node?.elementType == JavaDocTokenType.DOC_COMMENT_LEADING_ASTERISKS }
|
||||
.joinToString("") { it.text }
|
||||
@@ -17,6 +17,8 @@
|
||||
package org.jetbrains.kotlin.j2k
|
||||
|
||||
import com.intellij.psi.PsiMethod
|
||||
import org.jetbrains.kotlin.idea.j2k.DocCommentConverter
|
||||
import org.jetbrains.kotlin.idea.j2k.EmptyDocCommentConverter
|
||||
|
||||
interface JavaToKotlinConverterServices {
|
||||
val referenceSearcher: ReferenceSearcher
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.j2k.ast
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.j2k.CodeBuilder
|
||||
import org.jetbrains.kotlin.j2k.CodeConverter
|
||||
import org.jetbrains.kotlin.j2k.EmptyDocCommentConverter
|
||||
import org.jetbrains.kotlin.idea.j2k.EmptyDocCommentConverter
|
||||
|
||||
fun <TElement: Element> TElement.assignPrototype(prototype: PsiElement?, inheritance: CommentsAndSpacesInheritance = CommentsAndSpacesInheritance()): TElement {
|
||||
prototypes = if (prototype != null) listOf(PrototypeInfo(prototype, inheritance)) else listOf()
|
||||
|
||||
Reference in New Issue
Block a user