This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Build: NetBeans IDE Dev (Build 20161010-16f9bbc04752) VM: Java HotSpot(TM) 64-Bit Server VM, 25.66-b17, Java(TM) SE Runtime Environment, 1.8.0_66-b17 OS: Windows 8.1 User Comments: misterm: Generating equals and hashCode misterm: . misterm: . Stacktrace: java.lang.NullPointerException at org.netbeans.modules.java.source.pretty.WidthEstimator.widthQ(WidthEstimator.java:114) at org.netbeans.modules.java.source.pretty.WidthEstimator.width(WidthEstimator.java:101) at org.netbeans.modules.java.source.pretty.WidthEstimator.visitSelect(WidthEstimator.java:284) at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2096) at org.netbeans.modules.java.source.pretty.WidthEstimator.estimateWidth(WidthEstimator.java:73) at org.netbeans.modules.java.source.pretty.VeryPretty.wrapTrees(VeryPretty.java:3276)
Created attachment 162789 [details] stacktrace
This bug already has 5 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=227092
Created attachment 164617 [details] stacktrace Attempting to generate equals() and hashCode() in a newly create source file for this class: public final class UriInfo { public final int weight; public final int priority; public final CharSequence uri; public UriInfo(int weight, int priority, CharSequence uri) { this.weight = checkPositiveOrZero(weight, "weight"); this.priority = checkPositiveOrZero(priority, "priority"); this.uri = checkNotNull(uri, "uri"); if (uri.length() == 0) { throw new IllegalArgumentException("URI may not be empty"); } if (weight > 65535) { throw new IllegalArgumentException("Weight must be a positive integer 0-65535 but got " + priority); } if (weight > 65535) { throw new IllegalArgumentException("Weight must be a positive integer 0-65535 but got " + priority); } } }
Created attachment 164618 [details] stacktrace Attempting to generate equals() and hashCode() for this class: public final class UriInfo { public final int weight; public final int priority; public final CharSequence uri; public UriInfo(int weight, int priority, CharSequence uri) { this.weight = checkPositiveOrZero(weight, "weight"); this.priority = checkPositiveOrZero(priority, "priority"); this.uri = checkNotNull(uri, "uri"); if (uri.length() == 0) { throw new IllegalArgumentException("URI may not be empty"); } if (weight > 65535) { throw new IllegalArgumentException("Weight must be a positive integer 0-65535 but got " + priority); } if (weight > 65535) { throw new IllegalArgumentException("Weight must be a positive integer 0-65535 but got " + priority); } } }
Created attachment 165284 [details] stacktrace Happens frequently when invoking insert code, which then fails.
Hmm, appears to have been fixed by a commit from dbalek on August 11, 2017. I don't think my build is older than that, but it's possible.
But it was not actually fixed. Here is the needed patch: diff --git a/java.source.base/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java b/java.source.base/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java --- a/java.source.base/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java +++ b/java.source.base/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java @@ -114,7 +114,11 @@ if (t == null) { return; } - if (t.owner != null && t.owner != symbols.rootPackage && t.owner != t.packge().modle.unnamedPackage + boolean notOwnedByUnnamedPackage = true; + if (t.packge() != null && t.packge().modle != null) { + notOwnedByUnnamedPackage = t.owner != t.packge().modle.unnamedPackage; + } + if (t.owner != null && t.owner != symbols.rootPackage && notOwnedByUnnamedPackage && !(t.type instanceof Type.TypeVar) && !(t.owner instanceof MethodSymbol)) { width++;
Created attachment 165311 [details] stacktrace Generating equals and hashCode
This bug already has 10 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=227092
Created attachment 165626 [details] Patch to fix - been running it for months This patch has been in the comments for months - what will it take to get it applied?