public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/35253]  New: reflection on annotation objects throws IllegalAccessException
@ 2008-02-19 14:40 marcus at better dot se
  2008-02-19 14:41 ` [Bug libgcj/35253] " marcus at better dot se
  2008-03-09 14:46 ` marcus at better dot se
  0 siblings, 2 replies; 3+ messages in thread
From: marcus at better dot se @ 2008-02-19 14:40 UTC (permalink / raw)
  To: java-prs

The following test program throws an IllegalAccessException with gij,
but works with Sun Java.

~$ gij InvokeAnnotationMethod
Exception in thread "main" java.lang.IllegalAccessException
   at java.lang.reflect.Method.invoke(libgcj.so.90)
   at test.Helper.invoke(Helper.java:11)
   at InvokeAnnotationMethod.main(InvokeAnnotationMethod.java:11)

~$ java InvokeAnnotationMethod
~$ java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-b105, mixed mode)

The odd thing is that if the test.Helper class below is moved up to
the default package, the program works. So there seems to be some
reflection bug.

Report forwarded from Debian:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=466538

------------------------- file InvokeAnnotationMethod.java ----------------
import java.lang.annotation.*;

import test.Helper;

public class InvokeAnnotationMethod
{
    public static void main(String[] args)
        throws Exception
    {
        Annotation ann = Inner.class.getAnnotation(Ann.class);
        new Helper().invoke(ann);
    }

    @Retention(RetentionPolicy.RUNTIME)
    public @interface Ann {
        public int param() default 0;
    }

    @Ann
    public class Inner
    {
    }
}
-------------------------------------------------------

------------------------- file test/Helper.java ----------------
package test;

import java.lang.reflect.Method;

public class Helper
{
    public void invoke(Object a)
        throws Exception
    {
        Method m = a.getClass().getMethod("param", new Class[0]);
        m.invoke(a, new Object[0]);
    }
}


-- 
           Summary: reflection on annotation objects throws
                    IllegalAccessException
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marcus at better dot se
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35253


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libgcj/35253] reflection on annotation objects throws IllegalAccessException
  2008-02-19 14:40 [Bug libgcj/35253] New: reflection on annotation objects throws IllegalAccessException marcus at better dot se
@ 2008-02-19 14:41 ` marcus at better dot se
  2008-03-09 14:46 ` marcus at better dot se
  1 sibling, 0 replies; 3+ messages in thread
From: marcus at better dot se @ 2008-02-19 14:41 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from marcus at better dot se  2008-02-19 14:41 -------
$ gij -version
java version "1.5.0"
gij (GNU libgcj) version 4.3.0 20080202 (experimental) [trunk revision 132072]


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35253


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libgcj/35253] reflection on annotation objects throws IllegalAccessException
  2008-02-19 14:40 [Bug libgcj/35253] New: reflection on annotation objects throws IllegalAccessException marcus at better dot se
  2008-02-19 14:41 ` [Bug libgcj/35253] " marcus at better dot se
@ 2008-03-09 14:46 ` marcus at better dot se
  1 sibling, 0 replies; 3+ messages in thread
From: marcus at better dot se @ 2008-03-09 14:46 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from marcus at better dot se  2008-03-09 14:46 -------
BTW this bug makes TestNG fail horribly with gcj, it relies heavily on
reflection with annotations of this kind.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35253


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-09 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19 14:40 [Bug libgcj/35253] New: reflection on annotation objects throws IllegalAccessException marcus at better dot se
2008-02-19 14:41 ` [Bug libgcj/35253] " marcus at better dot se
2008-03-09 14:46 ` marcus at better dot se

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).