problem with anonymous inner classes
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Tue Mar 12 17:37:00 GMT 2002
Roland.Hautz wrote:
>>Alexandre Petit-Bianco writes:
>>
>>>I've seen this before. Could you please file a PR ? I've been trying
>>>to search GNATS for something of that nature already submitted, but
>>>the search hangs or is extremely slow.
>>>
>>The search came through -- this known problem is already in GNATS, see
>>PR java/4811. It would be nice to add your test case to this PR.
>>
>
>There are certainly some similarities between PR java/4811 and my case,
>mainly the same error message. But I see my case more critical. There in
>4811 is only a wrong error message, here the gcj rejects perfectly legal
>code.
>
>Should I still append my testcase to 4811?
>
Right, I was half way through writing a response to this but got
sidetracked.
4811 is just about getting the wrong error message on incorrect code.
But in this case, the code is correct, it seems to be failing to resolve
"value" as a class variable. So, a new PR is appropriate.
I was able to simplify the test case slightly:
interface IntProcedure
{
public int apply();
}
public class In
{
public Object a(final int key) {
return new IntProcedure() {
public int apply() {
return key;
}
};
}
public Object b(final int value) {
return new IntProcedure() {
public int apply() {
return value;
}
};
}
}
regards
Bryce.
More information about the Java
mailing list