You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Jan Lahoda (JIRA)" <ji...@apache.org> on 2018/03/27 16:02:00 UTC

[jira] [Resolved] (NETBEANS-251) Generate hashCode/equals() throws NPE

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

Jan Lahoda resolved NETBEANS-251.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 9.0

Should be fixed by:

https://github.com/apache/incubator-netbeans/commit/67c4882192cc5233081e279dfa48a70d90fcb38a

> Generate hashCode/equals() throws NPE
> -------------------------------------
>
>                 Key: NETBEANS-251
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-251
>             Project: NetBeans
>          Issue Type: Bug
>          Components: editor - Completion &amp; Templates
>         Environment: Product Version: Apache NetBeans IDE Dev (Build incubator-netbeans-release-159-on-20180102)
> Updates: Updates available
> Java: 9.0.1; Java HotSpot(TM) 64-Bit Server VM 9.0.1+11
> Runtime: Java(TM) SE Runtime Environment 9.0.1+11
> System: Windows 10 version 10.0 running on amd64; Cp1252; en_CA (nb)
> User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
> Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev
>            Reporter: Gili
>            Assignee: Jan Lahoda
>            Priority: Major
>              Labels: pull-request-available, regression
>             Fix For: 9.0
>
>         Attachments: GenerateEqualsNPE.zip
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 1. Invoke Generate -> equals() and hashCode()
> 2. Select any field(s)
> 3. Click "Generate"
> 4. Exception thrown:
> {code}
> java.lang.NullPointerException
> 	at org.netbeans.modules.java.source.pretty.WidthEstimator.widthQ(WidthEstimator.java:92)
> 	at org.netbeans.modules.java.source.pretty.WidthEstimator.width(WidthEstimator.java:76)
> 	at org.netbeans.modules.java.source.pretty.WidthEstimator.visitSelect(WidthEstimator.java:262)
> 	at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2110)
> 	at org.netbeans.modules.java.source.pretty.WidthEstimator.estimateWidth(WidthEstimator.java:48)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.visitBinary(VeryPretty.java:1703)
> 	at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1989)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.doAccept(VeryPretty.java:407)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.printExpr(VeryPretty.java:2816)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.printNoParenExpr(VeryPretty.java:2807)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.visitIf(VeryPretty.java:1391)
> 	at com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1421)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.doAccept(VeryPretty.java:407)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.printExpr(VeryPretty.java:2816)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.printStat(VeryPretty.java:2873)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.printStats(VeryPretty.java:2929)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.printBlock(VeryPretty.java:3011)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.printBlock(VeryPretty.java:2948)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.visitMethodDef(VeryPretty.java:1002)
> 	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:872)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.doAccept(VeryPretty.java:407)
> 	at org.netbeans.modules.java.source.pretty.VeryPretty.print(VeryPretty.java:276)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffList(CasualDiff.java:3936)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffClassDef(CasualDiff.java:1086)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTreeImpl0(CasualDiff.java:5215)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTreeImpl(CasualDiff.java:5109)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTree(CasualDiff.java:5037)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTree(CasualDiff.java:5008)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffList(CasualDiff.java:3854)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTopLevel(CasualDiff.java:578)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTreeImpl0(CasualDiff.java:5188)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTreeImpl(CasualDiff.java:5109)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTree(CasualDiff.java:5037)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diffTree(CasualDiff.java:5020)
> 	at org.netbeans.modules.java.source.save.CasualDiff.diff(CasualDiff.java:346)
> 	at org.netbeans.api.java.source.WorkingCopy.processCurrentCompilationUnit(WorkingCopy.java:907)
> 	at org.netbeans.api.java.source.WorkingCopy.getChanges(WorkingCopy.java:1319)
> 	at org.netbeans.api.java.source.JavaSource$1.run(JavaSource.java:675)
> 	at org.netbeans.api.java.source.JavaSource$1.run(JavaSource.java:662)
> 	at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:501)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
> 	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130)
> 	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
> 	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
> 	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
> 	at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
> 	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
> 	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
> 	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:451)
> 	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:422)
> 	at org.netbeans.api.java.source.JavaSource.runModificationTask(JavaSource.java:683)
> 	at org.netbeans.modules.java.editor.codegen.EqualsHashCodeGenerator.invoke(EqualsHashCodeGenerator.java:348)
> 	at org.netbeans.modules.editor.codegen.GenerateCodePanel.invokeSelected(GenerateCodePanel.java:165)
> 	at org.netbeans.modules.editor.codegen.GenerateCodePanel.listKeyPressed(GenerateCodePanel.java:121)
> 	at org.netbeans.modules.editor.codegen.GenerateCodePanel.access$200(GenerateCodePanel.java:41)
> 	at org.netbeans.modules.editor.codegen.GenerateCodePanel$4.keyPressed(GenerateCodePanel.java:95)
> 	at java.desktop/java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:258)
> 	at java.desktop/java.awt.Component.processKeyEvent(Component.java:6536)
> 	at java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2850)
> 	at java.desktop/java.awt.Component.processEvent(Component.java:6355)
> 	at java.desktop/java.awt.Container.processEvent(Container.java:2259)
> 	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4961)
> 	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2317)
> 	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4793)
> 	at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1955)
> 	at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:827)
> 	at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1096)
> 	at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:966)
> 	at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:792)
> 	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4842)
> 	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2317)
> 	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2758)
> 	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4793)
> 	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
> 	at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
> 	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
> 	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
> 	at java.base/java.security.AccessController.doPrivileged(Native Method)
> 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
> 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:99)
> 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:739)
> 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:737)
> 	at java.base/java.security.AccessController.doPrivileged(Native Method)
> 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
> 	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
> 	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
> [catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
> 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
> 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
> 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
> 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
> 	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
> {code}
> This is a regression relative to version 8.2.



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

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

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