package sandbox; /** * Demonstrates how to replicate issue 236155 * https://netbeans.org/bugzilla/show_bug.cgi?id=236155 * * Steps: * * 1) in the testSomething() method, highlight the code between the two comments * 2) Copy the highlighted code using ctrl+c * 3) Place cursor in the testSomethingElse() method between the two comments * 4) Paste the copied code using ctrl+v * * This will trigger the NullPointerException consistently in dev 2013 09 26 * * @author Jacob Dilles */ public class Issue236155 { static void run(Runnable r) { r.run(); } static abstract class RunnableImpl implements Runnable { public void run() { doSomething(); } abstract void doSomething(); } public void testSomething() { // start highlight here V run(new RunnableImpl() { @Override void doSomething() { } }); // ^ end highlight here } public void testSomethingElse() { // Place cursor below this line and CTRL+V to paste //Plase cursor above this line when pasting } }