Bug 161977 - [compiler] Identical branches in org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding#syntheticMethods
Summary: [compiler] Identical branches in org.eclipse.jdt.internal.compiler.lookup.Sou...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-23 12:22 EDT by Olivier Thomann CLA
Modified: 2008-10-28 13:05 EDT (History)
0 users

See Also:


Attachments
Proposed patch (6.53 KB, patch)
2008-10-03 04:43 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2006-10-23 12:22:24 EDT
Except for locals with different names, the two branches of this if statement are identical:
		if (fieldOrMethod instanceof MethodBinding) {

			SyntheticMethodBinding[] methodAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod);
			int numberOfAccessors = 0;
			if (methodAccessors[0] != null) numberOfAccessors++;
			if (methodAccessors[1] != null) numberOfAccessors++;
			if (index + numberOfAccessors > bindings.length)
				System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index);
			if (methodAccessors[0] != null) 
				bindings[index++] = methodAccessors[0]; // super access 
			if (methodAccessors[1] != null) 
				bindings[index++] = methodAccessors[1]; // normal access or bridge

		} else {

			SyntheticMethodBinding[] fieldAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod);
			int numberOfAccessors = 0;
			if (fieldAccessors[0] != null) numberOfAccessors++;
			if (fieldAccessors[1] != null) numberOfAccessors++;
			if (index + numberOfAccessors > bindings.length)
				System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index);
			if (fieldAccessors[0] != null) 
				bindings[index++] = fieldAccessors[0]; // read access
			if (fieldAccessors[1] != null) 
				bindings[index++] = fieldAccessors[1]; // write access
		}
Comment 1 Philipe Mulet CLA 2008-10-03 04:43:09 EDT
Created attachment 114162 [details]
Proposed patch
Comment 2 Philipe Mulet CLA 2008-10-03 04:44:00 EDT
Indeed, this was redundant.
Released for 3.5M3.
Fixed
Comment 3 Kent Johnson CLA 2008-10-28 13:05:38 EDT
Verified for 3.5M3 using I20081026-2000 build.