View Javadoc

    1   /*
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package net.sourceforge.pmd;
    5
    6   import net.sourceforge.pmd.ast.JavaCharStream;
    7   import net.sourceforge.pmd.ast.JavaParser;
    8   import net.sourceforge.pmd.ast.JavaParserTokenManager;
    9
    10  import java.io.InputStream;
    11  import java.io.Reader;
    12
    13  /**
    14   * This is an implementation of {@link net.sourceforge.pmd.TargetJDKVersion} for
    15   * JDK 1.4.
    16   *
    17   * @author Tom Copeland
    18   */
    19  public class TargetJDK1_4 implements TargetJDKVersion {
    20
    21      /**
    22       * @see net.sourceforge.pmd.TargetJDKVersion#createParser(InputStream)
    23       */
    24      public JavaParser createParser(InputStream in) {
    25          return new JavaParser(new JavaCharStream(in));
    26      }
    27
    28      /**
    29       * @see net.sourceforge.pmd.TargetJDKVersion#createParser(Reader)
    30       */
    31      public JavaParser createParser(Reader in) {
    32          return new JavaParser(new JavaCharStream(in));
    33      }
    34
    35      /**
    36       * Creates a token manager for the parser.
    37       *
    38       * @param in the reader for which to create a token manager
    39       * @return a token manager
    40       */
    41      public JavaParserTokenManager createJavaParserTokenManager(Reader in) {
    42          return new JavaParserTokenManager(new JavaCharStream(in));
    43      }
    44
    45      public String getVersionString() {
    46          return "1.4";
    47      }
    48
    49  }