I get a build error on this:
    [javac] /home/lostlogic/freenet/src/freenet/DSAIdentity.java:64:
    variable hashed might already have been assigned
        [javac]             hashed = makeHashCode();

        --Brandon

On Tue, 09/23/03 at 18:21:34 -0700, Edward J. Huff wrote:
> Update of /cvsroot/freenet/freenet/src/freenet
> In directory sc8-pr-cvs1:/tmp/cvs-serv23607
> 
> Modified Files:
>       DSAIdentity.java 
> Log Message:
> Compute hash code only once and save it in object.
> 
> Index: DSAIdentity.java
> ===================================================================
> RCS file: /cvsroot/freenet/freenet/src/freenet/DSAIdentity.java,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- DSAIdentity.java  6 Jul 2003 17:14:09 -0000       1.2
> +++ DSAIdentity.java  24 Sep 2003 01:21:32 -0000      1.3
> @@ -1,3 +1,4 @@
> +/* -*- Mode: java; c-basic-indent: 4; tab-width: 4 -*- */
>  package freenet;
>  
>  import freenet.crypt.*;
> @@ -13,6 +14,7 @@
>    * @author tavin
>    */
>  public class DSAIdentity extends DSAPublicKey implements Identity {
> +    private final int hashed;
>  
>      /**
>       * Create a DSAIdentity
> @@ -21,6 +23,7 @@
>       */
>      public DSAIdentity(DSAGroup g, DSAAuthentity x) {
>          super(g, x);
> +             hashed = makeHashCode();
>      }
>  
>      /**
> @@ -30,6 +33,7 @@
>       */
>      public DSAIdentity(DSAGroup g, BigInteger y) {
>          super(g, y);
> +             hashed = makeHashCode();
>      }
>      
>       /**
> @@ -39,6 +43,7 @@
>        */
>       public DSAIdentity(DSAGroup g, String yAsHexString) {
>               super(g, yAsHexString);
> +             hashed = makeHashCode();
>       }
>  
>      // FIXME: eliminate this constructor
> @@ -47,6 +52,7 @@
>                 Global.DSAgroupC : 
>                 (DSAGroup) DSAGroup.readFromField(grp)),
>                value);
> +             hashed = makeHashCode();
>      }
>  
>      /**
> @@ -55,6 +61,7 @@
>       */
>      public DSAIdentity(FieldSet fs) throws NumberFormatException {
>          this(getGroup(fs), getYasHexString(fs));
> +             hashed = makeHashCode();
>      }
>      
>       
> @@ -127,9 +134,13 @@
>      }
>      
>      public final int hashCode() {
> -        return getY().shiftRight(getY().bitLength()-32).intValue();
> +             return hashed;
>      }
>      
> +     private final int makeHashCode() {
> +        return getY().shiftRight(getY().bitLength()-32).intValue();
> +     }
> +
>      public final int compareTo(Object o) {
>          if (o == null)
>              return 1;
> 
> _______________________________________________
> cvs mailing list
> [EMAIL PROTECTED]
> http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to