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

Collapse All | Expand All

(-)src/org/eclipse/wst/jsdt/core/infer/InferEngine.java (-1 / +11 lines)
Lines 56-61 Link Here
56
import org.eclipse.wst.jsdt.internal.compiler.ast.ProgramElement;
56
import org.eclipse.wst.jsdt.internal.compiler.ast.ProgramElement;
57
import org.eclipse.wst.jsdt.internal.compiler.ast.SingleNameReference;
57
import org.eclipse.wst.jsdt.internal.compiler.ast.SingleNameReference;
58
import org.eclipse.wst.jsdt.internal.compiler.ast.UnaryExpression;
58
import org.eclipse.wst.jsdt.internal.compiler.ast.UnaryExpression;
59
import org.eclipse.wst.jsdt.internal.compiler.lookup.TypeConstants;
59
import org.eclipse.wst.jsdt.internal.compiler.util.HashtableOfObject;
60
import org.eclipse.wst.jsdt.internal.compiler.util.HashtableOfObject;
60
import org.eclipse.wst.jsdt.internal.compiler.util.Util;
61
import org.eclipse.wst.jsdt.internal.compiler.util.Util;
61
62
Lines 1340-1346 Link Here
1340
				{
1341
				{
1341
					char []name={};
1342
					char []name={};
1342
					for (int j = 0; j < param.types.length; j++) {
1343
					for (int j = 0; j < param.types.length; j++) {
1343
						char []typeName=param.types[j].getSimpleTypeName();
1344
						//char []typeName=param.types[j].getSimpleTypeName();
1345
						//make sure we are using the type version of Boolean, even if the user entered boolean as the JSdoc type.
1346
						char []typeName=changePrimitiveToObject(param.types[j].getSimpleTypeName());
1344
						if (j==0)
1347
						if (j==0)
1345
							name=typeName;
1348
							name=typeName;
1346
						else
1349
						else
Lines 1855-1859 Link Here
1855
	{
1858
	{
1856
		return compUnit.findInferredType(className);
1859
		return compUnit.findInferredType(className);
1857
	}
1860
	}
1861
	
1862
	protected char[] changePrimitiveToObject(char[] name) {
1863
		//Changes the first character of the name of the primitive types to uppercase. This will allow future reference to the object wrapper instead of the primitive type.
1864
		if(CharOperation.equals(name, TypeConstants.BOOLEAN, false)) //$NON-NLS-1$
1865
			return BooleanType.getName();
1866
		return name;
1867
	}
1858
1868
1859
}
1869
}
(-)src/org/eclipse/wst/jsdt/internal/compiler/ast/OperatorExpression.java (-1 / +1 lines)
Lines 513-519 Link Here
513
		//     table[(T_boolean<<4)+T_short] 			= T_undefined;
513
		//     table[(T_boolean<<4)+T_short] 			= T_undefined;
514
		//     table[(T_boolean<<4)+T_void] 			= T_undefined;
514
		//     table[(T_boolean<<4)+T_void] 			= T_undefined;
515
		     table[(T_boolean<<4)+T_JavaLangString] 			= T_JavaLangString;
515
		     table[(T_boolean<<4)+T_JavaLangString] 			= T_JavaLangString;
516
		//     table[(T_boolean<<4)+T_Object] 			= T_undefined;
516
		     table[(T_boolean<<4)+T_JavaLangObject] 			= T_JavaLangObject;
517
		//     table[(T_boolean<<4)+T_double] 			= T_undefined;
517
		//     table[(T_boolean<<4)+T_double] 			= T_undefined;
518
		//     table[(T_boolean<<4)+T_float] 			= T_undefined;
518
		//     table[(T_boolean<<4)+T_float] 			= T_undefined;
519
	   table[(T_boolean<<4)+T_boolean] 		= (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean;
519
	   table[(T_boolean<<4)+T_boolean] 		= (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean;
(-)src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicResolveTests.java (+17 lines)
Lines 1713-1717 Link Here
1713
					""
1713
					""
1714
			);
1714
			);
1715
	}
1715
	}
1716
1717
	public void testbug278172() {
1718
		this.runNegativeTest(
1719
					new String[] {
1720
							"Z.js",
1721
							"/**\n" +
1722
							"* @param {boolean} options\n" +
1723
							"*/\n" +
1724
							"function foo(options) {\n" +
1725
								"options = options || {};\n" +
1726
								"if (!options.bar)\n" +
1727
								"options.bar = 42;\n" +
1728
							"}"
1729
					},
1730
					""
1731
			);
1732
	}
1716
	
1733
	
1717
}
1734
}

Return to bug 278172