View | Details | Raw Unified | Return to bug 308980 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java (-2 / +12 lines)
Lines 16-28 Link Here
16
import java.util.HashSet;
16
import java.util.HashSet;
17
import java.util.Set;
17
import java.util.Set;
18
18
19
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
19
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
20
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
20
import org.eclipse.jdt.internal.compiler.ast.Annotation;
21
import org.eclipse.jdt.internal.compiler.ast.Annotation;
21
import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference;
22
import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference;
22
import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
23
import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
23
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
24
import org.eclipse.jdt.internal.compiler.ast.Expression;
24
import org.eclipse.jdt.internal.compiler.ast.Expression;
25
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.SingleTypeReference;
26
import org.eclipse.jdt.internal.compiler.ast.Statement;
27
import org.eclipse.jdt.internal.compiler.ast.Statement;
27
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
28
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
28
29
Lines 247-253 Link Here
247
				updateSourceEndIfNecessary(braceEnd - 1);
248
				updateSourceEndIfNecessary(braceEnd - 1);
248
				return this.parent;
249
				return this.parent;
249
			} else {
250
			} else {
250
				this.alreadyCompletedFieldInitialization = true;
251
				if (this.fieldDeclaration.declarationSourceEnd > 0)
252
					this.alreadyCompletedFieldInitialization = true;
251
			}
253
			}
252
		}
254
		}
253
		return this;
255
		return this;
Lines 276-281 Link Here
276
		this.bracketBalance++;
278
		this.bracketBalance++;
277
		return null; // no update is necessary	(enum constant)
279
		return null; // no update is necessary	(enum constant)
278
	}
280
	}
281
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980
282
	if (this.fieldDeclaration.declarationSourceEnd == 0
283
		&& this.fieldDeclaration.type instanceof SingleTypeReference) {
284
		// array initializer somewhere in the field declaration even when it isn't an array
285
		// type (eg. int x = new int[] { ...)
286
		this.bracketBalance++;
287
		return null;
288
	}
279
	// might be an array initializer
289
	// might be an array initializer
280
	this.updateSourceEndIfNecessary(braceStart - 1, braceEnd - 1);
290
	this.updateSourceEndIfNecessary(braceStart - 1, braceEnd - 1);
281
	return this.parent.updateOnOpeningBrace(braceStart, braceEnd);
291
	return this.parent.updateOnOpeningBrace(braceStart, braceEnd);
(-)src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java (-63 / +35 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 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
Lines 1839-1845 Link Here
1839
	String completeBehind = "zzz";
1839
	String completeBehind = "zzz";
1840
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
1840
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
1841
1841
1842
	String expectedCompletionNodeToString = "<NONE>";
1842
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
1843
	String expectedParentNodeToString = "<NONE>";
1843
	String expectedParentNodeToString = "<NONE>";
1844
	String completionIdentifier = "zzz";
1844
	String completionIdentifier = "zzz";
1845
	String expectedReplacedSource = "zzz";
1845
	String expectedReplacedSource = "zzz";
Lines 1848-1853 Link Here
1848
		"public class X {\n" +
1848
		"public class X {\n" +
1849
		"  Object o;\n" +
1849
		"  Object o;\n" +
1850
		"  {\n" +
1850
		"  {\n" +
1851
		"    <CompleteOnName:zzz>;\n" +
1851
		"  }\n" +
1852
		"  }\n" +
1852
		"  public X() {\n" +
1853
		"  public X() {\n" +
1853
		"  }\n" +
1854
		"  }\n" +
Lines 2063-2069 Link Here
2063
	String completeBehind = "zzz";
2064
	String completeBehind = "zzz";
2064
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
2065
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
2065
2066
2066
	String expectedCompletionNodeToString = "<NONE>";
2067
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
2067
	String expectedParentNodeToString = "<NONE>";
2068
	String expectedParentNodeToString = "<NONE>";
2068
	String completionIdentifier = "zzz";
2069
	String completionIdentifier = "zzz";
2069
	String expectedReplacedSource = "zzz";
2070
	String expectedReplacedSource = "zzz";
Lines 2072-2077 Link Here
2072
		"public class X {\n" +
2073
		"public class X {\n" +
2073
		"  Object o;\n" +
2074
		"  Object o;\n" +
2074
		"  {\n" +
2075
		"  {\n" +
2076
		"    <CompleteOnName:zzz>;\n" +
2075
		"  }\n" +
2077
		"  }\n" +
2076
		"  public X() {\n" +
2078
		"  public X() {\n" +
2077
		"  }\n" +
2079
		"  }\n" +
Lines 4115-4130 Link Here
4115
	String completeBehind = "zzz";
4117
	String completeBehind = "zzz";
4116
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4118
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4117
4119
4118
	String expectedCompletionNodeToString = "<NONE>";
4120
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4119
	String expectedParentNodeToString = "<NONE>";
4121
	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
4120
	String completionIdentifier = "zzz";
4122
	String completionIdentifier = "zzz";
4121
	String expectedReplacedSource = "zzz";
4123
	String expectedReplacedSource = "zzz";
4122
	String expectedUnitDisplayString =
4124
	String expectedUnitDisplayString =
4123
		"package p;\n" +
4125
		"package p;\n" +
4124
		"public class X {\n" +
4126
		"public class X {\n" +
4125
		"  Object o;\n" +
4127
		"  Object o = new X[]{<CompleteOnName:zzz>};\n" +
4126
		"  {\n" +
4127
		"  }\n" +
4128
		"  public X() {\n" +
4128
		"  public X() {\n" +
4129
		"  }\n" +
4129
		"  }\n" +
4130
		"}\n";
4130
		"}\n";
Lines 4150-4165 Link Here
4150
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4150
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4151
4151
4152
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4152
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4153
	String expectedParentNodeToString = "<NONE>";
4153
	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
4154
	String completionIdentifier = "zzz";
4154
	String completionIdentifier = "zzz";
4155
	String expectedReplacedSource = "zzz";
4155
	String expectedReplacedSource = "zzz";
4156
	String expectedUnitDisplayString =
4156
	String expectedUnitDisplayString =
4157
			"package p;\n" +
4157
			"package p;\n" +
4158
			"public class X {\n" +
4158
			"public class X {\n" +
4159
			"  Object o;\n" +
4159
			"  Object o = new X[]{<CompleteOnName:zzz>};\n" +			
4160
			"  {\n" +
4161
			"    <CompleteOnName:zzz>;\n" +
4162
			"  }\n" +
4163
			"  public X() {\n" +
4160
			"  public X() {\n" +
4164
			"  }\n" +
4161
			"  }\n" +
4165
			"}\n";
4162
			"}\n";
Lines 4332-4347 Link Here
4332
	String completeBehind = "zzz";
4329
	String completeBehind = "zzz";
4333
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4330
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4334
4331
4335
	String expectedCompletionNodeToString = "<NONE>";
4332
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4336
	String expectedParentNodeToString = "<NONE>";
4333
	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
4337
	String completionIdentifier = "zzz";
4334
	String completionIdentifier = "zzz";
4338
	String expectedReplacedSource = "zzz";
4335
	String expectedReplacedSource = "zzz";
4339
	String expectedUnitDisplayString =
4336
	String expectedUnitDisplayString =
4340
		"package p;\n" +
4337
		"package p;\n" +
4341
		"public class X {\n" +
4338
		"public class X {\n" +
4342
		"  Object o;\n" +
4339
		"  Object o = new X[]{<CompleteOnName:zzz>};\n" +
4343
		"  {\n" +
4344
		"  }\n" +
4345
		"  public X() {\n" +
4340
		"  public X() {\n" +
4346
		"  }\n" +
4341
		"  }\n" +
4347
		"}\n";
4342
		"}\n";
Lines 4368-4383 Link Here
4368
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4363
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4369
4364
4370
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4365
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4371
	String expectedParentNodeToString = "<NONE>";
4366
	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
4372
	String completionIdentifier = "zzz";
4367
	String completionIdentifier = "zzz";
4373
	String expectedReplacedSource = "zzz";
4368
	String expectedReplacedSource = "zzz";
4374
	String expectedUnitDisplayString =
4369
	String expectedUnitDisplayString =
4375
			"package p;\n" +
4370
			"package p;\n" +
4376
			"public class X {\n" +
4371
			"public class X {\n" +
4377
			"  Object o;\n" +
4372
			"  Object o = new X[]{<CompleteOnName:zzz>};\n" +
4378
			"  {\n" +
4379
			"    <CompleteOnName:zzz>;\n" +
4380
			"  }\n" +
4381
			"  public X() {\n" +
4373
			"  public X() {\n" +
4382
			"  }\n" +
4374
			"  }\n" +
4383
			"}\n";
4375
			"}\n";
Lines 4927-4942 Link Here
4927
	String completeBehind = "zzz";
4919
	String completeBehind = "zzz";
4928
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4920
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4929
4921
4930
	String expectedCompletionNodeToString = "<NONE>";
4922
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4931
	String expectedParentNodeToString = "<NONE>";
4923
	String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}";
4932
	String completionIdentifier = "zzz";
4924
	String completionIdentifier = "zzz";
4933
	String expectedReplacedSource = "zzz";
4925
	String expectedReplacedSource = "zzz";
4934
	String expectedUnitDisplayString =
4926
	String expectedUnitDisplayString =
4935
		"package p;\n" +
4927
		"package p;\n" +
4936
		"public class X {\n" +
4928
		"public class X {\n" +
4937
		"  int o;\n" +
4929
		"  int o = new int[]{<CompleteOnName:zzz>};\n" +
4938
		"  {\n" +
4939
		"  }\n" +
4940
		"  public X() {\n" +
4930
		"  public X() {\n" +
4941
		"  }\n" +
4931
		"  }\n" +
4942
		"}\n";
4932
		"}\n";
Lines 4962-4977 Link Here
4962
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4952
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
4963
4953
4964
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4954
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
4965
	String expectedParentNodeToString = "<NONE>";
4955
	String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}";
4966
	String completionIdentifier = "zzz";
4956
	String completionIdentifier = "zzz";
4967
	String expectedReplacedSource = "zzz";
4957
	String expectedReplacedSource = "zzz";
4968
	String expectedUnitDisplayString =
4958
	String expectedUnitDisplayString =
4969
			"package p;\n" +
4959
			"package p;\n" +
4970
			"public class X {\n" +
4960
			"public class X {\n" +
4971
			"  int o;\n" +
4961
			"  int o = new int[]{<CompleteOnName:zzz>};\n" +
4972
			"  {\n" +
4973
			"    <CompleteOnName:zzz>;\n" +
4974
			"  }\n" +
4975
			"  public X() {\n" +
4962
			"  public X() {\n" +
4976
			"  }\n" +
4963
			"  }\n" +
4977
			"}\n";
4964
			"}\n";
Lines 5148-5163 Link Here
5148
	String completeBehind = "zzz";
5135
	String completeBehind = "zzz";
5149
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5136
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5150
5137
5151
	String expectedCompletionNodeToString = "<NONE>";
5138
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5152
	String expectedParentNodeToString = "<NONE>";
5139
	String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}";
5153
	String completionIdentifier = "zzz";
5140
	String completionIdentifier = "zzz";
5154
	String expectedReplacedSource = "zzz";
5141
	String expectedReplacedSource = "zzz";
5155
	String expectedUnitDisplayString =
5142
	String expectedUnitDisplayString =
5156
		"package p;\n" +
5143
		"package p;\n" +
5157
		"public class X {\n" +
5144
		"public class X {\n" +
5158
		"  int o;\n" +
5145
		"  int o = new int[]{<CompleteOnName:zzz>};\n" +
5159
		"  {\n" +
5160
		"  }\n" +
5161
		"  public X() {\n" +
5146
		"  public X() {\n" +
5162
		"  }\n" +
5147
		"  }\n" +
5163
		"}\n";
5148
		"}\n";
Lines 5184-5199 Link Here
5184
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5169
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5185
5170
5186
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5171
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5187
	String expectedParentNodeToString = "<NONE>";
5172
	String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}";
5188
	String completionIdentifier = "zzz";
5173
	String completionIdentifier = "zzz";
5189
	String expectedReplacedSource = "zzz";
5174
	String expectedReplacedSource = "zzz";
5190
	String expectedUnitDisplayString =
5175
	String expectedUnitDisplayString =
5191
			"package p;\n" +
5176
			"package p;\n" +
5192
			"public class X {\n" +
5177
			"public class X {\n" +
5193
			"  int o;\n" +
5178
			"  int o = new int[]{<CompleteOnName:zzz>};\n" +
5194
			"  {\n" +
5195
			"    <CompleteOnName:zzz>;\n" +
5196
			"  }\n" +
5197
			"  public X() {\n" +
5179
			"  public X() {\n" +
5198
			"  }\n" +
5180
			"  }\n" +
5199
			"}\n";
5181
			"}\n";
Lines 5381-5396 Link Here
5381
	String completeBehind = "zzz";
5363
	String completeBehind = "zzz";
5382
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5364
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5383
5365
5384
	String expectedCompletionNodeToString = "<NONE>";
5366
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5385
	String expectedParentNodeToString = "<NONE>";
5367
	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
5386
	String completionIdentifier = "zzz";
5368
	String completionIdentifier = "zzz";
5387
	String expectedReplacedSource = "zzz";
5369
	String expectedReplacedSource = "zzz";
5388
	String expectedUnitDisplayString =
5370
	String expectedUnitDisplayString =
5389
		"package p;\n" +
5371
		"package p;\n" +
5390
		"public class X {\n" +
5372
		"public class X {\n" +
5391
		"  X o;\n" +
5373
		"  X o = new X[]{<CompleteOnName:zzz>};\n" +
5392
		"  {\n" +
5393
		"  }\n" +
5394
		"  public X() {\n" +
5374
		"  public X() {\n" +
5395
		"  }\n" +
5375
		"  }\n" +
5396
		"}\n";
5376
		"}\n";
Lines 5416-5431 Link Here
5416
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5396
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5417
5397
5418
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5398
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5419
	String expectedParentNodeToString = "<NONE>";
5399
	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
5420
	String completionIdentifier = "zzz";
5400
	String completionIdentifier = "zzz";
5421
	String expectedReplacedSource = "zzz";
5401
	String expectedReplacedSource = "zzz";
5422
	String expectedUnitDisplayString =
5402
	String expectedUnitDisplayString =
5423
			"package p;\n" +
5403
			"package p;\n" +
5424
			"public class X {\n" +
5404
			"public class X {\n" +
5425
			"  X o;\n" +
5405
			"  X o = new X[]{<CompleteOnName:zzz>};\n" +
5426
			"  {\n" +
5427
			"    <CompleteOnName:zzz>;\n" +
5428
			"  }\n" +
5429
			"  public X() {\n" +
5406
			"  public X() {\n" +
5430
			"  }\n" +
5407
			"  }\n" +
5431
			"}\n";
5408
			"}\n";
Lines 5601-5616 Link Here
5601
	String completeBehind = "zzz";
5578
	String completeBehind = "zzz";
5602
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5579
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5603
5580
5604
	String expectedCompletionNodeToString = "<NONE>";
5581
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5605
	String expectedParentNodeToString = "<NONE>";
5582
	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
5606
	String completionIdentifier = "zzz";
5583
	String completionIdentifier = "zzz";
5607
	String expectedReplacedSource = "zzz";
5584
	String expectedReplacedSource = "zzz";
5608
	String expectedUnitDisplayString =
5585
	String expectedUnitDisplayString =
5609
		"package p;\n" +
5586
		"package p;\n" +
5610
		"public class X {\n" +
5587
		"public class X {\n" +
5611
		"  X o;\n" +
5588
		"  X o = new X[]{<CompleteOnName:zzz>};\n" +
5612
		"  {\n" +
5613
		"  }\n" +
5614
		"  public X() {\n" +
5589
		"  public X() {\n" +
5615
		"  }\n" +
5590
		"  }\n" +
5616
		"}\n";
5591
		"}\n";
Lines 5637-5652 Link Here
5637
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5612
	int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1;
5638
5613
5639
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5614
	String expectedCompletionNodeToString = "<CompleteOnName:zzz>";
5640
	String expectedParentNodeToString = "<NONE>";
5615
	String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}";
5641
	String completionIdentifier = "zzz";
5616
	String completionIdentifier = "zzz";
5642
	String expectedReplacedSource = "zzz";
5617
	String expectedReplacedSource = "zzz";
5643
	String expectedUnitDisplayString =
5618
	String expectedUnitDisplayString =
5644
			"package p;\n" +
5619
			"package p;\n" +
5645
			"public class X {\n" +
5620
			"public class X {\n" +
5646
			"  X o;\n" +
5621
			"  X o = new X[]{<CompleteOnName:zzz>};\n" +
5647
			"  {\n" +
5648
			"    <CompleteOnName:zzz>;\n" +
5649
			"  }\n" +
5650
			"  public X() {\n" +
5622
			"  public X() {\n" +
5651
			"  }\n" +
5623
			"  }\n" +
5652
			"}\n";
5624
			"}\n";
(-)src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java (-16 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 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
Lines 3952-3959 Link Here
3952
		"  class Y {\n" +
3952
		"  class Y {\n" +
3953
		"    public String s;\n" +
3953
		"    public String s;\n" +
3954
		"    static int y;\n" +
3954
		"    static int y;\n" +
3955
		"    {\n" +
3956
		"    }\n" +
3957
		"    public int i = 0;\n" +
3955
		"    public int i = 0;\n" +
3958
		"    Y() {\n" +
3956
		"    Y() {\n" +
3959
		"    }\n" +
3957
		"    }\n" +
Lines 3973-3981 Link Here
3973
		"  class Y {\n" +
3971
		"  class Y {\n" +
3974
		"    public String s;\n" +
3972
		"    public String s;\n" +
3975
		"    static int y;\n" +
3973
		"    static int y;\n" +
3976
		"    {\n" +
3977
		"      ;\n" +
3978
		"    }\n" +
3979
		"    public int i = 0;\n" +
3974
		"    public int i = 0;\n" +
3980
		"    Y() {\n" +
3975
		"    Y() {\n" +
3981
		"      super();\n" +
3976
		"      super();\n" +
Lines 4000-4007 Link Here
4000
		"  class Y {\n" +
3995
		"  class Y {\n" +
4001
		"    public String s;\n" +
3996
		"    public String s;\n" +
4002
		"    static int y;\n" +
3997
		"    static int y;\n" +
4003
		"    {\n" +
4004
		"    }\n" +
4005
		"    public int i;\n" +
3998
		"    public int i;\n" +
4006
		"    Y() {\n" +
3999
		"    Y() {\n" +
4007
		"    }\n" +
4000
		"    }\n" +
Lines 6386-6395 Link Here
6386
	String expectedCompletionDietUnitToString =
6379
	String expectedCompletionDietUnitToString =
6387
		"public class X {\n" +
6380
		"public class X {\n" +
6388
		"  static int B;\n" +
6381
		"  static int B;\n" +
6389
		"  {\n" +
6390
		"  }\n" +
6391
		"  {\n" +
6392
		"  }\n" +
6393
		"  public X() {\n" +
6382
		"  public X() {\n" +
6394
		"  }\n" +
6383
		"  }\n" +
6395
		"  <clinit>() {\n" +
6384
		"  <clinit>() {\n" +
Lines 6517-6526 Link Here
6517
	String expectedCompletionDietUnitToString =
6506
	String expectedCompletionDietUnitToString =
6518
		"public class X {\n" +
6507
		"public class X {\n" +
6519
		"  int a;\n" +
6508
		"  int a;\n" +
6520
		"  {\n" +
6509
		"  int b;\n" +
6521
		"  }\n" +
6522
		"  {\n" +
6523
		"  }\n" +
6524
		"  public X() {\n" +
6510
		"  public X() {\n" +
6525
		"  }\n" +
6511
		"  }\n" +
6526
		"}\n";
6512
		"}\n";
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+44 lines)
Lines 21043-21046 Link Here
21043
			"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), 27}",
21043
			"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), 27}",
21044
			requestor.getResults());
21044
			requestor.getResults());
21045
}
21045
}
21046
21047
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980
21048
public void testBug308980() throws JavaModelException {
21049
	this.workingCopies = new ICompilationUnit[1];
21050
	this.workingCopies[0] = getWorkingCopy(
21051
		"/Completion/src/test/Try.java",
21052
		"package test;\n" +
21053
		"import java.util.Arrays;\n" +
21054
		"public class Try {\n" +
21055
		"	public static final AClass a1 = new JustTry(\n" +
21056
		"								new byte[][] {\n" +
21057
		"								{0x00,0x3C},\n" +
21058
		"								{0x04,0x2C}}) {\n" +
21059
		"									int justReturn (int a){\n" +
21060
		"										return a;\n" +
21061
		"									}\n" +
21062
		"								};\n" +
21063
		"   public static final AC" +
21064
		"}\n" +
21065
		"class AClass{\n" +
21066
		"	public byte[][] field1;\n" +
21067
		"	public AClass(byte[][] byteArray) {\n" +
21068
		"		field1 = byteArray;\n" +
21069
		"	}\n" +
21070
		"}\n" +
21071
		"abstract class JustTry extends Try {\n" +
21072
		"	public byte[][] field1;\n" +
21073
		"	public JustTry (byte[][] byteArray){\n" +
21074
		"		field1 = byteArray;\n" +
21075
		"	}\n" +
21076
		"	abstract int justReturn(int a);\n" +
21077
		"}\n");
21078
21079
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
21080
	requestor.allowAllRequiredProposals();
21081
	String str = this.workingCopies[0].getSource();
21082
	String completeBehind = "public static final AC";
21083
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
21084
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
21085
21086
	assertResults(
21087
			"AClass[TYPE_REF]{AClass, test, Ltest.AClass;, null, null, 27}",
21088
			requestor.getResults());
21089
}
21046
}
21090
}

Return to bug 308980