public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: java/9369: wrong bytecode generated for static inner class with private constructor
@ 2003-05-03  1:43 tromey
  0 siblings, 0 replies; 2+ messages in thread
From: tromey @ 2003-05-03  1:43 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, jsturm, nobody

Synopsis: wrong bytecode generated for static inner class with private constructor

State-Changed-From-To: open->analyzed
State-Changed-By: tromey
State-Changed-When: Sat May  3 01:43:00 2003
State-Changed-Why:
    Still a bug

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9369


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

* java/9369: wrong bytecode generated for static inner class with private constructor
@ 2003-01-19 18:16 jsturm
  0 siblings, 0 replies; 2+ messages in thread
From: jsturm @ 2003-01-19 18:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9369
>Category:       java
>Synopsis:       wrong bytecode generated for static inner class with private constructor
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 19 18:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     jsturm@one-point.com
>Release:        gcj (GCC) 3.4 20021230 (experimental)
>Organization:
>Environment:

>Description:
javac and jikes generate a synthetic constructor for the example given:

5: invokespecial #3=<Method Outer$Inner.<init> (Outer$1)void>

gcj however attempts to access the constructor declared private, failing at runtime with an IllegalAccessError:

4: invokespecial #13=<Method Outer$Inner.<init> ()void>

Also gcj doesn't generate the synthetic Outer$Inner constructor at all.
>How-To-Repeat:
$ cat Outer.java
public class Outer {
	public Object getInner() {
		return new Inner();
	}
	private static class Inner {
		private Inner() {
		}
		public String toString() {
			return "OK";
		}
	}
	public static void main(String[] args) {
		Outer outer = new Outer();
		System.out.println(outer.getInner());
	}
}
$ gcj -C Outer.java
$ gij Outer
Exception in thread "main" java.lang.IllegalAccessError
   at _Jv_SearchMethodInClass(java.lang.Class, java.lang.Class, _Jv_Utf8Const, _Jv_Utf8Const) (/opt/gcc/lib/libgcj.so.4.0.0)
   at _Jv_ResolvePoolEntry(java.lang.Class, int) (/opt/gcc/lib/libgcj.so.4.0.0)
   at Outer.getInner() (Unknown Source)
   at Outer.main(java.lang.String[]) (Unknown Source)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-05-03  1:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-03  1:43 java/9369: wrong bytecode generated for static inner class with private constructor tromey
  -- strict thread matches above, loose matches on Subject: below --
2003-01-19 18:16 jsturm

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).