Why can't my code see annotations in a class file?

So I have a JAR file with some classes in it. I have used DJ Java Decompiler to inspect the class in question and I can definitely see the annotations in it.
I'm working on a Maven MOJO that reads the JAR files to find the annotations, but for some reason my code does not find any annotations at all. Does anyone have any ideas what the problem might be?
The StreamLoader seems to be working because when I load the classes, their names get logged properly. Could there be something in the StreamLoader that is stripping off the annotations?
Cheers, Eric
try
    JarFile jarFile = new JarFile(artifact.getFile());
    Enumeration<JarEntry> jarEntries = jarFile.entries();
    while (jarEntries.hasMoreElements())
        JarEntry jarEntry = jarEntries.nextElement();
         if (!jarEntry.isDirectory() && jarEntry.getName().endsWith(".class"))
            getLog().info("jarEntry.getName() = " + jarEntry.getName());
            try
             Class<?> entry = streamLoader.loadClass(jarFile.getInputStream(jarEntry));
             getLog().info("entry " + entry.getName());
             if (entry.isAnnotationPresent(DotNet.class))
                 getLog().info("including " + entry.getName());
             DotNet dotNet = entry.getAnnotation(net.sf.jni4net.annotations.DotNet.class);
             if (dotNet == null)
                 Annotation [] annotations = entry.getAnnotations();
                 for (Annotation annotation : annotations)
                     getLog().info("annotation " + annotation.toString());
             else
                 getLog().info("including " + entry.getName());
         catch (Throwable t)
             getLog().warn("can't find class " + jarEntry.getName());
catch (IOException e)
    getLog().error(e.getMessage(), e);
class StreamLoader extends ClassLoader
    public StreamLoader(ClassLoader parent)
        super(parent);
    public Class<?> loadClass(InputStream input) throws ClassNotFoundException
        try
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            int data = input.read();
            while(data != -1)
                buffer.write(data);
                data = input.read();
            input.close();
            byte[] classData = buffer.toByteArray();
            return defineClass(null, classData, 0, classData.length);
        catch (MalformedURLException e)
            e.printStackTrace();
        catch (IOException e)
            e.printStackTrace();
        return null;
}

Yes.
@Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME)
public @interface DotNet { }I am assuming that if it were not set that way then it would not show up in the class file at all - but I could be wrong.
There are also other annotations with RetentionPolicy.RUNTIME, i.e. @ThreadSafe, but my code cannot see them either, even though the disassembler can see them.
Cheers, Eric

Similar Messages

  • Why can't anyone else see my Edge Animate html files in their browsers?

    I create this awesome file with bells and whistles and looks and runs great on mY computer and in mY browsers but when I send a client(s) the HTML file to view in their browser it NEVER works! Do I need to send them all the files? The image folder...the JS files and the HTML? I think I did that once and it still diodn't work...I understand that the browsers all dont play nice and that m os need to be updated on the client end but is there a good way to save the Animate file so that my clients can use the file to place in a website. I am creating small web ads.
    Thanks for all your help!
    Maria

    Do you have a website? If yes, you can load all your files at the root level and then you can send the link to your clients.
    It would go like this:
    http://www.yourWebsiteName.com/yourEdgeFolderName
    (I would name the edge files index rather than something else because most web server prefer that.)
    You could also create an html file with all your samples and iframes to load them. Then you need to put each edge folder at the root of your website.

  • Why can I no longer see CS6 in creative cloud

    Why can I no longer see CS6 to download in Creative Cloud?

    HI Intro,
    Once you will launch Creative Cloud Desktop you will get the option "Find new apps" and a drop down in front of it.
    On the Drop down menu you need to select "Previous Version".
    Once you do that you will get the option to download the Creative Cloud applications.
    Please check and let me if it works or not.
    Thanks,
    Ratandeep Arora

  • Why can I no longer see my img numbers on iphoto 9.4.1?  I need these numbers.  How do I get them back?

    Why can I no longer see my img numbers on iphoto 9.4.1?  I need these numbers.  How do I get them back?

    Under the view menu chech show title?
    LN

  • Why can't my computer see or find my ipod when i plug it in?

    why can't my computer see or find my ipod when i plug it in?
    so frustrating...

    See Here...
    Device Not Recognised
    For PC
    http://support.apple.com/kb/TS1538
    And Here
    iPhone, iPad, or iPod touch not appearing in iTunes

  • Why do we need the @EJB annotation at the class level?

    Why do we need the @EJB annotation at the class level?
    Eg: Why do we need the first piece of code, when the second code seems much simpler .
    *1.*
    @Stateful
    @EJB(name="ejb/TradeLocalNm",
    beanInterface=TradeLocal.class)
    public class TradeClientBean implements TradeClientRemote {
    *2.*
    @Stateful
    public class TradeClientBean implements TradeClientRemote {
    @EJB private TradeLocal trd;
    }

    I think it is possible to do it in an aggregated level however you need to define your distribution rules in order to get the desired result, you need also to consider that if distribution rules changes and the value after promotional planning returns the same value, it is possible that detailed level are not realigned to the new distribution rule (e.g. regarding another ratio).
    Maybe this is one of several causes.
    Regards,
    Carlos

  • Why can my reciever not see my emoji symbols on the message that I send

    Why can people not see the emoji symbols on my texts that I send

    Are you using the standard emoji keyboard on the iPhone, or are you using some type of 3rd party application? Are the receivers of your message iPhone users? If they are not, it could be their phone cannot decode and display the emoji from the phone.

  • Why can't my EJB see common files inside war file?

    My DataProcessorBean packaged in an ear file can't find a local class(JDomUtils) during runtime.
    It compiles fine, it's accessible in my IDE, and I can see it also in the war file contained in the ear but getting this error.
    Caused by: java.lang.NoClassDefFoundError: Lcom/app/util/xpath/JDomUtils;
    Any suggestions?
    DataProcessorBean.java
    import com.app.util.xpath.JDomUtils;
    public class DataProcessorBean implements SessionBean {
    SessionContext sessionContext;
    private JDomUtils domUtils;
    JDomUtils.java Found inside: app.war\WEB-INF\classes\com\app\util\xpath\JDomUtils
    package com.app.util.xpath;
    public class JDomUtils {
    public JDomUtils() {
    Edited by: 917903 on Aug 16, 2012 2:18 PM

    If I got you right your EJB is packaged in the jar which is in ear.
    Your util-class is in war which is in ear too.
    In such case you can't get access from Bean to Util class because of classloaders rule.
    Possible solution is to move your Util class to APP-INF\lib. In such case it will be shared by all the modules that you have in your ear.
    Edited by: 955802 on Aug 29, 2012 8:50 AM

  • Why can't i open my Panasonic Lumix FZ45 RAW files in CS3?

    why can't i open my RAW files?
    I have photoshop CS3 with camera raw plug-in 4.6.0.30 on MacBook Pro OS X Lion 10.7.5 (11G63) and a Panasonic Lumix FZ45
    I have checked the list of supported cameras and mine appears to be there.
    I have no available updates in photoshop so assume that I am up to date with those.
    Anyone have any ideas?
    thanks

    I have checked the list of supported cameras and mine appears to be there.
    Yes, the Panasonic FZ45 is listed but it was first supported by Adobe Camera Raw (ACR) 6.2.
    http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
    Then go to this table to see which versions of Photoshop are compatible with ACR 6.2: CS5 and later. Not CS3.
    http://helpx.adobe.com/x-productkb/global/camera-raw-compatible-applications.html
    So your options are to upgrade to CS6 or subscribe to CC (check out the Photoshop Photography Program: PS CC + Lightroom 5).
    Or download the free DNG converter, convert all your FZ75 Raw files to DNGs then open the DNGs in CS3
    http://www.adobe.com/products/photoshop/extend.displayTab2.html

  • Why can't I create a PDF from a Word file with your $9.99 monthly plan. I have done so before.

    Why can't I change a Word file to a PDF file with your $9.99 monthly plan? I have done so before.

    Firefox is a good browser, but it comes with its own PDF viewer, which may not display PDF files correctly.  See http://forums.adobe.com/thread/1158136
    If you want to continue to use Internet Explorer, you may want to lower its security settings; see http://windows.microsoft.com/en-us/Windows7/Change-Internet-Explorer-Security-settings

  • Why can't I hear the sound on a wmv file someone sent me?

    I can't hear the sound when playing a wmv file. Anyone know how to fix this?

    I would use VLC - http://www.videolan.org/vlc/download-macosx.html.
    Good luck,
    Clinton

  • Why can't my buddy see video on import

    Maybe you guys can help me. My buddy has a mac book air with an OS that uses QUICK TIME X. I guess he has SN or Lion. Anyway, I shot him some HD video in 720p 30fps and gave him a .mov file of the footage so he can learn to edit in imovie. I used FCP studio 3 to export.
    I have stayed away from QT X as much as possible becasue I don['t like it and it limits me. I also have all the codes with FCP studio.
    When he tries to import his video into imovie he only gets audio and the black screen. When he tries to open the file in QT X he gets a codec error. I told him to purchase QT pro and that should solve his problem. He bought it only to talk to Apple and the said it was not compatable with QT X. I stay away from X and FCP X. I dont  like the new interface.
    Is he having a global codec problem? He can't even see his video in MPEG Streamclip.
    What codec does he need to see and edit his video in imovie?
    Or do I need to export the file for imovie.....if so what are my settings?
    Thanks.
    PS, I can open the file in QT X and imovie with and 8 core 2009 mac with Snow Leopard. I haven't tried it on my MBP with Mountain Lion.

    If you have FCP and exported in full quality, you probably used ProRes 422. This codec does not come with Imovie. You can export the movie from FCP in Apple Intermediate Codec, and iMovie can handle it.
    It may be possible to download the ProRes codec for your friend so he can open in QuickTime X. It may also be readable in iMovie.  Here is a link. http://support.apple.com/kb/dl1396
    I am not certain this will work, because I have FCPX installed so I have no way to test whether it will work without it.

  • Why can I no longer see .mts files on my Sony Video Camera

    before I upgraded to Mountan Lion, I could hook my Sony Video Camera up to the USB port and see the .MTS files on my Mac. Now when I hook the camera up, I can no longer see the files. I have to hook the camera up to a windows machine, copy the files from the camera to a dropbox folder or DVD. Then I can see them on my Mac from the dropbox folder or DVD.  Why did I lose the ability to see the files directly on the camera?

    Under the view menu chech show title?
    LN

  • Why can only some machines see netboot images at the startup screen?

    I have a 10.6.6 server running as a netboot server. I have about 10 images running on the server that consist of a 10.6.6 and 10.5.8 triage partition and a 10.6.6 and 10.5.8 restore image. Now what I have noticed is that newer machines after starting up and holding down the option key will see all the available images.But on some older intel machines nothing will show up after holding the option key down accept the internal drive itself, But if you hold down the N key it WILL boot to the default image.
    I have made sure and checked that the ethernet port was working on the older machines. I also made sure that I can see the images from the startup control panel. All machines can see the netboot images from the startup control panel, but older intel versions cant. However I was able to sometimes get the old white and black macbooks to see the images but others not.
    Any suggestions as to why some machines will see the images at the startup screen after holding the option key and why some wont?

    That, most likely, means that you have a fairly large number of images and/or they have very long names.
    The number of images that can be displayed is limited by the size of the data packet which contains the NetBoot volume information. Two techniques we use to keep this in check are 1) aggressive purging of outdated images, and 2) use of shorter display names (the one seen in Startup Disk, not the one in the NetBootSP0 folder).

  • Why can't I immediately see the music that I've downloaded from itunes from my phone? I have to get to a wifi area and look for the music before it actually shows in my library. It wasn't like that before.

    Sometimes when I'm at work or just out and about I will download an album to my iPhone. It used to show up immediately in my iTunes library and I could start listening to my new music right away. It was awesome on trips or in the office or just with friends. Someone would mention a song, I beebop over to itunes, download it and BOOM everyone gets to listen to the song! Now, however, If I download any music without WiFi, it won't sync immediately to my library. It appears to be doing so, but I can't actually see any of the music until I get into a WiFi friendly area. Once I've done that, the music stays there so it's not the end of the world...I am getting my music. But, dang it, I want it now! Just like I used to!
    Is anyone else having this problem? I have the iPhone 5 and it's fully updated.

    You will need to contact iTunes Support : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

Maybe you are looking for

  • Runtime Error when Posting Invoice with text added (MIRO)

    Hi Gurus, We are getting a shortdump (runtime error) when we post certain invoices in MIRO. This happens when we input some text in the text field or add some text to the NOTE tab. We are having exception ERROR_DP raised in the program c_textedit_con

  • "Adobe Flash CS5 has stopped working" error anytime i do anything - HELP PLZ!

    Hi there, I have used Macromedia Flash MX for many, many moons. Finally, when I got Windows 7, I was VERY excited to get updated on MX and move to Adobe Flash Professional CS5. However, i have never once been able to use this program, as it crashes p

  • How do you rotate a pdf document in preview?

    There is a book where the double pages are turned. How do you rotate them so that you can read them in preview?

  • Report Output Name

    Good afternoon, When I run my Oracle Report from my form, Oracle appends random information at the end of the report name saved on the report server. Is there some way of stopping that? or is there some way of finding out the complete output filename

  • AE Mediacore Errors After Latest Update

    Hi, I have had a lot of problems on both of my computers after the latest update. My major one is Premiere, but thats another forum. Both my computers throw the error in the image when I launch AE. AE runs, but I want to make sure I am not going to s