Bug 98489 - [compiler] The batch compiler prints some messages to the console whereas its err and out streams are redefined
Summary: [compiler] The batch compiler prints some messages to the console whereas its...
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-06 07:03 EDT by Maxime Daniel CLA
Modified: 2005-06-10 10:20 EDT (History)
0 users

See Also:


Attachments
Batch compiler quick fix (disable some tests) to avoid console pollution (3.51 KB, patch)
2005-06-06 07:04 EDT, Maxime Daniel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Daniel CLA 2005-06-06 07:03:12 EDT
Investigating why the BathCompilerTest series of tests printed to the console
whereas the instance of batch compiler used specifically uses non default output
streams, it appeared that the delegate compiler used by the batch compiler does
post verbose information messages to the System.out stream (instead of posting
them to the specified output file).

In order to avoid polluting the console, a quick fix is attached that disables
the batch compiler tests that use the -verbose option. A better fix would be to
 propagate the logger initialized by the batch compiler into the delegate
compiler so that the latter could report verbose messages through the logger.

The alternative path that would augment the responsibilities of the
ICompilerRequestor to cope with real time informative messages seems less
appropriate (real time error messages not being the main focus of a compilation
result, the object that is passed back to the requestor.) 
A third approach would imitate more closely the behavior of a command line
compiler and would consider redirecting System.out itself to a file. In that
case, though, Main should be amended so that its constructors would no more take
parameters for err and out output streams. (In other words, either we consider
that Main should be able to take alternate streams parameters at construction
time and it should then *always* use them, or we consider that Main *always*
operates upon standard out and err, and BatchCompilerTest must provide for
System.out and System.err redirection. While changing System.out itself is not
an option, preventing it to write to the console might be one.)

The first option seems to be the cleaner path (IMHO), assuming then that command
line instances of the batch compiler would merely pass System.out and System.err
down the chain.
Comment 1 Maxime Daniel CLA 2005-06-06 07:04:42 EDT
Created attachment 22413 [details]
Batch compiler quick fix (disable some tests) to avoid console pollution
Comment 2 Philipe Mulet CLA 2005-06-06 07:24:34 EDT
Olivier - pls neutralize the offending tests for 3.1. Improving the compiler
along the line of what Maxime suggested should be deferred post 3.1 as non critical.
Comment 3 Frederic Fusier CLA 2005-06-06 08:02:45 EDT
Olivier, I'm currently running JDT/Core tests using Maxime's patch. I will
release it as soon as tests finish...
Comment 4 Frederic Fusier CLA 2005-06-06 09:11:47 EDT
Patch released in HEAD. I've verified that there's no longer compiler output in
console...
Comment 5 Frederic Fusier CLA 2005-06-09 06:01:11 EDT
fixed
Comment 6 Olivier Thomann CLA 2005-06-09 11:05:28 EDT
Verified that there is no more output to System.out.
Tests seem to be excluded.
Verified in N20050609-0010.
Comment 7 David Audel CLA 2005-06-10 10:20:54 EDT
Verified for 3.1 RC2 using build I20050610-0010