Re: flymake integration for the eclipse java compiler

"Suraj Acharya" <[email protected]> Thu, 26 Apr 2007 15:09:43 -0700
Newsgroups gmane.emacs.jdee
Message-ID <[email protected]>
Looks like another windows issue - filename expansion this time. Can
you try this ?

(defun jde-ecj-server-flymake-init ()
  "Run the Eclipse Java compiler to collect flymake errors.
To use this funtion set the java line in `flymake-allowed-file-name-masks' to
  (\"\\.java\\'\" jde-ecj-server-flymake-init jde-ecj-flymake-cleanup)"

  (unless jde-ecj-server-setup-called
    (jde-ecj-server-setup))

  (if (not (object-of-class-p (jde-compile-get-the-compiler)
'jde-compile-ejc-server))
      (error "The ecj option for flymake can only be set when the
jde-compiler is also set to ecj")
    ;; else
    (let* ((temp-file (flymake-init-create-temp-buffer-copy
'jde-ecj-create-temp-file))
           (directory-sep-char ?/)
           (args (append (jde-compile-classpath-arg
(jde-compile-get-the-compiler))
                         (list "-Xemacs" "-noExit")
                         jde-ecj-command-line-args))
           (arg-array (concat "new String[] {"))
           (bsh-process (oref (oref  (oref 'jde-bsh the-bsh) buffer) process)))

      (unless (jde-bsh-running-p)
        (bsh-launch (oref 'jde-bsh the-bsh))
        (bsh-eval (oref 'jde-bsh the-bsh) (jde-create-prj-values-str)))

      (if args (setq arg-array (concat arg-array
                                       (mapconcat
                                        (lambda (arg)
                                          (concat "\"" arg "\"")) args ",")
                                       ",")))

      (setq arg-array (concat arg-array "\"" temp-file "\"}"))


      (list (cons bsh-process ;; server process
                  "bsh %")  ;; output end marker
            ;; compile command
            (concat (format
                     "(new
org.eclipse.jdt.internal.compiler.batch.Main(new
java.io.PrintWriter(System.out),

new java.io.PrintWriter(System.err), true)).compile(%s);"
                     arg-array))))))

On 4/26/07, Jason Coffin <[email protected]> wrote:
> On Wed, Apr 25, 2007 at 09:42:58PM -0700, Suraj Acharya wrote:
> > >Almost have it. Now the first line of my source file will highlight as
> > >an error when there are errors in the file but none of the other
> > >errors will be highlighted, only the first line (even if that line has
> > >no error).
> > >
> > >If there are no errors in the file then there will be no highlights as
> > >expected.
> > >
> >
> > Can attach some of the debug output ?
> >
>
> Sure this is the output:
>
>
> received 286 byte(s) of output from process 1496
> output : c:\Documents and Settings\jcoffin\Local Settings\Temp\54987619\ISPSpamComplaintHandler.java:50: error: Syntax error on token "stati", static expected
>   public stati final String MAIL_SERVER_NAME = "backoffice.ISPSpamCompliantHandler.ServerName.";
>          ^^^^^
> 1 problem (1 error)
> bsh %
> file e:/work/LTY-P000039/backoffice/process/src/main/java/com/upromise/backoffice/daemons/ISPSpamComplaintHandler.java, init=jde-ecj-server-flymake-init
> parse line: file-idx=2 line-idx=4 file=c:\Documents and Settings\jcoffin\Local Settings\Temp\54987619\ISPSpamComplaintHandler.java line=50 text=error: Syntax error on token "stati", static expected
> get-real-file-name: file-name=c:\Documents and Settings\jcoffin\Local Settings\Temp\54987619\ISPSpamComplaintHandler.java real-name=c:/Documents and Settings/jcoffin/Local Settings/Temp/54987619/ISPSpamComplaintHandler.java
> parsed 'c:\Documents and Settings\jcoffin\Local Settings\Temp\54987619\ISPSpamComplaintHandler.java:50: error: Syntax error on token "stati", static expected', got line-err-info
> parsed '  public stati final String MAIL_SERVER_NAME = "backoffice.ISPSpamCompliantHandler.ServerName.";', no line-err-info
> parsed '         ^^^^^', no line-err-info
> parsed '1 problem (1 error)', no line-err-info
> file e:/work/LTY-P000039/backoffice/process/src/main/java/com/upromise/backoffice/daemons/ISPSpamComplaintHandler.java, init=jde-ecj-server-flymake-init
> server process 1496 "exited" with output c:\Documents and Settings\jcoffin\Local Settings\Temp\54987619\ISPSpamComplaintHandler.java:50: error: Syntax error on token "stati", static expected
>   public stati final String MAIL_SERVER_NAME = "backoffice.ISPSpamCompliantHandler.ServerName.";
>          ^^^^^
> 1 problem (1 error)
> bsh %
> cleaning up using jde-ecj-flymake-cleanup
> deleted file c:/DOCUME~1/jcoffin/LOCALS~1/Temp/54987619/ISPSpamComplaintHandler.java
> file e:/work/LTY-P000039/backoffice/process/src/main/java/com/upromise/backoffice/daemons/ISPSpamComplaintHandler.java, init=jde-ecj-server-flymake-init
> parsed 'bsh % ', no line-err-info
> created an overlay at (1-41)
> ISPSpamComplaintHandler.java: 1 error(s), 0 warning(s) in 0.64 second(s)
>