diff options
author | Sarika Sinha | 2020-06-05 13:17:04 +0000 |
---|---|---|
committer | Sarika Sinha | 2020-07-03 09:40:40 +0000 |
commit | 3109f48b71fb6b4c90d2dabf3c4b1fa4aed3d121 (patch) | |
tree | 82366ff294090403ef3903da20b3a266064143b1 | |
parent | d6a71058bdd11ff5a9caa4e85cb44b17d651af54 (diff) | |
download | eclipse.jdt.core-3109f48b71fb6b4c90d2dabf3c4b1fa4aed3d121.tar.gz eclipse.jdt.core-3109f48b71fb6b4c90d2dabf3c4b1fa4aed3d121.tar.xz eclipse.jdt.core-3109f48b71fb6b4c90d2dabf3c4b1fa4aed3d121.zip |
Bug 383608 - [1.8][compiler] Test failures need to be investigated
Change-Id: I658d88e90976bdeb11099550708476efbdec27cf
2 files changed, 56 insertions, 39 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java index 84c132f138..f5df0ae5ef 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java @@ -7952,7 +7952,7 @@ public class ASTConverterTestAST3_2 extends ConverterTestSetup { * @bug 149126: IllegalArgumentException in ASTConverter * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=149126" */ - public void _test0652() throws CoreException { + public void test0652() throws CoreException { ASTResult result = this.buildMarkedAST( "/Converter/src/TestCharset.java", "import java.nio.ByteBuffer;\n" + @@ -7987,8 +7987,7 @@ public class ASTConverterTestAST3_2 extends ConverterTestSetup { "public class TestCharset extends Charset {\n" + " public CharsetDecoder newDecoder(){\n" + " return new CharsetDecoder(this,2.0,2.0){\n" + - " void CharsetDecoder(){\n" + - " }\n" + + " void CharsetDecoder();\n" + " protected CoderResult decodeLoop( ByteBuffer in, CharBuffer out){\n" + " return null;\n" + " }\n" + @@ -8041,25 +8040,33 @@ public class ASTConverterTestAST3_2 extends ConverterTestSetup { "CharsetDecoder cannot be resolved to a type\n" + "10. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + " CharsetDecoder(CharSet\n" + - " ^^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "11. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + - " CharsetDecoder(CharSet\n" + " ^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + - "12. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + + "11. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + + " CharsetDecoder(CharSet\n" + + " ^^^^^^^\n" + + "Syntax error, insert \"... VariableDeclaratorId\" to complete FormalParameter\n" + + "12. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + + " CharsetDecoder(CharSet\n" + + " ^^^^^^^\n" + + "Syntax error, insert \")\" to complete ConstructorDeclaration\n" + + "13. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + + " CharsetDecoder(CharSet\n" + + " ^^^^^^^\n" + + "Syntax error, insert \";\" to complete ClassBodyDeclarations\n" + + "14. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + " protected CoderResult decodeLoop(ByteBuffer in,\n" + " ^^^^^^^^^^^\n" + "CoderResult cannot be resolved to a type\n" + - "13. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + + "15. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + " protected CoderResult decodeLoop(ByteBuffer in,\n" + " ^^^^^^^^^^\n" + "ByteBuffer cannot be resolved to a type\n" + - "14. ERROR in /Converter/src/TestCharset.java (at line 12)\n" + + "16. ERROR in /Converter/src/TestCharset.java (at line 12)\n" + " CharBuffer out) {\n" + " ^^^^^^^^^^\n" + "CharBuffer cannot be resolved to a type\n" + - "15. ERROR in /Converter/src/TestCharset.java (at line 17)\n" + + "17. ERROR in /Converter/src/TestCharset.java (at line 17)\n" + " public CharsetEncoder newEncoder() {\n" + " ^^^^^^^^^^^^^^\n" + "CharsetEncoder cannot be resolved to a type\n", @@ -8328,10 +8335,11 @@ public class ASTConverterTestAST3_2 extends ConverterTestSetup { assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, root.getNodeType()); CompilationUnit unit = (CompilationUnit) root; String errors = - "Syntax error on token(s), misplaced construct(s)\n" + - "Syntax error, insert \";\" to complete BlockStatements\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "Syntax error, insert \";\" to complete Statement"; + "Syntax error on token(s), misplaced construct(s)\n" + + "Syntax error, insert \";\" to complete BlockStatements\n" + + "Syntax error on token(s), misplaced construct(s)\n" + + "Syntax error, insert \";\" to complete Statement"; + assertProblemsSize(unit, 4, errors); } @@ -9436,12 +9444,12 @@ public class ASTConverterTestAST3_2 extends ConverterTestSetup { /* * https://bugs.eclipse.org/bugs/show_bug.cgi?id=169745 */ - public void _test0679() throws JavaModelException { + public void test0679() throws JavaModelException { ICompilationUnit workingCopy = null; try { String contents = "public class X {\n" + - " int i = 1 - 2 + 3 + 4 + 5;\n" + + " int i = 1 - 2 + 3 + 4 * 5;\n" + "}"; workingCopy = getWorkingCopy("/Converter/src/X.java", true/*resolve*/); ASTNode node = buildAST( @@ -9459,10 +9467,11 @@ public class ASTConverterTestAST3_2 extends ConverterTestSetup { final Expression initializer = fragment.getInitializer(); assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType()); InfixExpression infixExpression = (InfixExpression) initializer; - final Expression leftOperand = infixExpression.getLeftOperand(); - assertEquals("Not a number literal", ASTNode.NUMBER_LITERAL, leftOperand.getNodeType()); - NumberLiteral literal = (NumberLiteral) leftOperand; - assertEquals("Wrong value", "1", literal.getToken()); + final Expression rightOperand = infixExpression.getRightOperand(); + InfixExpression rightOperand2 = (InfixExpression) rightOperand; + assertEquals("Not a number literal", ASTNode.NUMBER_LITERAL, rightOperand2.getRightOperand().getNodeType()); + NumberLiteral literal = (NumberLiteral) rightOperand2.getRightOperand(); + assertEquals("Wrong value", "5", literal.getToken()); } finally { if (workingCopy != null) workingCopy.discardWorkingCopy(); diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java index 980ade0880..dd73458de4 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2019 IBM Corporation and others. + * Copyright (c) 2011, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -7949,7 +7949,7 @@ public class ASTConverterTestAST4_2 extends ConverterTestSetup { * @bug 149126: IllegalArgumentException in ASTConverter * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=149126" */ - public void _test0652() throws CoreException { + public void test0652() throws CoreException { ASTResult result = this.buildMarkedAST( "/Converter/src/TestCharset.java", "import java.nio.ByteBuffer;\n" + @@ -7984,8 +7984,7 @@ public class ASTConverterTestAST4_2 extends ConverterTestSetup { "public class TestCharset extends Charset {\n" + " public CharsetDecoder newDecoder(){\n" + " return new CharsetDecoder(this,2.0,2.0){\n" + - " void CharsetDecoder(){\n" + - " }\n" + + " void CharsetDecoder();\n" + " protected CoderResult decodeLoop( ByteBuffer in, CharBuffer out){\n" + " return null;\n" + " }\n" + @@ -8038,25 +8037,33 @@ public class ASTConverterTestAST4_2 extends ConverterTestSetup { "CharsetDecoder cannot be resolved to a type\n" + "10. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + " CharsetDecoder(CharSet\n" + - " ^^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "11. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + - " CharsetDecoder(CharSet\n" + " ^^^^^^^^^^^^^^^\n" + "Return type for the method is missing\n" + - "12. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + + "11. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + + " CharsetDecoder(CharSet\n" + + " ^^^^^^^\n" + + "Syntax error, insert \"... VariableDeclaratorId\" to complete FormalParameter\n" + + "12. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + + " CharsetDecoder(CharSet\n" + + " ^^^^^^^\n" + + "Syntax error, insert \")\" to complete ConstructorDeclaration\n" + + "13. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + + " CharsetDecoder(CharSet\n" + + " ^^^^^^^\n" + + "Syntax error, insert \";\" to complete ClassBodyDeclarations\n" + + "14. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + " protected CoderResult decodeLoop(ByteBuffer in,\n" + " ^^^^^^^^^^^\n" + "CoderResult cannot be resolved to a type\n" + - "13. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + + "15. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + " protected CoderResult decodeLoop(ByteBuffer in,\n" + " ^^^^^^^^^^\n" + "ByteBuffer cannot be resolved to a type\n" + - "14. ERROR in /Converter/src/TestCharset.java (at line 12)\n" + + "16. ERROR in /Converter/src/TestCharset.java (at line 12)\n" + " CharBuffer out) {\n" + " ^^^^^^^^^^\n" + "CharBuffer cannot be resolved to a type\n" + - "15. ERROR in /Converter/src/TestCharset.java (at line 17)\n" + + "17. ERROR in /Converter/src/TestCharset.java (at line 17)\n" + " public CharsetEncoder newEncoder() {\n" + " ^^^^^^^^^^^^^^\n" + "CharsetEncoder cannot be resolved to a type\n", @@ -9433,12 +9440,12 @@ public class ASTConverterTestAST4_2 extends ConverterTestSetup { /* * https://bugs.eclipse.org/bugs/show_bug.cgi?id=169745 */ - public void _test0679() throws JavaModelException { + public void test0679() throws JavaModelException { ICompilationUnit workingCopy = null; try { String contents = "public class X {\n" + - " int i = 1 - 2 + 3 + 4 + 5;\n" + + " int i = 1 - 2 + 3 + 4 * 5;\n" + "}"; workingCopy = getWorkingCopy("/Converter/src/X.java", true/*resolve*/); ASTNode node = buildAST( @@ -9456,10 +9463,11 @@ public class ASTConverterTestAST4_2 extends ConverterTestSetup { final Expression initializer = fragment.getInitializer(); assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType()); InfixExpression infixExpression = (InfixExpression) initializer; - final Expression leftOperand = infixExpression.getLeftOperand(); - assertEquals("Not a number literal", ASTNode.NUMBER_LITERAL, leftOperand.getNodeType()); - NumberLiteral literal = (NumberLiteral) leftOperand; - assertEquals("Wrong value", "1", literal.getToken()); + final Expression rightOperand = infixExpression.getRightOperand(); + InfixExpression rightOperand2 = (InfixExpression) rightOperand; + assertEquals("Not a number literal", ASTNode.NUMBER_LITERAL, rightOperand2.getRightOperand().getNodeType()); + NumberLiteral literal = (NumberLiteral) rightOperand2.getRightOperand(); + assertEquals("Wrong value", "5", literal.getToken()); } finally { if (workingCopy != null) workingCopy.discardWorkingCopy(); |