Use javaClass instead of getClass()

This commit is contained in:
Alexander Udalov
2014-07-22 00:35:36 +04:00
parent 8c13a76805
commit bea740b478
13 changed files with 23 additions and 23 deletions
@@ -125,7 +125,7 @@ open class KotlinPlugin [Inject] (val scriptHandler: ScriptHandler): Plugin<Proj
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) {
@@ -35,8 +35,8 @@ public open class KotlinCompile(): AbstractCompile() {
val srcDirsRoots = HashSet<File>()
val compiler = K2JVMCompiler()
private val _logger = Logging.getLogger(getClass())
override fun getLogger() = _logger
private val logger = Logging.getLogger(this.javaClass)
override fun getLogger() = logger
public var kotlinOptions: K2JVMCompilerArguments = K2JVMCompilerArguments();
@@ -148,8 +148,8 @@ public open class KotlinCompile(): AbstractCompile() {
public open class KDoc(): SourceTask() {
private val _logger = Logging.getLogger(getClass())
override fun getLogger() = _logger
private val logger = Logging.getLogger(this.javaClass)
override fun getLogger() = logger
public var kdocArgs: KDocArguments = KDocArguments()
@@ -15,7 +15,7 @@ import org.gradle.api.initialization.dsl.ScriptHandler
abstract class KotlinBasePluginWrapper: Plugin<Project> {
val log = Logging.getLogger(getClass())
val log = Logging.getLogger(this.javaClass)
public override fun apply(project: Project) {
val sourceBuildScript = findSourceBuildScript(project);
@@ -30,7 +30,7 @@ abstract class KotlinBasePluginWrapper: Plugin<Project> {
log.debug("Loading version information")
val props = Properties()
val propFileName = "project.properties"
val inputStream = getClass().getClassLoader()!!.getResourceAsStream(propFileName)
val inputStream = this.javaClass.getClassLoader()!!.getResourceAsStream(propFileName)
if (inputStream == null) {
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() })
log.debug("Resolved files: [" + kotlinPluginDependencies.toString() + "]")
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")
val cls = Class.forName(getPluginClassName(), true, kotlinPluginClassloader)
log.debug("Plugin class loaded")