JDK-6223857 : APT exit code isn't correct
  • Type: Bug
  • Component: tools
  • Sub-Component: apt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2005-02-01
  • Updated: 2010-05-11
  • Resolved: 2009-09-22
Related Reports
Relates :  
Description
When AnnotationProcessor throws a runtime exception, APT prints the stack trace, then returns with exit code 0 as if nothing went wrong.

Tracing the code, Main.compile(String[],Context) correctly exits with EXIT_ABNORMAL, but when it comes back to Main.compile(String[],AnnotationProcessorFactory), it simply records this value to a local "returnCode" variable and it then goes on to invoke javac with the generated code.

If javac doesn't fail, the returnCode is overwritten by javac's return code (line 1044), and hence the problem.

A non-zero exit code in earlier stage shouldn't trigger javac, or I suggest the returnCode to be OR-ed or added so that a failure in any one of the steps would cause the exit code to be non-zero.

###@###.### 2005-2-01 02:04:01 GMT

Comments
EVALUATION The apt tool and its API have been deprecated as of JDK 7 (6381698). By default, issues with annotation processing will only be fixed in the standardized JSR 269 processing in javac as of JDK 6. In this situation, javac already returns a nonzero exit code when a JSR 269 annotation processor throws a runtime exception. Closing as will not fix.
22-09-2009

EVALUATION Will investigate. ###@###.### 2005-04-18 23:56:17 GMT
18-04-2005