logo       

Nice/src/gnu/bytecode Field.java,1.6,1.7: msg#00048

Subject: Nice/src/gnu/bytecode Field.java,1.6,1.7
Update of /cvsroot/nice/Nice/src/gnu/bytecode
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9950/src/gnu/bytecode

Modified Files:
        Field.java 
Log Message:
Don't write ConstantValue attributes for the default value, since that's
redundant.


Index: Field.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/Field.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Field.java  31 Jul 2003 19:32:05 -0000      1.6
--- Field.java  8 Apr 2005 13:31:09 -0000       1.7
***************
*** 135,145 ****
        {
        case 'Z':
!         entry = cpool.addInt(((Boolean) value).booleanValue() ? 1 : 0); break;
        case 'C':
!       entry = cpool.addInt(((Character) value).charValue());  break;
        case 'B':
        case 'S':
        case 'I':
!       entry = cpool.addInt(((Number) value).intValue());  break;
        case 'J':
        entry = cpool.addLong(((Number) value).longValue());  break;
--- 135,145 ----
        {
        case 'Z':
!         entry = addIfNotDefault(cpool, ((Boolean) value).booleanValue() ? 1 : 
0); break;
        case 'C':
!       entry = addIfNotDefault(cpool, ((Character) value).charValue());  break;
        case 'B':
        case 'S':
        case 'I':
!       entry = addIfNotDefault(cpool, ((Number) value).intValue());  break;
        case 'J':
        entry = cpool.addLong(((Number) value).longValue());  break;
***************
*** 151,156 ****
        entry = cpool.addString(value.toString());  break;
        }
!     ConstantValueAttr attr = new ConstantValueAttr(entry.getIndex());
!     attr.addToFrontOf(this);
    }
  
--- 151,168 ----
        entry = cpool.addString(value.toString());  break;
        }
!     if (entry != null)
!       {
!         ConstantValueAttr attr = new ConstantValueAttr(entry.getIndex());
!         attr.addToFrontOf(this);
!       }
!   }
! 
!   private CpoolEntry addIfNotDefault(ConstantPool cpool, int value)
!   {
!     if (value == 0)
!       // 0 is the default value, no need to specify it.
!       return null;
!     else
!       return cpool.addInt(value);
    }
  



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe