This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 200688

Summary: Include support for string annotation processor for 3.0.4 platform
Product: javacard Reporter: ravi8work
Component: Java CardAssignee: Anton Chechel <manowar>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 7.1   
Hardware: PC   
OS: All   
Issue Type: TASK Exception Reporter:

Description ravi8work 2011-08-05 05:28:08 UTC
Java Card 3.0.4 classic specification is introducing a syntax using the
String type in a new annotation which allows an annotation processor to
create source files with declarations of pre-initialized byte arrays
with the UTF-8 representation to correspond to the String constants.

To support this feature, please upadte the template used for creating a classic
applet application project's build-impl.xml file to include support for the annotation processor when the java card platform is a 3.0.4 or higher (defined by the property javacard.version=3.0.4 in the platform.properties file). The annotation processor may be invoked in the compile target as shown below :

<target name="compile" depends="-init">
        <javac destdir="${build.classes.dir}" source="${javac.source}"
               target="${javac.target}" nowarn="${javac.deprecation}"
               debug="${javac.debug}" optimize="no"
               bootclasspath="${javacard.classic.bootclasspath};${jcdk.lib}/api_classic_annotations.jar"
               includeAntRuntime="no">
            <src path="${src.dir}"/>
            <src path="${build.classes.dir}"/>
            <classpath id="compile.path"/>
            <compilerarg line="-processor com.oracle.javacard.stringproc.StringConstantsProcessor -processorpath \\'${jcdk.lib}/tools.jar;${jcdk.lib}/api_classic_annotations.jar\\'"/>
        </javac>
        <condition property="compile.proxies">
            <and>
                <isset property="use.my.proxies"/>
                <equals arg1="${use.my.proxies}" arg2="true"/>
                <available file="${src.proxies.dir}" type="dir"/>
            </and>
        </condition>
        <copy todir="${build.classes.dir}">
            <fileset dir="${src.dir}" includes="${includes}" excludes="${excludes}"/>
        </copy>
    </target>
Comment 1 ravi8work 2011-09-09 17:29:32 UTC

One other small change is required to support clean Java Card 3.0.4 classic applet development using the string annotation feature. The language subset checker wizard needs to allow the use of the new string annotation declarations and the underlying "String" type and not flag syntax errors during editing.

The Class that needs to be updated for allowing classic applets to use String literals in the StringAnnotations is javacard.project/src/org/netbeans/modules/javacard/source/JavaCardErrorProcessor.java.
This class lists the types that classic and extended do not support. It should be modified so that for classic, when encountering a String literal it checks first if it is being used within one of the String annotations or not. If not it should flag it as an error.
Alternatively, it could be implemented with a tree visitor that visits Annotations and switches off the type usage checks when the annotation is one of the StringSupport annotations.