Menu

#898 Bad field ovewrite warning for pivate fields

confirmed
open
None
5
2004-06-10
2004-06-09
Anonymous
No

Hi,

Compiling this program with jikes 1.21

/*
* Test various definitions of the semi-magical 'serialPersistentFields' field.
*
* Copyright (c) 2002 Pat Tullmann
* All Rights Reserved.
*
* This file is released into the public domain.
*
* @author Pat Tullmann <pat_kaffe@tullmann.org>
*/
public class TestSerialPersistent
{
private static class Subset
{
private static final int I = 0;
}

private static class Subclass
extends Subset
{
private static final int I = 0;
}
}

results in a warning from jikes:

bash-2.05a$ jikes -cp /tmp/topic/current/jre/lib/rt.jar TestSerialPersistent.java

Issued 1 semantic warning compiling "TestSerialPersistent.java":

21. private static final int I = 0;
^
*** Semantic Warning: Field "I" shadows a field of the same name in "TestSerialPersistent$Subset".

I doubt it shadows the name of a private field :)

This comes up in the context of using serialPersistentFields , which are ocassionally useful for serialization.

cheers,
dalibor topic

Discussion

  • Chris Abbey

    Chris Abbey - 2004-06-10
    • assigned_to: nobody --> enh
     
  • Chris Abbey

    Chris Abbey - 2004-06-10

    Elliott, weren't you looking at the serial* magic fields?

     
  • Elliott Hughes

    Elliott Hughes - 2004-06-20

    why does MemberAccessCheck think Subset.I is accessible?

     

Log in to post a comment.

MongoDB Logo MongoDB