Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 419798
Collapse All | Expand All

(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java (+1 lines)
Lines 82-91 Link Here
82
82
83
	IrritantSet[] suppressWarningIrritants;  // irritant for suppressed warnings
83
	IrritantSet[] suppressWarningIrritants;  // irritant for suppressed warnings
84
	Annotation[] suppressWarningAnnotations;
84
	Annotation[] suppressWarningAnnotations;
85
	long[] suppressWarningScopePositions; // (start << 32) + end
85
	long[] suppressWarningScopePositions; // (start << 32) + end
86
	int suppressWarningsCount;
86
	int suppressWarningsCount;
87
	public ASTNode nodeBeingResolved;
87
88
88
public CompilationUnitDeclaration(ProblemReporter problemReporter, CompilationResult compilationResult, int sourceLength) {
89
public CompilationUnitDeclaration(ProblemReporter problemReporter, CompilationResult compilationResult, int sourceLength) {
89
	this.problemReporter = problemReporter;
90
	this.problemReporter = problemReporter;
90
	this.compilationResult = compilationResult;
91
	this.compilationResult = compilationResult;
91
	//by definition of a compilation unit....
92
	//by definition of a compilation unit....
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java (+4 lines)
Lines 316-326 Link Here
316
			lambda.returnsExpression(null,  methodType);
316
			lambda.returnsExpression(null,  methodType);
317
		if (methodType != null) scope.problemReporter().shouldReturn(methodType, this);
317
		if (methodType != null) scope.problemReporter().shouldReturn(methodType, this);
318
		return;
318
		return;
319
	}
319
	}
320
	
320
	
321
	CompilationUnitDeclaration referenceContext = scope.compilationUnitScope().referenceContext;
322
	ASTNode oldResolvNode = referenceContext.nodeBeingResolved;
323
	referenceContext.nodeBeingResolved = this.expression;
321
	expressionType = this.expression.resolveType(scope);
324
	expressionType = this.expression.resolveType(scope);
325
	referenceContext.nodeBeingResolved = oldResolvNode;
322
	if (lambda != null)
326
	if (lambda != null)
323
		lambda.returnsExpression(this.expression, expressionType);
327
		lambda.returnsExpression(this.expression, expressionType);
324
	
328
	
325
	if (expressionType == null) return;
329
	if (expressionType == null) return;
326
	if (expressionType == TypeBinding.VOID) {
330
	if (expressionType == TypeBinding.VOID) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-1 / +7 lines)
Lines 4575-4585 Link Here
4575
public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl, Object location) {
4575
public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl, Object location) {
4576
	this.referenceContext = compUnitDecl;
4576
	this.referenceContext = compUnitDecl;
4577
	String[] arguments = new String[] {CharOperation.toString(wellKnownTypeName)};
4577
	String[] arguments = new String[] {CharOperation.toString(wellKnownTypeName)};
4578
	int start = 0, end = 0;
4578
	int start = 0, end = 0;
4579
	if (location != null) {
4579
	if (location != null) {
4580
		if (location instanceof InvocationSite) {
4580
		ReferenceBinding refBinding;
4581
		if (compUnitDecl != null && compUnitDecl.nodeBeingResolved != null &&
4582
				location instanceof FieldDeclaration && ((refBinding = ((FieldDeclaration)location).binding.declaringClass).modifiers & ClassFileConstants.AccEnum) != 0 &&
4583
				!(compUnitDecl.getFileName().equals(refBinding instanceof SourceTypeBinding ? ((SourceTypeBinding)refBinding).getFileName(): null))) {
4584
			start = compUnitDecl.nodeBeingResolved.sourceStart;
4585
			end = compUnitDecl.nodeBeingResolved.sourceEnd;
4586
		} else if (location instanceof InvocationSite) {
4581
			InvocationSite site = (InvocationSite) location;
4587
			InvocationSite site = (InvocationSite) location;
4582
			start = site.sourceStart();
4588
			start = site.sourceStart();
4583
			end = site.sourceEnd();
4589
			end = site.sourceEnd();
4584
		} else if (location instanceof ASTNode) {
4590
		} else if (location instanceof ASTNode) {
4585
			ASTNode node = (ASTNode) location;
4591
			ASTNode node = (ASTNode) location;

Return to bug 419798