public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/12857] New: Illegal method modifier when loading a generated .class
@ 2003-10-31 14:19 yves dot martin at elca dot ch
2003-10-31 15:59 ` [Bug java/12857] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: yves dot martin at elca dot ch @ 2003-10-31 14:19 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12857
Summary: Illegal method modifier when loading a generated .class
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yves dot martin at elca dot ch
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: Linux
GCC target triplet: Java bytecode .class
I cannot describe why the .class is wrong - but I have extracted a simple test
case from a huge Java project:
public interface TestInterface {
public static final String CONST = "My Class = " +
TestInterface.class.getName();
public void aMethod();
}
public class TestCode implements TestInterface {
public void aMethod() {
return;
}
public static void main(String[] args) {
System.out.println("Hello " + CONST);
}
}
gcj -C TestInterface.java
gcj -C TestCode.java
java -cp . TestCode
The generated TestInterface.class is not loadable in Sun JVM:
Exception in thread "main" java.lang.ClassFormatError: TestInterface (Illegal
method modifiers: 0x8)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug java/12857] Illegal method modifier when loading a generated .class
2003-10-31 14:19 [Bug java/12857] New: Illegal method modifier when loading a generated .class yves dot martin at elca dot ch
@ 2003-10-31 15:59 ` pinskia at gcc dot gnu dot org
2003-11-03 1:50 ` jsturm at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-31 15:59 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12857
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
GCC host triplet|Linux |
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2003-10-31 15:37:37
date| |
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-31 15:37 -------
Confirmed on the mainline (20031018).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug java/12857] Illegal method modifier when loading a generated .class
2003-10-31 14:19 [Bug java/12857] New: Illegal method modifier when loading a generated .class yves dot martin at elca dot ch
2003-10-31 15:59 ` [Bug java/12857] " pinskia at gcc dot gnu dot org
@ 2003-11-03 1:50 ` jsturm at gcc dot gnu dot org
2003-11-14 11:04 ` aph at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jsturm at gcc dot gnu dot org @ 2003-11-03 1:50 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12857
jsturm at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Last reconfirmed|2003-10-31 15:37:37 |2003-11-03 01:50:18
date| |
Target Milestone|--- |3.4
------- Additional Comments From jsturm at gcc dot gnu dot org 2003-11-03 01:50 -------
Nice test case, thanks.
The problem here is that gcj tries to create the static "class$" synthetic
method in TestInterface, which the verifier quite rightly complains about (as
does libgcj's bytecode verifier, for that matter).
The proper fix is to create an anonymous inner class of TestInterface to contain
the class$ method. This is what jikes and javac do.
This is a little awkward in gcj where we don't discover that this anonymous
class is necessary until the 2nd pass, at which time the list of classes to
generate is normally complete. I'll try to think of a non-intrusive patch so
this can go into 3.4.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug java/12857] Illegal method modifier when loading a generated .class
2003-10-31 14:19 [Bug java/12857] New: Illegal method modifier when loading a generated .class yves dot martin at elca dot ch
2003-10-31 15:59 ` [Bug java/12857] " pinskia at gcc dot gnu dot org
2003-11-03 1:50 ` jsturm at gcc dot gnu dot org
@ 2003-11-14 11:04 ` aph at gcc dot gnu dot org
2003-11-15 5:29 ` jsturm at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: aph at gcc dot gnu dot org @ 2003-11-14 11:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From aph at gcc dot gnu dot org 2003-11-14 11:04 -------
Jeff, how did the testing go?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12857
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug java/12857] Illegal method modifier when loading a generated .class
2003-10-31 14:19 [Bug java/12857] New: Illegal method modifier when loading a generated .class yves dot martin at elca dot ch
` (2 preceding siblings ...)
2003-11-14 11:04 ` aph at gcc dot gnu dot org
@ 2003-11-15 5:29 ` jsturm at gcc dot gnu dot org
2003-11-18 3:57 ` cvs-commit at gcc dot gnu dot org
2003-11-18 4:07 ` jsturm at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: jsturm at gcc dot gnu dot org @ 2003-11-15 5:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsturm at gcc dot gnu dot org 2003-11-15 05:29 -------
(In reply to comment #4)
> Jeff, how did the testing go?
I get a miscompilation of java.io.ObjectStreamClass during bootstrap,
introducing 10 new Mauve failures. The .class file is created with fields in
the exact opposite of their declared order.
The cause is a bit surprising to me. On the surface the source parser looks as
though it would be reentrant, but it is not. Moving build_dot_class_method to
pass 1 causes load_class to be used, which may invoke the parser again (though
only during bootstrap when some class files are not available).
So java_reorder_fields is called prematurely on java.io.ObjectStreamClass, when
no fields are yet defined.
Should be fixable by either:
1) Moving build_dot_class_method back to pass 2 (patch_incomplete_class_ref), or
2) Modifying build_dot_class_method to not invoke load_class.
Overall I'm inclined to attempt 2), since the creation of 'class$' may occur in
an anonymous class, and all other inner classes are created in pass 1.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |aph at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12857
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug java/12857] Illegal method modifier when loading a generated .class
2003-10-31 14:19 [Bug java/12857] New: Illegal method modifier when loading a generated .class yves dot martin at elca dot ch
` (3 preceding siblings ...)
2003-11-15 5:29 ` jsturm at gcc dot gnu dot org
@ 2003-11-18 3:57 ` cvs-commit at gcc dot gnu dot org
2003-11-18 4:07 ` jsturm at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-11-18 3:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-11-18 03:57 -------
Subject: Bug 12857
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: jsturm@gcc.gnu.org 2003-11-18 03:57:08
Modified files:
gcc/java : ChangeLog decl.c java-tree.h parse.y
Log message:
Fix PR java/12857.
decl.c (java_init_decl_processing): Don't initialize
class_not_found_type_node, no_class_def_found_type_node.
java-tree.h (JTI_CLASS_NOT_FOUND_TYPE_NODE,
JTI_NO_CLASS_DEF_FOUND_TYPE_NODE): Remove from java_tree_index.
(class_not_found_type_node, no_class_def_found_type_node):
Don't define.
parse.y (build_dot_class_method_invocation): Add this_class
argument. Qualify method invocations to a different class.
(create_new_parser_context): Initialize saved_data_ctx to 0.
(java_parser_context_save_global): Initialize saved_data_ctx to 1.
(build_dot_class_method): Don't load classes. Register
incomplete types.
(build_incomplete_class_ref): Special cases for interfaces
and inner classes. Move build_dot_class_method call to here...
(patch_incomplete_class_ref): ...from here. Pass current_class
to build_dot_class_method_invocation.
(build_assertion): Pass class_type to
build_dot_class_method_invocation.
(encapsulate_with_try_catch): Handle EXPR_WITH_FILE_LOCATION node.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1294&r2=1.1295
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/decl.c.diff?cvsroot=gcc&r1=1.170&r2=1.171
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-tree.h.diff?cvsroot=gcc&r1=1.188&r2=1.189
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.456&r2=1.457
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12857
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug java/12857] Illegal method modifier when loading a generated .class
2003-10-31 14:19 [Bug java/12857] New: Illegal method modifier when loading a generated .class yves dot martin at elca dot ch
` (4 preceding siblings ...)
2003-11-18 3:57 ` cvs-commit at gcc dot gnu dot org
@ 2003-11-18 4:07 ` jsturm at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: jsturm at gcc dot gnu dot org @ 2003-11-18 4:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsturm at gcc dot gnu dot org 2003-11-18 04:07 -------
Patch applied.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12857
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-11-18 4:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-31 14:19 [Bug java/12857] New: Illegal method modifier when loading a generated .class yves dot martin at elca dot ch
2003-10-31 15:59 ` [Bug java/12857] " pinskia at gcc dot gnu dot org
2003-11-03 1:50 ` jsturm at gcc dot gnu dot org
2003-11-14 11:04 ` aph at gcc dot gnu dot org
2003-11-15 5:29 ` jsturm at gcc dot gnu dot org
2003-11-18 3:57 ` cvs-commit at gcc dot gnu dot org
2003-11-18 4:07 ` jsturm 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).