Loading ...
Sorry, an error occurred while loading the content.

antlr.jar and jdk 1.2.2

Expand Messages
  • Robert Colquhoun
    Hi, Just recently i upgraded my machine(HP-UX) from 1.1.8 to 1.2.2(as well as increased memory usage and decreased performance with the new jvm ;-) i have
    Message 1 of 1 , Jul 9 2:36 AM
    • 0 Attachment
      Hi,

      Just recently i upgraded my machine(HP-UX) from 1.1.8 to 1.2.2(as well as
      increased memory usage and decreased performance with the new jvm ;-) i
      have noticed a problem with using the current antlr.jar(2.7.0)

      If my parser needs to print out a message from a RecognitionException ie
      call the RecognitionException.toString() method the java virtual machine
      tries to suck in pretty much every class associated with antlr.

      Looking at antlr/RecognitionException.java
      public String toString() {
      return Tool.getFileLineString(fileName,line)+getMessage();
      }

      The Tool class is pretty large - i think for some reason the jvm decides as
      well as the Tool class to load every class associated with it even though
      the methods needed in Tool are static and isolated from the rest of the
      Tool class.

      In the Tool class the method called is:
      public static String getFileLineString(String fileName, int line) {
      return fileLineFormatter.getFormatString(fileName, line);
      }

      The FileLineFormatter is pretty much standalone(one method
      getFormatString()) i was wondering if somehow it could be broken out of the
      main Tool class so that there is no giant cascade of classes loaded.
      ....maybe a 'antlrUtilities' class to deal with all the static/utility
      stuff that is needed.

      PS I realise this problem is kind of cosmetic, but i really don't want to
      ship the kitchen sink with my application ;-)

      PPS As a hack fix if you change RecognitionException.java to:
      public String toString() {
      if (filename == null) {
      return "" + line + ": " + getMessage();
      }
      return filename + " Line: " + line + ": " + getMessage();
      }

      ....everything works just fine!

      - Robert
    Your message has been successfully submitted and would be delivered to recipients shortly.