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.
Summary: | NullPointerException at org.netbeans.modules.java.source.pretty.WidthEstimator.widthQ | ||
---|---|---|---|
Product: | java | Reporter: | misterm <misterm> |
Component: | Compiler | Assignee: | Dusan Balek <dbalek> |
Status: | NEW --- | ||
Severity: | normal | CC: | chenar, fillumina, gtzabari, hmichel, rudyment, tboudreau |
Priority: | P3 | ||
Version: | Dev | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | 227092 |
Attachments: |
stacktrace
stacktrace stacktrace stacktrace stacktrace Patch to fix - been running it for months |
Description
misterm
2016-11-04 23:34:44 UTC
Created attachment 162789 [details]
stacktrace
This bug already has 5 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=227092 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?
|