Re: Xcode 3.2 fails to highlight errors in Java source
Re: Xcode 3.2 fails to highlight errors in Java source
- Subject: Re: Xcode 3.2 fails to highlight errors in Java source
- From: "Pelaia II, Tom" <email@hidden>
- Date: Wed, 02 Sep 2009 14:31:21 -0400
- Acceptlanguage: en-US
- Thread-topic: Xcode 3.2 fails to highlight errors in Java source
Hi,
I have a workaround for the "error" bug in Ant that allows Xcode to display errors in the build window with links to the error (including bubbles) in the source file. The workaround involves two files (a script to substitute for the ant command and a sed script to process the ant output). To avoid file stripping I include the content of each script below. Place both scripts in the same directory (wherever you want).
The two scripts are xant and errorsub.sed. Call xant in place of ant.
xant calls ant passing any arguments to it and pipes the output to the errorsub sed script. The errorsub sed script ignores any lines with the warning signature since we want to preserver those. For all other lines, it looks for instances of an integer bounded by colons on either side. This is how line numbers are posted by ant. For such matches, it substitutes for the line number signature the line number signature (since we want to preserver it) followed by "error:". When Xcode sees the "error:" it identifies the line was an error and the rest just works.
I hope this helps. It works for me.
best regards,
tom
xant:
#!/bin/bash
# get the root directory of this script
root_dir=${0%/*}
echo $root_dir
# execute the ant command and perform the substitution
ant $* | sed -f $root_dir/errorsub.sed
errorsub.sed:
/: warning:/! {
s/\(:[0-9]*:\)/\1 error:/
}
On Sep 2, 2009, at 1:06 PM, Pelaia II, Tom wrote:
Hi
I just installed Snow Leopard and Xcode 3.2 and reproduced the problem
you posted. I have discovered that the cause of the problem is dues to
the Ant output. The output for the error message is missing an
"error:" text after the file specification and line number. I tested
this by generating Ant output using the echo task and it correctly
identified the error and was able to jump to the appropriate line
number.
Unfortunately, I haven't yet developed a workaround, but it may be
possible by using a "sed" to process the output of Ant.
best regards,
tom
I see that Xcode 3.2 does not correctly highlight errors in Java
source code. Warnings are correctly parsed and highlighted within
the Java source, but errors are only reported in the build results
window. That is to say, there is nothing that ties the errors
presented with the build results to the Java source file in the
Xcode project. When using Xcode 3.2, you must observe that you had
an error, and then try your best to determine where in the original
source file the affected line is. It really is quite cumbersome.
I mentioned this to the engineers in the Xcode lab during this
year's WWDC, but it seems that the version of Xcode that shipped
with Snow Leopard retains this problem. I submitted this problem
back in June as bug #6965152.
I'd love to know if there is a work around for this.
=========================
Michael F. Ellis
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden