parseResource

Parses the Java code contained in a resource and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

path

path to a resource containing Java source code. As resource is accessed through a class loader, a leading "/" is not allowed in pathToResource

Throws

if the source code has parser errors

the path could not be accessed


Deprecated

set the encoding in the ParserConfiguration

Parses the Java code contained in a resource and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

path

path to a resource containing Java source code. As resource is accessed through a class loader, a leading "/" is not allowed in pathToResource

encoding

encoding of the source code

Throws

if the source code has parser errors

the path could not be accessed


open fun parseResource(@NotNull classLoader: ClassLoader, @NotNull path: String, @NotNull encoding: Charset): CompilationUnit(source)

Deprecated

set the encoding in the ParserConfiguration

Parses the Java code contained in a resource and returns a CompilationUnit that represents it.

Return

CompilationUnit representing the Java source code

Parameters

classLoader

the classLoader that is asked to load the resource

path

path to a resource containing Java source code. As resource is accessed through a class loader, a leading "/" is not allowed in pathToResource

Throws

if the source code has parser errors

the path could not be accessed