Bug 165753

Summary: gcj generates different anonymous class names to sun
Product: [Fedora] Fedora Reporter: Andrew Cagney <cagney>
Component: gccAssignee: Andrew Haley <aph>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 6CC: jakub, tromey
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-03-30 19:22:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrew Cagney 2005-08-11 19:36:16 UTC
[there should be a gcc-java category :-)]

Given the java code:

import java.util.Observer;
import java.util.Observable;
class x
{
    Observer y = new Observer () {
	    public void update (Observable v, Object o) { }
	};
    void function () {
	class O implements Observer {
	    public void update (Observable v, Object o) { }
	};
    }
}

GCJ creates the .class files:

$ gcj -C x.java
$ ls *.class
x$1.class x$2$O.class x.class

where as sun's compiler creates:

x$1.class x$1O.class x.class

Comment 2 Andrew Cagney 2005-08-11 20:47:34 UTC
FYI, ECJ exibits behavior consistent with sun (so presumably implemented the
same algorithm).

I'd assume this is a pedantic language-lawyer edge case (which is why I set the
severity to "low" :-).


Comment 3 Tom Tromey 2006-01-04 20:43:22 UTC
AFAIK there's no spec or requirement for inner class names.
In fact I don't recall ever seeing that Sun's approach is documented.


Comment 4 Christian Iseli 2007-01-22 11:59:38 UTC
This report targets the FC3 or FC4 products, which have now been EOL'd.

Could you please check that it still applies to a current Fedora release, and
either update the target product or close it ?

Thanks.

Comment 5 Tom Tromey 2007-03-08 19:14:12 UTC
This still affects FC5 and FC6.  I set the version field here to fc6.

In F7 the inner class names are dependent on what the Eclipse compiler does.
If they are identical to sun, per comment #2, then this bug will be
fixed there.

In any case the names here are not part of the spec.
Fixing this in an older gcj is pretty hard.  I don't think anyone
will bother.


Comment 6 Jakub Jelinek 2007-03-12 12:52:11 UTC
I don't think it is even desirable to change this in FC5/FC6, there we primarily
need to avoid ABI breakages and need to be compatible with FC5 resp. FC6 gcj.

Comment 7 Tom Tromey 2007-03-30 19:22:07 UTC
I agree.  I am closing this.
I chose "wontfix", but I don't really know which resolution
is most appropriate.