Bug 405176 - [Batch] Add a newline to the end of ecj error output
Summary: [Batch] Add a newline to the end of ecj error output
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: 4.4 M1   Edit
Assignee: shankha banerjee CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-08 11:07 EDT by Mat Booth CLA
Modified: 2013-08-06 07:19 EDT (History)
8 users (show)

See Also:
jarthana: review+


Attachments
Missing carriage return at the end of the error summary output. (1.13 KB, patch)
2013-04-08 11:07 EDT, Mat Booth CLA
no flags Details | Diff
Patch (45.80 KB, patch)
2013-06-06 14:41 EDT, shankha banerjee CLA
no flags Details | Diff
Patch (47.10 KB, patch)
2013-06-10 01:45 EDT, shankha banerjee CLA
no flags Details | Diff
Patch (46.81 KB, patch)
2013-06-10 05:17 EDT, shankha banerjee CLA
shankhba: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mat Booth CLA 2013-04-08 11:07:47 EDT
Created attachment 229449 [details]
Missing carriage return at the end of the error summary output.

When compiling a Java file that contains errors using ecj from command line, the error output lacks a final carriage return. This means that the shell prompt or the next output from the invoking shell script appears on the same line as the last line of the ecj error output.

For example, you get this output:


[mbooth@10-2-5-11 calameo]$ CLASSPATH=/usr/share/java/ecj.jar:. \
  java org.eclipse.jdt.internal.compiler.batch.Main Envelope.java
... error output etc ...
----------
4 problems (4 errors)[mbooth@10-2-5-11 calameo]$ 


When it would be more desirable to have this output:


[mbooth@10-2-5-11 calameo]$ CLASSPATH=/usr/share/java/ecj.jar:. \
  java org.eclipse.jdt.internal.compiler.batch.Main Envelope.java
... error output etc ...
----------
4 problems (4 errors)
[mbooth@10-2-5-11 calameo]$ 


The attached patch makes a small change to the output so that instead of including a final carriage return *only* in EMACS log output mode, we include a final carriage return in every output mode *except* for XML log output mode.
Comment 1 Mat Booth CLA 2013-04-08 11:12:10 EDT
See also the downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=163447
Comment 2 Stephan Herrmann CLA 2013-04-09 10:36:34 EDT
Not a big deal, I'd say.

I was thinking maybe this would require adjusting thousands of tests,
but luckily most of our tests don't get the error output from the
batch compiler by directly from the internal ComilationResult.
Comment 3 Krzysztof Daniel CLA 2013-04-24 02:46:41 EDT
Stephan,
any plans on this? Could it get into Kepler?
Comment 4 Srikanth Sankaran CLA 2013-04-25 22:50:52 EDT
Shankha, please take it forward
Comment 5 shankha banerjee CLA 2013-05-01 11:53:21 EDT
Could you please suggest a way to create ecj.jar. 

I am trying to use export-ecj.xml.

C:\Work\JDT-repo3\eclipse.jdt.core>ant -f org.eclipse.jdt.core\scripts\export-ecj.xml
Buildfile: C:\Work\JDT-repo3\eclipse.jdt.core\org.eclipse.jdt.core\scripts\export-ecj.xml

init:

BUILD FAILED
C:\Work\JDT-repo3\eclipse.jdt.core\org.eclipse.jdt.core\scripts\export-ecj.xml:24: Unable to create javax script engine for javascript

Total time: 0 seconds

Thanks
Comment 6 Jay Arthanareeswaran CLA 2013-05-06 01:56:52 EDT
(In reply to comment #5)
> Could you please suggest a way to create ecj.jar. 

Did you try running the ant script from eclipse?
Comment 7 shankha banerjee CLA 2013-06-05 04:10:36 EDT
Set the JRE for the build run to JAVA60 for  (In reply to comment #5)
> Could you please suggest a way to create ecj.jar. 
> 
> I am trying to use export-ecj.xml.
> 
> C:\Work\JDT-repo3\eclipse.jdt.core>ant -f
> org.eclipse.jdt.core\scripts\export-ecj.xml
> Buildfile:
> C:\Work\JDT-repo3\eclipse.jdt.core\org.eclipse.jdt.core\scripts\export-ecj.
> xml
> 
> init:
> 
> BUILD FAILED
> C:\Work\JDT-repo3\eclipse.jdt.core\org.eclipse.jdt.core\scripts\export-ecj.
> xml:24: Unable to create javax script engine for javascript
> 
> Total time: 0 seconds
> 
> Thanks

Set the JRE for the build. This would solve the above issue.
Comment 8 shankha banerjee CLA 2013-06-05 04:57:22 EDT
The problem can be reproduced. The issue is resolved through the patch that is already posted  attachment 229449 [details].
Comment 9 shankha banerjee CLA 2013-06-06 14:41:34 EDT
Created attachment 232058 [details]
Patch

RunAllJDTCoreTests : ALL PASS

Please review. 

Way to test:

1) Have a java source file with errors. 
2) Build ecj by ruuning export-ecj.xml.
3) java -jar ecj_all.jar Error.java 

The prompt should be after the error message.

Thanks
Comment 10 Jay Arthanareeswaran CLA 2013-06-07 03:50:28 EDT
(In reply to comment #9)
> Created attachment 232058 [details]
> Patch

Comments on the patch:

1. When I use the -log option, the prompt appears on the same line. Looks like even though we request the log to be printed to a file, error messages still get printed on the console. Looks like the patch in comment #0 addresses this.

2. Copyright needs to be updated with year.
3. As per our code convention the else block should appear in the same line as '}'
  It should be something like:

   if () {
   } else {
   }
Comment 11 shankha banerjee CLA 2013-06-10 01:45:58 EDT
Created attachment 232150 [details]
Patch

Incorporated changes as suggested by Comment 10 

Tests: RunAllJDTCoreTests.

Thanks
Comment 12 shankha banerjee CLA 2013-06-10 05:17:59 EDT
Created attachment 232162 [details]
Patch

RunAllJDTCoreTests: Results OKAY.

All the changes have been incorporated. 

Thanks
Comment 13 Jay Arthanareeswaran CLA 2013-06-11 00:56:43 EDT
Thanks for the update, I will release once we tag for Kepler.
Comment 14 Jay Arthanareeswaran CLA 2013-07-01 04:50:37 EDT
(In reply to comment #0)
> Created attachment 229449 [details]
> Missing carriage return at the end of the error summary output.

Mat,

Thanks for the patch. For this fix and any future contribution, can you please sign the CLA agreement? Some help on doing this can be found here:

http://mmilinkov.wordpress.com/2013/06/17/eclipse-clas-are-live/

Or you can simply go to the eclipse project portal, my account and get to the CLA page.
Comment 15 Mat Booth CLA 2013-07-01 10:23:32 EDT
(In reply to comment #14)
> Mat,
> 
> Thanks for the patch. For this fix and any future contribution, can you
> please sign the CLA agreement? Some help on doing this can be found here:
> 
> http://mmilinkov.wordpress.com/2013/06/17/eclipse-clas-are-live/
> 
> Or you can simply go to the eclipse project portal, my account and get to
> the CLA page.

Thanks for reviewing my patch.

I have signed the contributor agreement by logging into the portal using my bugzilla credentials.
Comment 16 Jay Arthanareeswaran CLA 2013-07-18 02:27:36 EDT
The patches have been released in master via commit:

http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=870bb4f621dd0b8090426a7261d67a43a6dc9aa9

and it's parent.
Comment 17 ANIRBAN CHAKRABORTY CLA 2013-08-05 04:36:55 EDT
Verified for SDK-I20130730-0800.
Comment 18 Manoj N Palat CLA 2013-08-06 07:19:51 EDT
(In reply to comment #17)
> Verified for SDK-I20130730-0800.
ie Eclipse Luna 4.4 M1