Bug 18796

Summary: [4.0/4.1/4.2/4.3 Regression] gcj imports wrong superclass
Product: gcc Reporter: Rutger Ovidius <eclipse.lists>
Component: javaAssignee: Andrew Haley <aph>
Severity: normal CC: gcc-bugs, java-prs, phil
Priority: P5 Keywords: rejects-valid
Version: 4.0.0   
Target Milestone: 4.3.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2005-06-04 17:03:02
Bug Depends on: 28067    
Bug Blocks: 17574    
Attachments: testcase

Description Rutger Ovidius 2004-12-02 20:39:21 UTC
gcj -c -o bla.o sancho/view/transfer/AbstractDetailDialog.java

sancho/view/transfer/AbstractDetailDialog.java: In class
sancho/view/transfer/AbstractDetailDialog.java: In constructor '(int)':
sancho/view/transfer/AbstractDetailDialog.java:11: error: Can't find constructor
'org.eclipse.swt.widgets.Dialog(I)' in type 'org.eclipse.swt.widgets.Dialog'.

gcc version 4.0.0 20041130 (experimental) doesn't work.
gcc version 3.3.2 20031022 works fine.

It is due to the
"import org.eclipse.swt.widgets.*" in 

Changing AbstractDetailDialog.java to explicitly import the correct Dialog class
fixes it:

public abstract class AbstractDetailDialog extends
org.eclipse.jface.dialogs.Dialog {

(will attach small zip file)
Comment 1 Rutger Ovidius 2004-12-02 20:40:08 UTC
Created attachment 7664 [details]

The java files.
Comment 2 Andrew Pinski 2004-12-02 20:57:38 UTC
Confirmed, werid.
Comment 3 Tom Tromey 2004-12-03 23:25:45 UTC
I've looked into this a little.

Apparently we are getting to this line in

        local_super = do_resolve_class (NULL, local_super, NULL, NULL);

with local_super:

(gdb) pt local_super
 <pointer_type 0xf6d2315c Dialog unsigned SI
    size <integer_cst 0xf6ce9330 type <integer_type 0xf6cf01d0 bit_size_type>
constant invariant 32>
    unit size <integer_cst 0xf6ce9150 type <integer_type 0xf6cf015c> constant
invariant 4>
    align 32 symtab 0 alias set -1>

... but with the wrong `ctxp':

(gdb) p ctxp.filename
$91 = 0x8e3ab1a "./sancho/view/transfer/ClientDetailDialog.java"

Then we proceed to find "Dialog" using ClientDetailDialog's imports,
resulting in the incorrect org.eclipse.swt.widgets.Dialog

You might think we could call do_resolve_class here with "local_enclosing"
as an argument, but unfortunately it does not yet seem to have its
Comment 4 Tom Tromey 2004-12-16 18:14:04 UTC
Andrew agreed to look at this.
Comment 5 Mark Mitchell 2005-01-19 07:21:09 UTC
Java bugs are not showstoppers; removing target milestone.
Comment 6 Mark Mitchell 2005-08-22 02:25:21 UTC
Java bugs are not release-critical.
Comment 7 Paolo Bonzini 2005-10-05 15:45:05 UTC
This could be fixed now (because of the fix for PR17860 and other import-related bugs).
Comment 8 Mark Mitchell 2006-05-25 02:35:38 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 9 Tom Tromey 2007-01-09 20:46:46 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.