This is the mail archive of the java-prs@sources.redhat.com mailing list for the Java project.


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

gcj/299: wrong error message when trying to access outer field from inner static class



>Number:         299
>Category:       gcj
>Synopsis:       wrong error message when trying to access outer field from inner static class
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apbianco
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 04 07:00:01 PDT 2000
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

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