Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » command line formatter chokes on generics?
command line formatter chokes on generics? [message #240248] Fri, 02 February 2007 05:46 Go to next message
Eclipse UserFriend
Originally posted by: hemalpandya.gmail.com

I don't know what I am doing wrong, but I am not able to use the formatter
on the command line with classes that use the java Generics syntax.

The following file formats OK inside the IDE:

public class Generic<T>
{
T newInstance(Class<T> tclass) throws Exception
{ return tclass.newInstance(); }}

But when I try to format it on the command line with the following:

java -cp $ECLIPSE_HOME/startup.jar org.eclipse.core.launcher.Main
-noupdate -application org.eclipse.jdt.core.JavaCodeFormatter -config
format.config.xml Generic.java

I get the error:
The Eclipse formatter failed to format d:\tmp\Generic.java. Skip the file.

I am pretty sure this is because the formatter does not format this as 1.5
source. But I can't figure out where to specify the compatibility level
for the command line tool.

Thanks in advance and apologies if I failed to find this in some obvious
spot.

The config file format.config.xml is empty. I confirmed that java version
is 1.5.0_09. Using Eclipse 3.2.1 M20060921-0945
Re: command line formatter chokes on generics? [message #240331 is a reply to message #240248] Fri, 02 February 2007 09:05 Go to previous messageGo to next message
Eclipse UserFriend
Hemal Pandya a écrit :
> But when I try to format it on the command line with the following:
>
> java -cp $ECLIPSE_HOME/startup.jar org.eclipse.core.launcher.Main
> -noupdate -application org.eclipse.jdt.core.JavaCodeFormatter -config
> format.config.xml Generic.java
In the format.config.xml please add entries for the source compliance,
source version and target version to 1.5.
And it should work.
--
Olivier
Re: command line formatter chokes on generics? [message #240339 is a reply to message #240331] Fri, 02 February 2007 09:12 Go to previous messageGo to next message
Eclipse UserFriend
Olivier Thomann a écrit :
> In the format.config.xml please add entries for the source compliance,
> source version and target version to 1.5.
> And it should work.
I forgot the link to the help page. Search the help for this page:
"Generating a config file for the Formatter Application"
--
Olivier
Re: command line formatter chokes on generics? [message #240344 is a reply to message #240339] Fri, 02 February 2007 11:42 Go to previous message
Eclipse UserFriend
Originally posted by: hemalpandya.gmail.com

Olivier Thomann wrote:

> Olivier Thomann a écrit :
>> In the format.config.xml please add entries for the source compliance,
>> source version and target version to 1.5.
>> And it should work.
> I forgot the link to the help page. Search the help for this page:
> "Generating a config file for the Formatter Application"
> --
> Olivier

Perfect. Thanks Olivier. I couldn't find the setting earlier in the config
file but that was because I hadn't enabled project specific settings.
Previous Topic:Composite Refactoring using participants / TextChangeManager
Next Topic:Adding/Editing Template Variables
Goto Forum:
  


Current Time: Thu Jul 17 15:02:33 EDT 2025

Powered by FUDForum. Page generated in 0.73191 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top