This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java/1321: wrong error message when trying to access outer field from inner static class



>Number:         1321
>Category:       java
>Synopsis:       wrong error message when trying to access outer field from inner static class
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apbianco
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:19:02 PST 2000
>Closed-Date:    Fri Dec 15 21:37:49 PST 2000
>Last-Modified:  Fri Dec 15 21:40:00 PST 2000
>Originator:     Oskar Liljeblad
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
(I hope this is not old)
Compiling the code below prints this error:

$ gcj -C LinkedList.java 
LinkedList.java: In class `LinkedList$Iter':
LinkedList.java: In method `LinkedList$Iter()':
LinkedList.java:11: Undefined variable or class name: `this$0'.
}
^
1 error
$

It should probably print something like this:

"Can't make a static reference to nonstatic variable `modCount' in class `LinkedList'."

>How-To-Repeat:
public class LinkedList {
	public int modCount = 0;
	static class Iter {
		Iter() {
			int dumb = modCount;
		}
	}
	public void foo() {
		new Iter();
	}
}
>Fix:

>Release-Note:

>Audit-Trail:

Formerly PR gcj/299

State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Fri Dec 15 21:37:49 2000
State-Changed-Why:
    Fixed in the current cvs tree:
    $ gcj -c LinkedList.java 
    LinkedList.java: In class `LinkedList$Iter':
    LinkedList.java: In method `LinkedList$Iter()':
    LinkedList.java:5: Can't make a static reference to nonstatic variable `modCount' in class `LinkedList$Iter'.
                          int dumb = modCount;
                                     ^
    1 error

From: bryce@albatross.co.nz
To: apbianco@cygnus.com, java-gnats@sourceware.cygnus.com, osk@hem.passagen.se
Cc:  
Subject: Re: gcj/299
Date: 16 Dec 2000 05:37:49 -0000

 Synopsis: wrong error message when trying to access outer field from inner static class
 
 State-Changed-From-To: open->closed
 State-Changed-By: bryce
 State-Changed-When: Fri Dec 15 21:37:49 2000
 State-Changed-Why:
     Fixed in the current cvs tree:
     $ gcj -c LinkedList.java 
     LinkedList.java: In class `LinkedList$Iter':
     LinkedList.java: In method `LinkedList$Iter()':
     LinkedList.java:5: Can't make a static reference to nonstatic variable `modCount' in class `LinkedList$Iter'.
                           int dumb = modCount;
                                      ^
     1 error
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=299&database=java
>Unformatted:



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]