[ 
https://issues.apache.org/jira/browse/NETBEANS-415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gili updated NETBEANS-415:
--------------------------
    Description: 
(CCing as many people from the original discussion as I could find: [~svatoun] 
[~matthies] [~jlahoda])

Given that Netbeans now requires JDK 7, consider having the code generator 
delegate to

{{Objects.hashCode(Object)}} and {{Objects.hash(Object...)}} as they result in 
cleaner code than what is currently being generated.

As for {{equals()}}, the implementation generated by Netbeans violates the Java 
specification of java.lang.Object and should be fixed right away. You can read 
a more detailed discussion at 
[https://netbeans.org/bugzilla/show_bug.cgi?id=156994] [1] but essentially we 
agreed to fix this with a flag in the Options dialog to let users decide which 
approach they prefer.

[1] In my last post I suggested:
 # Making "instanceof" the default.
 # Warning if a class uses "instanceof" and subclasses override equals/hashCode.
 # Allowing users to configure whether they prefer instanceof or 
getClass()-based implementations of equals/hashcode on a project-level.
 # Warning if a class uses "getClass()" and has any subclasses.
 # Warnings should appear on the subclasses, not the parent class.

  was:
Given that Netbeans now requires JDK 7, consider having the code generator 
delegate to
 {{Objects.hashCode(Object)}} and {{Objects.hash(Object...)}} as they result in 
cleaner code than what is currently being generated.

As for {{equals()}}, the implementation generated by Netbeans violates the Java 
specification of java.lang.Object and should be fixed right away. You can read 
a more detailed discussion at 
[https://netbeans.org/bugzilla/show_bug.cgi?id=156994] but essentially we 
agreed to fix this with a flag in the Options dialog to let users decide which 
approach they prefer.


> Revisit hashCode(), equals() implementation
> -------------------------------------------
>
>                 Key: NETBEANS-415
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-415
>             Project: NetBeans
>          Issue Type: Improvement
>          Components: editor - Completion & Templates
>            Reporter: Gili
>            Priority: Major
>
> (CCing as many people from the original discussion as I could find: 
> [~svatoun] [~matthies] [~jlahoda])
> Given that Netbeans now requires JDK 7, consider having the code generator 
> delegate to
> {{Objects.hashCode(Object)}} and {{Objects.hash(Object...)}} as they result 
> in cleaner code than what is currently being generated.
> As for {{equals()}}, the implementation generated by Netbeans violates the 
> Java specification of java.lang.Object and should be fixed right away. You 
> can read a more detailed discussion at 
> [https://netbeans.org/bugzilla/show_bug.cgi?id=156994] [1] but essentially we 
> agreed to fix this with a flag in the Options dialog to let users decide 
> which approach they prefer.
> [1] In my last post I suggested:
>  # Making "instanceof" the default.
>  # Warning if a class uses "instanceof" and subclasses override 
> equals/hashCode.
>  # Allowing users to configure whether they prefer instanceof or 
> getClass()-based implementations of equals/hashcode on a project-level.
>  # Warning if a class uses "getClass()" and has any subclasses.
>  # Warnings should appear on the subclasses, not the parent class.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to