Bug 12434 - Field called java causes confusion.
Summary: Field called java causes confusion.
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
Keywords: rejects-valid
Depends on: 28067
Blocks: 13607
  Show dependency treegraph
Reported: 2003-09-28 11:03 UTC by Ralph Loader
Modified: 2007-01-09 20:45 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-07-23 05:28:31


Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Loader 2003-09-28 11:03:37 UTC
gcj implements an expression like foo.class by synthesizing a call to

The compiler gets a bit confused if you have a field called java.

$ dev/test/bin/gcj -fsyntax-only broken.java
broken.java: In class `broken':
broken.java: In method `class$(java.lang.String)':
broken.java:8: error: Can't make a static reference to nonstatic variable `java'
in class `broken'.
1 error

It should be possible to fix this by setting RESOLVE_PACKAGE_NAME_P on the
synthesized name, and then making sure we don't change that later.  The name
resolution code is "interesting" though.

The method name on the error message above is interesting too.

class broken {
    int java;

    Class foo()
	return broken.class;
Comment 1 Andrew Pinski 2003-09-30 22:17:57 UTC
I can confirm this on the mainline (20030925).
Comment 2 Tom Tromey 2007-01-09 20:45:50 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.