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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java (-1 / +194 lines)
Lines 95-101 Link Here
95
			return new Suite(ASTConverterTest2.class);		
95
			return new Suite(ASTConverterTest2.class);		
96
		}
96
		}
97
		TestSuite suite = new Suite(ASTConverterTest2.class.getName());
97
		TestSuite suite = new Suite(ASTConverterTest2.class.getName());
98
		suite.addTest(new ASTConverterTest2("test0558"));
98
		suite.addTest(new ASTConverterTest2("test0565"));
99
		return suite;
99
		return suite;
100
	}
100
	}
101
	/**
101
	/**
Lines 4968-4972 Link Here
4968
		List statements = block.statements();
4968
		List statements = block.statements();
4969
		assertNotNull("No statements", statements);
4969
		assertNotNull("No statements", statements);
4970
		assertEquals("Wrong size", 2, statements.size());
4970
		assertEquals("Wrong size", 2, statements.size());
4971
	}
4972
	
4973
	/**
4974
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
4975
	 */
4976
	public void test0559() throws JavaModelException {
4977
		ICompilationUnit sourceUnit = getCompilationUnit("Converter", "src", "test0559", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
4978
		char[] source = sourceUnit.getSource().toCharArray();
4979
		ASTNode result = runConversion(sourceUnit, true);
4980
		assertEquals("not a compilation unit", ASTNode.COMPILATION_UNIT, result.getNodeType()); //$NON-NLS-1$
4981
		CompilationUnit unit = (CompilationUnit) result;
4982
		final IProblem[] problems = unit.getProblems();
4983
		assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
4984
		ASTNode node = getASTNode(unit, 0, 0, 0);
4985
		assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
4986
		IfStatement ifStatement = (IfStatement) node;
4987
		Expression expression = ifStatement.getExpression();
4988
		assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
4989
		InfixExpression infixExpression = (InfixExpression) expression;
4990
		Expression expression2 = infixExpression.getLeftOperand();
4991
		assertEquals("Wrong type", ASTNode.METHOD_INVOCATION, expression2.getNodeType());
4992
		MethodInvocation methodInvocation = (MethodInvocation) expression2;
4993
		Expression expression3 = methodInvocation.getExpression();
4994
		assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
4995
		ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
4996
		Expression expression4 = parenthesizedExpression.getExpression();
4997
		assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
4998
		checkSourceRange(expression4, "\" \"", source);
4999
	}
5000
	
5001
	/**
5002
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
5003
	 */
5004
	public void test0560() throws JavaModelException {
5005
		ICompilationUnit sourceUnit = getCompilationUnit("Converter", "src", "test0560", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
5006
		char[] source = sourceUnit.getSource().toCharArray();
5007
		ASTNode result = runConversion(sourceUnit, true);
5008
		assertEquals("not a compilation unit", ASTNode.COMPILATION_UNIT, result.getNodeType()); //$NON-NLS-1$
5009
		CompilationUnit unit = (CompilationUnit) result;
5010
		final IProblem[] problems = unit.getProblems();
5011
		assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
5012
		ASTNode node = getASTNode(unit, 0, 0, 0);
5013
		assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
5014
		IfStatement ifStatement = (IfStatement) node;
5015
		Expression expression = ifStatement.getExpression();
5016
		assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
5017
		InfixExpression infixExpression = (InfixExpression) expression;
5018
		Expression expression2 = infixExpression.getLeftOperand();
5019
		assertEquals("Wrong type", ASTNode.METHOD_INVOCATION, expression2.getNodeType());
5020
		MethodInvocation methodInvocation = (MethodInvocation) expression2;
5021
		Expression expression3 = methodInvocation.getExpression();
5022
		assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
5023
		ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
5024
		Expression expression4 = parenthesizedExpression.getExpression();
5025
		assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
5026
		checkSourceRange(expression4, "\" \"", source);
5027
	}
5028
	
5029
	/**
5030
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
5031
	 */
5032
	public void test0561() throws JavaModelException {
5033
		ICompilationUnit sourceUnit = getCompilationUnit("Converter", "src", "test0561", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
5034
		char[] source = sourceUnit.getSource().toCharArray();
5035
		ASTNode result = runConversion(sourceUnit, true);
5036
		assertEquals("not a compilation unit", ASTNode.COMPILATION_UNIT, result.getNodeType()); //$NON-NLS-1$
5037
		CompilationUnit unit = (CompilationUnit) result;
5038
		final IProblem[] problems = unit.getProblems();
5039
		assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
5040
		ASTNode node = getASTNode(unit, 0, 0, 0);
5041
		assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
5042
		IfStatement ifStatement = (IfStatement) node;
5043
		Expression expression = ifStatement.getExpression();
5044
		assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
5045
		InfixExpression infixExpression = (InfixExpression) expression;
5046
		Expression expression2 = infixExpression.getLeftOperand();
5047
		assertEquals("Wrong type", ASTNode.METHOD_INVOCATION, expression2.getNodeType());
5048
		MethodInvocation methodInvocation = (MethodInvocation) expression2;
5049
		Expression expression3 = methodInvocation.getExpression();
5050
		assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
5051
		ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
5052
		Expression expression4 = parenthesizedExpression.getExpression();
5053
		assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
5054
		checkSourceRange(expression4, "\" \"", source);
5055
	}
5056
	
5057
	/**
5058
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
5059
	 */
5060
	public void test0562() throws JavaModelException {
5061
		ICompilationUnit sourceUnit = getCompilationUnit("Converter", "src", "test0562", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
5062
		char[] source = sourceUnit.getSource().toCharArray();
5063
		ASTNode result = runConversion(sourceUnit, true);
5064
		assertEquals("not a compilation unit", ASTNode.COMPILATION_UNIT, result.getNodeType()); //$NON-NLS-1$
5065
		CompilationUnit unit = (CompilationUnit) result;
5066
		final IProblem[] problems = unit.getProblems();
5067
		assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
5068
		ASTNode node = getASTNode(unit, 0, 0, 0);
5069
		assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
5070
		IfStatement ifStatement = (IfStatement) node;
5071
		Expression expression = ifStatement.getExpression();
5072
		assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
5073
		InfixExpression infixExpression = (InfixExpression) expression;
5074
		Expression expression2 = infixExpression.getLeftOperand();
5075
		assertEquals("Wrong type", ASTNode.METHOD_INVOCATION, expression2.getNodeType());
5076
		MethodInvocation methodInvocation = (MethodInvocation) expression2;
5077
		Expression expression3 = methodInvocation.getExpression();
5078
		assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
5079
		ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
5080
		Expression expression4 = parenthesizedExpression.getExpression();
5081
		assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
5082
		checkSourceRange(expression4, "\" \"", source);
5083
	}
5084
	
5085
	/**
5086
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
5087
	 */
5088
	public void test0563() throws JavaModelException {
5089
		ICompilationUnit sourceUnit = getCompilationUnit("Converter", "src", "test0563", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
5090
		char[] source = sourceUnit.getSource().toCharArray();
5091
		ASTNode result = runConversion(sourceUnit, true);
5092
		assertEquals("not a compilation unit", ASTNode.COMPILATION_UNIT, result.getNodeType()); //$NON-NLS-1$
5093
		CompilationUnit unit = (CompilationUnit) result;
5094
		final IProblem[] problems = unit.getProblems();
5095
		assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
5096
		ASTNode node = getASTNode(unit, 0, 0, 0);
5097
		assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
5098
		IfStatement ifStatement = (IfStatement) node;
5099
		Expression expression = ifStatement.getExpression();
5100
		assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
5101
		InfixExpression infixExpression = (InfixExpression) expression;
5102
		Expression expression2 = infixExpression.getLeftOperand();
5103
		assertEquals("Wrong type", ASTNode.METHOD_INVOCATION, expression2.getNodeType());
5104
		MethodInvocation methodInvocation = (MethodInvocation) expression2;
5105
		Expression expression3 = methodInvocation.getExpression();
5106
		assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
5107
		ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
5108
		Expression expression4 = parenthesizedExpression.getExpression();
5109
		checkSourceRange(expression4, "new String()", source);
5110
	}
5111
	
5112
	/**
5113
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
5114
	 */
5115
	public void test0564() throws JavaModelException {
5116
		ICompilationUnit sourceUnit = getCompilationUnit("Converter", "src", "test0564", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
5117
		char[] source = sourceUnit.getSource().toCharArray();
5118
		ASTNode result = runConversion(sourceUnit, true);
5119
		assertEquals("not a compilation unit", ASTNode.COMPILATION_UNIT, result.getNodeType()); //$NON-NLS-1$
5120
		CompilationUnit unit = (CompilationUnit) result;
5121
		final IProblem[] problems = unit.getProblems();
5122
		assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
5123
		ASTNode node = getASTNode(unit, 0, 0, 0);
5124
		assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
5125
		IfStatement ifStatement = (IfStatement) node;
5126
		Expression expression = ifStatement.getExpression();
5127
		assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
5128
		InfixExpression infixExpression = (InfixExpression) expression;
5129
		Expression expression2 = infixExpression.getLeftOperand();
5130
		assertEquals("Wrong type", ASTNode.METHOD_INVOCATION, expression2.getNodeType());
5131
		MethodInvocation methodInvocation = (MethodInvocation) expression2;
5132
		Expression expression3 = methodInvocation.getExpression();
5133
		assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
5134
		ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
5135
		Expression expression4 = parenthesizedExpression.getExpression();
5136
		checkSourceRange(expression4, "new String()", source);
5137
	}
5138
	
5139
	/**
5140
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
5141
	 */
5142
	public void test0565() throws JavaModelException {
5143
		ICompilationUnit sourceUnit = getCompilationUnit("Converter", "src", "test0565", "A.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
5144
		char[] source = sourceUnit.getSource().toCharArray();
5145
		ASTNode result = runConversion(sourceUnit, true);
5146
		assertEquals("not a compilation unit", ASTNode.COMPILATION_UNIT, result.getNodeType()); //$NON-NLS-1$
5147
		CompilationUnit unit = (CompilationUnit) result;
5148
		final IProblem[] problems = unit.getProblems();
5149
		assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
5150
		ASTNode node = getASTNode(unit, 0, 0, 0);
5151
		assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
5152
		IfStatement ifStatement = (IfStatement) node;
5153
		Expression expression = ifStatement.getExpression();
5154
		assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
5155
		InfixExpression infixExpression = (InfixExpression) expression;
5156
		Expression expression2 = infixExpression.getLeftOperand();
5157
		assertEquals("Wrong type", ASTNode.METHOD_INVOCATION, expression2.getNodeType());
5158
		MethodInvocation methodInvocation = (MethodInvocation) expression2;
5159
		Expression expression3 = methodInvocation.getExpression();
5160
		assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
5161
		ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
5162
		Expression expression4 = parenthesizedExpression.getExpression();
5163
		checkSourceRange(expression4, "(/**/ String /**/) new String()", source);
4971
	}
5164
	}
4972
}
5165
}
(-)workspace/Converter/.classpath (-1 / +1 lines)
Lines 1-8 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
3
	<classpathentry kind="src" path="src"/>
4
    <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
5
    <classpathentry kind="var" path="CONVERTER_JCL_LIB" sourcepath="CONVERTER_JCL_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>    
4
    <classpathentry kind="var" path="CONVERTER_JCL_LIB" sourcepath="CONVERTER_JCL_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>    
5
	<classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
6
    <classpathentry kind="output" path="bin"/>
6
    <classpathentry kind="output" path="bin"/>
7
    <classpathentry kind="lib" sourcepath="src" path="bins"/>
7
    <classpathentry kind="lib" sourcepath="src" path="bins"/>
8
</classpath>
8
</classpath>
(-)workspace/Converter/src/test0559/A.java (+8 lines)
Added Link Here
1
package test0559;
2
3
public class A {
4
	
5
	void foo() {
6
		if( (/*X:press_any_key_b*/ " " /**/).length() > 1 );
7
	}
8
}
(-)workspace/Converter/src/test0560/A.java (+8 lines)
Added Link Here
1
package test0560;
2
3
public class A {
4
	
5
	void foo() {
6
		if( (/*X:press_any_key_b*/" ").length() > 1 );
7
	}
8
}
(-)workspace/Converter/src/test0561/A.java (+8 lines)
Added Link Here
1
package test0561;
2
3
public class A {
4
	
5
	void foo() {
6
		if( (/*X:press_any_key_b*//**/ " " /**/).length() > 1 );
7
	}
8
}
(-)workspace/Converter/src/test0562/A.java (+8 lines)
Added Link Here
1
package test0562;
2
3
public class A {
4
	
5
	void foo() {
6
		if( (/*X:press_any_key_b*//**/" "/**/  /**/ ).length() > 1 );
7
	}
8
}
(-)workspace/Converter/src/test0563/A.java (+8 lines)
Added Link Here
1
package test0563;
2
3
public class A {
4
	
5
	void foo() {
6
		if( (/*X:press_any_key_b*//**/new String()/**/  /**/ ).length() > 1 );
7
	}
8
}
(-)workspace/Converter/src/test0564/A.java (+8 lines)
Added Link Here
1
package test0564;
2
3
public class A {
4
	
5
	void foo() {
6
		if( ( new String() ).length() > 1 );
7
	}
8
}
(-)workspace/Converter/src/test0565/A.java (+8 lines)
Added Link Here
1
package test0565;
2
3
public class A {
4
	
5
	void foo() {
6
		if( ( (/**/ String /**/) new String() /**/ ).length() > 1 );
7
	}
8
}

Return to bug 65562