Use javaClass instead of getClass()
This commit is contained in:
@@ -85,7 +85,7 @@ private object DebugTextBuildingVisitor : JetVisitor<String, Unit>() {
|
|||||||
|
|
||||||
override fun visitJetElement(element: JetElement, data: Unit?): String? {
|
override fun visitJetElement(element: JetElement, data: Unit?): String? {
|
||||||
if (element is JetElementImplStub<*>) {
|
if (element is JetElementImplStub<*>) {
|
||||||
LOG.error("getDebugText() is not defined for ${element.getClass()}")
|
LOG.error("getDebugText() is not defined for ${element.javaClass}")
|
||||||
}
|
}
|
||||||
return element.getText()
|
return element.getText()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public fun PsiElement.deleteElementAndCleanParent() {
|
|||||||
|
|
||||||
JetPsiUtil.deleteElementWithDelimiters(this)
|
JetPsiUtil.deleteElementWithDelimiters(this)
|
||||||
[suppress("UNCHECKED_CAST")]
|
[suppress("UNCHECKED_CAST")]
|
||||||
JetPsiUtil.deleteChildlessElement(parent, this.getClass() as Class<PsiElement>)
|
JetPsiUtil.deleteChildlessElement(parent, this.javaClass as Class<PsiElement>)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun PsiElement.parameterIndex(): Int {
|
public fun PsiElement.parameterIndex(): Int {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.util.ArrayList
|
|||||||
public open class JetStubBaseImpl<T : JetElementImplStub<*>>(parent: StubElement<*>?, elementType: IStubElementType<*, *>) : StubBase<T>(parent, elementType) {
|
public open class JetStubBaseImpl<T : JetElementImplStub<*>>(parent: StubElement<*>?, elementType: IStubElementType<*, *>) : StubBase<T>(parent, elementType) {
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val stubInterface = this.getClass().getInterfaces().first()
|
val stubInterface = this.javaClass.getInterfaces().first()
|
||||||
val propertiesValues = renderPropertyValues(stubInterface)
|
val propertiesValues = renderPropertyValues(stubInterface)
|
||||||
if (propertiesValues.isEmpty()) {
|
if (propertiesValues.isEmpty()) {
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ public class ExceptionTracker : ModificationTracker, LockBasedStorageManager.Exc
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return getClass().getName() + ": " + getModificationCount()
|
return javaClass.getName() + ": " + getModificationCount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,6 @@ public class SyntheticKotlinBlock(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return getClass().getName() + ": " + textRange
|
return javaClass.getName() + ": " + textRange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ private fun buildDecompiledText(packageFqName: FqName, descriptors: List<Declara
|
|||||||
|
|
||||||
fun appendDescriptor(descriptor: DeclarationDescriptor, indent: String) {
|
fun appendDescriptor(descriptor: DeclarationDescriptor, indent: String) {
|
||||||
if (descriptor is MissingDependencyErrorClass) {
|
if (descriptor is MissingDependencyErrorClass) {
|
||||||
throw IllegalStateException("${descriptor.getClass().getSimpleName()} cannot be rendered. FqName: ${descriptor.fullFqName}")
|
throw IllegalStateException("${descriptor.javaClass.getSimpleName()} cannot be rendered. FqName: ${descriptor.fullFqName}")
|
||||||
}
|
}
|
||||||
val startOffset = builder.length()
|
val startOffset = builder.length()
|
||||||
val header = if (isEnumEntry(descriptor))
|
val header = if (isEnumEntry(descriptor))
|
||||||
|
|||||||
+2
-2
@@ -223,7 +223,7 @@ public class MoveKotlinTopLevelDeclarationsProcessor(project: Project, val optio
|
|||||||
override fun performRefactoring(usages: Array<out UsageInfo>?) {
|
override fun performRefactoring(usages: Array<out UsageInfo>?) {
|
||||||
fun moveDeclaration(declaration: JetNamedDeclaration, moveTarget: KotlinMoveTarget): JetNamedDeclaration? {
|
fun moveDeclaration(declaration: JetNamedDeclaration, moveTarget: KotlinMoveTarget): JetNamedDeclaration? {
|
||||||
val file = declaration.getContainingFile() as? JetFile
|
val file = declaration.getContainingFile() as? JetFile
|
||||||
assert (file != null, "${declaration.getClass()}: ${declaration.getText()}")
|
assert (file != null, "${declaration.javaClass}: ${declaration.getText()}")
|
||||||
|
|
||||||
val targetPsi = moveTarget.getOrCreateTargetPsi(declaration)
|
val targetPsi = moveTarget.getOrCreateTargetPsi(declaration)
|
||||||
val targetFile =
|
val targetFile =
|
||||||
@@ -238,7 +238,7 @@ public class MoveKotlinTopLevelDeclarationsProcessor(project: Project, val optio
|
|||||||
}
|
}
|
||||||
else targetPsi
|
else targetPsi
|
||||||
|
|
||||||
assert(targetFile is JetFile, "Couldn't create Koltin file for: ${declaration.getClass()}: ${declaration.getText()}")
|
assert(targetFile is JetFile, "Couldn't create Koltin file for: ${declaration.javaClass}: ${declaration.getText()}")
|
||||||
|
|
||||||
val newPackageFqName = (targetFile as JetFile).getPackageFqName()
|
val newPackageFqName = (targetFile as JetFile).getPackageFqName()
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public abstract class AbstractDecompiledTextTest() : JetLightCodeInsightFixtureT
|
|||||||
val classFile = NavigateToDecompiledLibraryTest.getClassFile("test", getTestName(false), myModule!!)
|
val classFile = NavigateToDecompiledLibraryTest.getClassFile("test", getTestName(false), myModule!!)
|
||||||
val clsFileForClassFile = PsiManager.getInstance(getProject()!!).findFile(classFile)
|
val clsFileForClassFile = PsiManager.getInstance(getProject()!!).findFile(classFile)
|
||||||
assertNotNull(clsFileForClassFile)
|
assertNotNull(clsFileForClassFile)
|
||||||
assertTrue("Expecting java class file, was: " + clsFileForClassFile!!.getClass(), clsFileForClassFile is ClsFileImpl)
|
assertTrue("Expecting java class file, was: " + clsFileForClassFile.javaClass, clsFileForClassFile is ClsFileImpl)
|
||||||
val decompiledPsiFile = (clsFileForClassFile as ClsFileImpl).getDecompiledPsiFile()
|
val decompiledPsiFile = (clsFileForClassFile as ClsFileImpl).getDecompiledPsiFile()
|
||||||
assertNotNull(decompiledPsiFile)
|
assertNotNull(decompiledPsiFile)
|
||||||
assertSameLinesWithFile(path.substring(0, path.length - 1) + ".expected.kt", decompiledPsiFile!!.getText())
|
assertSameLinesWithFile(path.substring(0, path.length - 1) + ".expected.kt", decompiledPsiFile!!.getText())
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ public class InternalCompiledClassesTest : JetLightCodeInsightFixtureTestCase()
|
|||||||
val psiFile = PsiManager.getInstance(project).findFile(this)
|
val psiFile = PsiManager.getInstance(project).findFile(this)
|
||||||
Assert.assertTrue("Should not be kotlin file",
|
Assert.assertTrue("Should not be kotlin file",
|
||||||
psiFile !is JetClsFile)
|
psiFile !is JetClsFile)
|
||||||
Assert.assertTrue("Should be java file, was ${psiFile!!.getClass().getSimpleName()}",
|
Assert.assertTrue("Should be java file, was ${psiFile.javaClass.getSimpleName()}",
|
||||||
psiFile is ClsFileImpl)
|
psiFile is ClsFileImpl)
|
||||||
|
|
||||||
val decompiledPsiFile = (psiFile as PsiCompiledFile).getDecompiledPsiFile()!!
|
val decompiledPsiFile = (psiFile as PsiCompiledFile).getDecompiledPsiFile()!!
|
||||||
Assert.assertTrue("Should be java decompiled file, was ${decompiledPsiFile.getClass().getSimpleName()}",
|
Assert.assertTrue("Should be java decompiled file, was ${decompiledPsiFile.javaClass.getSimpleName()}",
|
||||||
decompiledPsiFile is PsiJavaFile)
|
decompiledPsiFile is PsiJavaFile)
|
||||||
val classes = (decompiledPsiFile as PsiJavaFile).getClasses()
|
val classes = (decompiledPsiFile as PsiJavaFile).getClasses()
|
||||||
Assert.assertTrue("Should have some decompiled text",
|
Assert.assertTrue("Should have some decompiled text",
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ private fun ReceiverParameterDescriptor.getNameForCapturedReceiver(): String {
|
|||||||
val containingDeclaration = this.getContainingDeclaration()
|
val containingDeclaration = this.getContainingDeclaration()
|
||||||
|
|
||||||
assert(containingDeclaration is MemberDescriptor) {
|
assert(containingDeclaration is MemberDescriptor) {
|
||||||
"Unsupported descriptor type: ${containingDeclaration.getClass()}, " +
|
"Unsupported descriptor type: ${containingDeclaration.javaClass}, " +
|
||||||
"receiverDescriptor = $this, " +"containingDeclaration = $containingDeclaration"
|
"receiverDescriptor = $this, " +"containingDeclaration = $containingDeclaration"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -125,7 +125,7 @@ open class KotlinPlugin [Inject] (val scriptHandler: ScriptHandler): Plugin<Proj
|
|||||||
|
|
||||||
open class KotlinAndroidPlugin [Inject] (val scriptHandler: ScriptHandler): Plugin<Project> {
|
open class KotlinAndroidPlugin [Inject] (val scriptHandler: ScriptHandler): Plugin<Project> {
|
||||||
|
|
||||||
val log = Logging.getLogger(getClass())
|
val log = Logging.getLogger(this.javaClass)
|
||||||
|
|
||||||
public override fun apply(p0: Project) {
|
public override fun apply(p0: Project) {
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -35,8 +35,8 @@ public open class KotlinCompile(): AbstractCompile() {
|
|||||||
val srcDirsRoots = HashSet<File>()
|
val srcDirsRoots = HashSet<File>()
|
||||||
val compiler = K2JVMCompiler()
|
val compiler = K2JVMCompiler()
|
||||||
|
|
||||||
private val _logger = Logging.getLogger(getClass())
|
private val logger = Logging.getLogger(this.javaClass)
|
||||||
override fun getLogger() = _logger
|
override fun getLogger() = logger
|
||||||
|
|
||||||
public var kotlinOptions: K2JVMCompilerArguments = K2JVMCompilerArguments();
|
public var kotlinOptions: K2JVMCompilerArguments = K2JVMCompilerArguments();
|
||||||
|
|
||||||
@@ -148,8 +148,8 @@ public open class KotlinCompile(): AbstractCompile() {
|
|||||||
|
|
||||||
public open class KDoc(): SourceTask() {
|
public open class KDoc(): SourceTask() {
|
||||||
|
|
||||||
private val _logger = Logging.getLogger(getClass())
|
private val logger = Logging.getLogger(this.javaClass)
|
||||||
override fun getLogger() = _logger
|
override fun getLogger() = logger
|
||||||
|
|
||||||
public var kdocArgs: KDocArguments = KDocArguments()
|
public var kdocArgs: KDocArguments = KDocArguments()
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -15,7 +15,7 @@ import org.gradle.api.initialization.dsl.ScriptHandler
|
|||||||
|
|
||||||
abstract class KotlinBasePluginWrapper: Plugin<Project> {
|
abstract class KotlinBasePluginWrapper: Plugin<Project> {
|
||||||
|
|
||||||
val log = Logging.getLogger(getClass())
|
val log = Logging.getLogger(this.javaClass)
|
||||||
|
|
||||||
public override fun apply(project: Project) {
|
public override fun apply(project: Project) {
|
||||||
val sourceBuildScript = findSourceBuildScript(project);
|
val sourceBuildScript = findSourceBuildScript(project);
|
||||||
@@ -30,7 +30,7 @@ abstract class KotlinBasePluginWrapper: Plugin<Project> {
|
|||||||
log.debug("Loading version information")
|
log.debug("Loading version information")
|
||||||
val props = Properties()
|
val props = Properties()
|
||||||
val propFileName = "project.properties"
|
val propFileName = "project.properties"
|
||||||
val inputStream = getClass().getClassLoader()!!.getResourceAsStream(propFileName)
|
val inputStream = this.javaClass.getClassLoader()!!.getResourceAsStream(propFileName)
|
||||||
|
|
||||||
if (inputStream == null) {
|
if (inputStream == null) {
|
||||||
throw FileNotFoundException("property file '" + propFileName + "' not found in the classpath")
|
throw FileNotFoundException("property file '" + propFileName + "' not found in the classpath")
|
||||||
@@ -51,7 +51,7 @@ abstract class KotlinBasePluginWrapper: Plugin<Project> {
|
|||||||
val kotlinPluginDependencies : List<URL> = configuration.getResolvedConfiguration().getFiles(KSpec({ dep -> true }))!!.map({(f: File):URL -> f.toURI().toURL() })
|
val kotlinPluginDependencies : List<URL> = configuration.getResolvedConfiguration().getFiles(KSpec({ dep -> true }))!!.map({(f: File):URL -> f.toURI().toURL() })
|
||||||
log.debug("Resolved files: [" + kotlinPluginDependencies.toString() + "]")
|
log.debug("Resolved files: [" + kotlinPluginDependencies.toString() + "]")
|
||||||
log.debug("Load plugin in parent-last URL classloader")
|
log.debug("Load plugin in parent-last URL classloader")
|
||||||
val kotlinPluginClassloader = ParentLastURLClassLoader(kotlinPluginDependencies, getClass().getClassLoader())
|
val kotlinPluginClassloader = ParentLastURLClassLoader(kotlinPluginDependencies, this.javaClass.getClassLoader())
|
||||||
log.debug("Class loader created")
|
log.debug("Class loader created")
|
||||||
val cls = Class.forName(getPluginClassName(), true, kotlinPluginClassloader)
|
val cls = Class.forName(getPluginClassName(), true, kotlinPluginClassloader)
|
||||||
log.debug("Plugin class loaded")
|
log.debug("Plugin class loaded")
|
||||||
|
|||||||
Reference in New Issue
Block a user