Bug 12217 - extra qualification required if multiple .java basenames on command line
extra qualification required if multiple .java basenames on command line
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: java
3.3.1
: P2 normal
: 4.3.0
Assigned To: Not yet assigned to anyone
:
Depends on: 28067
Blocks:
  Show dependency treegraph
 
Reported: 2003-09-08 21:01 UTC by bart
Modified: 2007-01-09 20:45 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bart 2003-09-08 21:01:36 UTC
so far i have been unable to condense the problem into a small example. here's
the gist, though. if you have the following 3 files:

j/a/X.java:
package a;
public interface X {
}
j/b/Y.java:
package b;
import c.X;
public class Y extends X { // will require explicit c.X ref
}
j/c/X.java:
package c;
public class X {
}

and then compile them into .class files with

gcj -C -d class -classpath class:j `find j -name '*.java'`

the behavior is that X in "extends X" in j/b/Y.java is taken as a.X rather than
the explicitly imported c.X.

the given example does NOT reproduce this bug, unfortunately. i don't know if
this is because i am characterizing the problem wrong or if it's a problem of scale.

i ran across it trying to compile the xalan package in rhug
(http://sources.redhat.com/rhug) using a makefile that compiles all the .java
files in each package at once.

at this point i don't know a way of reproducing this short of pulling the rhug
tree from cvs and using the following makefile instead:

F=--encoding=8859_1

all: xalan.o

regexp.o:       jakarta-regexp/upstream/src
        gcj -C $F -d class -classpath class:$< `alljava $<`
        gcj -c -o $@ $F -classpath class:$< `alljava $<`

xerces.o:       xerces/upstream/src regexp.o
        gcj -C $F -d class -classpath class:$< `alljava $<`
        gcj -c -o $@ $F -classpath class:$< `alljava $<`

cup.o:  cup/upstream
        gcj -C $F -d class -classpath class:$< `alljava $<`
        gcj -c -o $@ $F -classpath class:$< `alljava $<`

bcel.o: BCEL/upstream/src/java regexp.o
        gcj -C $F -d class -classpath class:$< `alljava $< | grep -v verifier`
        gcj -c -o $@ $F -classpath class:$< `alljava $< | grep -v verifier`

xalan.o:        xalan/upstream/src regexp.o xerces.o bcel.o cup.o
        gcj -C $F -d class -classpath class:$< `alljava $<`
        gcj -c -o $@ $F -classpath class:$< `alljava $<`

clean:
        rm -rf *.o class/*

where alljava is defined as:

#!/bin/sh
find ${1:-.} -name '*.java' | sed 's;^\./;;'

the first error you will get from this looks valid - a class that should be
declared public but isn't - but every one from that point on is this
qualification thing.

here is the list of cvs diffs that successfully work around this issue:

Index: org/apache/xalan/xsltc/compiler/Expression.java
===================================================================
RCS file:
/cvs/rhug/rhug/xalan/upstream/src/org/apache/xalan/xsltc/compiler/Expression.java,v
retrieving revision 1.2
diff -r1.2 Expression.java
76c76
< abstract class Expression extends SyntaxTreeNode {
---
> abstract public class Expression extends SyntaxTreeNode {
Index: org/apache/xpath/axes/PredicatedNodeTest.java
===================================================================
RCS file:
/cvs/rhug/rhug/xalan/upstream/src/org/apache/xpath/axes/PredicatedNodeTest.java,v
retrieving revision 1.2
diff -r1.2 PredicatedNodeTest.java
19c19
< public abstract class PredicatedNodeTest extends NodeTest implements
SubContextList
---
> public abstract class PredicatedNodeTest extends
org.apache.xpath.patterns.NodeTest implements SubContextList
Index: org/apache/xpath/objects/XObject.java
===================================================================
RCS file: /cvs/rhug/rhug/xalan/upstream/src/org/apache/xpath/objects/XObject.java,v
retrieving revision 1.2
diff -r1.2 XObject.java
85c85
< public class XObject extends Expression implements Serializable, Cloneable
---
> public class XObject extends org.apache.xpath.Expression implements
Serializable, Cloneable
Index: org/apache/xpath/operations/Operation.java
===================================================================
RCS file:
/cvs/rhug/rhug/xalan/upstream/src/org/apache/xpath/operations/Operation.java,v
retrieving revision 1.2
diff -r1.2 Operation.java
71c71
< public class Operation extends Expression implements ExpressionOwner
---
> public class Operation extends org.apache.xpath.Expression implements
ExpressionOwner
Index: org/apache/xpath/operations/UnaryOperation.java
===================================================================
RCS file:
/cvs/rhug/rhug/xalan/upstream/src/org/apache/xpath/operations/UnaryOperation.java,v
retrieving revision 1.2
diff -r1.2 UnaryOperation.java
71c71
< public abstract class UnaryOperation extends Expression implements ExpressionOwner
---
> public abstract class UnaryOperation extends org.apache.xpath.Expression
implements ExpressionOwner
Index: org/apache/xpath/operations/Variable.java
===================================================================
RCS file:
/cvs/rhug/rhug/xalan/upstream/src/org/apache/xpath/operations/Variable.java,v
retrieving revision 1.2
diff -r1.2 Variable.java
86c86
< public class Variable extends Expression implements PathComponent
---
> public class Variable extends org.apache.xpath.Expression implements PathComponent
Comment 1 bart 2003-09-08 21:26:00 UTC
update on bug report: the first reported xalan source file change is unnecessary
and is instead an artifact of the reported bug. qualifying the use of Expression
in xalan/upstream/src/org/apache/xpath/objects/XObject.java to
org.apache.xpath.Expression makes this seemingly unrelated bug go away.

so ignore this diff:

RCS file:
/cvs/rhug/rhug/xalan/upstream/src/org/apache/xalan/xsltc/compiler/Expression.java,v
retrieving revision 1.2
diff -r1.2 Expression.java
76c76
< abstract class Expression extends SyntaxTreeNode {
---
> abstract public class Expression extends SyntaxTreeNode {
Index: org/apache/xpath/axes/PredicatedNodeTest.java

the problem of extra qualifications being required is still there.
Comment 2 Tom Tromey 2007-01-09 20:45:45 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.
Thanks.