<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><tt>Hello Alexandru,<br>
        <br>
        No you did nothing wrong.<br>
        <br>
        We are using our own data structure to describe annotations in
        J3. So it is normal that you can not see your Java annotations
        inside the LLVM bytecode produced.<br>
        If I remember well, our implementation of annotations do not
        rely on LLVM annotations.<br>
        <br>
        Regards,<br>
      </tt>
      <pre class="moz-signature" cols="72">Harris Bakiras
</pre>
      On 06/17/2013 02:19 PM, Alexandru Ionut Diaconescu wrote:<br>
    </div>
    <blockquote
cite="mid:CAPBXs32V94CP6cmCGvgx0HtPWUBCzQa1W+9uddnTUDOVMLsSsQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>Hello everyone,<br>
                  <br>
                </div>
                I am able to work very well with annotations in C/C++,
                by using __attribute__((annotate("MYANNOTATION")))
                static int a; . Inside the LLVM bytecode I have
                @llvm.global.annotations and @llvm.var.annotation. <br>
                <br>
              </div>
              However, I was trying to test annotations also in Java,
              with VMKit. These are the commands that I run:<br>
              <br>
              javac -Xlint -g -O Main.java<br>
              ../Release+Asserts/bin/vmjc Main<br>
              ../Release+Asserts/bin/j3 Main<br>
              ../../llvm_new/Release+Asserts/bin/llvm-dis < Main.bc
              > Main_assembly<br>
              <br>
            </div>
            My small program is :<br>
            <br>
            import java.lang.annotation.ElementType;<br>
            import java.lang.annotation.Retention;<br>
            import java.lang.annotation.RetentionPolicy;<br>
            import java.lang.annotation.Target;<br>
            import java.lang.reflect.Method;<br>
            <br>
            @Target(ElementType.METHOD)<br>
            @Retention(RetentionPolicy.RUNTIME)<br>
            @interface Red {<br>
                String info() default "";<br>
            }<br>
            <br>
            <br>
            class Annotated {<br>
                @Red(info = "AWESOME")<br>
                public void foo(String myParam) {<br>
                    System.out.println("This is " + myParam);<br>
                }<br>
            }<br>
            <br>
            <br>
            class TestAnnotationParser {<br>
                public void parse(Class clazz) throws Exception {<br>
                    Method[] methods = clazz.getMethods();<br>
            <br>
            <br>
            <br>
                for (Method method : methods) {<br>
                    if (method.isAnnotationPresent(Red.class)) {<br>
                        Red test = method.getAnnotation(Red.class);<br>
                        String info = <a moz-do-not-send="true"
              href="http://test.info">test.info</a>();<br>
            <br>
                        if ("AWESOME".equals(info)) {<br>
                             System.out.println("info is awesome!");<br>
                             // try to invoke the method with param<br>
                             method.invoke(<br>
                                Annotated.class.newInstance(), <br>
                                info<br>
                             );<br>
                        }<br>
                    }<br>
                }<br>
            }<br>
            <br>
            <br>
            }<br>
            <br>
            <br>
            public class Main {<br>
                public static void main(String[] args) throws Exception
            {<br>
                    TestAnnotationParser parser = new
            TestAnnotationParser();<br>
                    parser.parse(Annotated.class);<br>
                }<br>
            }<br>
            <br>
            <br>
          </div>
          However, I cannot find the annotations in the bytecode. It is
          something that I did wrong?<br>
          <br>
        </div>
        Thank you in advance !<br>
        <div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>