public inbox for java-prs@sourceware.org help / color / mirror / Atom feed
* [Bug java/20215] New: gcj does not accept classes with same name fields @ 2005-02-26 16:13 bonniot at users dot sf dot net 2005-02-26 16:34 ` [Bug java/20215] " bonniot at users dot sf dot net ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: bonniot at users dot sf dot net @ 2005-02-26 16:13 UTC (permalink / raw) To: java-prs According to the JVM spec, class files can have several fields with the same name. As long as they have different types, they will be distinguished since all field operations specify both the name and the field of the field. Sun's JVM accepts such classes, and correctly distinguishes the fields, as you can see in the attached testcase. Here is the disassembly of this class: Access flags: 0x20 super This class: 2=DuplicateField, super: 4=java.lang.Object Interfaces (count: 0): Fields (count: 2): Field name:"foo" static Signature: 6=java.lang.String Field name:"foo" static Signature: 7=int Methods (count: 3): Method name:"<init>" Signature: 9=()void Attribute "Code", length:17, max_stack:1, max_locals:1, code_length:5 0: aload_0 1: invokespecial #11=<Method java.lang.Object.<init> ()void> 4: return Method name:"main" public static Signature: 14=(java.lang.String[])void Attribute "Code", length:31, max_stack:2, max_locals:1, code_length:19 0: getstatic #20=<Field java.lang.System.out java.io.PrintStream> 3: getstatic #22=<Field DuplicateField.foo java.lang.String> 6: invokevirtual #28=<Method java.io.PrintStream.println (java.lang.String)void> 9: getstatic #20=<Field java.lang.System.out java.io.PrintStream> 12: getstatic #30=<Field DuplicateField.foo int> 15: invokevirtual #33=<Method java.io.PrintStream.println (int)void> 18: return Method name:"<clinit>" static Signature: 9=()void Attribute "Code", length:24, max_stack:1, max_locals:0, code_length:12 0: ldc #36=<String "WOW"> 2: putstatic #22=<Field DuplicateField.foo java.lang.String> 5: sipush 42 8: putstatic #30=<Field DuplicateField.foo int> 11: return Sun's JVM correctly executes that program: $ java DuplicateField WOW 42 gcj fails during compilation with: $ gcj DuplicateField.class DuplicateField.java: In class 'DuplicateField': DuplicateField.java: In method 'DuplicateField.main(java.lang.String[])': DuplicateField.java:0: error: mismatching signature for field 'foo' in 'DuplicateField' DuplicateField.java: In method 'DuplicateField.<clinit>()': DuplicateField.java:0: error: mismatching signature for field 'foo' in 'DuplicateField' Surprisingly, gij also fails with: Exception in thread "main" java.lang.NullPointerException at java.io.PrintStream.println(java.lang.String) (/tmp/gcc/lib/libgcj.so.6.0.0) at DuplicateField.main(java.lang.String[]) (Unknown Source) at gnu.java.lang.MainThread.call_main() (/tmp/gcc/lib/libgcj.so.6.0.0) at gnu.java.lang.MainThread.run() (/tmp/gcc/lib/libgcj.so.6.0.0) gcj (GCC) 4.0.0 20050223 -- Summary: gcj does not accept classes with same name fields Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bonniot at users dot sf dot net CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20215 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug java/20215] gcj does not accept classes with same name fields 2005-02-26 16:13 [Bug java/20215] New: gcj does not accept classes with same name fields bonniot at users dot sf dot net @ 2005-02-26 16:34 ` bonniot at users dot sf dot net 2005-03-07 17:18 ` cvs-commit at gcc dot gnu dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: bonniot at users dot sf dot net @ 2005-02-26 16:34 UTC (permalink / raw) To: java-prs ------- Additional Comments From bonniot at users dot sf dot net 2005-02-25 19:50 ------- Created an attachment (id=8285) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8285&action=view) Testcase -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20215 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug java/20215] gcj does not accept classes with same name fields 2005-02-26 16:13 [Bug java/20215] New: gcj does not accept classes with same name fields bonniot at users dot sf dot net 2005-02-26 16:34 ` [Bug java/20215] " bonniot at users dot sf dot net @ 2005-03-07 17:18 ` cvs-commit at gcc dot gnu dot org 2005-03-08 10:05 ` cvs-commit at gcc dot gnu dot org 2005-05-27 0:17 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2005-03-07 17:18 UTC (permalink / raw) To: java-prs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-03-07 17:11 ------- Subject: Bug 20215 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: tromey@gcc.gnu.org 2005-03-07 17:11:29 Modified files: libjava : ChangeLog link.cc libjava/include: jvm.h Log message: PR java/20215: * include/jvm.h (_Jv_Linker::find_field_helper): Updated. * link.cc (find_field_helper): Added 'type' argument. (find_field): Updated. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3391.2.3&r2=1.3391.2.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/link.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.10&r2=1.10.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/jvm.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.77&r2=1.77.2.1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20215 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug java/20215] gcj does not accept classes with same name fields 2005-02-26 16:13 [Bug java/20215] New: gcj does not accept classes with same name fields bonniot at users dot sf dot net 2005-02-26 16:34 ` [Bug java/20215] " bonniot at users dot sf dot net 2005-03-07 17:18 ` cvs-commit at gcc dot gnu dot org @ 2005-03-08 10:05 ` cvs-commit at gcc dot gnu dot org 2005-05-27 0:17 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: cvs-commit at gcc dot gnu dot org @ 2005-03-08 10:05 UTC (permalink / raw) To: java-prs ------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-03-07 17:18 ------- Subject: Bug 20215 CVSROOT: /cvs/gcc Module name: gcc Changes by: tromey@gcc.gnu.org 2005-03-07 17:18:33 Modified files: libjava : ChangeLog link.cc libjava/include: jvm.h Log message: PR java/20215: * include/jvm.h (_Jv_Linker::find_field_helper): Updated. * link.cc (find_field_helper): Added 'type' argument. (find_field): Updated. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3399&r2=1.3400 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/link.cc.diff?cvsroot=gcc&r1=1.10&r2=1.11 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/jvm.h.diff?cvsroot=gcc&r1=1.77&r2=1.78 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20215 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug java/20215] gcj does not accept classes with same name fields 2005-02-26 16:13 [Bug java/20215] New: gcj does not accept classes with same name fields bonniot at users dot sf dot net ` (2 preceding siblings ...) 2005-03-08 10:05 ` cvs-commit at gcc dot gnu dot org @ 2005-05-27 0:17 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-05-27 0:17 UTC (permalink / raw) To: java-prs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-27 00:17 ------- Confirmed, the gij problem has been fixed by the patches above, this only leaves the java front-end problem. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Keywords| |rejects-valid Last reconfirmed|0000-00-00 00:00:00 |2005-05-27 00:17:46 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20215 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-05-27 0:17 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-02-26 16:13 [Bug java/20215] New: gcj does not accept classes with same name fields bonniot at users dot sf dot net 2005-02-26 16:34 ` [Bug java/20215] " bonniot at users dot sf dot net 2005-03-07 17:18 ` cvs-commit at gcc dot gnu dot org 2005-03-08 10:05 ` cvs-commit at gcc dot gnu dot org 2005-05-27 0:17 ` pinskia at gcc dot gnu dot org
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).