View | Details | Raw Unified | Return to bug 270446
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java (+4 lines)
Lines 62-67 Link Here
62
		} else if (!constructorBinding.isOrEnclosedByPrivateType()) {
62
		} else if (!constructorBinding.isOrEnclosedByPrivateType()) {
63
			break checkUnused;
63
			break checkUnused;
64
 		}
64
 		}
65
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=270446, When the AST built is an abridged version
66
		// we don't have all tree nodes we would otherwise expect. (see ASTParser.setFocalPosition)
67
		if (this.constructorCall == null)
68
			break checkUnused; 
65
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=264991, Don't complain about this
69
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=264991, Don't complain about this
66
		// constructor being unused if the base class doesn't have a no-arg constructor.
70
		// constructor being unused if the base class doesn't have a no-arg constructor.
67
		// See that a seemingly unused constructor that chains to another constructor with a
71
		// See that a seemingly unused constructor that chains to another constructor with a
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java (+30 lines)
Lines 5539-5543 Link Here
5539
				workingCopy.discardWorkingCopy();
5539
				workingCopy.discardWorkingCopy();
5540
		}
5540
		}
5541
	}
5541
	}
5542
	
5543
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=270446. NPE while building abridged AST
5544
	public void test0610() throws CoreException {
5545
		ICompilationUnit workingCopy = null;
5546
		try {
5547
			workingCopy = getWorkingCopy(
5548
				"/Converter/src/X.java",
5549
				"public class X {\n" +
5550
				"	  private class B {\n" +
5551
				"	    public B() {\n" +
5552
				"	    }\n" +
5553
				"	  }\n" +
5554
				"	  public X() {\n" +
5555
				"	  }\n" +
5556
				"	}\n"
5557
			);
5558
			
5559
			// Create parser
5560
			ASTParser parser = ASTParser.newParser(AST.JLS3);
5561
			parser.setSource(workingCopy);
5562
			parser.setFocalPosition(0);
5563
			parser.setResolveBindings(true);
5564
5565
			ASTNode result = parser.createAST(null);
5566
			assertNotNull("Should get an AST", result);
5567
		} finally {
5568
			if (workingCopy != null)
5569
				workingCopy.discardWorkingCopy();
5570
		}
5571
	}
5542
5572
5543
}
5573
}

Return to bug 270446