Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4625211

com.sun.tools.javac.v8.Main change in error output vs. com.sun.tools.javac.Main

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 1.3.1
    • tools
    • x86
    • windows_2000



      Name: jk109818 Date: 01/17/2002


      FULL PRODUCT VERSION :
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build
      1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      FULL OPERATING SYSTEM VERSION :

      Microsoft Windows 2000 [Version 5.00.2195]



      A DESCRIPTION OF THE PROBLEM :
      The original com.sun.tools.javac.Main provided the
      following constructore: Main(ByteArrayOutputStream baos,
      String name). This allowed the caller to provide a stream
      where compiler output would be redirected. The newer
      com.sun.tools.javac.v8.Main provides only: Main(String
      name, boolean gcEnable). All error output is hardcoded to
      System.err stream, which makes it hard for a caller to
      smoothly handle errors without redirecting system streams.

      REGRESSION. Last worked in version 1.2.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Write code that instantiates a
      com.sun.tools.javac.v8.Main object
      2. Write code that creates a com.sun.tools.javac.Main object
      3. Notice that v8 doesn't have a parameter for an output
      stream.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      =======================================
      OrigMainTester.java:

      import java.io.*;
      import java.util.*;
      import sun.tools.javac.Main;

      public class OrigMainTester
      {
        public static void main(String [] args)
        {
           ByteArrayOutputStream baos = new ByteArrayOutputStream
      ();
           try
      {
      // create compiler
      Main compiler = new Main
      (baos, "theCompiler");

      // run the compile
      boolean bStatus = compiler.compile
      (args);
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }
        }
      }

      =======================================
      Mainv8Tester.java:

      import java.io.*;
      import java.util.*;
      import sun.tools.javac.v8.Main;

      public class Mainv8Tester
      {
        public static void main(String [] args)
        {
           try
      {
      // create compiler
      Main compiler = new Main
      ("theCompiler", false); // no error stream!!

      // run the compile
      boolean bStatus = compiler.compile
      (args);
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }
        }
      }


      ---------- END SOURCE ----------
      (Review ID: 137792)
      ======================================================================

            gafter Neal Gafter (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: