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 408230 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java (-1 / +107 lines)
Lines 1-11 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
7
 *
11
 *
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.model;
15
package org.eclipse.jdt.core.tests.model;
Lines 832-837 Link Here
832
	}
836
	}
833
	finally {
837
	finally {
834
		deleteProject("Test342393");
838
		deleteProject("Test342393");
835
	}
839
	}
836
}
840
}
841
// Bug 408230 - [1.8][hovering] NPE on hovering over a type inferred parameter in lambda expression
842
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=408230
843
public void testBug408230a() throws CoreException {
844
	try {
845
		createJavaProject("P", new String[] {"src"}, new String[] {"JCL18_LIB"}, "bin", "1.8");
846
		String source = "package p;\n" +
847
				"public class X {\n" +
848
				"  FI i1 = (a, b) -> a+b;\n" +
849
				"  void foo() {\n" +
850
				"	FI i2 = (a,barg) -> { return a+barg; };\n" +
851
				"  }\n" +
852
				"}\n" +
853
				"interface FI { int f1(int a, int b); }\n";
854
		createFolder("/P/src/p");
855
		createFile(
856
			"/P/src/p/X.java",
857
			source
858
		);
859
		waitForAutoBuild();
860
		
861
		ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java"); 
862
		String selectString = "barg";
863
		((ICodeAssist) unit).codeSelect(source.lastIndexOf(selectString), selectString.length());
864
	} finally {
865
		deleteProject("P");
866
	}
867
}
868
public void testBug408230b() throws CoreException {
869
	try {
870
		createJavaProject("P", new String[] {"src"}, new String[] {"JCL18_LIB"}, "bin", "1.8");
871
		String source = "package p;\n" +
872
				"public class X {\n" +
873
				"  FI i1 = (a, b) -> a+b;\n" +
874
				"  void foo() {\n" +
875
				"	FI i2 = (aarg) -> { return aarg; };\n" +
876
				"  }\n" +
877
				"}\n" +
878
				"interface FI { int f1(int a, int b); }\n";
879
		createFolder("/P/src/p");
880
		createFile(
881
			"/P/src/p/X.java",
882
			source
883
		);
884
		waitForAutoBuild();
885
		
886
		ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java"); 
887
		String selectString = "aarg";
888
		((ICodeAssist) unit).codeSelect(source.lastIndexOf(selectString), selectString.length());
889
	} finally {
890
		deleteProject("P");
891
	}
892
}
893
public void testBug408230c() throws CoreException {
894
	try {
895
		createJavaProject("P", new String[] {"src"}, new String[] {"JCL18_LIB"}, "bin", "1.8");
896
		String source = "package p;\n" +
897
				"public class X {\n" +
898
				"  FI i1 = (a, barg) -> a+barg;\n" +
899
				"  void foo() {\n" +
900
				"	FI i2 = (a,b) -> { return a+b; };\n" +
901
				"  }\n" +
902
				"}\n" +
903
				"interface FI { int f1(int a, int b); }\n";
904
		createFolder("/P/src/p");
905
		createFile(
906
			"/P/src/p/X.java",
907
			source
908
		);
909
		waitForAutoBuild();
910
		
911
		ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java"); 
912
		String selectString = "barg";
913
		((ICodeAssist) unit).codeSelect(source.lastIndexOf(selectString), selectString.length());
914
	} finally {
915
		deleteProject("P");
916
	}
917
}
918
public void testBug408230d() throws CoreException {
919
	try {
920
		createJavaProject("P", new String[] {"src"}, new String[] {"JCL18_LIB"}, "bin", "1.8");
921
		String source = "package p;\n" +
922
				"public class X {\n" +
923
				"  FI i1 = (aarg) -> aarg++;\n" +
924
				"  void foo() {\n" +
925
				"	FI i2 = (a,b) -> { return a+b; };\n" +
926
				"  }\n" +
927
				"}\n" +
928
				"interface FI { int f1(int a, int b); }\n";
929
		createFolder("/P/src/p");
930
		createFile(
931
			"/P/src/p/X.java",
932
			source
933
		);
934
		waitForAutoBuild();
935
		
936
		ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java"); 
937
		String selectString = "aarg";
938
		((ICodeAssist) unit).codeSelect(source.lastIndexOf(selectString), selectString.length());
939
	} finally {
940
		deleteProject("P");
941
	}
942
}
837
}
943
}
(-)a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java (+6 lines)
Lines 1439-1448 Link Here
1439
		this action is also performed when shifting token after recovery
1439
		this action is also performed when shifting token after recovery
1440
		got activated once.
1440
		got activated once.
1441
	*/
1441
	*/
1442
	recoveryTokenCheck();
1442
	recoveryTokenCheck();
1443
}
1443
}
1444
protected void consumeTypeElidedLambdaParameter(boolean parenthesized) {
1445
	if (this.astStack[this.astPtr] instanceof LocalDeclaration) {
1446
		this.astStack[this.astPtr].bits |= ASTNode.IsInitializedByLamdaExpression;
1447
	}
1448
	super.consumeTypeElidedLambdaParameter(parenthesized);
1449
}
1444
1450
1445
public  String toString() {
1451
public  String toString() {
1446
	String s = Util.EMPTY_STRING;
1452
	String s = Util.EMPTY_STRING;
1447
	s = s + "elementKindStack : int[] = {"; //$NON-NLS-1$
1453
	s = s + "elementKindStack : int[] = {"; //$NON-NLS-1$
1448
	for (int i = 0; i <= this.elementPtr; i++) {
1454
	for (int i = 0; i <= this.elementPtr; i++) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (-1 / +2 lines)
Lines 41-51 Link Here
41
	public final static int Bit3 = 0x4;					// return type (operator) | name reference kind (name ref) | implicit this (this ref) | is argument(local)
41
	public final static int Bit3 = 0x4;					// return type (operator) | name reference kind (name ref) | implicit this (this ref) | is argument(local)
42
	public final static int Bit4 = 0x8;					// return type (operator) | first assignment to local (name ref,local decl) | undocumented empty block (block, type and method decl)
42
	public final static int Bit4 = 0x8;					// return type (operator) | first assignment to local (name ref,local decl) | undocumented empty block (block, type and method decl)
43
	public final static int Bit5 = 0x10;					// value for return (expression) | has all method bodies (unit) | supertype ref (type ref) | resolved (field decl)
43
	public final static int Bit5 = 0x10;					// value for return (expression) | has all method bodies (unit) | supertype ref (type ref) | resolved (field decl)
44
	public final static int Bit6 = 0x20;					// depth (name ref, msg) | ignore need cast check (cast expression) | error in signature (method declaration/ initializer) | is recovered (annotation reference)
44
	public final static int Bit6 = 0x20;					// depth (name ref, msg) | ignore need cast check (cast expression) | error in signature (method declaration/ initializer) | is recovered (annotation reference)
45
	public final static int Bit7 = 0x40;					// depth (name ref, msg) | operator (operator) | need runtime checkcast (cast expression) | label used (labelStatement) | needFreeReturn (AbstractMethodDeclaration)
45
	public final static int Bit7 = 0x40;					// depth (name ref, msg) | operator (operator) | need runtime checkcast (cast expression) | label used (labelStatement) | needFreeReturn (AbstractMethodDeclaration)
46
	public final static int Bit8 = 0x80;					// depth (name ref, msg) | operator (operator) | unsafe cast (cast expression) | is default constructor (constructor declaration) | isElseStatementUnreachable (if statement)
46
	public final static int Bit8 = 0x80;					// depth (name ref, msg) | operator (operator) | unsafe cast (cast expression) | is default constructor (constructor declaration) | isElseStatementUnreachable (if statement) | IsInitializedByLambdaExpression (local declaration)
47
	public final static int Bit9 = 0x100;				// depth (name ref, msg) | operator (operator) | is local type (type decl) | isThenStatementUnreachable (if statement) | can be static
47
	public final static int Bit9 = 0x100;				// depth (name ref, msg) | operator (operator) | is local type (type decl) | isThenStatementUnreachable (if statement) | can be static
48
	public final static int Bit10= 0x200;				// depth (name ref, msg) | operator (operator) | is anonymous type (type decl)
48
	public final static int Bit10= 0x200;				// depth (name ref, msg) | operator (operator) | is anonymous type (type decl)
49
	public final static int Bit11 = 0x400;				// depth (name ref, msg) | operator (operator) | is member type (type decl)
49
	public final static int Bit11 = 0x400;				// depth (name ref, msg) | operator (operator) | is member type (type decl)
50
	public final static int Bit12 = 0x800;				// depth (name ref, msg) | operator (operator) | has abstract methods (type decl)
50
	public final static int Bit12 = 0x800;				// depth (name ref, msg) | operator (operator) | has abstract methods (type decl)
51
	public final static int Bit13 = 0x1000;			// depth (name ref, msg) | is secondary type (type decl)
51
	public final static int Bit13 = 0x1000;			// depth (name ref, msg) | is secondary type (type decl)
Lines 126-135 Link Here
126
	public static final int IsTypeElided = Bit2;  // type elided lambda argument.
126
	public static final int IsTypeElided = Bit2;  // type elided lambda argument.
127
	public static final int IsArgument = Bit3;
127
	public static final int IsArgument = Bit3;
128
	public static final int IsLocalDeclarationReachable = Bit31;
128
	public static final int IsLocalDeclarationReachable = Bit31;
129
	public static final int IsForeachElementVariable = Bit5;
129
	public static final int IsForeachElementVariable = Bit5;
130
	public static final int ShadowsOuterLocal = Bit22;
130
	public static final int ShadowsOuterLocal = Bit22;
131
	public static final int IsInitializedByLamdaExpression = Bit8;
131
132
132
	// for name refs or local decls
133
	// for name refs or local decls
133
	public static final int FirstAssignmentToLocal = Bit4;
134
	public static final int FirstAssignmentToLocal = Bit4;
134
135
135
	// for msg or field references
136
	// for msg or field references
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java (-10 / +75 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.parser;
15
package org.eclipse.jdt.internal.compiler.parser;
12
16
Lines 17-26 Link Here
17
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
21
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
18
import org.eclipse.jdt.internal.compiler.ast.Argument;
22
import org.eclipse.jdt.internal.compiler.ast.Argument;
19
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
23
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
20
import org.eclipse.jdt.internal.compiler.ast.Block;
24
import org.eclipse.jdt.internal.compiler.ast.Block;
21
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
25
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
26
import org.eclipse.jdt.internal.compiler.ast.LambdaExpression;
22
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
27
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
23
import org.eclipse.jdt.internal.compiler.ast.Statement;
28
import org.eclipse.jdt.internal.compiler.ast.Statement;
24
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
29
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
25
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
30
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
26
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
31
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
Lines 29-39 Link Here
29
34
30
	public Block blockDeclaration;
35
	public Block blockDeclaration;
31
	public RecoveredStatement[] statements;
36
	public RecoveredStatement[] statements;
32
	public int statementCount;
37
	public int statementCount;
33
	public boolean preserveContent = false;
38
	public boolean preserveContent = false;
34
	public RecoveredLocalVariable pendingArgument;
39
	public RecoveredLocalVariable [] pendingArguments = null;
35
40
36
	int pendingModifiers;
41
	int pendingModifiers;
37
	int pendingModifersSourceStart = -1;
42
	int pendingModifersSourceStart = -1;
38
	RecoveredAnnotation[] pendingAnnotations;
43
	RecoveredAnnotation[] pendingAnnotations;
39
	int pendingAnnotationCount;
44
	int pendingAnnotationCount;
Lines 54-63 Link Here
54
			return this; // ignore this element
59
			return this; // ignore this element
55
		}
60
		}
56
	}
61
	}
57
	return super.add(methodDeclaration, bracketBalanceValue);
62
	return super.add(methodDeclaration, bracketBalanceValue);
58
}
63
}
64
public void addPendingArgument(RecoveredLocalVariable pendingArg) {
65
	if (this.pendingArguments == null) {
66
		RecoveredLocalVariable recoveredLocalVariable [] = {pendingArg};
67
		this.pendingArguments = recoveredLocalVariable;
68
	}
69
	else {
70
		int length = this.pendingArguments.length;
71
		System.arraycopy(this.pendingArguments, 0, this.pendingArguments = new RecoveredLocalVariable[length+1], 0, length);
72
		this.pendingArguments[length] = pendingArg;
73
	}
74
}
59
/*
75
/*
60
 * Record a nested block declaration
76
 * Record a nested block declaration
61
 */
77
 */
62
public RecoveredElement add(Block nestedBlockDeclaration, int bracketBalanceValue) {
78
public RecoveredElement add(Block nestedBlockDeclaration, int bracketBalanceValue) {
63
	resetPendingModifiers();
79
	resetPendingModifiers();
Lines 70-82 Link Here
70
	}
86
	}
71
87
72
	RecoveredBlock element = new RecoveredBlock(nestedBlockDeclaration, this, bracketBalanceValue);
88
	RecoveredBlock element = new RecoveredBlock(nestedBlockDeclaration, this, bracketBalanceValue);
73
89
74
	// if we have a pending Argument, promote it into the new block
90
	// if we have a pending Argument, promote it into the new block
75
	if (this.pendingArgument != null){
91
	if (this.pendingArguments != null) {
76
		element.attach(this.pendingArgument);
92
		for (int indx = 0; indx < this.pendingArguments.length; indx++) {
77
		this.pendingArgument = null;
93
			element.attach(this.pendingArguments[indx]);			
94
		}
95
		this.pendingArguments = null;
78
	}
96
	}
79
	if(parser().statementRecoveryActivated) {
97
	if(parser().statementRecoveryActivated) {
80
		addBlockStatement(element);
98
		addBlockStatement(element);
81
	}
99
	}
82
	attach(element);
100
	attach(element);
Lines 129-139 Link Here
129
				this.pendingModifersSourceStart);
147
				this.pendingModifersSourceStart);
130
	}
148
	}
131
	resetPendingModifiers();
149
	resetPendingModifiers();
132
150
133
	if (localDeclaration instanceof Argument){
151
	if (localDeclaration instanceof Argument){
134
		this.pendingArgument = element;
152
		addPendingArgument(element);
135
		return this;
153
		return this;
136
	}
154
	}
137
155
138
	attach(element);
156
	attach(element);
139
	if (localDeclaration.declarationSourceEnd == 0) return element;
157
	if (localDeclaration.declarationSourceEnd == 0) return element;
Lines 277-287 Link Here
277
	return result.toString();
295
	return result.toString();
278
}
296
}
279
/*
297
/*
280
 * Rebuild a block from the nested structure which is in scope
298
 * Rebuild a block from the nested structure which is in scope
281
 */
299
 */
282
public Block updatedBlock(int depth, Set knownTypes){
300
public Block updatedBlock(int depth, Set knownTypes) {
301
	return updatedBlock(depth, knownTypes, false);
302
}
303
public Block updatedBlock(int depth, Set knownTypes, boolean lambdaExpressionExpected) {
283
304
284
	// if block was not marked to be preserved or empty, then ignore it
305
	// if block was not marked to be preserved or empty, then ignore it
285
	if (!this.preserveContent || this.statementCount == 0) return null;
306
	if (!this.preserveContent || this.statementCount == 0) return null;
286
307
287
	Statement[] updatedStatements = new Statement[this.statementCount];
308
	Statement[] updatedStatements = new Statement[this.statementCount];
Lines 323-335 Link Here
323
344
324
	int lastEnd = this.blockDeclaration.sourceStart;
345
	int lastEnd = this.blockDeclaration.sourceStart;
325
346
326
	// only collect the non-null updated statements
347
	// only collect the non-null updated statements
327
	for (int i = 0; i < this.statementCount; i++){
348
	for (int i = 0; i < this.statementCount; i++){
328
		Statement updatedStatement = this.statements[i].updatedStatement(depth, knownTypes);
349
		boolean lambdaExprInit = i > 0 && lambdaExpressionInitializable(this.statements[i-1]);
350
		Statement updatedStatement = this.statements[i].updatedStatement(depth, knownTypes, lambdaExprInit);
329
		if (updatedStatement != null){
351
		if (updatedStatement != null){
330
			updatedStatements[updatedCount++] = updatedStatement;
352
			LambdaExpression lambdaExpr = getLambdaExpression(updatedStatement);
353
			if (lambdaExprInit && lambdaExpr != null) {
354
				((LocalDeclaration)updatedStatements[updatedCount-1]).initialization = lambdaExpr;
355
			}
356
			else {
357
				updatedStatements[updatedCount++] = updatedStatement;
358
			}
331
359
332
			if (updatedStatement instanceof LocalDeclaration) {
360
			if (updatedStatement instanceof LocalDeclaration) {
333
				LocalDeclaration localDeclaration = (LocalDeclaration) updatedStatement;
361
				LocalDeclaration localDeclaration = (LocalDeclaration) updatedStatement;
334
				if(localDeclaration.declarationSourceEnd > lastEnd) {
362
				if(localDeclaration.declarationSourceEnd > lastEnd) {
335
					lastEnd = localDeclaration.declarationSourceEnd;
363
					lastEnd = localDeclaration.declarationSourceEnd;
Lines 351-361 Link Here
351
	// resize statement collection if necessary
379
	// resize statement collection if necessary
352
	if (updatedCount != this.statementCount){
380
	if (updatedCount != this.statementCount){
353
		this.blockDeclaration.statements = new Statement[updatedCount];
381
		this.blockDeclaration.statements = new Statement[updatedCount];
354
		System.arraycopy(updatedStatements, 0, this.blockDeclaration.statements, 0, updatedCount);
382
		System.arraycopy(updatedStatements, 0, this.blockDeclaration.statements, 0, updatedCount);
355
	} else {
383
	} else {
356
		this.blockDeclaration.statements = updatedStatements;
384
		LambdaExpression lambda = null;
385
		if (lambdaExpressionExpected && (lambda = canGetLambdaExpression(updatedStatements, updatedCount)) != null) {
386
			Statement [] stmt = {lambda};
387
			this.blockDeclaration.statements = stmt;
388
		}
389
		else {
390
			this.blockDeclaration.statements = updatedStatements;
391
		}
357
	}
392
	}
358
393
359
	if (this.blockDeclaration.sourceEnd == 0) {
394
	if (this.blockDeclaration.sourceEnd == 0) {
360
		if(lastEnd < bodyEndValue) {
395
		if(lastEnd < bodyEndValue) {
361
			this.blockDeclaration.sourceEnd = bodyEndValue;
396
			this.blockDeclaration.sourceEnd = bodyEndValue;
Lines 364-380 Link Here
364
		}
399
		}
365
	}
400
	}
366
401
367
	return this.blockDeclaration;
402
	return this.blockDeclaration;
368
}
403
}
404
public LambdaExpression getLambdaExpression (Statement stmnt) {
405
	if (stmnt instanceof LambdaExpression) {
406
		return (LambdaExpression)stmnt;
407
	}
408
	else if (stmnt instanceof Block && ((Block)stmnt).statements[0] instanceof LambdaExpression) {
409
		return (LambdaExpression)((Block)stmnt).statements[0];
410
	}
411
	return null;
412
}
413
public LambdaExpression canGetLambdaExpression (Statement [] statementsArray, int count) {
414
	for (int indx = 0; indx < count - 1; indx++) {
415
		if (!(statementsArray[indx] instanceof Argument)) {
416
			return null;
417
		}
418
	}
419
	Argument [] arguments = new Argument [count-1];
420
	System.arraycopy(statementsArray, 0, arguments, 0, count-1);
421
	return new LambdaExpression(parser().compilationUnit.compilationResult, arguments, statementsArray[count-1]);
422
}
369
/*
423
/*
370
 * Rebuild a statement from the nested structure which is in scope
424
 * Rebuild a statement from the nested structure which is in scope
371
 */
425
 */
372
public Statement updatedStatement(int depth, Set knownTypes){
426
public Statement updatedStatement(int depth, Set knownTypes){
373
427
374
	return updatedBlock(depth, knownTypes);
428
	return updatedBlock(depth, knownTypes);
375
}
429
}
430
public Statement updatedStatement(int depth, Set knownTypes, boolean lambdaExpressionExpected) {
431
432
	return lambdaExpressionExpected ? updatedBlock(depth, knownTypes, true) : updatedStatement(depth, knownTypes);
433
}
434
boolean lambdaExpressionInitializable(RecoveredStatement stmnt) {
435
	if (stmnt instanceof RecoveredLocalVariable) {
436
		RecoveredLocalVariable recLocVar = (RecoveredLocalVariable) stmnt;
437
		return recLocVar.localDeclaration != null && (recLocVar.localDeclaration.bits & ASTNode.IsInitializedByLamdaExpression) != 0;
438
	}
439
	return false;
440
}
376
/*
441
/*
377
 * A closing brace got consumed, might have closed the current element,
442
 * A closing brace got consumed, might have closed the current element,
378
 * in which case both the currentElement is exited
443
 * in which case both the currentElement is exited
379
 */
444
 */
380
public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){
445
public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd){
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java (-1 / +8 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.parser;
15
package org.eclipse.jdt.internal.compiler.parser;
12
16
Lines 42-51 Link Here
42
	return tabString(tab) + "Recovered statement:\n" + this.statement.print(tab + 1, new StringBuffer(10)); //$NON-NLS-1$
46
	return tabString(tab) + "Recovered statement:\n" + this.statement.print(tab + 1, new StringBuffer(10)); //$NON-NLS-1$
43
}
47
}
44
public Statement updatedStatement(int depth, Set knownTypes){
48
public Statement updatedStatement(int depth, Set knownTypes){
45
	return this.statement;
49
	return this.statement;
46
}
50
}
51
public Statement updatedStatement(int depth, Set knownTypes, boolean lambdaExpressionExpected) {
52
	return updatedStatement(depth, knownTypes);
53
}
47
public void updateParseTree(){
54
public void updateParseTree(){
48
	updatedStatement(0, new HashSet());
55
	updatedStatement(0, new HashSet());
49
}
56
}
50
/*
57
/*
51
 * Update the declarationSourceEnd of the corresponding parse node
58
 * Update the declarationSourceEnd of the corresponding parse node
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java (-2 / +6 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
8
 * Contributors:
12
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
13
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
14
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core;
15
package org.eclipse.jdt.internal.core;
12
16
Lines 449-459 Link Here
449
				new String(local.name),
453
				new String(local.name),
450
				local.declarationSourceStart,
454
				local.declarationSourceStart,
451
				local.declarationSourceEnd,
455
				local.declarationSourceEnd,
452
				local.sourceStart,
456
				local.sourceStart,
453
				local.sourceEnd,
457
				local.sourceEnd,
454
				Util.typeSignature(local.type),
458
				local.type == null ? Signature.createTypeSignature(local.binding.type.readableName(), false) : Util.typeSignature(local.type),
455
				local.annotations,
459
				local.annotations,
456
				local.modifiers,
460
				local.modifiers,
457
				local.getKind() == AbstractVariableDeclaration.PARAMETER);
461
				local.getKind() == AbstractVariableDeclaration.PARAMETER);
458
	}
462
	}
459
	if (localVar != null) {
463
	if (localVar != null) {

Return to bug 408230