com.netflix.java.refactor.CompilationUnit.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-source-refactor Show documentation
Show all versions of java-source-refactor Show documentation
Pluggable and distributed refactoring tool for Java source code
package com.netflix.java.refactor
import com.netflix.java.refactor.ast.AstParser
import com.sun.tools.javac.tree.JCTree
import java.nio.file.Path
/**
* Keep track of the current state of the compilation unit for a given file. As rules
* begin to modify the underlying source file,
*/
data class CompilationUnit(var jcCompilationUnit: JCTree.JCCompilationUnit,
val parser: AstParser) {
fun source(): Path {
val path = jcCompilationUnit.sourcefile.javaClass.declaredFields.find { it.type == Path::class.java }!!
path.isAccessible = true
return path.get(jcCompilationUnit.sourcefile) as Path
}
fun reparse() {
jcCompilationUnit = parser.reparse(this)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy