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 JDK9 Branch (Build 201606110404) VM: Java HotSpot(TM) 64-Bit Server VM, 25.92-b14, Java(TM) SE Runtime Environment, 1.8.0_92-b14 OS: Windows 10 User Comments: zmirc: Same as before. Here is the current code of the class (I know it doesn't compile, because it's not finished). package dk.wordmaps.api.various; import dk.wordmaps.api.boundary.util.exceptions.ApiCallException; import dk.wordmaps.api.util.Config; import dk.wordmaps.shared.util.JSONStringUtils; import java.io.IOException; import javax.servlet.http.HttpServletResponse; import org.apache.http.StatusLine; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.json.JSONArray; import org.testng.annotations.Test; public class Danskkulturarv { private static final CloseableHttpClient HC = HttpClients.createDefault(); @Test public void step1() { HttpGet get = new HttpGet("http://api.larm.fm/v6/Session/Create"); try (CloseableHttpResponse r = HC.execute(get)) { StatusLine sl = r.getStatusLine(); GUEST: I was doing a copy paste of a entire method(signature and contents) from source file A into source file B. The paste location was located in a method of source file B. The resulting code had a method in a method then the error instantly occured. jan.kurnatowski: while editing Java code GUEST: Adding a try with resrouces statement with a Callable Statement GUEST: I was just typing code. GUEST: Error when declaring "try with resources" chunkyks: Create a new file, I called mine "NewClass" Enter this code: public class NewClass { public int test(Connection c) { PreparedStatement s = c.prepareStatement("SELECT 1"); return 0; } } Obviously this is broken So manually edit the code to change it to a try-with-resources, and this crash happens. Before "PreparedStatement", manually enter "try(", then delete the semicolon from the end and put in close parentheses. Instant crash seligor: NullPointerException during source editing tboudreau: Typing in editor atehrani: Copy/paste jan.kurnatowski: while editing Java code... vriha: pasted code from one class to another and used code completion jan.kurnatowski: while editing Java code (I have restarted IDE after reporting Exceptions 788010 788009 788007 and tried to reproduce this issue) GUEST: did an if statement opened the brace { and hit return GUEST: <Please provide a description of the problem or the steps to reproduce> vriha: copy pasted java code from one method to another terje7601: Same ... terje7601: Coding Java terje7601: Working on Java 9 code zmirc: Same as before. It's probably because I've just deleted the "catch" part of a try catch while I was doing some refactoring. GUEST: Error when declaring "try with resources" tboudreau: Pasting zmirc: Working with try catch in a Java method inside a TestNG test class fordfrog: This error occurred after writing try (final RS and pressing Ctrl+Space. AFAIK exceptions are fired until i close the ( with corresponding ) plus {} block and start the catch statement. The bug is there for more than week a guess, probably even longer. jskrivanek: I pasted block of code to a method. sreder: Just typing java code Lolmewn: Copy pasted a piece of code which included a try-with-resources block without a throw/catch block yet (was gonna add that with the help of hints but got this error instead). Also returns a boolean while method type is void. lvaills: I just removed a catch block from try with resources. gtzabari: Saved file. Exception thrown. GUEST: happened after closing merge screen GUEST: just editing GUEST: . jan.kurnatowski: while editing Java code jskrivanek: I removed catch block and method became uncompilable. Stacktrace: java.lang.NullPointerException at com.sun.tools.javac.model.JavacTypes.asMemberOf(JavacTypes.java:297) at org.netbeans.modules.java.hints.errors.UncaughtException.run(UncaughtException.java:354) at org.netbeans.modules.java.hints.infrastructure.CreatorBasedLazyFixList.compute(CreatorBasedLazyFixList.java:148) at org.netbeans.modules.java.hints.infrastructure.LazyHintComputation.run(LazyHintComputation.java:112) at org.netbeans.modules.java.hints.infrastructure.LazyHintComputation.run(LazyHintComputation.java:58) at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:298)
Created attachment 160093 [details] stacktrace