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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-18 / +10 lines)
Lines 328-334 Link Here
328
		constructor.constructorCall.sourceEnd = this.sourceEnd;
328
		constructor.constructorCall.sourceEnd = this.sourceEnd;
329
	}
329
	}
330
330
331
	//adding the constructor in the methods list
331
	//adding the constructor in the methods list: rank is not critical since bindings will be sorted
332
	if (needToInsert) {
332
	if (needToInsert) {
333
		if (this.methods == null) {
333
		if (this.methods == null) {
334
			this.methods = new AbstractMethodDeclaration[] { constructor };
334
			this.methods = new AbstractMethodDeclaration[] { constructor };
Lines 347-353 Link Here
347
	return constructor;
347
	return constructor;
348
}
348
}
349
349
350
// anonymous type constructor creation
350
// anonymous type constructor creation: rank is important since bindings already got sorted
351
public MethodBinding createDefaultConstructorWithBinding(MethodBinding inheritedConstructorBinding) {
351
public MethodBinding createDefaultConstructorWithBinding(MethodBinding inheritedConstructorBinding) {
352
	//Add to method'set, the default constuctor that just recall the
352
	//Add to method'set, the default constuctor that just recall the
353
	//super constructor with the same arguments
353
	//super constructor with the same arguments
Lines 390-426 Link Here
390
		this.methods = new AbstractMethodDeclaration[] { constructor };
390
		this.methods = new AbstractMethodDeclaration[] { constructor };
391
	} else {
391
	} else {
392
		AbstractMethodDeclaration[] newMethods;
392
		AbstractMethodDeclaration[] newMethods;
393
		System.arraycopy(
393
		System.arraycopy(this.methods, 0, newMethods = new AbstractMethodDeclaration[this.methods.length + 1], 1, this.methods.length);
394
			this.methods,
395
			0,
396
			newMethods = new AbstractMethodDeclaration[this.methods.length + 1],
397
			1,
398
			this.methods.length);
399
		newMethods[0] = constructor;
394
		newMethods[0] = constructor;
400
		this.methods = newMethods;
395
		this.methods = newMethods;
401
	}
396
	}
402
397
403
	//============BINDING UPDATE==========================
398
	//============BINDING UPDATE==========================
399
	SourceTypeBinding sourceType = this.binding;
404
	constructor.binding = new MethodBinding(
400
	constructor.binding = new MethodBinding(
405
			constructor.modifiers, //methodDeclaration
401
			constructor.modifiers, //methodDeclaration
406
			argumentsLength == 0 ? Binding.NO_PARAMETERS : argumentTypes, //arguments bindings
402
			argumentsLength == 0 ? Binding.NO_PARAMETERS : argumentTypes, //arguments bindings
407
			inheritedConstructorBinding.thrownExceptions, //exceptions
403
			inheritedConstructorBinding.thrownExceptions, //exceptions
408
			this.binding); //declaringClass
404
			sourceType); //declaringClass
409
			
405
			
410
	constructor.scope = new MethodScope(this.scope, constructor, true);
406
	constructor.scope = new MethodScope(this.scope, constructor, true);
411
	constructor.bindArguments();
407
	constructor.bindArguments();
412
	constructor.constructorCall.resolve(constructor.scope);
408
	constructor.constructorCall.resolve(constructor.scope);
413
409
414
	MethodBinding[] oldMethods = this.binding.methods(); // trigger sorting
410
	MethodBinding[] oldMethods = sourceType.methods(); // trigger sorting
415
	MethodBinding[] newMethods;
411
	MethodBinding[] newMethods;
416
	System.arraycopy(
412
	System.arraycopy(oldMethods, 0, 	newMethods = new MethodBinding[oldMethods.length + 1], 1, oldMethods.length);
417
		this.binding.methods(),
413
	newMethods[0] = constructor.binding; 
418
		0,
414
	sourceType.tagBits &= ~(TagBits.AreMethodsComplete|TagBits.AreMethodsSorted); // still need to resort, since could be valid methods ahead (140643)
419
		newMethods = new MethodBinding[oldMethods.length + 1],
415
	sourceType.setMethods(newMethods);
420
		1,
421
		oldMethods.length);
422
	newMethods[0] = constructor.binding; // position 0 is important, since if sorted, constructor will still be ahead
423
	this.binding.setMethods(newMethods);
424
	//===================================================
416
	//===================================================
425
417
426
	return constructor.binding;
418
	return constructor.binding;

Return to bug 140643