i am looking for a framework above which I can write a transformation program for Java applications. At last i found Recoder... i have used the examples to learn the Recoder... i have few doubts about the functional behaviour of the Recoder...
I found that it is throwing exception when i try to load a single file without its dependency files... but it's not practically possible to load all the Java application files into the memory as it might go out of the JVM's memory, and we don't want to extend the JVM memory as it might go to any max. extend...
so my requirement is to load files only on demand... my transformation will be within the method level... at rare situations, i might need to load one or two dependency files...
is it possible in the current Recoder design?
regards,
Jay
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if the source file is on the search path list.
This assumes you didn't use getAllCompilationUnitsFromPath(), which would have already added the file. Otherwise, add the file's path to your search path list first.
Tobias
PS: I now monitor this forum
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thanks Christian for the info... it looks perfect for my requirement... one more doubt is whether it is possible to load a file on demand... i.e. assume i have loaded a file without dependency files and then after analyzing the file, i found i need another file to load.. is it possible to do lazy loading from the code?
Appriciate your help.
regards,
Jay
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i am looking for a framework above which I can write a transformation program for Java applications. At last i found Recoder... i have used the examples to learn the Recoder... i have few doubts about the functional behaviour of the Recoder...
I found that it is throwing exception when i try to load a single file without its dependency files... but it's not practically possible to load all the Java application files into the memory as it might go out of the JVM's memory, and we don't want to extend the JVM memory as it might go to any max. extend...
so my requirement is to load files only on demand... my transformation will be within the method level... at rare situations, i might need to load one or two dependency files...
is it possible in the current Recoder design?
regards,
Jay
Hi,
sorry for the late answer, I assume it doesn't help you any more, but for future support requests:
Try
getServiceConfiguration().getNameInfo().getType(typeName);
if the source file is on the search path list.
This assumes you didn't use getAllCompilationUnitsFromPath(), which would have already added the file. Otherwise, add the file's path to your search path list first.
Tobias
PS: I now monitor this forum
Hi Jay,
maybe you can use the error handling mechanism to tell recoder that the errors it discovers (missing references) are ok.
CrossReferenceServiceConfiguration xServiceConfig = new CrossReferenceServiceConfiguration();
ProjectSettings projectSettings = xServiceConfig.getProjectSettings();
projectSettings.setErrorHandler( new SoftErrorHandler() );
And here the error handler impl:
public class SoftErrorHandler extends DefaultErrorHandler {
}
Hope that helps,
Christian
--
www.Christian-Schneider.net
thanks Christian for the info... it looks perfect for my requirement... one more doubt is whether it is possible to load a file on demand... i.e. assume i have loaded a file without dependency files and then after analyzing the file, i found i need another file to load.. is it possible to do lazy loading from the code?
Appriciate your help.
regards,
Jay