[JSR308] Question regarding -XDTA:spacesincomments

Jesper Tärnvik jesper.tarnvik at pricer.com
Fri Jun 26 06:53:51 EDT 2009


Hi!

 

After having followed this mailing list since JavaOne I realize that this question might not be of the normal complexity discussed on the list, so if I should direct my question elsewhere please direct me to that list or forum.

 

After having attended the presentation regarding JSR-308 at JavaOne I am fairly eager trying to start using the compiler on parts of our server project.  Since I need to keep using Java 6 for release builds I am forced to use the "Annotations in Comments" way of annotating my project. Also due to historical reasons I would like to keep the formatting rules and conventions already in use in our development team, so I would like to use the -XDTA:spacesincomments compiler switch to enable me to keep my eclipse formatting rules, but I am unable to get it to work.

 

This smallish test exemplifies my problems:

##################################################

public class JSRTest1 {

   public/* @Nullable */String returnNullString(String mightBeNull) {

      if (mightBeNull == null) {

         return null;

      }

      return "";

   }

}

##################################################

Buildfile:

<?xml version="1.0" encoding="ISO-8859-1"?>

<project name="R3Server" default="jsr308" basedir=".">

           <property environment="env" />

           <property name="basedir" value="." />

           

           <property name="build.home.jsr" value="${basedir}/build.jsr/R3Server" />

           <property name="src.home" value="${basedir}" />

           

           <target name="jsr308" description="Compile Java sources to class files"  >

                      <property name="jsr308.path" value="C:\work\Software\trunk\R3Server\tools\jsr308-checkers-0.9.3\checkers" />

                      <delete dir="${build.home.jsr}" />

                      <mkdir dir="${build.home.jsr}" />

                      <javac destdir="${build.home.jsr}" 

                                 fork="yes"

                                 executable="${jsr308.path}/binary/javac.bat">

                                 <compilerarg value="-version"/>

                                 <compilerarg line="-XDTA:spacesincomments"/>

                                 <compilerarg line="-target 6"/>

                                 <compilerarg line="-processor checkers.nullness.NullnessChecker"/>

                                 <src path="${src.home}/src" />

                                 <include name="**/*.java" />

                                 <classpath>

                                            <pathelement location="${jsr308.path}/checkers.jar" />

                                 </classpath>

                      </javac>

           </target>

</project>

Output:

Buildfile: build.xml

 

jsr308:

   [delete] Deleting directory c:\DevTools\workspace-ganymede\JSRTest\build.jsr\R3Server

    [mkdir] Created dir: c:\DevTools\workspace-ganymede\JSRTest\build.jsr\R3Server

    [javac] Compiling 1 source file to c:\DevTools\workspace-ganymede\JSRTest\build.jsr\R3Server

    [javac] javac 1.7.0-jsr308-0.9.3

    [javac] c:\DevTools\workspace-ganymede\JSRTest\src\JSRTest1.java:4: incompatible types.

    [javac]          return null;

    [javac]                 ^

    [javac]   found   : @Nullable <nulltype>

    [javac]   required: @NonNull String

    [javac] 1 error

 

BUILD FAILED

c:\DevTools\workspace-ganymede\JSRTest\build.xml:15: Compile failed; see the compiler error output for details.

 

Removing the spaces in the annotation makes the class compile without any errors. Things that doesn't seem to matter is changing the <compilerarg line ...> to <compilerarg value...>

 

Any help appreciated.

 

I am using JSR 308 version 0.9.3 by the way.

 

Jesper Tärnvik
Senior Software Developer
 
Pricer AB, Bergkällavägen 20-22, 192 79 Sollentuna, Sweden
Phone: +46 8 5055 8251, cell: +46 708-10 80 51 
jesper.tarnvik at pricer.com <mailto:jesper.tarnvik at pricer.com>  www.pricer.com <file:///\\exchweb\bin\redir.asp?URL=http://www.pricer.com/> 
 
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/pipermail/jsr308/attachments/20090626/7f83c009/attachment-0001.htm 


More information about the JSR308 mailing list