cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dzmitry Kazimirchyk (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAY-1622) Generated classes shouldn't produce serialVersionUID compiler warning
Date Tue, 04 Oct 2011 12:45:34 GMT

    [ https://issues.apache.org/jira/browse/CAY-1622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13120039#comment-13120039
] 

Dzmitry Kazimirchyk commented on CAY-1622:
------------------------------------------

> Suggestion #1: Use separators between the names when constructing the array to be hashed.
This reduces the collision chance back to the theoretical minimum. 

That's a good idea.

> Suggestion #2: Just pick up the first eight bytes of the digest. You don't need to iterate
over all of the resulting digest bytes just to shift them out to the left, you know :-) (oh,
and you could use DataInputStream#readLong for that, > getting whatever implementation
is currently considered state of the art). Or use ByteBuffer.wrap(hashBytes).getLong(). Both
ways may throw exceptions, but then a hash code is supposed to return enough bytes for a long
(at > the very least). 

Actually I don't iterate over all of the digest bytes, just over first eight and writing them
one after another to 64 bit hash, shifting left by 8 bit on each iteration. And, yes, ByteBuffer.wrap(hashBytes).getLong()
might be useful, but doing it by hand looks more... transparent, I'd say.
                
> Generated classes shouldn't produce serialVersionUID compiler warning
> ---------------------------------------------------------------------
>
>                 Key: CAY-1622
>                 URL: https://issues.apache.org/jira/browse/CAY-1622
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0
>            Reporter: Bob Harner
>            Priority: Minor
>
> It is probably a good idea for Cayenne not to produce any compiler warnings, but auto-generated
entity classes always have the "The serializable class _Foo does not declare a static final
serialVersionUID field of type long" compiler warning.  
> The @SuppressWarnings("serial") annotation will get rid of the warnings, but of course
it is not recommended to manually update the generated  classes.
> Users could configure the IDE to ignore these warnings (yuk), but then other team members
will still see them.
> Another option is to for users to set up a custom velocity template to include this annotation.
> But the best solution would be for Cayenne to either automatically generate either the
serialVersionUID itself or the @SuppressWarnings("serial") annotation that suppresses the
compiler warning.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message