Menu

Loading single file without reference files..

Developers
Jay
2005-03-14
2012-10-08
  • Jay

    Jay - 2005-03-14

    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

     
    • Tobias Gutzmann

      Tobias Gutzmann - 2005-11-20

      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

       
    • Christian Schneider

      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 {

      public SoftErrorHandler() {
          super();
      }
      
      protected boolean isReferingUnavailableCode(ModelElement me) {
          return true;
      }
      

      }

      Hope that helps,
      Christian

      --
      www.Christian-Schneider.net

       
    • Jay

      Jay - 2005-03-14

      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

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.