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.
This bug was originally marked as duplicate of bug 230937, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related. Build: NetBeans IDE Dev (Build 201512070002) VM: Java HotSpot(TM) 64-Bit Server VM, 25.60-b23, Java(TM) SE Runtime Environment, 1.8.0_60-b27 OS: Windows 7 User Comments: terje7601: An NPE during coding Stacktrace: java.lang.NullPointerException at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1141) at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:842) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:286) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1120)
Created attachment 157695 [details] stacktrace
Created attachment 157696 [details] dump file mentioned in the exception dialog
Created attachment 157698 [details] IDE log
Created attachment 157834 [details] stacktrace Happened during code completion
Created attachment 157845 [details] stacktrace Happened during code completion of JsonObject
Created attachment 158215 [details] stacktrace Happened during annotating an annotation (typing @)
This bug already has 5 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=221545
Created attachment 158296 [details] stacktrace I was typing inside of a newly-added JPA @Query annotation when the error message came up.
Created attachment 158411 [details] stacktrace Opened file in Java editor. Exception thrown.
This bug already has 20 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=221545
Dusan, This exception is taking down the entire IDE. If I code-format after saving code that generates this exception, the Swing thread hangs (indefinitely) running some endless task and I am forced to kill the process. This is 100% reproducible.
Product Version: NetBeans IDE Dev (Build 201605170002) Java: 1.8.0_92; Java HotSpot(TM) 64-Bit Server VM 25.92-b14 Runtime: Java(TM) SE Runtime Environment 1.8.0_92-b14 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 Repro steps: 1. Create new Maven Java project 2. Create a new class and save it: package websitemonitor.backend.entity; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import com.google.common.collect.ImmutableList; import com.vtlr.backend.ToJsonString; import java.net.URI; import java.util.List; import org.bitbucket.cowwoc.preconditions.Preconditions; /** * A collection of pages. * <p> * @author Gili Tzabari */ public final class PagesEntities { /** * The content-type of the JSON representation of this resource. */ public static final String JSON_TYPE = "application/x-websitemonitor.Pages+json; version=1; charset=utf-8"; /** * The entity returned by HTTP GET uri:pages. */ public static final class GetPages { /** * The address of the page. */ private final URI uri; /** * The canonical address of the page. */ private final URI canonicalUri; /** * Indicates how long it took for the page to load. */ private final Duration loadTime; /** * The HTTP status code returned when loading the page. */ private final int statusCode; /** * Links that refer to malformed URLs. */ private final List<String> invalidLinks = new ArrayList<>(); /** * Links that refer to well-formed URLs. */ private final List<URI> validLinks = new ArrayList<>(); /** * Creates a new GetCompanies. * <p> * @param companies the list of companies * @throws NullPointerException if companies is null */ @JsonCreator public GetCompanies(List<URI> companies) throws NullPointerException { Preconditions.requireThat(companies, "companies").isNotNull(); this.companies = ImmutableList.copyOf(companies); } /** * @return the list of companies */ @JsonValue @SuppressWarnings("ReturnOfCollectionOrArrayField") public List<URI> getCompanies() { return companies; } @Override public String toString() { return new ToJsonString(getClass(), this).toString(); } } /** * Prevent construction. */ private CompaniesEntities() { } } 3. Netbeans will throw the following exception: java.lang.NullPointerException at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1141) at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:842) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:286) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1120) at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:748) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:286) at com.sun.tools.javac.code.TypeAnnotations$1.run(TypeAnnotations.java:124) at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:179) at com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:130) at com.sun.tools.javac.comp.Enter.complete(Enter.java:738) at org.netbeans.lib.nbjavac.services.NBJavadocEnter.main(NBJavadocEnter.java:84) at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:995) at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:369) at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:311) at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:630) at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:496) at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:163) at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:631) at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:262) at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:798) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:304) at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:725) [catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:686) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058) 4. Close the Exception Reporter dialog. 5. Invoke code-format. 6. Save the file. 7. IDE will hang indefinitely. Process must be killed. This is 100% reproducible.
Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/5a6f2b6ec074 http://hg.netbeans.org/main/nb-javac/rev/e63522d2d8d2
Dusan, What about the bigger bug of the IDE hanging if a parsing error occuring? Did you take a look at that?
Integrated into 'main-silver', will be available in build *201605260002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/5a6f2b6ec074 User: Dusan Balek <dbalek@netbeans.org> Log: Issue #257020 - NullPointerException at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef - fixed.
Thanks. Verified as fixed Product Version: NetBeans IDE Dev (Build 201606010002)