1 Reply Latest reply on Aug 11, 2006 5:29 PM by starksm64

    Tomcat java compiler ignores annotations

    bill.burke

      The java compiler that compiles JSPs that comes with Tomcat does not insert annotation information into the .class bytes. This means that if you use @EJB, or whatever in your USP, the field/method it is annotated to will not have the annotation embedded in bytecode. Thus any annotation processor will fail.

      I haven't tried the old ANT way of doing this stuff yes, but we may have to revert to that. Should I reenable the ant stuff if it does the appropriate annotation compilation?

        • 1. Re: Tomcat java compiler ignores annotations
          starksm64

          It looks like it is there in the output of the eclipse3.2 compiler. Tomcat is using the one from 3.1 as far as I know.

          [starksm@succubus eclipse-test-classes]$ javap -c -verbose TestAnno
          Compiled from "TestAnno.java"
          public class TestAnno extends java.lang.Object
           SourceFile: "TestAnno.java"
           Deprecated: length = 0x
          
           RuntimeVisibleAnnotations: length = 0x6
           00 01 00 12 00 00
           minor version: 0
           major version: 49
           Constant pool:
          const #1 = class #2; // TestAnno
          const #2 = Asciz TestAnno;
          const #3 = class #4; // java/lang/Object
          const #4 = Asciz java/lang/Object;
          const #5 = Asciz <init>;
          const #6 = Asciz ()V;
          const #7 = Asciz Code;
          const #8 = Method #3.#9; // java/lang/Object."<init>":()V
          const #9 = NameAndType #5:#6;// "<init>":()V
          const #10 = Asciz LineNumberTable;
          const #11 = Asciz LocalVariableTable;
          const #12 = Asciz this;
          const #13 = Asciz LTestAnno;;
          const #14 = Asciz SourceFile;
          const #15 = Asciz TestAnno.java;
          const #16 = Asciz Deprecated;
          const #17 = Asciz RuntimeVisibleAnnotations;
          const #18 = Asciz Ljava/lang/Deprecated;;
          
          {
          public TestAnno();
           Code:
           Stack=1, Locals=1, Args_size=1
           0: aload_0
           1: invokespecial #8; //Method java/lang/Object."<init>":()V
           4: return
           LineNumberTable:
           line 3: 0
           LocalVariableTable:
           Start Length Slot Name Signature
           0 5 0 this LTestAnno;
          
          }