|
|
|
Re: How can I force JvmInferrer to import a class I used in a body statement [message #1746251 is a reply to message #1746102] |
Tue, 25 October 2016 23:31   |
|
Christian Dietrich wrote on Fri, 21 October 2016 14:34body = '''<<Myclass>>'''
I tried the following:
members += element.toMethod("open", typeRef(void)) [
visibility = JvmVisibility.PROTECTED
parameters += element.toParameter("indexPath", typeRef(String))
body = '''
<<java.nio.file.Paths>>
<<org.apache.lucene.store.FSDirectory>>
<<org.apache.lucene.index.DirectoryReader>>
path = Paths.get(indexPath);
directory = FSDirectory.open(path);
indexReader = DirectoryReader.open(directory);
synchronized(this) {
indexSearcher = null;
}
'''
]
and get this:
protected void open(final String indexPath) {
<<java.nio.file.Paths>>
<<org.apache.lucene.store.FSDirectory>>
<<org.apache.lucene.index.DirectoryReader>>
path = Paths.get(indexPath);
directory = FSDirectory.open(path);
indexReader = DirectoryReader.open(directory);
synchronized(this) {
indexSearcher = null;
}
}
What I did wrong ?
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02590 seconds