Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java174
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java50
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java290
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest18.java1338
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java16
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java68
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java994
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java700
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java70
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsSelectionTest.java50
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LambdaExpressionSyntaxTest.java602
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ModuleDeclarationSyntaxTest.java114
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java134
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java1044
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceExpressionSyntaxTest.java852
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest10.java32
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest12.java512
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java880
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest18.java214
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java30
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java118
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest.java58
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest_1_5.java50
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java1898
29 files changed, 5149 insertions, 5149 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
index 1ea8201f8..c70decd56 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
@@ -62,7 +62,7 @@ public class AbstractSyntaxTreeTest extends AbstractCompilerTest implements IDoc
CHECK_DOCUMENT_ELEMENT_PARSER | CHECK_COMMENT_RECORDER_PARSER |
//{ObjectTeams: with our grammar testing the IndexingParser is even less useful (creates false positives), just disable it:
/* orig:
- CHECK_SOURCE_ELEMENT_PARSER | CHECK_INDEXING_PARSER);
+ CHECK_SOURCE_ELEMENT_PARSER | CHECK_INDEXING_PARSER);
:giro */
CHECK_SOURCE_ELEMENT_PARSER /*| CHECK_INDEXING_PARSER */);
// SH}
@@ -85,11 +85,11 @@ public class AbstractSyntaxTreeTest extends AbstractCompilerTest implements IDoc
}
public void checkParse(int parserToCheck, char[] source, String expectedSyntaxErrorDiagnosis,
String testName, String expectedUnitToString, ASTVisitor visitor, CompilerOptions options) throws IOException {
-
+
ICompilationUnit sourceUnit = null;
CompilationResult compilationResult = null;
CompilationUnitDeclaration unit = null;
-
+
if (this.referenceCompiler != null && (parserToCheck & CHECK_JAVAC_PARSER) != 0) {
String javaFilePath = this.referenceCompilerTestsScratchArea + "\\Xyz.java";
File f = new File(javaFilePath);
@@ -130,7 +130,7 @@ public class AbstractSyntaxTreeTest extends AbstractCompilerTest implements IDoc
}
parser1 = null;
}
-
+
if ((parserToCheck & CHECK_COMPLETION_PARSER) != 0) {
CompletionParser parser2 = new CompletionParser(
new ProblemReporter(
@@ -278,65 +278,65 @@ public class AbstractSyntaxTreeTest extends AbstractCompilerTest implements IDoc
public void acceptImport(int declarationStart, int declarationEnd, int[] javaDocPositions,
char[] name, int nameStartPosition, boolean onDemand, int modifiers) {
-
-
+
+
}
public void acceptInitializer(int declarationStart, int declarationEnd, int[] javaDocPositions,
int modifiers, int modifiersStart, int bodyStart, int bodyEnd) {
-
-
+
+
}
public void acceptLineSeparatorPositions(int[] positions) {
-
-
+
+
}
public void acceptPackage(int declarationStart, int declarationEnd, int[] javaDocPositions,
char[] name, int nameStartPosition) {
-
-
+
+
}
public void acceptProblem(CategorizedProblem problem) {
-
-
+
+
}
public void enterClass(int declarationStart, int[] javaDocPositions, int modifiers,
int modifiersStart, int classStart, char[] name, int nameStart, int nameEnd,
char[] superclass, int superclassStart, int superclassEnd, char[][] superinterfaces, int[] superinterfaceStarts,
int[] superinterfaceEnds, int bodyStart) {
-
-
+
+
}
public void enterCompilationUnit() {
-
-
+
+
}
public void enterConstructor(int declarationStart, int[] javaDocPositions, int modifiers,
int modifiersStart, char[] name, int nameStart, int nameEnd, char[][] parameterTypes,
int[] parameterTypeStarts, int[] parameterTypeEnds, char[][] parameterNames, int[] parameterNameStarts, int[] parameterNameEnds,
int parametersEnd, char[][] exceptionTypes, int[] exceptionTypeStarts, int[] exceptionTypeEnds, int bodyStart) {
-
-
+
+
}
public void enterField(int declarationStart, int[] javaDocPositions, int modifiers,
int modifiersStart, char[] type, int typeStart, int typeEnd, int typeDimensionCount,
char[] name, int nameStart, int nameEnd, int extendedTypeDimensionCount, int extendedTypeDimensionEnd) {
-
-
+
+
}
public void enterInterface(int declarationStart, int[] javaDocPositions, int modifiers,
int modifiersStart, int interfaceStart, char[] name, int nameStart, int nameEnd,
char[][] superinterfaces, int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) {
-
-
+
+
}
public void enterMethod(int declarationStart, int[] javaDocPositions, int modifiers,
@@ -345,175 +345,175 @@ public class AbstractSyntaxTreeTest extends AbstractCompilerTest implements IDoc
int[] parameterTypeEnds, char[][] parameterNames, int[] parameterNameStarts, int[] parameterNameEnds, int parametersEnd,
int extendedReturnTypeDimensionCount, int extendedReturnTypeDimensionEnd, char[][] exceptionTypes, int[] exceptionTypeStarts, int[] exceptionTypeEnds,
int bodyStart) {
-
-
+
+
}
public void exitClass(int bodyEnd, int declarationEnd) {
-
-
+
+
}
public void exitCompilationUnit(int declarationEnd) {
-
-
+
+
}
public void exitConstructor(int bodyEnd, int declarationEnd) {
-
-
+
+
}
public void exitField(int bodyEnd, int declarationEnd) {
-
-
+
+
}
public void exitInterface(int bodyEnd, int declarationEnd) {
-
-
+
+
}
public void exitMethod(int bodyEnd, int declarationEnd) {
-
-
+
+
}
public void acceptAnnotationTypeReference(char[][] annotation, int sourceStart,
int sourceEnd) {
-
-
+
+
}
public void acceptAnnotationTypeReference(char[] annotation, int sourcePosition) {
-
-
+
+
}
public void acceptConstructorReference(char[] typeName, int argCount,
int sourcePosition) {
-
-
+
+
}
public void acceptFieldReference(char[] fieldName, int sourcePosition) {
-
-
+
+
}
public void acceptImport(int declarationStart, int declarationEnd, int nameStart,
int nameEnd, char[][] tokens, boolean onDemand, int modifiers) {
-
-
+
+
}
public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition) {
-
-
+
+
}
public void acceptPackage(ImportReference importReference) {
-
-
+
+
}
public void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd) {
-
-
+
+
}
public void acceptTypeReference(char[] typeName, int sourcePosition) {
-
-
+
+
}
public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) {
-
-
+
+
}
public void acceptUnknownReference(char[] name, int sourcePosition) {
-
-
+
+
}
public void enterConstructor(MethodInfo methodInfo) {
-
-
+
+
}
public void enterField(FieldInfo fieldInfo) {
-
-
+
+
}
public void enterInitializer(int declarationStart, int modifiers) {
-
-
+
+
}
public void enterMethod(MethodInfo methodInfo) {
-
-
+
+
}
public void enterType(TypeInfo typeInfo) {
-
-
+
+
}
public void exitConstructor(int declarationEnd) {
-
-
+
+
}
public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {
-
-
+
+
}
public void exitInitializer(int declarationEnd) {
-
-
+
+
}
public void exitMethod(int declarationEnd, Expression defaultValue) {
-
-
+
+
}
public void exitType(int declarationEnd) {
-
-
+
+
}
//{ObjectTeams: new methods
public void acceptBaseReference(char[][] typeName, int sourceStart, int sourceEnd) {
-
+
}
public void enterCalloutMapping(CalloutInfo info) {
-
+
}
public void enterCalloutToFieldMapping(CalloutToFieldInfo info) {
-
+
}
public void enterCallinMapping(CallinInfo info) {
-
+
}
public void exitCalloutMapping(int sourceEnd, int declarationSourceEnd) {
-
+
}
public void exitCalloutToFieldMapping(int sourceEnd, int declarationSourceEnd) {
-
+
}
public void exitCallinMapping(int sourceEnd, int declarationSourceEnd) {
-
+
}
// SH}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java
index 8ace4d8e8..2c6421b29 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java
@@ -3322,7 +3322,7 @@ public void test0087(){
String expectedReplacedSource = "foo";
String expectedUnitDisplayString =
"public class X {\n" +
- " @Annot(zzz = {<CompleteOnName:foo>})\n" +
+ " @Annot(zzz = {<CompleteOnName:foo>})\n" +
" public X() {\n" +
" }\n" +
" void bar() {\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java
index cf908782d..d00432e99 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java
@@ -1924,39 +1924,39 @@ public void test0041() {
"}\n";
String expectedDietUnitToString =
- "package snippet;\n" +
- "public class Bug366003 {\n" +
- " public Bug366003() {\n" +
- " }\n" +
- " void foo(Object o1) {\n" +
- " }\n" +
- " @Blah User(@Bla String str) {\n" +
- " }\n" +
+ "package snippet;\n" +
+ "public class Bug366003 {\n" +
+ " public Bug366003() {\n" +
+ " }\n" +
+ " void foo(Object o1) {\n" +
+ " }\n" +
+ " @Blah User(@Bla String str) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyUnitToString =
- "package snippet;\n" +
- "public class Bug366003 {\n" +
- " public Bug366003() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(Object o1) {\n" +
- " }\n" +
- " @Blah User(@Bla String str) {\n" +
- " }\n" +
+ "package snippet;\n" +
+ "public class Bug366003 {\n" +
+ " public Bug366003() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(Object o1) {\n" +
+ " }\n" +
+ " @Blah User(@Bla String str) {\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString = expectedDietUnitToString;
String expectedCompletionDietUnitToString =
- "package snippet;\n" +
- "public class Bug366003 {\n" +
- " public Bug366003() {\n" +
- " }\n" +
- " void foo(Object o1) {\n" +
- " }\n" +
- " User(@Bla String str) {\n" +
- " }\n" +
+ "package snippet;\n" +
+ "public class Bug366003 {\n" +
+ " public Bug366003() {\n" +
+ " }\n" +
+ " void foo(Object o1) {\n" +
+ " }\n" +
+ " User(@Bla String str) {\n" +
+ " }\n" +
"}\n";
String testName = "<annotation recovery>";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java
index 03eb21f59..4e68502dd 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -8658,28 +8658,28 @@ public void testBug310423(){
String testName = "";
String completeBehind = "In";
String expectedCompletionNodeToString = "<CompleteOnInterface:In>";
- String expectedParentNodeToString =
- "public class Test implements <CompleteOnInterface:In> {\n" +
- " public Test() {\n" +
- " }\n" +
+ String expectedParentNodeToString =
+ "public class Test implements <CompleteOnInterface:In> {\n" +
+ " public Test() {\n" +
+ " }\n" +
"}";
String completionIdentifier = "In";
String expectedReplacedSource = "In";
int cursorLocation = str.lastIndexOf("In") + completeBehind.length() - 1;
String expectedUnitDisplayString =
- "import java.lang.annotation.Annotation;\n" +
- "interface In {\n" +
- "}\n" +
- "interface Inn {\n" +
- " interface Inn2 {\n" +
- " }\n" +
- " @interface InAnnot {\n" +
- " }\n" +
- "}\n" +
- "@interface InnAnnot {\n" +
- "}\n" +
- "public class Test implements <CompleteOnInterface:In> {\n" +
- " public Test() {\n" +
+ "import java.lang.annotation.Annotation;\n" +
+ "interface In {\n" +
+ "}\n" +
+ "interface Inn {\n" +
+ " interface Inn2 {\n" +
+ " }\n" +
+ " @interface InAnnot {\n" +
+ " }\n" +
+ "}\n" +
+ "@interface InnAnnot {\n" +
+ "}\n" +
+ "public class Test implements <CompleteOnInterface:In> {\n" +
+ " public Test() {\n" +
" }\n" +
"}\n";
@@ -8723,32 +8723,32 @@ public void testBug338789(){
String completionIdentifier = "IZZ";
String expectedReplacedSource = "IZZ";
String expectedUnitDisplayString =
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void throwing() throws IZZBException, IZZException {\n" +
- " }\n" +
- " public void foo() {\n" +
- " try\n" +
- " {\n" +
- " throwing();\n" +
- " }\n" +
- " catch (IZZException | <CompleteOnException:IZZ> )\n" +
- " {\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "class IZZAException extends Exception {\n" +
- " IZZAException() {\n" +
- " }\n" +
- "}\n" +
- "class IZZBException extends Exception {\n" +
- " IZZBException() {\n" +
- " }\n" +
- "}\n" +
- "class IZZException extends Exception {\n" +
- " IZZException() {\n" +
- " }\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void throwing() throws IZZBException, IZZException {\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " try\n" +
+ " {\n" +
+ " throwing();\n" +
+ " }\n" +
+ " catch (IZZException | <CompleteOnException:IZZ> )\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "class IZZAException extends Exception {\n" +
+ " IZZAException() {\n" +
+ " }\n" +
+ "}\n" +
+ "class IZZBException extends Exception {\n" +
+ " IZZBException() {\n" +
+ " }\n" +
+ "}\n" +
+ "class IZZException extends Exception {\n" +
+ " IZZException() {\n" +
+ " }\n" +
"}\n";
int cursorLocation = str.indexOf("IZZException | IZZ") + completeBehind.length() - 1;
@@ -8786,20 +8786,20 @@ public void testBug338789b(){
String completionIdentifier = "I";
String expectedReplacedSource = "java.lang.I";
String expectedUnitDisplayString =
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void throwing() throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException {\n" +
- " }\n" +
- " public void foo() {\n" +
- " try\n" +
- " {\n" +
- " throwing();\n" +
- " }\n" +
- " catch (java.lang.IllegalArgumentException | <CompleteOnException:java.lang.I> )\n" +
- " {\n" +
- " }\n" +
- " }\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void throwing() throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException {\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " try\n" +
+ " {\n" +
+ " throwing();\n" +
+ " }\n" +
+ " catch (java.lang.IllegalArgumentException | <CompleteOnException:java.lang.I> )\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
int cursorLocation = str.indexOf("java.lang.IllegalArgumentException | java.lang.I") + completeBehind.length() - 1;
@@ -8837,24 +8837,24 @@ public void testBug343637(){
String expectedCompletionNodeToString = "<CompleteOnException:java.lang.I>";
String completionIdentifier = "I";
String expectedReplacedSource = "java.lang.I";
- String expectedUnitDisplayString =
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void throwing() throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException, java.lang.IOException {\n" +
- " }\n" +
- " public void foo() {\n" +
- " try\n" +
- " {\n" +
- " throwing();\n" +
- " }\n" +
- " catch (java.lang.IOException e)\n" +
- " {\n" +
- " }\n" +
- " catch (java.lang.IllegalArgumentException | <CompleteOnException:java.lang.I> )\n" +
- " {\n" +
- " }\n" +
- " }\n" +
+ String expectedUnitDisplayString =
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void throwing() throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException, java.lang.IOException {\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " try\n" +
+ " {\n" +
+ " throwing();\n" +
+ " }\n" +
+ " catch (java.lang.IOException e)\n" +
+ " {\n" +
+ " }\n" +
+ " catch (java.lang.IllegalArgumentException | <CompleteOnException:java.lang.I> )\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
int cursorLocation = str.indexOf("java.lang.IllegalArgumentException | java.lang.I") + completeBehind.length() - 1;
@@ -8884,13 +8884,13 @@ public void testBug346454(){
String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new Test<>()>";
String completionIdentifier = "";
String expectedReplacedSource = "";
- String expectedUnitDisplayString =
- "public class Test<T> {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " Test<String> t = <CompleteOnAllocationExpression:new Test<>()>;\n" +
- " }\n" +
+ String expectedUnitDisplayString =
+ "public class Test<T> {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " Test<String> t = <CompleteOnAllocationExpression:new Test<>()>;\n" +
+ " }\n" +
"}\n";
int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
@@ -8920,17 +8920,17 @@ public void testBug346454b(){
String expectedCompletionNodeToString = "<CompleteOnQualifiedAllocationExpression:new Test<>().new T2<>()>";
String completionIdentifier = "";
String expectedReplacedSource = "";
- String expectedUnitDisplayString =
- "public class Test<T> {\n" +
- " public class T2<Z> {\n" +
- " public T2() {\n" +
- " }\n" +
- " }\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo() {\n" +
- " Test<String>.T2<String> t = <CompleteOnQualifiedAllocationExpression:new Test<>().new T2<>()>;\n" +
- " }\n" +
+ String expectedUnitDisplayString =
+ "public class Test<T> {\n" +
+ " public class T2<Z> {\n" +
+ " public T2() {\n" +
+ " }\n" +
+ " }\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " Test<String>.T2<String> t = <CompleteOnQualifiedAllocationExpression:new Test<>().new T2<>()>;\n" +
+ " }\n" +
"}\n";
int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
@@ -8967,27 +8967,27 @@ public void testBug346415(){
String expectedCompletionNodeToString = "<CompleteOnException:>";
String completionIdentifier = "";
String expectedReplacedSource = "";
- String expectedUnitDisplayString =
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void throwing() throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException, java.lang.IOException {\n" +
- " }\n" +
- " public void foo() {\n" +
- " try\n" +
- " {\n" +
- " throwing();\n" +
- " }\n" +
- " catch (java.lang.IOException e)\n" +
- " {\n" +
- " }\n" +
- " catch (java.lang.IllegalArgumentException e)\n" +
- " {\n" +
- " }\n" +
- " catch (<CompleteOnException:> )\n" +
- " {\n" +
- " }\n" +
- " }\n" +
+ String expectedUnitDisplayString =
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void throwing() throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException, java.lang.IOException {\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " try\n" +
+ " {\n" +
+ " throwing();\n" +
+ " }\n" +
+ " catch (java.lang.IOException e)\n" +
+ " {\n" +
+ " }\n" +
+ " catch (java.lang.IllegalArgumentException e)\n" +
+ " {\n" +
+ " }\n" +
+ " catch (<CompleteOnException:> )\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1;
@@ -9026,26 +9026,26 @@ public void testBug292087a(){
String testName = "";
String completeBehind = "/*Complete here*/";
String expectedCompletionNodeToString = "<CompleteOnName:>";
- String expectedParentNodeToString =
+ String expectedParentNodeToString =
"public MyClass[] member = {<CompleteOnName:>};";
String completionIdentifier = "";
String expectedReplacedSource = "";
int cursorLocation = str.lastIndexOf("/*Complete here*/") + completeBehind.length() - 1;
String expectedUnitDisplayString =
- "package test;\n" +
- "class MyClass {\n" +
- " MyClass() {\n" +
- " }\n" +
- "}\n" +
- "public class Try extends Thread {\n" +
- " public static MyClass MyClassField;\n" +
- " public MyClass[] member = {<CompleteOnName:>};\n" +
- " public Try() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public static MyClass MyClassMethod() {\n" +
- " }\n" +
+ "package test;\n" +
+ "class MyClass {\n" +
+ " MyClass() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class Try extends Thread {\n" +
+ " public static MyClass MyClassField;\n" +
+ " public MyClass[] member = {<CompleteOnName:>};\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public static MyClass MyClassMethod() {\n" +
+ " }\n" +
"}\n";
checkDietParse(
@@ -9084,26 +9084,26 @@ public void testBug292087b(){
String testName = "";
String completeBehind = "/*Complete here*/";
String expectedCompletionNodeToString = "<CompleteOnName:>";
- String expectedParentNodeToString =
+ String expectedParentNodeToString =
"public MyClass[] member = {<CompleteOnName:>};";
String completionIdentifier = "";
String expectedReplacedSource = "";
int cursorLocation = str.lastIndexOf("/*Complete here*/") + completeBehind.length() - 1;
String expectedUnitDisplayString =
- "package test;\n" +
- "class MyClass {\n" +
- " MyClass() {\n" +
- " }\n" +
- "}\n" +
- "public class Try extends Thread {\n" +
- " public static MyClass MyClassField;\n" +
- " public MyClass[] member = {<CompleteOnName:>};\n" +
- " public Try() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public static MyClass MyClassMethod() {\n" +
- " }\n" +
+ "package test;\n" +
+ "class MyClass {\n" +
+ " MyClass() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class Try extends Thread {\n" +
+ " public static MyClass MyClassField;\n" +
+ " public MyClass[] member = {<CompleteOnName:>};\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public static MyClass MyClassMethod() {\n" +
+ " }\n" +
"}\n";
checkDietParse(
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest18.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest18.java
index 05db7fdb6..52431729b 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest18.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest18.java
@@ -58,25 +58,25 @@ public void test0001() {
String completionIdentifier = "";
String expectedReplacedSource = "first.";
String expectedUnitDisplayString =
- "interface I {\n" +
- " J foo(String x, String y);\n" +
- "}\n" +
- "interface J {\n" +
- " K foo(String x, String y);\n" +
- "}\n" +
- "interface K {\n" +
- " int foo(String x, int y);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " static void goo(J i) {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " goo((<no type> first, <no type> second) -> {\n" +
- " return (<no type> xyz, <no type> pqr) -> <CompleteOnName:first.>;\n" +
- "});\n" +
- " }\n" +
+ "interface I {\n" +
+ " J foo(String x, String y);\n" +
+ "}\n" +
+ "interface J {\n" +
+ " K foo(String x, String y);\n" +
+ "}\n" +
+ "interface K {\n" +
+ " int foo(String x, int y);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " static void goo(J i) {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " goo((<no type> first, <no type> second) -> {\n" +
+ " return (<no type> xyz, <no type> pqr) -> <CompleteOnName:first.>;\n" +
+ "});\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -106,13 +106,13 @@ public void test0002() {
String completionIdentifier = "fi";
String expectedReplacedSource = "fi";
String expectedUnitDisplayString =
- "interface Foo {\n" +
- " void run1(int s1, int s2);\n" +
- "}\n" +
- "interface X extends Foo {\n" +
- " static Foo f = (<no type> first, <no type> second) -> System.out.print(<CompleteOnName:fi>);\n" +
- " <clinit>() {\n" +
- " }\n" +
+ "interface Foo {\n" +
+ " void run1(int s1, int s2);\n" +
+ "}\n" +
+ "interface X extends Foo {\n" +
+ " static Foo f = (<no type> first, <no type> second) -> System.out.print(<CompleteOnName:fi>);\n" +
+ " <clinit>() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -144,13 +144,13 @@ public void test0003() {
String completionIdentifier = "fi";
String expectedReplacedSource = "fi";
String expectedUnitDisplayString =
- "interface Foo {\n" +
- " void run1(int s1, int s2);\n" +
- "}\n" +
- "interface X extends Foo {\n" +
- " public static void main(String[] args) {\n" +
- " Foo f = (<no type> first, <no type> second) -> System.out.print(<CompleteOnName:fi>);\n" +
- " }\n" +
+ "interface Foo {\n" +
+ " void run1(int s1, int s2);\n" +
+ "}\n" +
+ "interface X extends Foo {\n" +
+ " public static void main(String[] args) {\n" +
+ " Foo f = (<no type> first, <no type> second) -> System.out.print(<CompleteOnName:fi>);\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -180,15 +180,15 @@ public void test0004() {
String completionIdentifier = "x";
String expectedReplacedSource = "x";
String expectedUnitDisplayString =
- "interface Foo {\n" +
- " int run1(int s1, int s2);\n" +
- "}\n" +
- "interface X extends Foo {\n" +
- " static Foo f = (<no type> x5, <no type> x6) -> {\n" +
- " <CompleteOnName:x>;\n" +
- " };\n" +
- " <clinit>() {\n" +
- " }\n" +
+ "interface Foo {\n" +
+ " int run1(int s1, int s2);\n" +
+ "}\n" +
+ "interface X extends Foo {\n" +
+ " static Foo f = (<no type> x5, <no type> x6) -> {\n" +
+ " <CompleteOnName:x>;\n" +
+ " };\n" +
+ " <clinit>() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -224,20 +224,20 @@ public void test0005() {
String completionIdentifier = "arg";
String expectedReplacedSource = "arg";
String expectedUnitDisplayString =
- "interface I {\n" +
- " int foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void go() {\n" +
- " I i = (<no type> argument) -> {\n" +
- " if (true)\n" +
- " {\n" +
- " return <CompleteOnName:arg>;\n" +
- " }\n" +
- " };\n" +
- " }\n" +
+ "interface I {\n" +
+ " int foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void go() {\n" +
+ " I i = (<no type> argument) -> {\n" +
+ " if (true)\n" +
+ " {\n" +
+ " return <CompleteOnName:arg>;\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -271,17 +271,17 @@ public void test0006() {
String completionIdentifier = "arg";
String expectedReplacedSource = "arg";
String expectedUnitDisplayString =
- "interface I {\n" +
- " int foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void go() {\n" +
- " I i = (<no type> argument) -> {\n" +
- " <CompleteOnName:arg>;\n" +
- " };\n" +
- " }\n" +
+ "interface I {\n" +
+ " int foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void go() {\n" +
+ " I i = (<no type> argument) -> {\n" +
+ " <CompleteOnName:arg>;\n" +
+ " };\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -317,21 +317,21 @@ public void test0007() {
String completionIdentifier = "";
String expectedReplacedSource = "X.";
String expectedUnitDisplayString =
- "public interface Foo {\n" +
- " int run(int s1, int s2);\n" +
- "}\n" +
- "interface X {\n" +
+ "public interface Foo {\n" +
+ " int run(int s1, int s2);\n" +
+ "}\n" +
+ "interface X {\n" +
" static Foo f;\n" +
- " static int x1;\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n" +
- "class C {\n" +
- " C() {\n" +
- " }\n" +
- " void method1() {\n" +
- " int p = <CompleteOnName:X.>;\n" +
- " }\n" +
+ " static int x1;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ "}\n" +
+ "class C {\n" +
+ " C() {\n" +
+ " }\n" +
+ " void method1() {\n" +
+ " int p = <CompleteOnName:X.>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -400,7 +400,7 @@ public void test0010() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=417935, [1.8][code select] ICU#codeSelect doesn't work on reference to lambda parameter
public void test417935() {
- String string =
+ String string =
"import java.util.ArrayList;\n" +
"import java.util.Arrays;\n" +
"import java.util.Collections;\n" +
@@ -421,18 +421,18 @@ public void test417935() {
String completionIdentifier = "compa";
String expectedReplacedSource = "o1.compa";
String expectedUnitDisplayString =
- "import java.util.ArrayList;\n" +
- "import java.util.Arrays;\n" +
- "import java.util.Collections;\n" +
- "import java.util.Comparator;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int compareTo(X x) {\n" +
- " }\n" +
- " void foo() {\n" +
- " Collections.sort(new ArrayList<X>(Arrays.asList(new X(), new X(), new X())), (X o1, X o2) -> <CompleteOnName:o1.compa>);\n" +
- " }\n" +
+ "import java.util.ArrayList;\n" +
+ "import java.util.Arrays;\n" +
+ "import java.util.Collections;\n" +
+ "import java.util.Comparator;\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " int compareTo(X x) {\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " Collections.sort(new ArrayList<X>(Arrays.asList(new X(), new X(), new X())), (X o1, X o2) -> <CompleteOnName:o1.compa>);\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -445,9 +445,9 @@ public void test417935() {
expectedReplacedSource,
"diet ast");
}
-// https://bugs.eclipse.org/bugs/show_bug.cgi?id=405126, [1.8][code assist] Lambda parameters incorrectly recovered as fields.
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=405126, [1.8][code assist] Lambda parameters incorrectly recovered as fields.
public void test405126() {
- String string =
+ String string =
"public interface Foo { \n" +
" int run(int s1, int s2); \n" +
"}\n" +
@@ -469,21 +469,21 @@ public void test405126() {
String completionIdentifier = "";
String expectedReplacedSource = "X.";
String expectedUnitDisplayString =
- "public interface Foo {\n" +
- " int run(int s1, int s2);\n" +
- "}\n" +
- "interface X {\n" +
- " static Foo f;\n" +
- " static int x1;\n" +
- " <clinit>() {\n" +
- " }\n" +
- "}\n" +
- "class C {\n" +
- " C() {\n" +
- " }\n" +
- " void method1() {\n" +
- " int p = <CompleteOnName:X.>;\n" +
- " }\n" +
+ "public interface Foo {\n" +
+ " int run(int s1, int s2);\n" +
+ "}\n" +
+ "interface X {\n" +
+ " static Foo f;\n" +
+ " static int x1;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ "}\n" +
+ "class C {\n" +
+ " C() {\n" +
+ " }\n" +
+ " void method1() {\n" +
+ " int p = <CompleteOnName:X.>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -498,7 +498,7 @@ public void test405126() {
}
// Verify that locals inside a lambda block don't get promoted to the parent block.
public void testLocalsPromotion() {
- String string =
+ String string =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -522,22 +522,22 @@ public void testLocalsPromotion() {
String completionIdentifier = "lam";
String expectedReplacedSource = "lam";
String expectedUnitDisplayString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " static void goo(I i) {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " int outerLocal;\n" +
- " goo((<no type> x) -> {\n" +
- " int lambdaLocal;\n" +
- " System.out.println(\"Statement inside lambda\");\n" +
- " <CompleteOnName:lam>;\n" +
- "});\n" +
- " }\n" +
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " static void goo(I i) {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " int outerLocal;\n" +
+ " goo((<no type> x) -> {\n" +
+ " int lambdaLocal;\n" +
+ " System.out.println(\"Statement inside lambda\");\n" +
+ " <CompleteOnName:lam>;\n" +
+ "});\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -553,7 +553,7 @@ public void testLocalsPromotion() {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=422107, [1.8][code assist] Invoking code assist just before and after a variable initialized using lambda gives different result
public void testCompletionLocation() {
- String string =
+ String string =
"interface I {\n" +
" void doit();\n" +
"}\n" +
@@ -572,16 +572,16 @@ public void testCompletionLocation() {
String completionIdentifier = "";
String expectedReplacedSource = "";
String expectedUnitDisplayString =
- "interface I {\n" +
- " void doit();\n" +
- "}\n" +
- "interface J {\n" +
- "}\n" +
- "public class X {\n" +
- " Object o;\n" +
- " <CompleteOnType:>;\n" +
- " public X() {\n" +
- " }\n" +
+ "interface I {\n" +
+ " void doit();\n" +
+ "}\n" +
+ "interface J {\n" +
+ "}\n" +
+ "public class X {\n" +
+ " Object o;\n" +
+ " <CompleteOnType:>;\n" +
+ " public X() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -595,7 +595,7 @@ public void testCompletionLocation() {
"diet ast");
}
public void testElidedCompletion() {
- String string =
+ String string =
"class Collections {\n" +
" public static void sort(ArrayList list, Comparator c) {\n" +
" }\n" +
@@ -620,27 +620,27 @@ public void testElidedCompletion() {
String completionIdentifier = "compa";
String expectedReplacedSource = "o1.compa";
String expectedUnitDisplayString =
- "class Collections {\n" +
- " Collections() {\n" +
- " }\n" +
- " public static void sort(ArrayList list, Comparator c) {\n" +
- " }\n" +
- "}\n" +
- "interface Comparator {\n" +
- " int compareTo(X t, X s);\n" +
- "}\n" +
- "class ArrayList {\n" +
- " ArrayList() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int compareTo(X x) {\n" +
- " }\n" +
- " void foo() {\n" +
- " Collections.sort(new ArrayList(), (X o1, X o2) -> <CompleteOnName:o1.compa>);\n" +
- " }\n" +
+ "class Collections {\n" +
+ " Collections() {\n" +
+ " }\n" +
+ " public static void sort(ArrayList list, Comparator c) {\n" +
+ " }\n" +
+ "}\n" +
+ "interface Comparator {\n" +
+ " int compareTo(X t, X s);\n" +
+ "}\n" +
+ "class ArrayList {\n" +
+ " ArrayList() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " int compareTo(X x) {\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " Collections.sort(new ArrayList(), (X o1, X o2) -> <CompleteOnName:o1.compa>);\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -654,7 +654,7 @@ public void testElidedCompletion() {
"diet ast");
}
public void testElidedCompletion2() {
- String string =
+ String string =
"class Collections {\n" +
" public static void sort(ArrayList list, Comparator c) {\n" +
" }\n" +
@@ -679,27 +679,27 @@ public void testElidedCompletion2() {
String completionIdentifier = "compa";
String expectedReplacedSource = "o1.compa";
String expectedUnitDisplayString =
- "class Collections {\n" +
- " Collections() {\n" +
- " }\n" +
- " public static void sort(ArrayList list, Comparator c) {\n" +
- " }\n" +
- "}\n" +
- "interface Comparator {\n" +
- " int compareTo(X t, X s);\n" +
- "}\n" +
- "class ArrayList {\n" +
- " ArrayList() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " int compareTo(X x) {\n" +
- " }\n" +
- " void foo() {\n" +
- " Collections.sort(new ArrayList(), (<no type> o1, <no type> o2) -> <CompleteOnName:o1.compa>);\n" +
- " }\n" +
+ "class Collections {\n" +
+ " Collections() {\n" +
+ " }\n" +
+ " public static void sort(ArrayList list, Comparator c) {\n" +
+ " }\n" +
+ "}\n" +
+ "interface Comparator {\n" +
+ " int compareTo(X t, X s);\n" +
+ "}\n" +
+ "class ArrayList {\n" +
+ " ArrayList() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " int compareTo(X x) {\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " Collections.sort(new ArrayList(), (<no type> o1, <no type> o2) -> <CompleteOnName:o1.compa>);\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -713,7 +713,7 @@ public void testElidedCompletion2() {
"diet ast");
}
public void testUnspecifiedReference() { // verify that completion works on unspecified reference and finds types and names.
- String string =
+ String string =
"interface I {\n" +
" void doit(X x);\n" +
"}\n" +
@@ -737,23 +737,23 @@ public void testUnspecifiedReference() { // verify that completion works on uns
String completionIdentifier = "Str";
String expectedReplacedSource = "Str";
String expectedUnitDisplayString =
- "interface I {\n" +
- " void doit(X x);\n" +
- "}\n" +
- "class String {\n" +
- " String() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " static void goo(I i) {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " goo((<no type> StringParameter) -> {\n" +
- " <CompleteOnName:Str>;\n" +
- "});\n" +
- " }\n" +
+ "interface I {\n" +
+ " void doit(X x);\n" +
+ "}\n" +
+ "class String {\n" +
+ " String() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " static void goo(I i) {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " goo((<no type> StringParameter) -> {\n" +
+ " <CompleteOnName:Str>;\n" +
+ "});\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -767,7 +767,7 @@ public void testUnspecifiedReference() { // verify that completion works on uns
"diet ast");
}
public void testBrokenMethodCall() { // verify that completion works when the call containing the lambda is broken - i.e missing a semicolon.
- String string =
+ String string =
"interface I {\n" +
" void doit(X x);\n" +
"}\n" +
@@ -789,19 +789,19 @@ public void testBrokenMethodCall() { // verify that completion works when the c
String completionIdentifier = "Str";
String expectedReplacedSource = "Str";
String expectedUnitDisplayString =
- "interface I {\n" +
- " void doit(X x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " static void goo(I i) {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " goo((<no type> StringParameter) -> {\n" +
- " <CompleteOnName:Str>;\n" +
- "});\n" +
- " }\n" +
+ "interface I {\n" +
+ " void doit(X x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " static void goo(I i) {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " goo((<no type> StringParameter) -> {\n" +
+ " <CompleteOnName:Str>;\n" +
+ "});\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -816,7 +816,7 @@ public void testBrokenMethodCall() { // verify that completion works when the c
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=424080, [1.8][completion] Workbench hanging on code completion with lambda expression containing anonymous class
public void test424080() {
-String string =
+String string =
"interface FI {\n" +
" public static int val = 5;\n" +
" default int run (String x) { return 1;};\n" +
@@ -834,18 +834,18 @@ String string =
String completionIdentifier = "val";
String expectedReplacedSource = "val";
String expectedUnitDisplayString =
- "interface FI {\n" +
- " public static int val;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " default int run(String x) {\n" +
- " }\n" +
- " public int run(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " FI fi;\n" +
- " public X() {\n" +
- " }\n" +
+ "interface FI {\n" +
+ " public static int val;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " default int run(String x) {\n" +
+ " }\n" +
+ " public int run(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " FI fi;\n" +
+ " public X() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -860,7 +860,7 @@ String string =
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=425084, [1.8][completion] Eclipse freeze while autocompleting try block in lambda.
public void test425084() {
- String string =
+ String string =
"interface I {\n" +
" void foo();\n" +
"}\n" +
@@ -878,15 +878,15 @@ public void test425084() {
String completionIdentifier = "try";
String expectedReplacedSource = "try";
String expectedUnitDisplayString =
- "interface I {\n" +
- " void foo();\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " I goo() {\n" +
- " <CompleteOnName:try>;\n" +
- " }\n" +
+ "interface I {\n" +
+ " void foo();\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " I goo() {\n" +
+ " <CompleteOnName:try>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -901,7 +901,7 @@ public void test425084() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=425084, [1.8][completion] Eclipse freeze while autocompleting try block in lambda.
public void test425084b() {
- String string =
+ String string =
"interface I {\n" +
" void foo();\n" +
"}\n" +
@@ -921,17 +921,17 @@ public void test425084b() {
String completionIdentifier = "try";
String expectedReplacedSource = "try";
String expectedUnitDisplayString =
- "interface I {\n" +
- " void foo();\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " I goo() {\n" +
- " return () -> {\n" +
- " <CompleteOnName:try>;\n" +
- "};\n" +
- " }\n" +
+ "interface I {\n" +
+ " void foo();\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " I goo() {\n" +
+ " return () -> {\n" +
+ " <CompleteOnName:try>;\n" +
+ "};\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -946,7 +946,7 @@ public void test425084b() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=427255, [1.8][code assist] Hang due to infinite loop in Parser.automatonWillShift
public void test427255() {
- String string =
+ String string =
"public class X {\n" +
" public final String targetApplication;\n" +
" public final String arguments;\n" +
@@ -962,15 +962,15 @@ public void test427255() {
String completionIdentifier = "X";
String expectedReplacedSource = "X";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public final String targetApplication;\n" +
- " public final String arguments;\n" +
- " public final String appUserModelID;\n" +
- " <CompleteOnType:X>;\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
+ "public class X {\n" +
+ " public final String targetApplication;\n" +
+ " public final String arguments;\n" +
+ " public final String appUserModelID;\n" +
+ " <CompleteOnType:X>;\n" +
+ " {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -985,7 +985,7 @@ public void test427255() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=427322, [1.8][code assist] Eclipse hangs upon completion just past lambda
public void test427322() {
- String string =
+ String string =
"public class X {\n" +
" interface I {\n" +
" int foo();\n" +
@@ -1003,17 +1003,17 @@ public void test427322() {
String completionIdentifier = "";
String expectedReplacedSource = "";
String expectedUnitDisplayString =
- "public class X {\n" +
- " interface I {\n" +
- " int foo();\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i;\n" +
- " I i;\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
+ "public class X {\n" +
+ " interface I {\n" +
+ " int foo();\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i;\n" +
+ " I i;\n" +
+ " <CompleteOnName:>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1028,7 +1028,7 @@ public void test427322() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=427322, [1.8][code assist] Eclipse hangs upon completion just past lambda
public void test427322a() {
- String string =
+ String string =
"public class X {\n" +
" interface I {\n" +
" int foo();\n" +
@@ -1046,17 +1046,17 @@ public void test427322a() {
String completionIdentifier = "";
String expectedReplacedSource = "";
String expectedUnitDisplayString =
- "public class X {\n" +
- " interface I {\n" +
- " int foo();\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i;\n" +
- " I i;\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
+ "public class X {\n" +
+ " interface I {\n" +
+ " int foo();\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i;\n" +
+ " I i;\n" +
+ " <CompleteOnName:>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1071,7 +1071,7 @@ public void test427322a() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=427463, [1.8][content assist] No completions available in throw statement within lambda body
public void test427463() {
- String string =
+ String string =
"interface FI1 {\n" +
" int foo(int x) throws Exception;\n" +
"}\n" +
@@ -1092,17 +1092,17 @@ public void test427463() {
String completionIdentifier = "Ex";
String expectedReplacedSource = "Ex";
String expectedUnitDisplayString =
- "interface FI1 {\n" +
- " int foo(int x) throws Exception;\n" +
- "}\n" +
- "class Test {\n" +
- " FI1 fi1 = (int x) -> {\n" +
- " <CompleteOnException:Ex>;\n" +
- " };\n" +
- " Test() {\n" +
- " }\n" +
- " private void test() throws Exception {\n" +
- " }\n" +
+ "interface FI1 {\n" +
+ " int foo(int x) throws Exception;\n" +
+ "}\n" +
+ "class Test {\n" +
+ " FI1 fi1 = (int x) -> {\n" +
+ " <CompleteOnException:Ex>;\n" +
+ " };\n" +
+ " Test() {\n" +
+ " }\n" +
+ " private void test() throws Exception {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1117,7 +1117,7 @@ public void test427463() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=427117, [1.8][code assist] code assist after lambda as a parameter does not work
public void test427117() {
- String string =
+ String string =
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"public class X {\n" +
@@ -1139,17 +1139,17 @@ public void test427117() {
String completionIdentifier = "";
String expectedReplacedSource = "list.";
String expectedUnitDisplayString =
- "import java.util.ArrayList;\n" +
- "import java.util.List;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " }\n" +
- " public static void bar() {\n" +
- " List<Integer> list;\n" +
- " <CompleteOnName:list.>;\n" +
- " }\n" +
+ "import java.util.ArrayList;\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " }\n" +
+ " public static void bar() {\n" +
+ " List<Integer> list;\n" +
+ " <CompleteOnName:list.>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1164,7 +1164,7 @@ public void test427117() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=427532, [1.8][code assist] Completion engine does not like intersection casts
public void test427532() {
- String string =
+ String string =
"import java.io.Serializable;\n" +
"interface I {\n" +
" void foo();\n" +
@@ -1184,17 +1184,17 @@ public void test427532() {
String completionIdentifier = "syso";
String expectedReplacedSource = "syso";
String expectedUnitDisplayString =
- "import java.io.Serializable;\n" +
- "interface I {\n" +
- " void foo();\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i;\n" +
- " <CompleteOnName:syso>;\n" +
- " }\n" +
+ "import java.io.Serializable;\n" +
+ "interface I {\n" +
+ " void foo();\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i;\n" +
+ " <CompleteOnName:syso>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1209,7 +1209,7 @@ public void test427532() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735() {
- String string =
+ String string =
"import java.util.List;\n" +
"class Person {\n" +
" String getLastName() { return null; }\n" +
@@ -1228,19 +1228,19 @@ public void test428735() {
String completionIdentifier = "";
String expectedReplacedSource = "p.";
String expectedUnitDisplayString =
- "import java.util.List;\n" +
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void test1(List<Person> people) {\n" +
- " people.stream().forEach((<no type> p) -> System.out.println(<CompleteOnName:p.>));\n" +
- " }\n" +
+ "import java.util.List;\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void test1(List<Person> people) {\n" +
+ " people.stream().forEach((<no type> p) -> System.out.println(<CompleteOnName:p.>));\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1255,7 +1255,7 @@ public void test428735() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735a() {
- String string =
+ String string =
"import java.util.List;\n" +
"class Person {\n" +
" String getLastName() { return null; }\n" +
@@ -1277,21 +1277,21 @@ public void test428735a() {
String completionIdentifier = "";
String expectedReplacedSource = "x.";
String expectedUnitDisplayString =
- "import java.util.List;\n" +
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void test1(List<Person> people) {\n" +
- " }\n" +
- " void test2(List<Person> people) {\n" +
- " people.sort((<no type> x, <no type> y) -> <CompleteOnName:x.>);\n" +
- " }\n" +
+ "import java.util.List;\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void test1(List<Person> people) {\n" +
+ " }\n" +
+ " void test2(List<Person> people) {\n" +
+ " people.sort((<no type> x, <no type> y) -> <CompleteOnName:x.>);\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1306,7 +1306,7 @@ public void test428735a() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735b() {
- String string =
+ String string =
"import java.util.List;\n" +
"class Person {\n" +
" String getLastName() { return null; }\n" +
@@ -1316,7 +1316,7 @@ public void test428735b() {
" people.stream().forEach(p -> System.out.println(p.)); // NOK\n" +
" }\n" +
" void test2(List<Person> people) {\n" +
- " people.sort((x,y) -> x.getLastName().compareTo(y.));\n" +
+ " people.sort((x,y) -> x.getLastName().compareTo(y.));\n" +
" }\n" +
"}\n";
@@ -1328,21 +1328,21 @@ public void test428735b() {
String completionIdentifier = "";
String expectedReplacedSource = "y.";
String expectedUnitDisplayString =
- "import java.util.List;\n" +
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void test1(List<Person> people) {\n" +
- " }\n" +
- " void test2(List<Person> people) {\n" +
- " people.sort((<no type> x, <no type> y) -> x.getLastName().compareTo(<CompleteOnName:y.>));\n" +
- " }\n" +
+ "import java.util.List;\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void test1(List<Person> people) {\n" +
+ " }\n" +
+ " void test2(List<Person> people) {\n" +
+ " people.sort((<no type> x, <no type> y) -> x.getLastName().compareTo(<CompleteOnName:y.>));\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1357,7 +1357,7 @@ public void test428735b() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735c() {
- String string =
+ String string =
"import java.util.List;\n" +
"class Person {\n" +
" String getLastName() { return null; }\n" +
@@ -1367,7 +1367,7 @@ public void test428735c() {
" people.stream().forEach(p -> System.out.println(p.)); // NOK\n" +
" }\n" +
" void test2(List<Person> people) {\n" +
- " people.sort((x,y) -> x.getLastName() + y.);\n" +
+ " people.sort((x,y) -> x.getLastName() + y.);\n" +
" }\n" +
"}\n";
@@ -1379,21 +1379,21 @@ public void test428735c() {
String completionIdentifier = "";
String expectedReplacedSource = "y.";
String expectedUnitDisplayString =
- "import java.util.List;\n" +
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void test1(List<Person> people) {\n" +
- " }\n" +
- " void test2(List<Person> people) {\n" +
- " people.sort((<no type> x, <no type> y) -> (x.getLastName() + <CompleteOnName:y.>));\n" +
- " }\n" +
+ "import java.util.List;\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void test1(List<Person> people) {\n" +
+ " }\n" +
+ " void test2(List<Person> people) {\n" +
+ " people.sort((<no type> x, <no type> y) -> (x.getLastName() + <CompleteOnName:y.>));\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1408,7 +1408,7 @@ public void test428735c() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735d() {
- String string =
+ String string =
"import java.util.List;\n" +
"class Person {\n" +
" String getLastName() { return null; }\n" +
@@ -1418,7 +1418,7 @@ public void test428735d() {
" people.stream().forEach(p -> System.out.println(p.)); // NOK\n" +
" }\n" +
" void test2(List<Person> people) {\n" +
- " people.sort((x,y) -> \"\" + x.); \n" +
+ " people.sort((x,y) -> \"\" + x.); \n" +
" }\n" +
"}\n";
@@ -1430,21 +1430,21 @@ public void test428735d() {
String completionIdentifier = "";
String expectedReplacedSource = "x.";
String expectedUnitDisplayString =
- "import java.util.List;\n" +
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void test1(List<Person> people) {\n" +
- " }\n" +
- " void test2(List<Person> people) {\n" +
- " people.sort((<no type> x, <no type> y) -> (\"\" + <CompleteOnName:x.>));\n" +
- " }\n" +
+ "import java.util.List;\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void test1(List<Person> people) {\n" +
+ " }\n" +
+ " void test2(List<Person> people) {\n" +
+ " people.sort((<no type> x, <no type> y) -> (\"\" + <CompleteOnName:x.>));\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1459,7 +1459,7 @@ public void test428735d() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735e() { // field
- String string =
+ String string =
"class Person {\n" +
" String getLastName() { return null; }\n" +
"}\n" +
@@ -1478,19 +1478,19 @@ public void test428735e() { // field
String completionIdentifier = "get";
String expectedReplacedSource = "y.get";
String expectedUnitDisplayString =
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "interface I {\n" +
- " int foo(Person p, Person q);\n" +
- "}\n" +
- "public class X {\n" +
- " I i = (<no type> x, <no type> y) -> (10 + x.getLastName().compareTo(<CompleteOnName:y.get>));\n" +
- " public X() {\n" +
- " }\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "interface I {\n" +
+ " int foo(Person p, Person q);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " I i = (<no type> x, <no type> y) -> (10 + x.getLastName().compareTo(<CompleteOnName:y.get>));\n" +
+ " public X() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1505,7 +1505,7 @@ public void test428735e() { // field
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735f() { // local
- String string =
+ String string =
"class Person {\n" +
" String getLastName() { return null; }\n" +
"}\n" +
@@ -1526,21 +1526,21 @@ public void test428735f() { // local
String completionIdentifier = "get";
String expectedReplacedSource = "y.get";
String expectedUnitDisplayString =
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "interface I {\n" +
- " int foo(Person p, Person q);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " I i = (<no type> x, <no type> y) -> (10 + x.getLastName().compareTo(<CompleteOnName:y.get>));\n" +
- " }\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "interface I {\n" +
+ " int foo(Person p, Person q);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " I i = (<no type> x, <no type> y) -> (10 + x.getLastName().compareTo(<CompleteOnName:y.get>));\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1555,7 +1555,7 @@ public void test428735f() { // local
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735g() { // initializer block
- String string =
+ String string =
"import java.util.List;\n" +
"class Person {\n" +
" String getLastName() { return null; }\n" +
@@ -1566,7 +1566,7 @@ public void test428735g() { // initializer block
"public class X {\n" +
" List<Person> people;\n" +
" {\n" +
- " people.sort((x,y) -> \"\" + x.); \n" +
+ " people.sort((x,y) -> \"\" + x.); \n" +
" }\n" +
"}\n";
@@ -1578,23 +1578,23 @@ public void test428735g() { // initializer block
String completionIdentifier = "";
String expectedReplacedSource = "x.";
String expectedUnitDisplayString =
- "import java.util.List;\n" +
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "interface I {\n" +
- " int foo(Person p, Person q);\n" +
- "}\n" +
- "public class X {\n" +
- " List<Person> people;\n" +
- " {\n" +
- " people.sort((<no type> x, <no type> y) -> (\"\" + <CompleteOnName:x.>));\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
+ "import java.util.List;\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "interface I {\n" +
+ " int foo(Person p, Person q);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " List<Person> people;\n" +
+ " {\n" +
+ " people.sort((<no type> x, <no type> y) -> (\"\" + <CompleteOnName:x.>));\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1609,7 +1609,7 @@ public void test428735g() { // initializer block
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=402081, [1.8][code complete] No proposals while completing at method/constructor references
public void test402081() { // initializer block
- String string =
+ String string =
"interface I {\n" +
" String foo(String x);\n" +
"}\n" +
@@ -1632,18 +1632,18 @@ public void test402081() { // initializer block
String completionIdentifier = "long";
String expectedReplacedSource = "x::long";
String expectedUnitDisplayString =
- "interface I {\n" +
- " String foo(String x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public String longMethodName(String x) {\n" +
- " }\n" +
- " void foo() {\n" +
- " X x;\n" +
- " I i = <CompletionOnReferenceExpressionName:x::long>;\n" +
- " }\n" +
+ "interface I {\n" +
+ " String foo(String x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public String longMethodName(String x) {\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " X x;\n" +
+ " I i = <CompletionOnReferenceExpressionName:x::long>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1658,7 +1658,7 @@ public void test402081() { // initializer block
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=430656, [1.8][content assist] Content assist does not work for method reference argument
public void test430656() {
- String string =
+ String string =
"import java.util.ArrayList;\n" +
"import java.util.Collections;\n" +
"import java.util.Comparator;\n" +
@@ -1683,23 +1683,23 @@ public void test430656() {
String completionIdentifier = "get";
String expectedReplacedSource = "Person::get";
String expectedUnitDisplayString =
- "import java.util.ArrayList;\n" +
- "import java.util.Collections;\n" +
- "import java.util.Comparator;\n" +
- "import java.util.List;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public void bar() {\n" +
- " List<Person> people;\n" +
- " Comparator.comparing(<CompletionOnReferenceExpressionName:Person::get>);\n" +
- " }\n" +
- "}\n" +
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
+ "import java.util.ArrayList;\n" +
+ "import java.util.Collections;\n" +
+ "import java.util.Comparator;\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public void bar() {\n" +
+ " List<Person> people;\n" +
+ " Comparator.comparing(<CompletionOnReferenceExpressionName:Person::get>);\n" +
+ " }\n" +
+ "}\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1712,9 +1712,9 @@ public void test430656() {
expectedReplacedSource,
"diet ast");
}
-// https://bugs.eclipse.org/bugs/show_bug.cgi?id=438952, [1.8][content assist] StackOverflowError at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.traverse(SingleTypeReference.java:108)
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=438952, [1.8][content assist] StackOverflowError at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.traverse(SingleTypeReference.java:108)
public void test438952() {
- String string =
+ String string =
"import java.util.function.Supplier;\n" +
"class SO {\n" +
" {\n" +
@@ -1736,18 +1736,18 @@ public void test438952() {
String completionIdentifier = "";
String expectedReplacedSource = "";
String expectedUnitDisplayString =
- "import java.util.function.Supplier;\n" +
- "class SO {\n" +
- " {\n" +
- " int Supplier;\n" +
- " m6 = () -> new SO() {\n" +
- " void test() {\n" +
- " <CompleteOnName:>;\n" +
- " }\n" +
- "};\n" +
- " }\n" +
- " SO() {\n" +
- " }\n" +
+ "import java.util.function.Supplier;\n" +
+ "class SO {\n" +
+ " {\n" +
+ " int Supplier;\n" +
+ " m6 = () -> new SO() {\n" +
+ " void test() {\n" +
+ " <CompleteOnName:>;\n" +
+ " }\n" +
+ "};\n" +
+ " }\n" +
+ " SO() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1760,9 +1760,9 @@ public void test438952() {
expectedReplacedSource,
"diet ast");
}
-// https://bugs.eclipse.org/bugs/show_bug.cgi?id=435219, [1.8][content assist] No proposals for some closure cases
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=435219, [1.8][content assist] No proposals for some closure cases
public void test435219() {
- String string =
+ String string =
"import java.util.Arrays;\n" +
"import java.util.List;\n" +
"public class X {\n" +
@@ -1782,15 +1782,15 @@ public void test435219() {
String completionIdentifier = "dou";
String expectedReplacedSource = "cost.dou";
String expectedUnitDisplayString =
- "import java.util.Arrays;\n" +
- "import java.util.List;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " List<Integer> costBeforeTax;\n" +
- " double bill = costBeforeTax.stream().map((<no type> cost) -> (cost + (0.19 * cost))).reduce((<no type> sum, <no type> cost) -> (sum.doubleValue() + <CompleteOnName:cost.dou>));\n" +
- " }\n" +
+ "import java.util.Arrays;\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " List<Integer> costBeforeTax;\n" +
+ " double bill = costBeforeTax.stream().map((<no type> cost) -> (cost + (0.19 * cost))).reduce((<no type> sum, <no type> cost) -> (sum.doubleValue() + <CompleteOnName:cost.dou>));\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1805,7 +1805,7 @@ public void test435219() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=435682, [1.8] content assist not working inside lambda expression
public void test435682() {
- String string =
+ String string =
"import java.util.Arrays;\n" +
"import java.util.List;\n" +
"public class X {\n" +
@@ -1823,15 +1823,15 @@ public void test435682() {
String completionIdentifier = "";
String expectedReplacedSource = "so.";
String expectedUnitDisplayString =
- "import java.util.Arrays;\n" +
- "import java.util.List;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " List<String> words;\n" +
- " List<String> list1 = words.stream().map((<no type> so) -> <CompleteOnName:so.>).collect(Collectors.toList());\n" +
- " }\n" +
+ "import java.util.Arrays;\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " List<String> words;\n" +
+ " List<String> list1 = words.stream().map((<no type> so) -> <CompleteOnName:so.>).collect(Collectors.toList());\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1846,7 +1846,7 @@ public void test435682() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=430667, [1.8][content assist] no proposals around lambda as a field
public void test430667() {
- String string =
+ String string =
"interface D_FI {\n" +
" void print(String value, int n);\n" +
"}\n" +
@@ -1868,14 +1868,14 @@ public void test430667() {
String completionIdentifier = "D_F";
String expectedReplacedSource = "D_F";
String expectedUnitDisplayString =
- "interface D_FI {\n" +
- " void print(String value, int n);\n" +
- "}\n" +
- "class D_DemoRefactorings {\n" +
- " D_FI fi1;\n" +
- " <CompleteOnType:D_F>;\n" +
- " D_DemoRefactorings() {\n" +
- " }\n" +
+ "interface D_FI {\n" +
+ " void print(String value, int n);\n" +
+ "}\n" +
+ "class D_DemoRefactorings {\n" +
+ " D_FI fi1;\n" +
+ " <CompleteOnType:D_F>;\n" +
+ " D_DemoRefactorings() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -1890,7 +1890,7 @@ public void test430667() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=430667, [1.8][content assist] no proposals around lambda as a field
public void test430667a() {
- String string =
+ String string =
"class D_DemoRefactorings {\n" +
" \n" +
" D_FI fi1= (String value, int n) -> {\n" +
@@ -1903,7 +1903,7 @@ public void test430667a() {
"interface D_FI {\n" +
" void print(String value, int n);\n" +
"}\n";
-
+
String completeBehind = "/*HERE*/D_F";
int cursorLocation = string.lastIndexOf(completeBehind) + completeBehind.length() - 1;
@@ -1913,14 +1913,14 @@ public void test430667a() {
String completionIdentifier = "D_F";
String expectedReplacedSource = "D_F";
String expectedUnitDisplayString =
- "class D_DemoRefactorings {\n" +
- " D_FI fi1;\n" +
- " <CompleteOnType:D_F>;\n" +
- " D_DemoRefactorings() {\n" +
- " }\n" +
- "}\n" +
- "interface D_FI {\n" +
- " void print(String value, int n);\n" +
+ "class D_DemoRefactorings {\n" +
+ " D_FI fi1;\n" +
+ " <CompleteOnType:D_F>;\n" +
+ " D_DemoRefactorings() {\n" +
+ " }\n" +
+ "}\n" +
+ "interface D_FI {\n" +
+ " void print(String value, int n);\n" +
"}\n";
checkMethodParse(
@@ -1935,7 +1935,7 @@ public void test430667a() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=430667, [1.8][content assist] no proposals around lambda as a field
public void test430667b() {
- String string =
+ String string =
"public class D_DemoRefactorings {\n" +
" D_F\n" +
" D_FI fi1= (String value, int n) -> {\n" +
@@ -1947,7 +1947,7 @@ public void test430667b() {
"interface D_FI {\n" +
" void print(String value, int n);\n" +
"}\n";
-
+
String completeBehind = "D_F";
int cursorLocation = string.indexOf(completeBehind) + completeBehind.length() - 1;
@@ -1956,14 +1956,14 @@ public void test430667b() {
String completionIdentifier = "D_F";
String expectedReplacedSource = "D_F";
String expectedUnitDisplayString =
- "public class D_DemoRefactorings {\n" +
- " <CompleteOnType:D_F>;\n" +
- " D_FI fi1;\n" +
- " public D_DemoRefactorings() {\n" +
- " }\n" +
- "}\n" +
- "interface D_FI {\n" +
- " void print(String value, int n);\n" +
+ "public class D_DemoRefactorings {\n" +
+ " <CompleteOnType:D_F>;\n" +
+ " D_FI fi1;\n" +
+ " public D_DemoRefactorings() {\n" +
+ " }\n" +
+ "}\n" +
+ "interface D_FI {\n" +
+ " void print(String value, int n);\n" +
"}\n";
checkMethodParse(
@@ -1978,7 +1978,7 @@ public void test430667b() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=430667, [1.8][content assist] no proposals around lambda as a field
public void test430667c() {
- String string =
+ String string =
"public interface Foo {\n" +
" int run(int s1, int s2);\n" +
"}\n" +
@@ -1987,7 +1987,7 @@ public void test430667c() {
" static int another = 3;\n" +
" static int two () { return 2; }\n" +
"}";
-
+
String completeBehind = "(int x5, int x2) -> anot";
int cursorLocation = string.indexOf(completeBehind) + completeBehind.length() - 1;
@@ -1996,16 +1996,16 @@ public void test430667c() {
String completionIdentifier = "anot";
String expectedReplacedSource = "anot";
String expectedUnitDisplayString =
- "public interface Foo {\n" +
- " int run(int s1, int s2);\n" +
- "}\n" +
- "interface B {\n" +
- " static Foo f = (int x5, int x2) -> <CompleteOnName:anot>;\n" +
- " static int another;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " static int two() {\n" +
- " }\n" +
+ "public interface Foo {\n" +
+ " int run(int s1, int s2);\n" +
+ "}\n" +
+ "interface B {\n" +
+ " static Foo f = (int x5, int x2) -> <CompleteOnName:anot>;\n" +
+ " static int another;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " static int two() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -2020,14 +2020,14 @@ public void test430667c() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=430667, [1.8][content assist] no proposals around lambda as a field
public void test430667d() {
- String string =
+ String string =
"import java.util.Arrays;\n" +
"import java.util.List;\n" +
"public class X {\n" +
" List<Integer> list = Arrays.asList(1, 2, 3);\n" +
" Object o = list.stream().map((x) -> x * x.hashCode()).forEach(System.out::pri);\n" +
"}\n";
-
+
String completeBehind = "pri";
int cursorLocation = string.indexOf(completeBehind) + completeBehind.length() - 1;
@@ -2036,13 +2036,13 @@ public void test430667d() {
String completionIdentifier = "pri";
String expectedReplacedSource = "System.out::pri";
String expectedUnitDisplayString =
- "import java.util.Arrays;\n" +
- "import java.util.List;\n" +
- "public class X {\n" +
- " List<Integer> list;\n" +
- " Object o = list.stream().map((<no type> x) -> (x * x.hashCode())).forEach(<CompletionOnReferenceExpressionName:System.out::pri>);\n" +
- " public X() {\n" +
- " }\n" +
+ "import java.util.Arrays;\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " List<Integer> list;\n" +
+ " Object o = list.stream().map((<no type> x) -> (x * x.hashCode())).forEach(<CompletionOnReferenceExpressionName:System.out::pri>);\n" +
+ " public X() {\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -2055,9 +2055,9 @@ public void test430667d() {
expectedReplacedSource,
"diet ast");
}
-// https://bugs.eclipse.org/bugs/show_bug.cgi?id=446765,
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=446765,
public void test446765() {
- String string =
+ String string =
"class Stepper<T> {\n" +
" public interface Step<T> {\n" +
" void run();\n" +
@@ -2092,59 +2092,59 @@ public void test446765() {
" }.run(); \n" +
" } \n" +
"}\n";
-
+
String completeBehind = "response.";
int cursorLocation = string.indexOf(completeBehind) + completeBehind.length() - 1;
String expectedCompletionNodeToString = "<CompleteOnName:response.>";
- String expectedParentNodeToString = "if (<CompleteOnName:response.>)\n" +
+ String expectedParentNodeToString = "if (<CompleteOnName:response.>)\n" +
" ;";
String completionIdentifier = "";
String expectedReplacedSource = "response.";
String expectedUnitDisplayString =
- "class Stepper<T> {\n" +
- " public interface Step<T> {\n" +
- " void run();\n" +
- " }\n" +
- " public Stepper(Handler<AsyncResult<T>> handler) {\n" +
- " }\n" +
- " public final @SafeVarargs void run(Step<T>... steps) {\n" +
- " }\n" +
- "}\n" +
- "interface AsyncResult<T> {\n" +
- "}\n" +
- "interface Handler<E> {\n" +
- " void handle(E event);\n" +
- "}\n" +
- "class Z {\n" +
- " Z() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
- "}\n" +
- "interface I {\n" +
- " void foo(Z z);\n" +
- "}\n" +
- "class Y {\n" +
- " Y() {\n" +
- " }\n" +
- " void request(I i) {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void test() {\n" +
- " new Stepper<Void>((<no type> r) -> {\n" +
- "}) {\n" +
- " private void step1() {\n" +
- " Y y;\n" +
- " y.request((<no type> response) -> {\n" +
- " <CompleteOnName:response.>;\n" +
- "});\n" +
- " }\n" +
- "}.run();\n" +
- " }\n" +
+ "class Stepper<T> {\n" +
+ " public interface Step<T> {\n" +
+ " void run();\n" +
+ " }\n" +
+ " public Stepper(Handler<AsyncResult<T>> handler) {\n" +
+ " }\n" +
+ " public final @SafeVarargs void run(Step<T>... steps) {\n" +
+ " }\n" +
+ "}\n" +
+ "interface AsyncResult<T> {\n" +
+ "}\n" +
+ "interface Handler<E> {\n" +
+ " void handle(E event);\n" +
+ "}\n" +
+ "class Z {\n" +
+ " Z() {\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " }\n" +
+ "}\n" +
+ "interface I {\n" +
+ " void foo(Z z);\n" +
+ "}\n" +
+ "class Y {\n" +
+ " Y() {\n" +
+ " }\n" +
+ " void request(I i) {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void test() {\n" +
+ " new Stepper<Void>((<no type> r) -> {\n" +
+ "}) {\n" +
+ " private void step1() {\n" +
+ " Y y;\n" +
+ " y.request((<no type> response) -> {\n" +
+ " <CompleteOnName:response.>;\n" +
+ "});\n" +
+ " }\n" +
+ "}.run();\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -2159,7 +2159,7 @@ public void test446765() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428735, [1.8][assist] Missing completion proposals inside lambda body expression - other than first token
public void test428735h() {
- String string =
+ String string =
"import java.util.List;\n" +
"class Person {\n" +
" String getLastName() { return null; }\n" +
@@ -2171,7 +2171,7 @@ public void test428735h() {
" else return \"\";\n" +
" }\n" +
"}\n";
-
+
String completeBehind = "x.get";
int cursorLocation = string.indexOf(completeBehind) + completeBehind.length() - 1;
@@ -2180,24 +2180,24 @@ public void test428735h() {
String completionIdentifier = "get";
String expectedReplacedSource = "x.get";
String expectedUnitDisplayString =
- "import java.util.List;\n" +
- "class Person {\n" +
- " Person() {\n" +
- " }\n" +
- " String getLastName() {\n" +
- " }\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " void test2(List<Person> people) {\n" +
- " people.sort((<no type> x, <no type> y) -> {\n" +
- " if (true)\n" +
- " return (\"\" + <CompleteOnName:x.get>);\n" +
- " ;\n" +
- " return \"\";\n" +
- "});\n" +
- " }\n" +
+ "import java.util.List;\n" +
+ "class Person {\n" +
+ " Person() {\n" +
+ " }\n" +
+ " String getLastName() {\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void test2(List<Person> people) {\n" +
+ " people.sort((<no type> x, <no type> y) -> {\n" +
+ " if (true)\n" +
+ " return (\"\" + <CompleteOnName:x.get>);\n" +
+ " ;\n" +
+ " return \"\";\n" +
+ "});\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -2212,7 +2212,7 @@ public void test428735h() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=422468, [1.8][assist] Code assist issues with type elided lambda parameters
public void test422468() { // computing visible elements in lambda scope.
- String string =
+ String string =
"interface I {\n" +
" void foo(X x);\n" +
"}\n" +
@@ -2245,31 +2245,31 @@ public void test422468() { // computing visible elements in lambda scope.
String completionIdentifier = "";
String expectedReplacedSource = "xyz.";
String expectedUnitDisplayString =
- "interface I {\n" +
- " void foo(X x);\n" +
- "}\n" +
- "public class X {\n" +
- " static X xField;\n" +
- " public X() {\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " static X goo(String s) {\n" +
- " }\n" +
- " static void goo(I i) {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " X xLocal;\n" +
- " {\n" +
- " {\n" +
- " goo((<no type> xyz) -> {\n" +
- " X xLambdaLocal;\n" +
+ "interface I {\n" +
+ " void foo(X x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " static X xField;\n" +
+ " public X() {\n" +
+ " }\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " static X goo(String s) {\n" +
+ " }\n" +
+ " static void goo(I i) {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " X xLocal;\n" +
+ " {\n" +
+ " {\n" +
+ " goo((<no type> xyz) -> {\n" +
+ " X xLambdaLocal;\n" +
" System.out.println(<CompleteOnName:xyz.>);\n" +
- " ;\n" +
- "});\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ " ;\n" +
+ "});\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -2284,7 +2284,7 @@ public void test422468() { // computing visible elements in lambda scope.
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=473008
public void test473008() {
- String string =
+ String string =
"interface FooFunctional {\n" +
" void function();\n" +
"}\n" +
@@ -2302,16 +2302,16 @@ public void test473008() {
String completionIdentifier = "";
String expectedReplacedSource = "";
String expectedUnitDisplayString =
- "interface FooFunctional {\n" +
- " void function();\n" +
- "}\n" +
- "public class Foo {\n" +
- " public Foo() {\n" +
- " }\n" +
- " public void bar() {\n" +
- " private FooFunctional lambda;\n" +
- " <CompleteOnAllocationExpression:new StringBuffer()>;\n" +
- " }\n" +
+ "interface FooFunctional {\n" +
+ " void function();\n" +
+ "}\n" +
+ "public class Foo {\n" +
+ " public Foo() {\n" +
+ " }\n" +
+ " public void bar() {\n" +
+ " private FooFunctional lambda;\n" +
+ " <CompleteOnAllocationExpression:new StringBuffer()>;\n" +
+ " }\n" +
"}\n";
checkMethodParse(
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
index 0318fb79e..f36ef7575 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -4159,7 +4159,7 @@ public void test0067_Method(){
String expectedUnitDisplayString =
"package p;\n" +
"public class X {\n" +
- " Object o = new X[]{<CompleteOnName:zzz>};\n" +
+ " Object o = new X[]{<CompleteOnName:zzz>};\n" +
" public X() {\n" +
" }\n" +
"}\n";
@@ -9302,12 +9302,12 @@ public void test0139(){
String completeBehind = "Z.";
int cursorLocation = str.indexOf("Z.") + completeBehind.length() - 1;
String expectedCompletionNodeToString = "<CompleteOnClass:Z.>";
- String expectedParentNodeToString =
- "public class X extends <CompleteOnClass:Z.> {\n" +
- " {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
+ String expectedParentNodeToString =
+ "public class X extends <CompleteOnClass:Z.> {\n" +
+ " {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
"}";
String completionIdentifier = "";
String expectedReplacedSource = "Z.";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java
index e4efa645e..f24fb392c 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java
@@ -1035,46 +1035,46 @@ public void test25() {
public void test26() {
this.runTestCheckMethodParse(
// compilationUnit:
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "\n" +
- "public class Try {\n" +
- "\n" +
- " void main(Shell shell) {\n" +
- "\n" +
- " final Label label= new Label(shell, SWT.WRAP);\n" +
- " label.addPaintListener(new PaintListener() {\n" +
- " public void paintControl(PaintEvent e) {\n" +
- " e.gc.setLineCap(SWT.CAP_); // content assist after CAP_\n" +
- " }\n" +
- " });\n" +
- "\n" +
- " shell.addControlListener(new ControlAdapter() { });\n" +
- "\n" +
- " while (!shell.isDisposed()) { }\n" +
- " }\n" +
- "}\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "\n" +
+ "public class Try {\n" +
+ "\n" +
+ " void main(Shell shell) {\n" +
+ "\n" +
+ " final Label label= new Label(shell, SWT.WRAP);\n" +
+ " label.addPaintListener(new PaintListener() {\n" +
+ " public void paintControl(PaintEvent e) {\n" +
+ " e.gc.setLineCap(SWT.CAP_); // content assist after CAP_\n" +
+ " }\n" +
+ " });\n" +
+ "\n" +
+ " shell.addControlListener(new ControlAdapter() { });\n" +
+ "\n" +
+ " while (!shell.isDisposed()) { }\n" +
+ " }\n" +
+ "}\n" +
"\n",
// completeBehind:
"SWT.CAP_",
// expectedCompletionNodeToString:
"<CompleteOnName:SWT.CAP_>",
// expectedUnitDisplayString:
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " final Label label;\n" +
- " new PaintListener() {\n" +
- " public void paintControl(PaintEvent e) {\n" +
- " e.gc.setLineCap(<CompleteOnName:SWT.CAP_>);\n" +
- " }\n" +
- " };\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " final Label label;\n" +
+ " new PaintListener() {\n" +
+ " public void paintControl(PaintEvent e) {\n" +
+ " e.gc.setLineCap(<CompleteOnName:SWT.CAP_>);\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
"}\n",
// expectedCompletionIdentifier:
"CAP_",
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java
index 44c0c96ad..3265d2e89 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java
@@ -1107,11 +1107,11 @@ public void test0023() {
expected13ProblemLog;
String expected15ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 1)\n" +
- " import static for;\n" +
- " ^^^\n" +
- "Syntax error on token \"for\", invalid Name\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " import static for;\n" +
+ " ^^^\n" +
+ "Syntax error on token \"for\", invalid Name\n" +
"----------\n";
runComplianceParserTest(
@@ -1256,21 +1256,21 @@ public void test0027() {
};
String expected13ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " for(Object o : switch){\n" +
- " ^\n" +
- "Syntax error on token \":\", delete this token\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 3)\n" +
- " for(Object o : switch){\n" +
- " ^\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " for(Object o : switch){\n" +
+ " ^\n" +
+ "Syntax error on token \":\", delete this token\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " for(Object o : switch){\n" +
+ " ^\n" +
"Syntax error, insert \": Expression )\" to complete EnhancedForStatementHeader\n" + // FIXME: bogus suggestion, this rule is compliance 1.5
- "----------\n" +
- "3. ERROR in X.java (at line 3)\n" +
- " for(Object o : switch){\n" +
- " ^\n" +
- "Syntax error, insert \"Statement\" to complete BlockStatements\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " for(Object o : switch){\n" +
+ " ^\n" +
+ "Syntax error, insert \"Statement\" to complete BlockStatements\n" +
"----------\n";
String expected14ProblemLog =
expected13ProblemLog;
@@ -1524,16 +1524,16 @@ public void _test0032() {
};
String expected13ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 1)\n" +
- " public class X <T1 extends String, T2 extends Y {\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Syntax error on token(s), misplaced construct(s)\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 1)\n" +
- " public class X <T1 extends String, T2 extends Y {\n" +
- " ^\n" +
- "Y cannot be resolved to a type\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public class X <T1 extends String, T2 extends Y {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Syntax error on token(s), misplaced construct(s)\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " public class X <T1 extends String, T2 extends Y {\n" +
+ " ^\n" +
+ "Y cannot be resolved to a type\n" +
"----------\n";
String expected14ProblemLog =
expected13ProblemLog;
@@ -1639,10 +1639,10 @@ public void test0034() {
"Syntax error, insert \"}\" to complete ClassBody\n" +
:giro */
" ^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Syntax error on tokens, delete these tokens\n" +
+ "Syntax error on tokens, delete these tokens\n" +
"----------\n" +
"2. ERROR in X.java (at line 1)\n" +
- " public class X <T1 extnds String, T2> extends Y {\n" +
+ " public class X <T1 extnds String, T2> extends Y {\n" +
" ^^\n" +
"T1 cannot be resolved to a type\n" +
// SH}
@@ -1654,22 +1654,22 @@ public void test0034() {
"----------\n" +
"1. ERROR in X.java (at line 1)\n" +
//{ObjectTeams
- " public class X <T1 extnds String, T2> extends Y {\n" +
- " ^^\n" +
- "T1 cannot be resolved to a type\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 1)\n" +
-// orig:
+ " public class X <T1 extnds String, T2> extends Y {\n" +
+ " ^^\n" +
+ "T1 cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+// orig:
" public class X <T1 extnds String, T2> extends Y {\n" +
" ^^^^^^\n" +
"Syntax error on token \"extnds\", extends expected\n" +
-/*
+/*
"----------\n" +
"2. ERROR in X.java (at line 1)\n" +
" public class X <T1 extnds String, T2> extends Y {\n" +
" ^^^^^^\n" +
"extnds cannot be resolved to a type\n" +
- :giro */
+ :giro */
// SH}
"----------\n";
@@ -1994,24 +1994,24 @@ public void _test0042() {
};
String expected13ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 1)\n" +
- " void ___eval() {\n" +
- " ^^^^^^^^^^^^^^\n" +
- "Syntax error on tokens, delete these tokens\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 2)\n" +
- " new Runnable() {\n" +
- " int ___run() throws Throwable {\n" +
- " return blah;\n" +
- " }\n" +
- " private String blarg;\n" +
- " public void run() {\n" +
- " }\n" +
- " };\n" +
- "}\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Syntax error on tokens, delete these tokens\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " void ___eval() {\n" +
+ " ^^^^^^^^^^^^^^\n" +
+ "Syntax error on tokens, delete these tokens\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " new Runnable() {\n" +
+ " int ___run() throws Throwable {\n" +
+ " return blah;\n" +
+ " }\n" +
+ " private String blarg;\n" +
+ " public void run() {\n" +
+ " }\n" +
+ " };\n" +
+ "}\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Syntax error on tokens, delete these tokens\n" +
"----------\n";
@SuppressWarnings("unused")
String expected14ProblemLog =
@@ -2019,65 +2019,65 @@ public void _test0042() {
@SuppressWarnings("unused")
String expected15ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 1)\n" +
- " void ___eval() {\n" +
- " ^^^^\n" +
- "Syntax error on token \"void\", @ expected\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 1)\n" +
- " void ___eval() {\n" +
- " ^\n" +
- "Syntax error on token \")\", delete this token\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 9)\n" +
- " };\n" +
- "}\n" +
- " ^^^^\n" +
- "Syntax error on tokens, delete these tokens\n" +
- "----------\n" +
- "4. ERROR in X.java (at line 23)\n" +
- " }\n" +
- " ^\n" +
- "Syntax error, insert \"}\" to complete ClassBody\n" +
- "----------\n" +
- "5. ERROR in X.java (at line 23)\n" +
- " }\n" +
- " ^\n" +
- "Syntax error, insert \"}\" to complete MemberValue\n" +
- "----------\n" +
- "6. ERROR in X.java (at line 23)\n" +
- " }\n" +
- " ^\n" +
- "Syntax error, insert \")\" to complete Modifiers\n" +
- "----------\n" +
- "7. ERROR in X.java (at line 23)\n" +
- " }\n" +
- " ^\n" +
- "Syntax error, insert \"enum Identifier\" to complete EnumHeader\n" +
- "----------\n" +
- "8. ERROR in X.java (at line 23)\n" +
- " }\n" +
- " ^\n" +
- "Syntax error, insert \"EnumBody\" to complete CompilationUnit\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " void ___eval() {\n" +
+ " ^^^^\n" +
+ "Syntax error on token \"void\", @ expected\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " void ___eval() {\n" +
+ " ^\n" +
+ "Syntax error on token \")\", delete this token\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 9)\n" +
+ " };\n" +
+ "}\n" +
+ " ^^^^\n" +
+ "Syntax error on tokens, delete these tokens\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 23)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error, insert \"}\" to complete ClassBody\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 23)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error, insert \"}\" to complete MemberValue\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 23)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error, insert \")\" to complete Modifiers\n" +
+ "----------\n" +
+ "7. ERROR in X.java (at line 23)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error, insert \"enum Identifier\" to complete EnumHeader\n" +
+ "----------\n" +
+ "8. ERROR in X.java (at line 23)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error, insert \"EnumBody\" to complete CompilationUnit\n" +
"----------\n";
String expected_Java14_ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 1)\n" +
- " void ___eval() {\n" +
- " ^^^^\n" +
- "Syntax error on token \"void\", record expected\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 1)\n" +
- " void ___eval() {\n" +
- " ^\n" +
- "Syntax error on token \")\", { expected after this token\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 23)\n" +
- " }\n" +
- " ^\n" +
- "Syntax error, insert \"}\" to complete RecordBody\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " void ___eval() {\n" +
+ " ^^^^\n" +
+ "Syntax error on token \"void\", record expected\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " void ___eval() {\n" +
+ " ^\n" +
+ "Syntax error on token \")\", { expected after this token\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 23)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error, insert \"}\" to complete RecordBody\n" +
"----------\n";
runComplianceParserTest(
testFiles,
@@ -2146,26 +2146,26 @@ public void test0044() {
};
String expected13ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 2)\n" +
- " public <T> X(T t){\n" +
- " ^\n" +
- "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 5)\n" +
- " }\n" +
- " ^\n" +
- "Syntax error on token \"}\", delete this token\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 9)\n" +
- " <String>super(\"SUCCESS\");\n" +
- " ^^^^^^\n" +
- "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
- "----------\n" +
- "4. ERROR in X.java (at line 9)\n" +
- " <String>super(\"SUCCESS\");\n" +
- " ^^^^^^\n" +
- "Syntax error, parameterized types are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public <T> X(T t){\n" +
+ " ^\n" +
+ "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error on token \"}\", delete this token\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 9)\n" +
+ " <String>super(\"SUCCESS\");\n" +
+ " ^^^^^^\n" +
+ "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 9)\n" +
+ " <String>super(\"SUCCESS\");\n" +
+ " ^^^^^^\n" +
+ "Syntax error, parameterized types are only available if source level is 1.5 or greater\n" +
"----------\n";
String expected14ProblemLog =
expected13ProblemLog;
@@ -2418,17 +2418,17 @@ public void test0050() {
" ^^^^\n" +
"List cannot be resolved to a type\n" +
"----------\n";
- String expected17ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 2)\n" +
- " void foo(List<String>... args) {}\n" +
- " ^^^^\n" +
- "List cannot be resolved to a type\n" +
- "----------\n" +
- "2. WARNING in X.java (at line 2)\n" +
- " void foo(List<String>... args) {}\n" +
- " ^^^^\n" +
- "Type safety: Potential heap pollution via varargs parameter args\n" +
+ String expected17ProblemLog =
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " void foo(List<String>... args) {}\n" +
+ " ^^^^\n" +
+ "List cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 2)\n" +
+ " void foo(List<String>... args) {}\n" +
+ " ^^^^\n" +
+ "Type safety: Potential heap pollution via varargs parameter args\n" +
"----------\n";
runComplianceParserTest(
@@ -2520,10 +2520,10 @@ public void test0052() {
String expected15ProblemLog =
"----------\n" +
- "1. ERROR in X.java (at line 5)\n" +
- " void foo2() {\n" +
- " ^^^^\n" +
- "Syntax error on token \"void\", record expected\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " void foo2() {\n" +
+ " ^^^^\n" +
+ "Syntax error on token \"void\", record expected\n" +
"----------\n";
runComplianceParserTest(
@@ -2580,11 +2580,11 @@ public void test0054() {
};
String expected13ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " try (int i = 0) {};\n" +
- " ^^^^^^^^^\n" +
- "Resource specification not allowed here for source level below 1.7\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " try (int i = 0) {};\n" +
+ " ^^^^^^^^^\n" +
+ "Resource specification not allowed here for source level below 1.7\n" +
"----------\n";
String expected14ProblemLog =
expected13ProblemLog;
@@ -2592,12 +2592,12 @@ public void test0054() {
String expected15ProblemLog =
expected14ProblemLog;
- String expected17ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " try (int i = 0) {};\n" +
- " ^^^\n" +
- "The resource type int does not implement java.lang.AutoCloseable\n" +
+ String expected17ProblemLog =
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " try (int i = 0) {};\n" +
+ " ^^^\n" +
+ "The resource type int does not implement java.lang.AutoCloseable\n" +
"----------\n";
runComplianceParserTest(
testFiles,
@@ -2617,23 +2617,23 @@ public void test0055() {
"import java.io.*;\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
- " try {\n" +
- " System.out.println();\n" +
- " Reader r = new FileReader(args[0]);\n" +
- " r.read();\n" +
- " } catch(IOException | RuntimeException e) {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
+ " try {\n" +
+ " System.out.println();\n" +
+ " Reader r = new FileReader(args[0]);\n" +
+ " r.read();\n" +
+ " } catch(IOException | RuntimeException e) {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
" }\n" +
"}\n"
};
String expected13ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 8)\n" +
- " } catch(IOException | RuntimeException e) {\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Multi-catch parameters are not allowed for source level below 1.7\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " } catch(IOException | RuntimeException e) {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Multi-catch parameters are not allowed for source level below 1.7\n" +
"----------\n";
String expected14ProblemLog =
expected13ProblemLog;
@@ -2648,22 +2648,22 @@ public void test0055() {
expected15ProblemLog
);
}
-// rethrow should not be precisely computed in 1.6-
+// rethrow should not be precisely computed in 1.6-
public void test0056() {
String[] testFiles = new String[] {
"X.java",
"public class X {\n" +
- " public static void main(String[] args) {\n" +
- " try {\n" +
+ " public static void main(String[] args) {\n" +
+ " try {\n" +
" throw new DaughterOfFoo();\n"+
- " } catch(Foo e) {\n" +
+ " } catch(Foo e) {\n" +
" try {\n" +
" throw e;\n" +
" } catch (SonOfFoo e1) {\n" +
" e1.printStackTrace();\n" +
" } catch (Foo e1) {}\n" +
- " }\n" +
- " }\n" +
+ " }\n" +
+ " }\n" +
"}\n"+
"class Foo extends Exception {}\n"+
"class SonOfFoo extends Foo {}\n"+
@@ -2671,21 +2671,21 @@ public void test0056() {
};
String expected13ProblemLog =
- "----------\n" +
- "1. WARNING in X.java (at line 14)\n" +
- " class Foo extends Exception {}\n" +
- " ^^^\n" +
- "The serializable class Foo does not declare a static final serialVersionUID field of type long\n" +
- "----------\n" +
- "2. WARNING in X.java (at line 15)\n" +
- " class SonOfFoo extends Foo {}\n" +
- " ^^^^^^^^\n" +
- "The serializable class SonOfFoo does not declare a static final serialVersionUID field of type long\n" +
- "----------\n" +
- "3. WARNING in X.java (at line 16)\n" +
- " class DaughterOfFoo extends Foo {}\n" +
- " ^^^^^^^^^^^^^\n" +
- "The serializable class DaughterOfFoo does not declare a static final serialVersionUID field of type long\n" +
+ "----------\n" +
+ "1. WARNING in X.java (at line 14)\n" +
+ " class Foo extends Exception {}\n" +
+ " ^^^\n" +
+ "The serializable class Foo does not declare a static final serialVersionUID field of type long\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 15)\n" +
+ " class SonOfFoo extends Foo {}\n" +
+ " ^^^^^^^^\n" +
+ "The serializable class SonOfFoo does not declare a static final serialVersionUID field of type long\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 16)\n" +
+ " class DaughterOfFoo extends Foo {}\n" +
+ " ^^^^^^^^^^^^^\n" +
+ "The serializable class DaughterOfFoo does not declare a static final serialVersionUID field of type long\n" +
"----------\n";
String expected14ProblemLog =
expected13ProblemLog;
@@ -2693,27 +2693,27 @@ public void test0056() {
String expected15ProblemLog =
expected14ProblemLog;
- String expected17ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 8)\n" +
- " } catch (SonOfFoo e1) {\n" +
- " ^^^^^^^^\n" +
- "Unreachable catch block for SonOfFoo. This exception is never thrown from the try statement body\n" +
- "----------\n" +
- "2. WARNING in X.java (at line 14)\n" +
- " class Foo extends Exception {}\n" +
- " ^^^\n" +
- "The serializable class Foo does not declare a static final serialVersionUID field of type long\n" +
- "----------\n" +
- "3. WARNING in X.java (at line 15)\n" +
- " class SonOfFoo extends Foo {}\n" +
- " ^^^^^^^^\n" +
- "The serializable class SonOfFoo does not declare a static final serialVersionUID field of type long\n" +
- "----------\n" +
- "4. WARNING in X.java (at line 16)\n" +
- " class DaughterOfFoo extends Foo {}\n" +
- " ^^^^^^^^^^^^^\n" +
- "The serializable class DaughterOfFoo does not declare a static final serialVersionUID field of type long\n" +
+ String expected17ProblemLog =
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " } catch (SonOfFoo e1) {\n" +
+ " ^^^^^^^^\n" +
+ "Unreachable catch block for SonOfFoo. This exception is never thrown from the try statement body\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 14)\n" +
+ " class Foo extends Exception {}\n" +
+ " ^^^\n" +
+ "The serializable class Foo does not declare a static final serialVersionUID field of type long\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 15)\n" +
+ " class SonOfFoo extends Foo {}\n" +
+ " ^^^^^^^^\n" +
+ "The serializable class SonOfFoo does not declare a static final serialVersionUID field of type long\n" +
+ "----------\n" +
+ "4. WARNING in X.java (at line 16)\n" +
+ " class DaughterOfFoo extends Foo {}\n" +
+ " ^^^^^^^^^^^^^\n" +
+ "The serializable class DaughterOfFoo does not declare a static final serialVersionUID field of type long\n" +
"----------\n";
runComplianceParserTest(
testFiles,
@@ -2736,11 +2736,11 @@ public void test0057() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 2)\n" +
- " public default void foo() { System.out.println(); }\n" +
- " ^^^^^\n" +
- "Default methods are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public default void foo() { System.out.println(); }\n" +
+ " ^^^^^\n" +
+ "Default methods are allowed only at source level 1.8 or above\n" +
"----------\n";
runComplianceParserTest(
@@ -2768,11 +2768,11 @@ public void test0058() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 5)\n" +
- " I i = System::exit;\n" +
- " ^^^^^^^^^^^^\n" +
- "Method references are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " I i = System::exit;\n" +
+ " ^^^^^^^^^^^^\n" +
+ "Method references are allowed only at source level 1.8 or above\n" +
"----------\n";
runComplianceParserTest(
@@ -2804,16 +2804,16 @@ public void test0059() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 9)\n" +
- " I i = super::goo;\n" +
- " ^^^^^^^^^^\n" +
- "Method references are allowed only at source level 1.8 or above\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 9)\n" +
- " I i = super::goo;\n" +
- " ^^^^^^^^^^\n" +
- "The method goo(int) from the type Y should be accessed in a static way \n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " I i = super::goo;\n" +
+ " ^^^^^^^^^^\n" +
+ "Method references are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " I i = super::goo;\n" +
+ " ^^^^^^^^^^\n" +
+ "The method goo(int) from the type Y should be accessed in a static way \n" +
"----------\n";
runComplianceParserTest(
@@ -2845,11 +2845,11 @@ public void test0060() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 9)\n" +
- " I i = new Y()::goo;\n" +
- " ^^^^^^^^^^^^\n" +
- "Method references are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " I i = new Y()::goo;\n" +
+ " ^^^^^^^^^^^^\n" +
+ "Method references are allowed only at source level 1.8 or above\n" +
"----------\n";
runComplianceParserTest(
@@ -2883,11 +2883,11 @@ public void test0061() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 11)\n" +
- " I i = Y::new;\n" +
- " ^^^^^^\n" +
- "Constructor references are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 11)\n" +
+ " I i = Y::new;\n" +
+ " ^^^^^^\n" +
+ "Constructor references are allowed only at source level 1.8 or above\n" +
"----------\n";
runComplianceParserTest(
@@ -2915,11 +2915,11 @@ public void test0062() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 5)\n" +
- " I i = p -> 10 + 20 + 30;\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " I i = p -> 10 + 20 + 30;\n" +
" ^^^^^^^^^^^^^^^^^\n" +
- "Lambda expressions are allowed only at source level 1.8 or above\n" +
+ "Lambda expressions are allowed only at source level 1.8 or above\n" +
"----------\n";
runComplianceParserTest(
@@ -2951,21 +2951,21 @@ public void test0063() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 5)\n" +
- " I i = X<String>::foo;\n" +
- " ^^^^^^^^^^^^^^\n" +
- "Method references are allowed only at source level 1.8 or above\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 5)\n" +
- " I i = X<String>::foo;\n" +
- " ^^^^^^^^^^^^^^\n" +
- "The method foo(int) from the type X<String> should be accessed in a static way \n" +
- "----------\n" +
- "3. ERROR in X.java (at line 6)\n" +
- " I i2 = (p) -> 10;\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " I i = X<String>::foo;\n" +
+ " ^^^^^^^^^^^^^^\n" +
+ "Method references are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " I i = X<String>::foo;\n" +
+ " ^^^^^^^^^^^^^^\n" +
+ "The method foo(int) from the type X<String> should be accessed in a static way \n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " I i2 = (p) -> 10;\n" +
" ^^^^^^^^^\n" +
- "Lambda expressions are allowed only at source level 1.8 or above\n" +
+ "Lambda expressions are allowed only at source level 1.8 or above\n" +
"----------\n";
runComplianceParserTest(
@@ -3038,26 +3038,26 @@ public void testBug391201() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 2)\n" +
- " @Marker int foo(@Marker int p) {\n" +
- " ^^^^^^^\n" +
- "Syntax error, type annotations are available only when source level is at least 1.8\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 2)\n" +
- " @Marker int foo(@Marker int p) {\n" +
- " ^^^^^^^\n" +
- "Syntax error, type annotations are available only when source level is at least 1.8\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 3)\n" +
- " @Marker int i = 0;\n" +
- " ^^^^^^^\n" +
- "Syntax error, type annotations are available only when source level is at least 1.8\n" +
- "----------\n" +
- "4. ERROR in X.java (at line 6)\n" +
- " @Marker\n" +
- " ^^^^^^^\n" +
- "Syntax error, type annotations are available only when source level is at least 1.8\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " @Marker int foo(@Marker int p) {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error, type annotations are available only when source level is at least 1.8\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " @Marker int foo(@Marker int p) {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error, type annotations are available only when source level is at least 1.8\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " @Marker int i = 0;\n" +
+ " ^^^^^^^\n" +
+ "Syntax error, type annotations are available only when source level is at least 1.8\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 6)\n" +
+ " @Marker\n" +
+ " ^^^^^^^\n" +
+ "Syntax error, type annotations are available only when source level is at least 1.8\n" +
"----------\n";
runComplianceParserTest(
@@ -3088,31 +3088,31 @@ public void testBug399773() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " default void doitalso () {}\n" +
- " ^^^^^^^^^^^\n" +
- "Default methods are allowed only at source level 1.8 or above\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 7)\n" +
- " default void doitalso () {}\n" +
- " ^^^^^^^^^^^\n" +
- "Default methods are allowed only at source level 1.8 or above\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 10)\n" +
- " Object p = (I & J) () -> {};\n" +
- " ^^^^^\n" +
- "Additional bounds are not allowed in cast operator at source levels below 1.8\n" +
- "----------\n" +
- "4. ERROR in X.java (at line 10)\n" +
- " Object p = (I & J) () -> {};\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " default void doitalso () {}\n" +
+ " ^^^^^^^^^^^\n" +
+ "Default methods are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 7)\n" +
+ " default void doitalso () {}\n" +
+ " ^^^^^^^^^^^\n" +
+ "Default methods are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 10)\n" +
+ " Object p = (I & J) () -> {};\n" +
+ " ^^^^^\n" +
+ "Additional bounds are not allowed in cast operator at source levels below 1.8\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 10)\n" +
+ " Object p = (I & J) () -> {};\n" +
" ^^^^^\n" +
- "Lambda expressions are allowed only at source level 1.8 or above\n" +
- "----------\n" +
- "5. ERROR in X.java (at line 10)\n" +
- " Object p = (I & J) () -> {};\n" +
+ "Lambda expressions are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 10)\n" +
+ " Object p = (I & J) () -> {};\n" +
" ^^^^^\n" +
- "The target type of this expression must be a functional interface\n" +
+ "The target type of this expression must be a functional interface\n" +
"----------\n";
runComplianceParserTest(
@@ -3138,11 +3138,11 @@ public void testBug399778() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " List<String> l = null == null ? Arrays.asList() : Arrays.asList(\"Hello\",\"world\");\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Type mismatch: cannot convert from List<capture#1-of ? extends Object> to List<String>\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " List<String> l = null == null ? Arrays.asList() : Arrays.asList(\"Hello\",\"world\");\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Type mismatch: cannot convert from List<capture#1-of ? extends Object> to List<String>\n" +
"----------\n";
runComplianceParserTest(
@@ -3169,11 +3169,11 @@ public void testBug399778a() {
};
String expectedProblemLog =
- "----------\n" +
- "1. WARNING in X.java (at line 4)\n" +
- " List<String> l = (List<String>) (null == null ? Arrays.asList() : Arrays.asList(\"Hello\",\"world\"));\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Type safety: Unchecked cast from List<capture#1-of ? extends Object> to List<String>\n" +
+ "----------\n" +
+ "1. WARNING in X.java (at line 4)\n" +
+ " List<String> l = (List<String>) (null == null ? Arrays.asList() : Arrays.asList(\"Hello\",\"world\"));\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Type safety: Unchecked cast from List<capture#1-of ? extends Object> to List<String>\n" +
"----------\n";
runComplianceParserTest(
@@ -3201,26 +3201,26 @@ public void testBug399780() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in I.java (at line 2)\n" +
- " public static void foo1() { System.out.println(); }\n" +
- " ^^^^^^\n" +
- "Static methods are allowed in interfaces only at source level 1.8 or above\n" +
- "----------\n" +
- "2. ERROR in I.java (at line 2)\n" +
- " public static void foo1() { System.out.println(); }\n" +
- " ^^^^^^\n" +
- "Illegal modifier for the interface method foo1; only public & abstract are permitted\n" +
- "----------\n" +
- "3. ERROR in I.java (at line 3)\n" +
- " public static void foo2();\n" +
- " ^^^^^^\n" +
- "Illegal modifier for the interface method foo2; only public & abstract are permitted\n" +
- "----------\n" +
- "4. ERROR in I.java (at line 4)\n" +
- " public abstract static void foo3();\n" +
- " ^^^^^^\n" +
- "Illegal modifier for the interface method foo3; only public & abstract are permitted\n" +
+ "----------\n" +
+ "1. ERROR in I.java (at line 2)\n" +
+ " public static void foo1() { System.out.println(); }\n" +
+ " ^^^^^^\n" +
+ "Static methods are allowed in interfaces only at source level 1.8 or above\n" +
+ "----------\n" +
+ "2. ERROR in I.java (at line 2)\n" +
+ " public static void foo1() { System.out.println(); }\n" +
+ " ^^^^^^\n" +
+ "Illegal modifier for the interface method foo1; only public & abstract are permitted\n" +
+ "----------\n" +
+ "3. ERROR in I.java (at line 3)\n" +
+ " public static void foo2();\n" +
+ " ^^^^^^\n" +
+ "Illegal modifier for the interface method foo2; only public & abstract are permitted\n" +
+ "----------\n" +
+ "4. ERROR in I.java (at line 4)\n" +
+ " public abstract static void foo3();\n" +
+ " ^^^^^^\n" +
+ "Illegal modifier for the interface method foo3; only public & abstract are permitted\n" +
"----------\n";
runComplianceParserTest(
@@ -3254,58 +3254,58 @@ public void testBug399781() {
};
String usLevel = this.complianceLevel < ClassFileConstants.JDK9 ? "WARNING" : "ERROR";
String expectedProblemLog =
- "----------\n" +
- "1. " + usLevel +" in X.java (at line 2)\n" +
- " int _;\n" +
- " ^\n" +
- "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" +
- "----------\n" +
- "2. " + usLevel +" in X.java (at line 4)\n" +
- " int _ = 3;\n" +
- " ^\n" +
- "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" +
- "----------\n" +
- "3. WARNING in X.java (at line 4)\n" +
- " int _ = 3;\n" +
- " ^\n" +
- "The local variable _ is hiding a field from type X\n" +
- "----------\n" +
- "4. " + usLevel +" in X.java (at line 8)\n" +
- " void goo(int _) {}\n" +
- " ^\n" +
- "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" +
- "----------\n" +
- "5. WARNING in X.java (at line 8)\n" +
- " void goo(int _) {}\n" +
- " ^\n" +
- "The parameter _ is hiding a field from type X\n" +
- "----------\n" +
- "6. " + usLevel +" in X.java (at line 11)\n" +
- " } catch (Exception _) {\n" +
- " ^\n" +
- "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" +
- "----------\n" +
- "7. WARNING in X.java (at line 11)\n" +
- " } catch (Exception _) {\n" +
- " ^\n" +
- "The parameter _ is hiding a field from type X\n" +
+ "----------\n" +
+ "1. " + usLevel +" in X.java (at line 2)\n" +
+ " int _;\n" +
+ " ^\n" +
+ "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" +
+ "----------\n" +
+ "2. " + usLevel +" in X.java (at line 4)\n" +
+ " int _ = 3;\n" +
+ " ^\n" +
+ "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 4)\n" +
+ " int _ = 3;\n" +
+ " ^\n" +
+ "The local variable _ is hiding a field from type X\n" +
+ "----------\n" +
+ "4. " + usLevel +" in X.java (at line 8)\n" +
+ " void goo(int _) {}\n" +
+ " ^\n" +
+ "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" +
+ "----------\n" +
+ "5. WARNING in X.java (at line 8)\n" +
+ " void goo(int _) {}\n" +
+ " ^\n" +
+ "The parameter _ is hiding a field from type X\n" +
+ "----------\n" +
+ "6. " + usLevel +" in X.java (at line 11)\n" +
+ " } catch (Exception _) {\n" +
+ " ^\n" +
+ "\'_\' should not be used as an identifier, since it is a reserved keyword from source level 1.8 on\n" +
+ "----------\n" +
+ "7. WARNING in X.java (at line 11)\n" +
+ " } catch (Exception _) {\n" +
+ " ^\n" +
+ "The parameter _ is hiding a field from type X\n" +
"----------\n";
String expected13ProblemLog =
- "----------\n" +
- "1. WARNING in X.java (at line 4)\n" +
- " int _ = 3;\n" +
- " ^\n" +
- "The local variable _ is hiding a field from type X\n" +
- "----------\n" +
- "2. WARNING in X.java (at line 8)\n" +
- " void goo(int _) {}\n" +
- " ^\n" +
- "The parameter _ is hiding a field from type X\n" +
- "----------\n" +
- "3. WARNING in X.java (at line 11)\n" +
- " } catch (Exception _) {\n" +
- " ^\n" +
- "The parameter _ is hiding a field from type X\n" +
+ "----------\n" +
+ "1. WARNING in X.java (at line 4)\n" +
+ " int _ = 3;\n" +
+ " ^\n" +
+ "The local variable _ is hiding a field from type X\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 8)\n" +
+ " void goo(int _) {}\n" +
+ " ^\n" +
+ "The parameter _ is hiding a field from type X\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 11)\n" +
+ " } catch (Exception _) {\n" +
+ " ^\n" +
+ "The parameter _ is hiding a field from type X\n" +
"----------\n";
runComplianceParserTest(
@@ -3320,10 +3320,10 @@ public void testBug399781() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=406846: [1.8] compiler NPE for method reference/lambda code compiled with < 1.8 compliance
public void test406846() {
-
+
if (this.complianceLevel >= ClassFileConstants.JDK1_8) // tested in LET.
return;
-
+
String[] testFiles = new String[] {
"X.java",
"import java.util.*;\n" +
@@ -3348,58 +3348,58 @@ public void test406846() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 9)\n" +
- " eachWithIndex(list,X::printItem);\n" +
- " ^^^^^^^^^^^^\n" +
- "Method references are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " eachWithIndex(list,X::printItem);\n" +
+ " ^^^^^^^^^^^^\n" +
+ "Method references are allowed only at source level 1.8 or above\n" +
"----------\n";
String expected1314ProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " public static <E> void printItem(E value, int index) {\n" +
- " ^\n" +
- "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " String output = String.format(\"%d -> %s\", index, value);\n" +
- " ^^^^^^\n" +
- "The method format(String, Object[]) in the type String is not applicable for the arguments (String, int, E)\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 8)\n" +
- " List<String> list = Arrays.asList(\"A\",\"B\",\"C\");\n" +
- " ^^^^^^\n" +
- "Syntax error, parameterized types are only available if source level is 1.5 or greater\n" +
- "----------\n" +
- "4. ERROR in X.java (at line 8)\n" +
- " List<String> list = Arrays.asList(\"A\",\"B\",\"C\");\n" +
- " ^^^^^^\n" +
- "The method asList(T[]) in the type Arrays is not applicable for the arguments (String, String, String)\n" +
- "----------\n" +
- "5. ERROR in X.java (at line 9)\n" +
- " eachWithIndex(list,X::printItem);\n" +
- " ^^^^^^^^^^^^\n" +
- "Method references are allowed only at source level 1.8 or above\n" +
- "----------\n" +
- "6. ERROR in X.java (at line 11)\n" +
- " interface ItemWithIndexVisitor<E> {\n" +
- " ^\n" +
- "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
- "----------\n" +
- "7. ERROR in X.java (at line 14)\n" +
- " public static <E> void eachWithIndex(List<E> list, ItemWithIndexVisitor<E> visitor) {\n" +
- " ^\n" +
- "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
- "----------\n" +
- "8. ERROR in X.java (at line 14)\n" +
- " public static <E> void eachWithIndex(List<E> list, ItemWithIndexVisitor<E> visitor) {\n" +
- " ^\n" +
- "Syntax error, parameterized types are only available if source level is 1.5 or greater\n" +
- "----------\n" +
- "9. ERROR in X.java (at line 14)\n" +
- " public static <E> void eachWithIndex(List<E> list, ItemWithIndexVisitor<E> visitor) {\n" +
- " ^\n" +
- "Syntax error, parameterized types are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " public static <E> void printItem(E value, int index) {\n" +
+ " ^\n" +
+ "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " String output = String.format(\"%d -> %s\", index, value);\n" +
+ " ^^^^^^\n" +
+ "The method format(String, Object[]) in the type String is not applicable for the arguments (String, int, E)\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 8)\n" +
+ " List<String> list = Arrays.asList(\"A\",\"B\",\"C\");\n" +
+ " ^^^^^^\n" +
+ "Syntax error, parameterized types are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 8)\n" +
+ " List<String> list = Arrays.asList(\"A\",\"B\",\"C\");\n" +
+ " ^^^^^^\n" +
+ "The method asList(T[]) in the type Arrays is not applicable for the arguments (String, String, String)\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 9)\n" +
+ " eachWithIndex(list,X::printItem);\n" +
+ " ^^^^^^^^^^^^\n" +
+ "Method references are allowed only at source level 1.8 or above\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 11)\n" +
+ " interface ItemWithIndexVisitor<E> {\n" +
+ " ^\n" +
+ "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "7. ERROR in X.java (at line 14)\n" +
+ " public static <E> void eachWithIndex(List<E> list, ItemWithIndexVisitor<E> visitor) {\n" +
+ " ^\n" +
+ "Syntax error, type parameters are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "8. ERROR in X.java (at line 14)\n" +
+ " public static <E> void eachWithIndex(List<E> list, ItemWithIndexVisitor<E> visitor) {\n" +
+ " ^\n" +
+ "Syntax error, parameterized types are only available if source level is 1.5 or greater\n" +
+ "----------\n" +
+ "9. ERROR in X.java (at line 14)\n" +
+ " public static <E> void eachWithIndex(List<E> list, ItemWithIndexVisitor<E> visitor) {\n" +
+ " ^\n" +
+ "Syntax error, parameterized types are only available if source level is 1.5 or greater\n" +
"----------\n";
runComplianceParserTest(
@@ -3415,7 +3415,7 @@ public void test406846() {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=401850: [1.8][compiler] Compiler fails to type poly allocation expressions in method invocation contexts
// FAIL: sub-optimal overload picked
public void test401850() {
-
+
if (this.complianceLevel < ClassFileConstants.JDK1_7)
return;
this.runConformTest(
@@ -3467,17 +3467,17 @@ public void test429110() {
" return arg;\n" +
" }\n" +
"}\n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 7)\n" +
- " List<@NonNull String> foo(List<@NonNull String> arg) {\n" +
- " ^^^^^^^^\n" +
- "Syntax error, type annotations are available only when source level is at least 1.8\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 7)\n" +
- " List<@NonNull String> foo(List<@NonNull String> arg) {\n" +
- " ^^^^^^^^\n" +
- "Syntax error, type annotations are available only when source level is at least 1.8\n" +
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " List<@NonNull String> foo(List<@NonNull String> arg) {\n" +
+ " ^^^^^^^^\n" +
+ "Syntax error, type annotations are available only when source level is at least 1.8\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 7)\n" +
+ " List<@NonNull String> foo(List<@NonNull String> arg) {\n" +
+ " ^^^^^^^^\n" +
+ "Syntax error, type annotations are available only when source level is at least 1.8\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=421477: [1.8][compiler] strange error message for default method in class
@@ -3550,16 +3550,16 @@ public void testBug440285() {
" Function<Integer, int[]> m1 = int[]::<Y, Z>new;\n" +
" Function<Integer, int[]> m2 = int[]::<Y>new;\n" +
"}",},
- "----------\n" +
- "1. ERROR in X.java (at line 5)\n" +
- " Function<Integer, int[]> m1 = int[]::<Y, Z>new;\n" +
- " ^^^^\n" +
- "Type arguments are not allowed here\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 6)\n" +
- " Function<Integer, int[]> m2 = int[]::<Y>new;\n" +
- " ^\n" +
- "Type arguments are not allowed here\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " Function<Integer, int[]> m1 = int[]::<Y, Z>new;\n" +
+ " ^^^^\n" +
+ "Type arguments are not allowed here\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " Function<Integer, int[]> m2 = int[]::<Y>new;\n" +
+ " ^\n" +
+ "Type arguments are not allowed here\n" +
"----------\n");
}
public void testBug531714_001() {
@@ -3583,30 +3583,30 @@ public void testBug531714_001() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " int tw = switch (i) {\n" +
- " case 0 -> i * 0;\n" +
- " case 1 -> 2;\n" +
- " default -> 3;\n" +
- " };\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Switch Expressions are supported from Java 14 onwards only\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " case 0 -> i * 0;\n" +
- " ^^^^^^\n" +
- "Arrow in case statement supported from Java 14 onwards only\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 5)\n" +
- " case 1 -> 2;\n" +
- " ^^^^^^\n" +
- "Arrow in case statement supported from Java 14 onwards only\n" +
- "----------\n" +
- "4. ERROR in X.java (at line 6)\n" +
- " default -> 3;\n" +
- " ^^^^^^^\n" +
- "Arrow in case statement supported from Java 14 onwards only\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " int tw = switch (i) {\n" +
+ " case 0 -> i * 0;\n" +
+ " case 1 -> 2;\n" +
+ " default -> 3;\n" +
+ " };\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Switch Expressions are supported from Java 14 onwards only\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " case 0 -> i * 0;\n" +
+ " ^^^^^^\n" +
+ "Arrow in case statement supported from Java 14 onwards only\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " case 1 -> 2;\n" +
+ " ^^^^^^\n" +
+ "Arrow in case statement supported from Java 14 onwards only\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 6)\n" +
+ " default -> 3;\n" +
+ " ^^^^^^^\n" +
+ "Arrow in case statement supported from Java 14 onwards only\n" +
"----------\n";
runComplianceParserTest(
@@ -3639,21 +3639,21 @@ public void testBug531714_002() {
};
String expectedProblemLog =
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " case 0 -> i * 0;\n" +
- " ^^^^^^\n" +
- "Arrow in case statement supported from Java 14 onwards only\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 5)\n" +
- " case 1 -> 2;\n" +
- " ^^^^^^\n" +
- "Arrow in case statement supported from Java 14 onwards only\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 6)\n" +
- " default -> 3;\n" +
- " ^^^^^^^\n" +
- "Arrow in case statement supported from Java 14 onwards only\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " case 0 -> i * 0;\n" +
+ " ^^^^^^\n" +
+ "Arrow in case statement supported from Java 14 onwards only\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " case 1 -> 2;\n" +
+ " ^^^^^^\n" +
+ "Arrow in case statement supported from Java 14 onwards only\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " default -> 3;\n" +
+ " ^^^^^^^\n" +
+ "Arrow in case statement supported from Java 14 onwards only\n" +
"----------\n";
runComplianceParserTest(
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
index 7fda33cb8..212e32411 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java
@@ -685,7 +685,7 @@ public void test05() {
" }\n" +
" void foo() {\n" +
" System.out.println();\n" +
- " void baz;\n" +
+ " void baz;\n" +
" }\n" +
" void bar() {\n" +
" }\n" +
@@ -1987,9 +1987,9 @@ public void test25() {
" \n" +
" void bar(){ \n" +
" void truc(){ \n" +
-//{ObjectTeams: Unfortunately our parser needs one more '}' which I think is somewhat acceptable
- "} \n" +
-// SH}
+//{ObjectTeams: Unfortunately our parser needs one more '}' which I think is somewhat acceptable
+ "} \n" +
+// SH}
"} \n";
String expectedDietUnitToString =
@@ -4663,23 +4663,23 @@ public void test75() {
String expectedCompletionDietUnitToString =
"package ZKentTest;\n" +
- "import java.awt.color.*;\n" +
- "public class A {\n" +
- " int[] ii;\n" +
- " public A() {\n" +
- " }\n" +
- " A foo(int i) {\n" +
- " }\n" +
- "}\n" +
- "class Local {\n" +
- " Local() {\n" +
- " }\n" +
- " int hello() {\n" +
- " }\n" +
- " int world() {\n" +
- " }\n" +
- " void foo() {\n" +
- " }\n" +
+ "import java.awt.color.*;\n" +
+ "public class A {\n" +
+ " int[] ii;\n" +
+ " public A() {\n" +
+ " }\n" +
+ " A foo(int i) {\n" +
+ " }\n" +
+ "}\n" +
+ "class Local {\n" +
+ " Local() {\n" +
+ " }\n" +
+ " int hello() {\n" +
+ " }\n" +
+ " int world() {\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " }\n" +
"}\n";
String testName = "<bunch of syntax errors>";
@@ -6011,14 +6011,14 @@ public void test99() {
" removes the;\n" +
" thread restriction;\n" +
" will need = (re - create);\n" +
-//{ObjectTeams our compiler recovers less than the orig
+//{ObjectTeams our compiler recovers less than the orig
/* orig:
" request as;\n" +
" does not;\n" +
" the removal;\n" +
" thread = $missing$;\n" +
:giro */
-// SH}
+// SH}
" }\n" +
" public IJavaThread[] getThreadFilters() {\n" +
" return the;\n" +
@@ -7631,12 +7631,12 @@ public void _test124() {
"}\n";
} else {
expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
- "public class Test {\n" +
- " public Test() {\n" +
- " super();\n" +
- " }\n" +
- " void aMethod() {\n" +
- " }\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void aMethod() {\n" +
+ " }\n" +
"}\n";
}
@@ -7669,7 +7669,7 @@ public void test125() {
String s =
"public class Test {\n" +
"}\n";
-
+
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 1000; i++) {
buf.append("class AClass #\n");
@@ -7700,14 +7700,14 @@ public void test125() {
buf.append(indent).append(" }\n");
buf.append(indent).append("}\n");
}
-
+
expectedDietUnitToString += buf.toString();
-
+
// expectedDietPlusBodyUnitToString
String expectedDietPlusBodyUnitToString =
"public class Test {\n" +
" public Test() {\n" +
- " super();\n" +
+ " super();\n" +
" }\n" +
"}\n";
buf = new StringBuffer();
@@ -7764,52 +7764,52 @@ public void test126() {
"}\n";
String expectedDietUnitToString =
- "package p;\n" +
- "public class ContextTest {\n" +
- " private Context context = new Context();\n" +
- " public ContextTest() {\n" +
- " }\n" +
- " public void test() {\n" +
- " }\n" +
+ "package p;\n" +
+ "public class ContextTest {\n" +
+ " private Context context = new Context();\n" +
+ " public ContextTest() {\n" +
+ " }\n" +
+ " public void test() {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyUnitToString =
- "package p;\n" +
- "public class ContextTest {\n" +
- " private Context context = new Context();\n" +
- " public ContextTest() {\n" +
- " super();\n" +
- " }\n" +
- " public void test() {\n" +
- " }\n" +
+ "package p;\n" +
+ "public class ContextTest {\n" +
+ " private Context context = new Context();\n" +
+ " public ContextTest() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void test() {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
- "package p;\n" +
- "public class ContextTest {\n" +
- " private Context context = new Context();\n" +
- " public ContextTest() {\n" +
- " super();\n" +
- " }\n" +
- " public void test() {\n" +
- " context.new Callback() {\n" +
- " public void doit(int value) {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
+ "package p;\n" +
+ "public class ContextTest {\n" +
+ " private Context context = new Context();\n" +
+ " public ContextTest() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void test() {\n" +
+ " context.new Callback() {\n" +
+ " public void doit(int value) {\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
expectedDietUnitToString;
String expectedCompletionDietUnitToString =
- "package p;\n" +
- "public class ContextTest {\n" +
- " private Context context;\n" +
- " public ContextTest() {\n" +
- " }\n" +
- " public void test() {\n" +
- " }\n" +
+ "package p;\n" +
+ "public class ContextTest {\n" +
+ " private Context context;\n" +
+ " public ContextTest() {\n" +
+ " }\n" +
+ " public void test() {\n" +
+ " }\n" +
"}\n";
String testName = "test";
@@ -7824,114 +7824,114 @@ public void test126() {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=201762
public void test127() {
String s =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "\n" +
- "public class Try {\n" +
- "\n" +
- " void main(Shell shell) {\n" +
- "\n" +
- " final Label label= new Label(shell, SWT.WRAP);\n" +
- " label.addPaintListener(new PaintListener() {\n" +
- " public void paintControl(PaintEvent e) {\n" +
- " e.gc.setLineCap(SWT.CAP_); // content assist after CAP_\n" +
- " }\n" +
- " });\n" +
- "\n" +
- " shell.addControlListener(new ControlAdapter() { });\n" +
- "\n" +
- " while (!shell.isDisposed()) { }\n" +
- " }\n" +
- "}\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "\n" +
+ "public class Try {\n" +
+ "\n" +
+ " void main(Shell shell) {\n" +
+ "\n" +
+ " final Label label= new Label(shell, SWT.WRAP);\n" +
+ " label.addPaintListener(new PaintListener() {\n" +
+ " public void paintControl(PaintEvent e) {\n" +
+ " e.gc.setLineCap(SWT.CAP_); // content assist after CAP_\n" +
+ " }\n" +
+ " });\n" +
+ "\n" +
+ " shell.addControlListener(new ControlAdapter() { });\n" +
+ "\n" +
+ " while (!shell.isDisposed()) { }\n" +
+ " }\n" +
+ "}\n" +
"\n";
String expectedDietUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " super();\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " final Label label = new Label(shell, SWT.WRAP);\n" +
- " label.addPaintListener(new PaintListener() {\n" +
- " public void paintControl(PaintEvent e) {\n" +
- " e.gc.setLineCap(SWT.CAP_);\n" +
- " }\n" +
- "});\n" +
- " shell.addControlListener(new ControlAdapter() {\n" +
- "});\n" +
- " while ((! shell.isDisposed())) {\n" +
- " }\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " final Label label = new Label(shell, SWT.WRAP);\n" +
+ " label.addPaintListener(new PaintListener() {\n" +
+ " public void paintControl(PaintEvent e) {\n" +
+ " e.gc.setLineCap(SWT.CAP_);\n" +
+ " }\n" +
+ "});\n" +
+ " shell.addControlListener(new ControlAdapter() {\n" +
+ "});\n" +
+ " while ((! shell.isDisposed())) {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " super();\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " final Label label = new Label(shell, SWT.WRAP);\n" +
- " label.addPaintListener(new PaintListener() {\n" +
- " public void paintControl(PaintEvent e) {\n" +
- " e.gc.setLineCap(SWT.CAP_);\n" +
- " }\n" +
- "});\n" +
- " shell.addControlListener(new ControlAdapter() {\n" +
- "});\n" +
- " while ((! shell.isDisposed())) {\n" +
- " }\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " final Label label = new Label(shell, SWT.WRAP);\n" +
+ " label.addPaintListener(new PaintListener() {\n" +
+ " public void paintControl(PaintEvent e) {\n" +
+ " e.gc.setLineCap(SWT.CAP_);\n" +
+ " }\n" +
+ "});\n" +
+ " shell.addControlListener(new ControlAdapter() {\n" +
+ "});\n" +
+ " while ((! shell.isDisposed())) {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " super();\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " final Label label = new Label(shell, SWT.WRAP);\n" +
- " label.addPaintListener(new PaintListener() {\n" +
- " public void paintControl(PaintEvent e) {\n" +
- " e.gc.setLineCap(SWT.CAP_);\n" +
- " }\n" +
- "});\n" +
- " shell.addControlListener(new ControlAdapter() {\n" +
- "});\n" +
- " while ((! shell.isDisposed())) {\n" +
- " }\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " final Label label = new Label(shell, SWT.WRAP);\n" +
+ " label.addPaintListener(new PaintListener() {\n" +
+ " public void paintControl(PaintEvent e) {\n" +
+ " e.gc.setLineCap(SWT.CAP_);\n" +
+ " }\n" +
+ "});\n" +
+ " shell.addControlListener(new ControlAdapter() {\n" +
+ "});\n" +
+ " while ((! shell.isDisposed())) {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedCompletionDietUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " }\n" +
"}\n";
String testName = "test";
@@ -7946,93 +7946,93 @@ public void test127() {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=201762
public void test128() {
String s =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "\n" +
- "public class Try {\n" +
- "\n" +
- " void main(Shell shell) {\n" +
- "\n" +
- " final Label label= new Label(shell, SWT.WRAP);\n" +
- " label.addPaintListener(new PaintListener() {\n" +
- " public void paintControl(PaintEvent e) {\n" +
- " e.gc.setLineCap(SWT.CAP_#); // content assist after CAP_\n" +
- " }\n" +
- " });\n" +
- "\n" +
- " shell.addControlListener(new ControlAdapter() { });\n" +
- "\n" +
- " while (!shell.isDisposed()) { }\n" +
- " }\n" +
- "}\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "\n" +
+ "public class Try {\n" +
+ "\n" +
+ " void main(Shell shell) {\n" +
+ "\n" +
+ " final Label label= new Label(shell, SWT.WRAP);\n" +
+ " label.addPaintListener(new PaintListener() {\n" +
+ " public void paintControl(PaintEvent e) {\n" +
+ " e.gc.setLineCap(SWT.CAP_#); // content assist after CAP_\n" +
+ " }\n" +
+ " });\n" +
+ "\n" +
+ " shell.addControlListener(new ControlAdapter() { });\n" +
+ "\n" +
+ " while (!shell.isDisposed()) { }\n" +
+ " }\n" +
+ "}\n" +
"\n";
String expectedDietUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " super();\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " super();\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " final Label label = new Label(shell, SWT.WRAP);\n" +
- " label.addPaintListener(new PaintListener() {\n" +
- " public void paintControl(PaintEvent e) {\n" +
- " e.gc.setLineCap(SWT.CAP_);\n" +
- " }\n" +
- "});\n" +
- " shell.addControlListener(new ControlAdapter() {\n" +
- "});\n" +
- " while ((! shell.isDisposed())) {\n" +
- " }\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " final Label label = new Label(shell, SWT.WRAP);\n" +
+ " label.addPaintListener(new PaintListener() {\n" +
+ " public void paintControl(PaintEvent e) {\n" +
+ " e.gc.setLineCap(SWT.CAP_);\n" +
+ " }\n" +
+ "});\n" +
+ " shell.addControlListener(new ControlAdapter() {\n" +
+ "});\n" +
+ " while ((! shell.isDisposed())) {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " }\n" +
"}\n";
String expectedCompletionDietUnitToString =
- "import org.eclipse.swt.*;\n" +
- "import org.eclipse.swt.events.*;\n" +
- "import org.eclipse.swt.widgets.*;\n" +
- "public class Try {\n" +
- " public Try() {\n" +
- " }\n" +
- " void main(Shell shell) {\n" +
- " }\n" +
+ "import org.eclipse.swt.*;\n" +
+ "import org.eclipse.swt.events.*;\n" +
+ "import org.eclipse.swt.widgets.*;\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " void main(Shell shell) {\n" +
+ " }\n" +
"}\n";
String testName = "test";
@@ -8047,68 +8047,68 @@ public void test128() {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=405778 - [1.8][dom ast] method body recovery broken (empty body)
public void test405778() {
String s =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public void __test1() {\n" +
- " Object o = new Object();\n" +
- " if (o.hashCode() != 0) {\n" +
- " o.\n" +
- " \n" +
- " }\n" +
- " }\n" +
- "}" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public void __test1() {\n" +
+ " Object o = new Object();\n" +
+ " if (o.hashCode() != 0) {\n" +
+ " o.\n" +
+ " \n" +
+ " }\n" +
+ " }\n" +
+ "}" +
"\n";
String expectedDietUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " }\n" +
- " public void __test1() {\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " }\n" +
+ " public void __test1() {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " super();\n" +
- " }\n" +
- " public void __test1() {\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void __test1() {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " super();\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " super();\n" +
+ " }\n" +
" public void __test1() {\n" +
" Object o = new Object();\n" +
- " if ((o.hashCode() != 0))\n" +
- " {\n" +
- " o = $missing$;\n" +
- " }\n" +
- " }\n" +
+ " if ((o.hashCode() != 0))\n" +
+ " {\n" +
+ " o = $missing$;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " }\n" +
- " public void __test1() {\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " }\n" +
+ " public void __test1() {\n" +
+ " }\n" +
"}\n";
String expectedCompletionDietUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " }\n" +
- " public void __test1() {\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " }\n" +
+ " public void __test1() {\n" +
+ " }\n" +
"}\n";
String testName = "test";
@@ -8124,7 +8124,7 @@ public void test405778() {
public void test405778a() {
String s =
"import java.util.Collection;\n" +
- "public class E {\n" +
+ "public class E {\n" +
" void m(String[] names) {\n"
+ "/*[*/\n"
+ "for (String string : names) {\n"
@@ -8132,63 +8132,63 @@ public void test405778a() {
+ "}\n"
+ "/*]*/\n"
+ "}\n"
- + "}\n" +
+ + "}\n" +
"\n";
String expectedDietUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " }\n" +
- " void m(String[] names) {\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " }\n" +
+ " void m(String[] names) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " super();\n" +
- " }\n" +
- " void m(String[] names) {\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void m(String[] names) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " super();\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " super();\n" +
+ " }\n" +
" void m(String[] names) {\n" +
- " for (String string : names) \n" +
- " {\n" +
+ " for (String string : names) \n" +
+ " {\n" +
//{ObjectTeams: guessing differently:
/* orig:
" System.out.println(string.class);\n" +
:giro */
" System.out.println(string.this);\n" +
// SH}
- " }\n" +
- " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " }\n" +
- " void m(String[] names) {\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " }\n" +
+ " void m(String[] names) {\n" +
+ " }\n" +
"}\n";
String expectedCompletionDietUnitToString =
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " }\n" +
- " void m(String[] names) {\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " }\n" +
+ " void m(String[] names) {\n" +
+ " }\n" +
"}\n";
String testName = "test";
@@ -8203,66 +8203,66 @@ public void test405778a() {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=456861 - [recovery] NPE in RecoveryScanner since Mars M4
public void test456861() {
String s =
- "import java.awt.Point;\n" +
- "public class Test {\n" +
- " public void foo(Point p, int[] a) {\n" +
- " String s1 = \"\";\n" +
- " s.;\n" +
- " }\n" +
+ "import java.awt.Point;\n" +
+ "public class Test {\n" +
+ " public void foo(Point p, int[] a) {\n" +
+ " String s1 = \"\";\n" +
+ " s.;\n" +
+ " }\n" +
" }";
String expectedDietUnitToString =
- "import java.awt.Point;\n" +
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo(Point p, int[] a) {\n" +
- " }\n" +
+ "import java.awt.Point;\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void foo(Point p, int[] a) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyUnitToString =
- "import java.awt.Point;\n" +
- "public class Test {\n" +
- " public Test() {\n" +
+ "import java.awt.Point;\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
" super();\n" +
- " }\n" +
- " public void foo(Point p, int[] a) {\n" +
- " }\n" +
+ " }\n" +
+ " public void foo(Point p, int[] a) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyPlusStatementsRecoveryUnitToString =
- "import java.awt.Point;\n" +
- "public class Test {\n" +
- " public Test() {\n" +
+ "import java.awt.Point;\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
" super();\n" +
- " }\n" +
- " public void foo(Point p, int[] a) {\n" +
+ " }\n" +
+ " public void foo(Point p, int[] a) {\n" +
" String s1 = \"\";\n" +
//{ObjectTeams: different grammar => different recovery:
/* orig:
- " s = $missing$;\n" +
+ " s = $missing$;\n" +
:giro */
" s --;\n" +
// SH}
- " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "import java.awt.Point;\n" +
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo(Point p, int[] a) {\n" +
- " }\n" +
+ "import java.awt.Point;\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void foo(Point p, int[] a) {\n" +
+ " }\n" +
"}\n";
String expectedCompletionDietUnitToString =
- "import java.awt.Point;\n" +
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo(Point p, int[] a) {\n" +
- " }\n" +
+ "import java.awt.Point;\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void foo(Point p, int[] a) {\n" +
+ " }\n" +
"}\n";
String testName = "test";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java
index f9f29cc13..1a1648ff1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java
@@ -1121,7 +1121,7 @@ public void testForStatementExpression() {
" }\n" +
" void foo() {\n" +
" int i;\n" +
- " for (; <CompleteOnMemberAccess:fred().x>; ) \n" +
+ " for (; <CompleteOnMemberAccess:fred().x>; ) \n" +
" ;\n" +
" }\n" +
"}\n",
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java
index 6c6cf281c..fee3bdaeb 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -432,10 +432,10 @@ public void test0014(){
String completeBehind = "Y<Z>.";
int cursorLocation = str.indexOf("Y<Z>.") + completeBehind.length() - 1;
String expectedCompletionNodeToString = "<CompleteOnClass:Y<Z>.>";
- String expectedParentNodeToString =
- "public class X extends <CompleteOnClass:Y<Z>.> {\n" +
- " public X() {\n" +
- " }\n" +
+ String expectedParentNodeToString =
+ "public class X extends <CompleteOnClass:Y<Z>.> {\n" +
+ " public X() {\n" +
+ " }\n" +
"}";
String completionIdentifier = "";
String expectedReplacedSource = "Y<Z>.";
@@ -465,10 +465,10 @@ public void test0015(){
String completeBehind = "Y<Z>.";
int cursorLocation = str.indexOf("Y<Z>.") + completeBehind.length() - 1;
String expectedCompletionNodeToString = "<CompleteOnInterface:Y<Z>.>";
- String expectedParentNodeToString =
- "public class X implements I1, <CompleteOnInterface:Y<Z>.> {\n" +
- " public X() {\n" +
- " }\n" +
+ String expectedParentNodeToString =
+ "public class X implements I1, <CompleteOnInterface:Y<Z>.> {\n" +
+ " public X() {\n" +
+ " }\n" +
"}";
String completionIdentifier = "";
String expectedReplacedSource = "Y<Z>.";
@@ -11095,11 +11095,11 @@ public void test0219_Diet() {
String completionIdentifier = "";
String expectedReplacedSource = "\"\"";
String expectedUnitDisplayString =
- "public class X {\n" +
- " @Annot(value = <CompletionOnString:\"\">)\n" +
- " int field;\n" +
- " public X() {\n" +
- " }\n" +
+ "public class X {\n" +
+ " @Annot(value = <CompletionOnString:\"\">)\n" +
+ " int field;\n" +
+ " public X() {\n" +
+ " }\n" +
"}\n";
checkDietParse(
@@ -11128,11 +11128,11 @@ public void test0220_Diet() {
String completionIdentifier = "";
String expectedReplacedSource = "\"\"";
String expectedUnitDisplayString =
- "public class X {\n" +
- " @Annot(value = <CompletionOnString:\"\">)\n" +
- " int field;\n" +
- " public X() {\n" +
- " }\n" +
+ "public class X {\n" +
+ " @Annot(value = <CompletionOnString:\"\">)\n" +
+ " int field;\n" +
+ " public X() {\n" +
+ " }\n" +
"}\n";
checkDietParse(
@@ -11196,16 +11196,16 @@ public void testBug351426b(){
String completionIdentifier = "";
String expectedReplacedSource = "";
String expectedUnitDisplayString =
- "public class X<T> {\n" +
- " static class X1<E> {\n" +
- " X1() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " void foo() {\n" +
- " X1<String> x = new X.X1<<CompleteOnType:>>();\n" +
- " }\n" +
+ "public class X<T> {\n" +
+ " static class X1<E> {\n" +
+ " X1() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " X1<String> x = new X.X1<<CompleteOnType:>>();\n" +
+ " }\n" +
"}\n";
checkMethodParse(
@@ -11234,12 +11234,12 @@ public void testBug351426c(){
String completionIdentifier = "";
String expectedReplacedSource = "";
String expectedUnitDisplayString =
- "public class X<T> {\n" +
- " public X() {\n" +
- " }\n" +
- " public X<String> foo() {\n" +
- " return new X<<CompleteOnType:>>();\n" +
- " }\n" +
+ "public class X<T> {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public X<String> foo() {\n" +
+ " return new X<<CompleteOnType:>>();\n" +
+ " }\n" +
"}\n";
checkMethodParse(
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsSelectionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsSelectionTest.java
index f44654702..a5b71ce3f 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsSelectionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsSelectionTest.java
@@ -913,13 +913,13 @@ public void test0023() {
String completionIdentifier = "emptyList";
String expectedUnitDisplayString =
- "package test;\n" +
- "public class Test {\n" +
- " public Test() {\n" +
- " }\n" +
- " public List<String> foo() {\n" +
- " return <SelectOnMessageSend:Collections.emptyList()>;\n" +
- " }\n" +
+ "package test;\n" +
+ "public class Test {\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public List<String> foo() {\n" +
+ " return <SelectOnMessageSend:Collections.emptyList()>;\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "Collections.emptyList()";
String testName = "<select method>";
@@ -941,14 +941,14 @@ public void test0023() {
public void test0024() {
String str =
- "import java.util.List;\n" +
- "public class X {\n" +
- " <T> T bar(T t) { return t; }\n" +
- " void foo(boolean b, Runnable r) {\n" +
- " Zork z = null;\n" +
- " String s = (String) bar(z); // 5\n" +
- " }\n" +
- "}\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " <T> T bar(T t) { return t; }\n" +
+ " void foo(boolean b, Runnable r) {\n" +
+ " Zork z = null;\n" +
+ " String s = (String) bar(z); // 5\n" +
+ " }\n" +
+ "}\n" +
"\n";
String selection = "bar";
@@ -957,16 +957,16 @@ public void test0024() {
String completionIdentifier = "bar";
String expectedUnitDisplayString =
- "import java.util.List;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " <T>T bar(T t) {\n" +
- " }\n" +
- " void foo(boolean b, Runnable r) {\n" +
- " Zork z;\n" +
- " String s = (String) <SelectOnMessageSend:bar(z)>;\n" +
- " }\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " <T>T bar(T t) {\n" +
+ " }\n" +
+ " void foo(boolean b, Runnable r) {\n" +
+ " Zork z;\n" +
+ " String s = (String) <SelectOnMessageSend:bar(z)>;\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "bar(z)";
String testName = "<select method>";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
index 4de24598a..f28fb42c1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
@@ -608,7 +608,7 @@ public void test025() {
} else if (this.complianceLevel >= ClassFileConstants.JDK12) {
additionalTags = new char[][] {
TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE,
- TAG_CODE, TAG_LITERAL,
+ TAG_CODE, TAG_LITERAL,
TAG_INDEX, TAG_SUMMARY, TAG_SYSTEM_PROPERTY
};
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LambdaExpressionSyntaxTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LambdaExpressionSyntaxTest.java
index 802340017..38dabe743 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LambdaExpressionSyntaxTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LambdaExpressionSyntaxTest.java
@@ -56,7 +56,7 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
}
// type elided, unparenthesized parameter + expression body lambda in casting context.
public void test0001() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -66,23 +66,23 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(((I) (<no type> x) -> (x * x)).square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(((I) (<no type> x) -> (x * x)).square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0001", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda as initializer.
public void test0002() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -93,24 +93,24 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = (<no type> x) -> (x * x);\n" +
- " System.out.println(i.square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = (<no type> x) -> (x * x);\n" +
+ " System.out.println(i.square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0002", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda as initializer, full lambda is parenthesized.
public void test0003() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -121,24 +121,24 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = (((((<no type> x) -> (x * x)))));\n" +
- " System.out.println(i.square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = (((((<no type> x) -> (x * x)))));\n" +
+ " System.out.println(i.square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0003", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda as RHS of assignment, full lambda is parenthesized.
public void test0004() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -150,25 +150,25 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i;\n" +
- " i = ((<no type> x) -> (x * x));\n" +
- " System.out.println(i.square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i;\n" +
+ " i = ((<no type> x) -> (x * x));\n" +
+ " System.out.println(i.square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0004", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda in return statement, full lambda is parenthesized.
public void test0005() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -182,27 +182,27 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " static I getI() {\n" +
- " return ((<no type> x) -> (x * x));\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = getI();\n" +
- " System.out.println(i.square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " static I getI() {\n" +
+ " return ((<no type> x) -> (x * x));\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = getI();\n" +
+ " System.out.println(i.square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0005", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda in conditional expression.
public void test0006() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -213,24 +213,24 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = ((args == null) ? (<no type> x) -> (x * x) : (<no type> x) -> ((x * x) * x));\n" +
- " System.out.println(i.square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = ((args == null) ? (<no type> x) -> (x * x) : (<no type> x) -> ((x * x) * x));\n" +
+ " System.out.println(i.square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0006", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda in message send.
public void test0007() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -244,27 +244,27 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " static void foo(I i1, I i2) {\n" +
- " System.out.println(i1.square(10));\n" +
- " System.out.println(i2.square(10));\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " foo((<no type> x) -> (x * x), (<no type> x) -> ((x * x) * x));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " static void foo(I i1, I i2) {\n" +
+ " System.out.println(i1.square(10));\n" +
+ " System.out.println(i2.square(10));\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " foo((<no type> x) -> (x * x), (<no type> x) -> ((x * x) * x));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0007", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda in constructor call.
public void test0008() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -278,25 +278,25 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " X(I i1, I i2) {\n" +
- " super();\n" +
- " System.out.println(i1.square(10));\n" +
- " System.out.println(i2.square(10));\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " new X((<no type> x) -> (x * x), (<no type> x) -> ((x * x) * x));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " X(I i1, I i2) {\n" +
+ " super();\n" +
+ " System.out.println(i1.square(10));\n" +
+ " System.out.println(i2.square(10));\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " new X((<no type> x) -> (x * x), (<no type> x) -> ((x * x) * x));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0008", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda in lambda.
public void test0009() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" I square(int x);\n" +
"}\n" +
@@ -306,23 +306,23 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " I square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(((I) (<no type> a) -> (<no type> b) -> (<no type> c) -> (<no type> d) -> (<no type> e) -> (<no type> f) -> (<no type> g) -> null).square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " I square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(((I) (<no type> a) -> (<no type> b) -> (<no type> c) -> (<no type> d) -> (<no type> e) -> (<no type> f) -> (<no type> g) -> null).square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0009", expectedUnitToString);
}
// type elided, unparenthesized parameter + expression body lambda in an initializer block
public void test00010() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -336,29 +336,29 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " static I i = (<no type> x) -> (x * x);\n" +
- " {\n" +
- " i = (<no type> x) -> ((x * x) * x);\n" +
- " }\n" +
- " static {\n" +
- " i = (<no type> x) -> ((x * x) * x);\n" +
- " }\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " static I i = (<no type> x) -> (x * x);\n" +
+ " {\n" +
+ " i = (<no type> x) -> ((x * x) * x);\n" +
+ " }\n" +
+ " static {\n" +
+ " i = (<no type> x) -> ((x * x) * x);\n" +
+ " }\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test00010", expectedUnitToString);
}
// type elided, parenthesized parameter + expression body lambda in casting context.
public void test0011() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -368,23 +368,23 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(((I) (<no type> x) -> (x * x)).square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(((I) (<no type> x) -> (x * x)).square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0011", expectedUnitToString);
}
// Normal & minimal parameter list + expression body lambda in assignment context.
public void test0012() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -395,24 +395,24 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = (int x) -> (x * x);\n" +
- " System.out.println(i.square(10));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = (int x) -> (x * x);\n" +
+ " System.out.println(i.square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0012", expectedUnitToString);
}
// Normal parameter list, with modifiers & annotations + expression body lambda in invocation context.
public void test0013() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -427,29 +427,29 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " @interface Positive {\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " static void foo(I i1, I i2) {\n" +
- " System.out.println(i1.square(10));\n" +
- " System.out.println(i2.square(10));\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " foo((final int x) -> (x * x), (final @Positive int x) -> ((x * x) * x));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " @interface Positive {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " static void foo(I i1, I i2) {\n" +
+ " System.out.println(i1.square(10));\n" +
+ " System.out.println(i2.square(10));\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " foo((final int x) -> (x * x), (final @Positive int x) -> ((x * x) * x));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0013", expectedUnitToString);
}
// Vararg parameter list, with modifiers & annotations + expression body lambda in message send context.
public void test0014() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int ... x);\n" +
"}\n" +
@@ -464,29 +464,29 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int... x);\n" +
- "}\n" +
- "public class X {\n" +
- " @interface Positive {\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " static void foo(I i1, I i2) {\n" +
- " System.out.println(i1.square(10));\n" +
- " System.out.println(i2.square(10));\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " foo((final int... x) -> 10, (final @Positive int[] x) -> 20);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int... x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " @interface Positive {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " static void foo(I i1, I i2) {\n" +
+ " System.out.println(i1.square(10));\n" +
+ " System.out.println(i2.square(10));\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " foo((final int... x) -> 10, (final @Positive int[] x) -> 20);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0014", expectedUnitToString);
}
// multi parameter type elided list + expression body lambda in return statement.
public void test0015() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int product(int x, int y);\n" +
"}\n" +
@@ -500,27 +500,27 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"};\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int product(int x, int y);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " static I getI() {\n" +
- " return ((<no type> x, <no type> y) -> (x * y));\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = getI();\n" +
- " System.out.println(i.product(5, 6));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int product(int x, int y);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " static I getI() {\n" +
+ " return ((<no type> x, <no type> y) -> (x * y));\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = getI();\n" +
+ " System.out.println(i.product(5, 6));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0015", expectedUnitToString);
}
// multi parameter type specified list + block body lambda in return statement.
public void test0016() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int product(int x, int y);\n" +
"}\n" +
@@ -534,29 +534,29 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " int product(int x, int y);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " static I getI() {\n" +
- " return (int x, int y) -> {\n" +
- " return (x * y);\n" +
- "};\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = getI();\n" +
- " System.out.println(i.product(5, 6));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int product(int x, int y);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " static I getI() {\n" +
+ " return (int x, int y) -> {\n" +
+ " return (x * y);\n" +
+ "};\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = getI();\n" +
+ " System.out.println(i.product(5, 6));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0016", expectedUnitToString);
}
- // noarg + block body lambda
+ // noarg + block body lambda
public void test0017() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" String noarg();\n" +
"}\n" +
@@ -566,25 +566,25 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " String noarg();\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(((I) () -> {\n" +
- " return \"noarg\";\n" +
- "}).noarg());\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " String noarg();\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(((I) () -> {\n" +
+ " return \"noarg\";\n" +
+ "}).noarg());\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0017", expectedUnitToString);
}
// Assorted tests.
public void test0018() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo();\n" +
"}\n" +
@@ -607,44 +607,44 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
" };\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo();\n" +
- "}\n" +
- "interface J {\n" +
- " int foo();\n" +
- "}\n" +
- "public class X {\n" +
- " I i1 = () -> {\n" +
- " };\n" +
- " J j1 = () -> 0;\n" +
- " J j2 = () -> {\n" +
- " return 0;\n" +
- " };\n" +
- " I i2 = () -> {\n" +
- " System.gc();\n" +
- " };\n" +
- " J j3 = () -> {\n" +
- " if (true)\n" +
- " return 0;\n" +
- " else\n" +
- " {\n" +
- " int r = 12;\n" +
- " for (int i = 1;; (i < 8); i ++) \n" +
- " r += i;\n" +
- " return r;\n" +
- " }\n" +
- " };\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo();\n" +
+ "}\n" +
+ "interface J {\n" +
+ " int foo();\n" +
+ "}\n" +
+ "public class X {\n" +
+ " I i1 = () -> {\n" +
+ " };\n" +
+ " J j1 = () -> 0;\n" +
+ " J j2 = () -> {\n" +
+ " return 0;\n" +
+ " };\n" +
+ " I i2 = () -> {\n" +
+ " System.gc();\n" +
+ " };\n" +
+ " J j3 = () -> {\n" +
+ " if (true)\n" +
+ " return 0;\n" +
+ " else\n" +
+ " {\n" +
+ " int r = 12;\n" +
+ " for (int i = 1;; (i < 8); i ++) \n" +
+ " r += i;\n" +
+ " return r;\n" +
+ " }\n" +
+ " };\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0018", expectedUnitToString);
}
// like test0001() but body expression is an assignment
public void test0019() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" int square(int x);\n" +
"}\n" +
@@ -654,28 +654,28 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(((I) x -> y = x * x ).square(10));\n" +
" }\n" +
"}\n";
-
- String expectedUnitToString =
- "interface I {\n" +
- " int square(int x);\n" +
- "}\n" +
- "public class X {\n" +
+
+ String expectedUnitToString =
+ "interface I {\n" +
+ " int square(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
" int y;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(((I) (<no type> x) -> y = (x * x)).square(10));\n" +
- " }\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(((I) (<no type> x) -> y = (x * x)).square(10));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0019", expectedUnitToString);
}
-
+
// Coverage: exercise this condition in Parser.consumeExpression():
// if (this.valueLambdaNestDepth >= 0 && this.stateStackLengthStack[this.valueLambdaNestDepth] == this.stateStackTop - 1)
// make sure we see a (true && false) combination
public void testNestedLambda01() throws IOException {
- String source =
+ String source =
"public class C {\n" +
" I foo() {\n" +
" return (i1, i2) -> (String x1, String x2) -> { \n" +
@@ -687,7 +687,7 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
"interface I {\n" +
" String doit(String s1, String s2);\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"public class C {\n" +
" public C() {\n" +
" super();\n" +
@@ -706,14 +706,14 @@ public class LambdaExpressionSyntaxTest extends AbstractSyntaxTreeTest {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=385132
public void test385132() throws IOException {
String source = "->";
- String expectedErrorString =
+ String expectedErrorString =
"----------\n" +
"1. ERROR in test385132 (at line 1)\n" +
" ->\n" +
" ^^\n" +
"Syntax error on token \"->\", delete this token\n" +
"----------\n";
-
+
checkParse(CHECK_PARSER , source.toCharArray(), expectedErrorString, "test385132", null);
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ModuleDeclarationSyntaxTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ModuleDeclarationSyntaxTest.java
index dd40942cf..791cca4b1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ModuleDeclarationSyntaxTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ModuleDeclarationSyntaxTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -45,10 +45,10 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
super(testName, null, null);
}
public void test0001() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module com.greetings {\n" +
"}\n";
CompilerOptions options = new CompilerOptions(getCompilerOptions());
@@ -58,11 +58,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0002() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
"requires org.astro;" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module com.greetings {\n" +
" requires org.astro;\n" +
"}\n";
@@ -73,11 +73,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0003() throws IOException {
- String source =
+ String source =
"module org.astro {\n" +
" exports org.astro;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module org.astro {\n" +
" exports org.astro;\n" +
"}\n";
@@ -88,11 +88,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0004() throws IOException {
- String source =
+ String source =
"module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
"}\n";
@@ -103,13 +103,13 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0005() throws IOException {
- String source =
+ String source =
"module com.socket {\n" +
" exports com.socket;\n" +
" exports com.socket.spi;\n" +
" uses com.socket.spi.NetworkSocketProvider;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module com.socket {\n" +
" exports com.socket;\n" +
" exports com.socket.spi;\n" +
@@ -122,13 +122,13 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0006() throws IOException {
- String source =
+ String source =
"module org.fastsocket {\n" +
" requires com.socket;\n" +
" provides com.socket.spi.NetworkSocketProvider\n" +
" with org.fastsocket.FastNetworkSocketProvider;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module org.fastsocket {\n" +
" requires com.socket;\n" +
" provides com.socket.spi.NetworkSocketProvider with org.fastsocket.FastNetworkSocketProvider;\n" +
@@ -140,12 +140,12 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0007() throws IOException {
- String source =
+ String source =
"module org.fastsocket {\n" +
" requires com.socket;\n" +
" provides com.socket.spi.NetworkSocketProvider;\n" +
"}\n";
- String expectedErrorString =
+ String expectedErrorString =
"----------\n" +
"1. ERROR in module-info (at line 3)\n" +
" provides com.socket.spi.NetworkSocketProvider;\n" +
@@ -159,11 +159,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), expectedErrorString, "module-info", null, null, options);
}
public void test0008() throws IOException {
- String source =
+ String source =
"module @Marker com.greetings {\n" +
" requires org.astro;" +
"}\n";
- String errorMsg =
+ String errorMsg =
"----------\n" +
"1. ERROR in module-info (at line 1)\n" +
" module @Marker com.greetings {\n" +
@@ -182,11 +182,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), errorMsg, "module-info", null, null, options);
}
public void test0009() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
" requires @Marker org.astro;\n" +
"}\n";
- String errorMsg =
+ String errorMsg =
"----------\n" +
"1. ERROR in module-info (at line 1)\n" +
" module com.greetings {\n requires @Marker org.astro;\n" +
@@ -210,11 +210,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), errorMsg, "module-info", null, null, options);
}
public void test0010() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
" requires private org.astro;\n" +
"}\n";
- String errorMsg =
+ String errorMsg =
"----------\n" +
"1. ERROR in module-info (at line 2)\n" +
" requires private org.astro;\n"+
@@ -228,11 +228,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), errorMsg, "module-info", null, null, options);
}
public void test0011() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
" exports @Marker com.greetings;\n" +
"}\n";
- String errorMsg =
+ String errorMsg =
"----------\n" +
"1. ERROR in module-info (at line 1)\n" +
" module com.greetings {\n exports @Marker com.greetings;\n" +
@@ -256,11 +256,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), errorMsg, "module-info", null, null, options);
}
public void test0012() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
" exports com.greetings to @Marker org.astro;\n" +
"}\n";
- String errorMsg =
+ String errorMsg =
"----------\n" +
"1. ERROR in module-info (at line 2)\n" +
" exports com.greetings to @Marker org.astro;\n"+
@@ -274,11 +274,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), errorMsg, "module-info", null, null, options);
}
public void test0013() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
" uses @Marker org.astro.World;\n" +
"}\n";
- String errorMsg =
+ String errorMsg =
"----------\n" +
"1. ERROR in module-info (at line 2)\n" +
" uses @Marker org.astro.World;\n" +
@@ -292,11 +292,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), errorMsg, "module-info", null, null, options);
}
public void test0014() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
" provides @Marker org.astro.World with @Marker com.greetings.Main;\n" +
"}\n";
- String errorMsg =
+ String errorMsg =
"----------\n" +
"1. ERROR in module-info (at line 2)\n" +
" provides @Marker org.astro.World with @Marker com.greetings.Main;\n" +
@@ -315,11 +315,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), errorMsg, "module-info", null, null, options);
}
public void test0015() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
"requires transitive org.astro;" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module com.greetings {\n" +
" requires transitive org.astro;\n" +
"}\n";
@@ -330,11 +330,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0016() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
"requires static org.astro;" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module com.greetings {\n" +
" requires static org.astro;\n" +
"}\n";
@@ -345,11 +345,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0017() throws IOException {
- String source =
+ String source =
"module com.greetings {\n" +
"requires transitive static org.astro;" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module com.greetings {\n" +
" requires transitive static org.astro;\n" +
"}\n";
@@ -360,14 +360,14 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0018() throws IOException {
- String source =
+ String source =
"import com.socket.spi.NetworkSocketProvider;\n" +
"module org.fastsocket {\n" +
" requires com.socket;\n" +
" provides NetworkSocketProvider\n" +
" with org.fastsocket.FastNetworkSocketProvider;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"import com.socket.spi.NetworkSocketProvider;\n" +
"module org.fastsocket {\n" +
" requires com.socket;\n" +
@@ -380,14 +380,14 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0019() throws IOException {
- String source =
+ String source =
"import com.socket.spi.*;\n" +
"module org.fastsocket {\n" +
" requires com.socket;\n" +
" provides NetworkSocketProvider\n" +
" with org.fastsocket.FastNetworkSocketProvider;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"import com.socket.spi.*;\n" +
"module org.fastsocket {\n" +
" requires com.socket;\n" +
@@ -400,11 +400,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0020() throws IOException {
- String source =
+ String source =
"open module com.greetings {\n" +
"requires transitive static org.astro;" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"open module com.greetings {\n" +
" requires transitive static org.astro;\n" +
"}\n";
@@ -415,13 +415,13 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0021() throws IOException {
- String source =
+ String source =
"module org.fastsocket {\n" +
" requires com.socket;\n" +
" provides com.socket.spi.NetworkSocketProvider\n" +
" with org.fastsocket.FastNetworkSocketProvider, org.fastSocket.SlowNetworkSocketProvider;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module org.fastsocket {\n" +
" requires com.socket;\n" +
" provides com.socket.spi.NetworkSocketProvider with org.fastsocket.FastNetworkSocketProvider, org.fastSocket.SlowNetworkSocketProvider;\n" +
@@ -433,11 +433,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0022() throws IOException {
- String source =
+ String source =
"module org.astro {\n" +
" opens org.astro;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module org.astro {\n" +
" opens org.astro;\n" +
"}\n";
@@ -448,11 +448,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0023() throws IOException {
- String source =
+ String source =
"module org.astro {\n" +
" opens org.astro to com.greetings, com.example1, com.example2;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module org.astro {\n" +
" opens org.astro to com.greetings, com.example1, com.example2;\n" +
"}\n";
@@ -463,13 +463,13 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0024() throws IOException {
- String source =
+ String source =
"module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro.galaxy to com.greetings, com.example1, com.example2;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro to com.greetings, com.example1, com.example2;\n" +
@@ -482,14 +482,14 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0025() throws IOException {
- String source =
+ String source =
"@Foo\n" +
"module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro.galaxy to com.greetings, com.example1, com.example2;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Foo\n" +
"module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
@@ -503,14 +503,14 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
checkParse(CHECK_PARSER, source.toCharArray(), null, "module-info", expectedUnitToString, null, options);
}
public void test0026() throws IOException {
- String source =
+ String source =
"@Foo\n" +
"open module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro.galaxy to com.greetings, com.example1, com.example2;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Foo\n" +
"open module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
@@ -525,14 +525,14 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
}
public void test0027() throws IOException {
- String source =
+ String source =
"@Foo @Bar(x = 2) @Baz(\"true\")\n" +
"open module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro to com.greetings, com.example1, com.example2;\n" +
" opens org.astro.galaxy to com.greetings, com.example1, com.example2;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Foo @Bar(x = 2) @Baz(\"true\")\n" +
"open module org.astro {\n" +
" exports org.astro to com.greetings, com.example1, com.example2;\n" +
@@ -547,11 +547,11 @@ public class ModuleDeclarationSyntaxTest extends AbstractSyntaxTreeTest {
}
public void testBug518626() throws IOException {
- String source =
+ String source =
"module module.test {\n" +
" provides X with Y;\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"module module.test {\n" +
" provides X with Y;\n" +
"}\n";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java
index 4f8cf5e86..0a688f6b3 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java
@@ -166,7 +166,7 @@ public void test1FVRQQA_2() {
" void foo() {\n" +
" Enumeration e;\n" +
" for (; <CompleteOnName:e.has>; ) \n" +
- " ;\n" +
+ " ;\n" +
" }\n" +
"}\n",
// expectedCompletionIdentifier:
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java
index 5869d5054..11f2ae6bd 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java
@@ -76,21 +76,21 @@ public void test003() {
" }\n" +
"}\n"
},
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " throws new X\n" +
- " ^^^^^^\n" +
- "Syntax error on token \"throws\", throw expected\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 3)\n" +
- " throws new X\n" +
- " ^\n" +
- "Syntax error, insert \"( )\" to complete Expression\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 3)\n" +
- " throws new X\n" +
- " ^\n" +
- "Syntax error, insert \";\" to complete BlockStatements\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " throws new X\n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"throws\", throw expected\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " throws new X\n" +
+ " ^\n" +
+ "Syntax error, insert \"( )\" to complete Expression\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " throws new X\n" +
+ " ^\n" +
+ "Syntax error, insert \";\" to complete BlockStatements\n" +
"----------\n");
}
public void test004() {
@@ -139,21 +139,21 @@ public void test006() {
" }\n" +
"}\n"
},
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " throws new X\n" +
- " ^^^^^^\n" +
- "Syntax error on token \"throws\", throw expected\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 3)\n" +
- " throws new X\n" +
- " ^\n" +
- "Syntax error, insert \"( )\" to complete Expression\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 3)\n" +
- " throws new X\n" +
- " ^\n" +
- "Syntax error, insert \";\" to complete BlockStatements\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " throws new X\n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"throws\", throw expected\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " throws new X\n" +
+ " ^\n" +
+ "Syntax error, insert \"( )\" to complete Expression\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " throws new X\n" +
+ " ^\n" +
+ "Syntax error, insert \";\" to complete BlockStatements\n" +
"----------\n");
}
public void test007() {
@@ -755,23 +755,23 @@ public void test027() {
*/
public void _test028() {
String error = (this.complianceLevel == ClassFileConstants.JDK14) ?
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " Srtring bar = \"\"\"\n" +
- " }\n" +
- " ^^^^\n" +
- "Text block is not properly closed with the delimiter\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " Srtring bar = \"\"\"\n" +
+ " }\n" +
+ " ^^^^\n" +
+ "Text block is not properly closed with the delimiter\n" +
"----------\n" :
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " Srtring bar = \"\"\"\n" +
- " ^^\n" +
- "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " Srtring bar = \"\"\"\n" +
- " ^\n" +
- "String literal is not properly closed by a double-quote\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " Srtring bar = \"\"\"\n" +
+ " ^^\n" +
+ "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " Srtring bar = \"\"\"\n" +
+ " ^\n" +
+ "String literal is not properly closed by a double-quote\n" +
"----------\n";
Map options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR);
@@ -794,34 +794,34 @@ public void testBug485477() {
runNegativeTest(
new String[] {
"T.java",
- "public class T {{\n" +
+ "public class T {{\n" +
" Object o = T.super; // error: '.' expected\n" + // instance initializer
- " System.out.println(o.toString());\n" +
- "}}\n" +
- "class U {\n" +
+ " System.out.println(o.toString());\n" +
+ "}}\n" +
+ "class U {\n" +
" Object o1;\n" +
" Object o2 = T.super;\n" + // field initializer
- " U() {\n" +
+ " U() {\n" +
" o1 = U.super;\n" + // constructor
" System.out.println(o1.toString());\n" +
- " }\n" +
+ " }\n" +
"}"
},
- "----------\n" +
- "1. ERROR in T.java (at line 2)\n" +
- " Object o = T.super; // error: \'.\' expected\n" +
- " ^^^^^\n" +
- "Syntax error, insert \". Identifier\" to complete Expression\n" +
- "----------\n" +
- "2. ERROR in T.java (at line 7)\n" +
- " Object o2 = T.super;\n" +
- " ^^^^^\n" +
- "Syntax error, insert \". Identifier\" to complete Expression\n" +
- "----------\n" +
- "3. ERROR in T.java (at line 9)\n" +
- " o1 = U.super;\n" +
- " ^^^^^\n" +
- "Syntax error, insert \". Identifier\" to complete Expression\n" +
+ "----------\n" +
+ "1. ERROR in T.java (at line 2)\n" +
+ " Object o = T.super; // error: \'.\' expected\n" +
+ " ^^^^^\n" +
+ "Syntax error, insert \". Identifier\" to complete Expression\n" +
+ "----------\n" +
+ "2. ERROR in T.java (at line 7)\n" +
+ " Object o2 = T.super;\n" +
+ " ^^^^^\n" +
+ "Syntax error, insert \". Identifier\" to complete Expression\n" +
+ "----------\n" +
+ "3. ERROR in T.java (at line 9)\n" +
+ " o1 = U.super;\n" +
+ " ^^^^^\n" +
+ "Syntax error, insert \". Identifier\" to complete Expression\n" +
"----------\n");
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java
index 12a6a1dc7..9efe7e1e1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -191,10 +191,10 @@ public void checkParse(
new DefaultProblemFactory(Locale.getDefault())),
true);
parser.setStatementsRecovery(false);
-
+
ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null);
CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
+
CompilationUnitDeclaration computedUnit = parser.parse(sourceUnit, compilationResult);
String computedUnitToString = computedUnit.toString();
if (!expectedFullUnitToString.equals(computedUnitToString)){
@@ -204,7 +204,7 @@ public void checkParse(
"Invalid unit full structure" + testName,
expectedFullUnitToString,
computedUnitToString);
-
+
}
}
/* using regular parser in FULL mode and statementRecoveryEnabled */
@@ -256,77 +256,77 @@ public void test0001() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException | IOException | Exception e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException | IOException | Exception e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException | IOException | Exception e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException | IOException | Exception e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException | IOException | Exception e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException | IOException | Exception e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -359,77 +359,77 @@ public void test0002() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -458,53 +458,53 @@ public void test0003() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
" }\n" +
- " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -535,65 +535,65 @@ public void test0004() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -624,65 +624,65 @@ public void test0005() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -715,77 +715,77 @@ public void test0006() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException | IOException | Exception e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException | IOException | Exception e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException | IOException | Exception e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException | IOException | Exception e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException | IOException | Exception e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " finally\n" +
- " {\n" +
- " System.out.println(\"Finishing try-with-resources\");\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException | IOException | Exception e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " finally\n" +
+ " {\n" +
+ " System.out.println(\"Finishing try-with-resources\");\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -813,47 +813,47 @@ public void test0007() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<String> l = new ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<String> l = new ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<String> l = new ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<String> l = new ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<String> l = new ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<String> l = new ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -881,47 +881,47 @@ public void test0008() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<> l = new ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<> l = new ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<> l = new ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<> l = new ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<> l = new ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<> l = new ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -949,47 +949,47 @@ public void test0009() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<String> l = new java.util.ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<String> l = new java.util.ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<String> l = new java.util.ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<String> l = new java.util.ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " List<String> l = new java.util.ArrayList<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " List<String> l = new java.util.ArrayList<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -1017,47 +1017,47 @@ public void test0010() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " B<String>.C<Integer> o = new B<>.C<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " B<String>.C<Integer> o = new B<>.C<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " B<String>.C<Integer> o = new B<>.C<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " B<String>.C<Integer> o = new B<>.C<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " B<String>.C<Integer> o = new B<>.C<>();\n" +
- " System.out.println(l);\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " B<String>.C<Integer> o = new B<>.C<>();\n" +
+ " System.out.println(l);\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -1088,65 +1088,65 @@ public void test0011() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
@@ -1178,68 +1178,68 @@ public void test0012() {
"}";
String expectedDietUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\");\n" +
- " Reader reader2 = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\");\n" +
+ " Reader reader2 = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\");\n" +
- " Reader reader2 = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\");\n" +
+ " Reader reader2 = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(String fileName) {\n" +
- " try (Reader reader = new FileReader(\"fileName\");\n" +
- " Reader reader2 = new FileReader(\"fileName\"))\n" +
- " {\n" +
- " System.out.println(reader.read());\n" +
- " }\n" +
- " catch (FileNotFoundException e)\n" +
- " {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(String fileName) {\n" +
+ " try (Reader reader = new FileReader(\"fileName\");\n" +
+ " Reader reader2 = new FileReader(\"fileName\"))\n" +
+ " {\n" +
+ " System.out.println(reader.read());\n" +
+ " }\n" +
+ " catch (FileNotFoundException e)\n" +
+ " {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedFullWithStatementRecoveryUnitToString =
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceExpressionSyntaxTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceExpressionSyntaxTest.java
index c4f14db2f..36e736cc1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceExpressionSyntaxTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceExpressionSyntaxTest.java
@@ -54,9 +54,9 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
jsr335TestScratchArea = null;
}
}
- // Reference expression - super:: form, without type arguments.
+ // Reference expression - super:: form, without type arguments.
public void test0001() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -74,35 +74,35 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X extends Y {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " new X().doit();\n" +
- " }\n" +
- " void doit() {\n" +
- " I i = super::foo;\n" +
- " i.foo(10);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X extends Y {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " new X().doit();\n" +
+ " }\n" +
+ " void doit() {\n" +
+ " I i = super::foo;\n" +
+ " i.foo(10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0001", expectedUnitToString);
}
- // Reference expression - super:: form, with type arguments.
+ // Reference expression - super:: form, with type arguments.
public void test0002() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -120,35 +120,35 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X extends Y {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " new X().doit();\n" +
- " }\n" +
- " void doit() {\n" +
- " I i = super::<String>foo;\n" +
- " i.foo(10);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X extends Y {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " new X().doit();\n" +
+ " }\n" +
+ " void doit() {\n" +
+ " I i = super::<String>foo;\n" +
+ " i.foo(10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0002", expectedUnitToString);
}
// Reference expression - SimpleName:: form, without type arguments.
public void test0003() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -163,32 +163,32 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y::foo;\n" +
- " i.foo(10);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " public static void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y::foo;\n" +
+ " i.foo(10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0003", expectedUnitToString);
}
// Reference expression - SimpleName:: form, with type arguments.
public void test0004() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -203,32 +203,32 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y::<String>foo;\n" +
- " i.foo(10);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " public static void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y::<String>foo;\n" +
+ " i.foo(10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0004", expectedUnitToString);
}
// Reference expression - QualifiedName:: form, without type arguments.
public void test0005() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -245,37 +245,37 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y.Z::foo;\n" +
- " i.foo(10);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " static class Z {\n" +
- " Z() {\n" +
- " super();\n" +
- " }\n" +
- " public static void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
- " }\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y.Z::foo;\n" +
+ " i.foo(10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " static class Z {\n" +
+ " Z() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
+ " }\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0005", expectedUnitToString);
}
// Reference expression - QualifiedName:: form, with type arguments.
public void test0006() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -292,37 +292,37 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y.Z::<String>foo;\n" +
- " i.foo(10);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " static class Z {\n" +
- " Z() {\n" +
- " super();\n" +
- " }\n" +
- " public static void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
- " }\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y.Z::<String>foo;\n" +
+ " i.foo(10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " static class Z {\n" +
+ " Z() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
+ " }\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0006", expectedUnitToString);
}
// Reference expression - Primary:: form, without type arguments.
public void test0007() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -337,32 +337,32 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = new Y()::foo;\n" +
- " i.foo(10);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = new Y()::foo;\n" +
+ " i.foo(10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0007", expectedUnitToString);
}
// Reference expression - primary:: form, with type arguments.
public void test0008() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
@@ -377,32 +377,32 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = new Y()::<String>foo;\n" +
- " i.foo(10);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = new Y()::<String>foo;\n" +
+ " i.foo(10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0008", expectedUnitToString);
}
// Reference expression - X<T>:: form, without type arguments.
public void test0009() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(Y<String> y, int x);\n" +
"}\n" +
@@ -417,32 +417,32 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(Y<String> y, int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y<String>::foo;\n" +
- " i.foo(new Y<String>(), 10);\n" +
- " }\n" +
- "}\n" +
- "class Y<T> {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(Y<String> y, int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y<String>::foo;\n" +
+ " i.foo(new Y<String>(), 10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y<T> {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0009", expectedUnitToString);
}
// Reference expression - X<T>:: form, with type arguments.
public void test0010() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(Y<String> y, int x);\n" +
"}\n" +
@@ -457,32 +457,32 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(Y<String> y, int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y<String>::<String>foo;\n" +
- " i.foo(new Y<String>(), 10);\n" +
- " }\n" +
- "}\n" +
- "class Y<T> {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(Y<String> y, int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y<String>::<String>foo;\n" +
+ " i.foo(new Y<String>(), 10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y<T> {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0010", expectedUnitToString);
}
// Reference expression - X<T>.Name:: form, without type arguments.
public void test0011() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(Y<String>.Z z, int x);\n" +
"}\n" +
@@ -499,37 +499,37 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(Y<String>.Z z, int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y<String>.Z::foo;\n" +
- " i.foo(new Y<String>().new Z(), 10);\n" +
- " }\n" +
- "}\n" +
- "class Y<T> {\n" +
- " class Z {\n" +
- " Z() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
- " }\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(Y<String>.Z z, int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y<String>.Z::foo;\n" +
+ " i.foo(new Y<String>().new Z(), 10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y<T> {\n" +
+ " class Z {\n" +
+ " Z() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
+ " }\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0011", expectedUnitToString);
}
// Reference expression - X<T>.Name:: form, with type arguments.
public void test0012() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(Y<String>.Z z, int x);\n" +
"}\n" +
@@ -546,37 +546,37 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(Y<String>.Z z, int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y<String>.Z::<String>foo;\n" +
- " i.foo(new Y<String>().new Z(), 10);\n" +
- " }\n" +
- "}\n" +
- "class Y<T> {\n" +
- " class Z {\n" +
- " Z() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
- " }\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(Y<String>.Z z, int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y<String>.Z::<String>foo;\n" +
+ " i.foo(new Y<String>().new Z(), 10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y<T> {\n" +
+ " class Z {\n" +
+ " Z() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
+ " }\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0012", expectedUnitToString);
}
// Reference expression - X<T>.Y<K>:: form, without type arguments.
public void test0013() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(Y<String>.Z<Integer> z, int x);\n" +
"}\n" +
@@ -593,37 +593,37 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(Y<String>.Z<Integer> z, int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y<String>.Z<Integer>::foo;\n" +
- " i.foo(new Y<String>().new Z<Integer>(), 10);\n" +
- " }\n" +
- "}\n" +
- "class Y<T> {\n" +
- " class Z<K> {\n" +
- " Z() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
- " }\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(Y<String>.Z<Integer> z, int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y<String>.Z<Integer>::foo;\n" +
+ " i.foo(new Y<String>().new Z<Integer>(), 10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y<T> {\n" +
+ " class Z<K> {\n" +
+ " Z() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
+ " }\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0013", expectedUnitToString);
}
// Reference expression - X<T>.Y<K>:: form, with type arguments.
public void test0014() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(Y<String>.Z<Integer> z, int x);\n" +
"}\n" +
@@ -640,37 +640,37 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(Y<String>.Z<Integer> z, int x);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y<String>.Z<Integer>::<String>foo;\n" +
- " i.foo(new Y<String>().new Z<Integer>(), 10);\n" +
- " }\n" +
- "}\n" +
- "class Y<T> {\n" +
- " class Z<K> {\n" +
- " Z() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " System.out.println(x);\n" +
- " }\n" +
- " }\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(Y<String>.Z<Integer> z, int x);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y<String>.Z<Integer>::<String>foo;\n" +
+ " i.foo(new Y<String>().new Z<Integer>(), 10);\n" +
+ " }\n" +
+ "}\n" +
+ "class Y<T> {\n" +
+ " class Z<K> {\n" +
+ " Z() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
+ " }\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0014", expectedUnitToString);
}
// Constructor reference expression - X<T>.Y<K>::new form, with type arguments.
public void test0015() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(Y<String> y);\n" +
"}\n" +
@@ -687,35 +687,35 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" }\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(Y<String> y);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = Y<String>.Z<Integer>::<String>new;\n" +
- " i.foo(new Y<String>());\n" +
- " }\n" +
- "}\n" +
- "class Y<T> {\n" +
- " class Z<K> {\n" +
- " Z() {\n" +
- " super();\n" +
- " System.out.println(\"Y<T>.Z<K>::new\");\n" +
- " }\n" +
- " }\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(Y<String> y);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = Y<String>.Z<Integer>::<String>new;\n" +
+ " i.foo(new Y<String>());\n" +
+ " }\n" +
+ "}\n" +
+ "class Y<T> {\n" +
+ " class Z<K> {\n" +
+ " Z() {\n" +
+ " super();\n" +
+ " System.out.println(\"Y<T>.Z<K>::new\");\n" +
+ " }\n" +
+ " }\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0015", expectedUnitToString);
}
// Reference expression - PrimitiveType[]:: form, with type arguments.
public void test0016() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" Object copy(int [] ia);\n" +
"}\n" +
@@ -725,24 +725,24 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" i.copy(new int[10]); \n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " Object copy(int[] ia);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = int[]::<String>clone;\n" +
- " i.copy(new int[10]);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " Object copy(int[] ia);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = int[]::<String>clone;\n" +
+ " i.copy(new int[10]);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0016", expectedUnitToString);
- }
+ }
// Reference expression - Name[]:: form, with type arguments.
public void test0017() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" Object copy(X [] ia);\n" +
"}\n" +
@@ -752,24 +752,24 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" i.copy(new X[10]); \n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " Object copy(X[] ia);\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = X[]::<String>clone;\n" +
- " i.copy(new X[10]);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " Object copy(X[] ia);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = X[]::<String>clone;\n" +
+ " i.copy(new X[10]);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0017", expectedUnitToString);
- }
+ }
// Reference expression - X<T>.Y<K>[]:: form, with type arguments.
public void test0018() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" Object copy(X<String>.Y<Integer> [] p);\n" +
"}\n" +
@@ -782,31 +782,31 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" i.copy(xs); \n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " Object copy(X<String>.Y<Integer>[] p);\n" +
- "}\n" +
- "public class X<T> {\n" +
- " class Y<K> {\n" +
- " Y() {\n" +
- " super();\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " I i = X<String>.Y<Integer>[]::<String>clone;\n" +
- " X<String>.Y<Integer>[] xs = null;\n" +
- " i.copy(xs);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " Object copy(X<String>.Y<Integer>[] p);\n" +
+ "}\n" +
+ "public class X<T> {\n" +
+ " class Y<K> {\n" +
+ " Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " I i = X<String>.Y<Integer>[]::<String>clone;\n" +
+ " X<String>.Y<Integer>[] xs = null;\n" +
+ " i.copy(xs);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0018", expectedUnitToString);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=384320, syntax error while mixing 308 and 335.
public void test0019() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo(X<String> s, int x);\n" +
"}\n" +
@@ -818,27 +818,27 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
"@interface Foo {\n" +
" String [] value();\n" +
"}\n";
- String expectedUnitToString =
- "interface I {\n" +
- " void foo(X<String> s, int x);\n" +
- "}\n" +
- "public class X<T> {\n" +
- " I i = X<@Foo({\"hello\"}) String>::foo;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(int x) {\n" +
- " }\n" +
- "}\n" +
- "@interface Foo {\n" +
- " String[] value();\n" +
+ String expectedUnitToString =
+ "interface I {\n" +
+ " void foo(X<String> s, int x);\n" +
+ "}\n" +
+ "public class X<T> {\n" +
+ " I i = X<@Foo({\"hello\"}) String>::foo;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(int x) {\n" +
+ " }\n" +
+ "}\n" +
+ "@interface Foo {\n" +
+ " String[] value();\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0019", expectedUnitToString);
}
// Reference expression - Name::new forms, with/without type arguments.
public void test0020() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" Y foo(int x);\n" +
"}\n" +
@@ -870,7 +870,7 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"interface I {\n" +
" Y foo(int x);\n" +
"}\n" +
@@ -911,19 +911,19 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=385132
public void test385132() throws IOException {
String source = "::";
- String expectedErrorString =
+ String expectedErrorString =
"----------\n" +
"1. ERROR in test385132 (at line 1)\n" +
" ::\n" +
" ^^\n" +
"Syntax error on token \"::\", delete this token\n" +
"----------\n";
-
+
checkParse(CHECK_PARSER , source.toCharArray(), expectedErrorString, "test385132", null);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=385374, Support for 308 style type annotations on 335 constructs.
public void test385374() throws IOException {
- String source =
+ String source =
"interface I {\n" +
" void foo();\n" +
"}\n" +
@@ -950,8 +950,8 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
" // Qualified generic type array form with dimension annotations and type parameter annotations.\n" +
" I x9 = @TypeAnnotation X<@TypeParameterAnnotation String>.Y<@TypeParameterAnnotation String> @ArrayAnnotation[]@ArrayAnnotation[]::<@TypeParameterAnnotation String>clone; \n" +
"}\n";
-
- String expectedUnitToString =
+
+ String expectedUnitToString =
"interface I {\n" +
" void foo();\n" +
"}\n" +
@@ -975,7 +975,7 @@ public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
}
/* https://bugs.eclipse.org/bugs/show_bug.cgi?id=385374, Support for 308 style type annotations on 335 constructs - make sure illegal modifiers are rejected
This test has been rendered meaningless as the grammar has been so throughly changed - Type annotations are not accepted via modifiers in the first place.
- Disabling this test as we don't want fragile and unstable tests that are at the whimsy of the diagnose parser's complex algorithms.
+ Disabling this test as we don't want fragile and unstable tests that are at the whimsy of the diagnose parser's complex algorithms.
*/
public void test385374a() throws IOException {
// Nop.
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java
index 5c5634ad7..3ca664b2b 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest10.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest10.java
index 588ffadea..5ed1fbe24 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest10.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest10.java
@@ -10,7 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Jesper Steen Møller <jesper@selskabet.org> - contributions for:
+ * Jesper Steen Møller <jesper@selskabet.org> - contributions for:
* Bug 531046: [10] ICodeAssist#codeSelect support for 'var'
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.parser;
@@ -34,22 +34,22 @@ public class SelectionParserTest10 extends AbstractSelectionTest {
}
public void test001() throws JavaModelException {
- String string = "public class X {\n"
+ String string = "public class X {\n"
+ " public static void main(String[] args) {\n"
+ " var s_s = args[0];\n"
+ " }\n"
- + "}\n";
+ + "}\n";
String selection = "s_s";
String expectedSelection = "<SelectionOnLocalName:var s_s = args[0]>;";
String completionIdentifier = "s_s";
- String expectedUnitDisplayString = "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " <SelectionOnLocalName:var s_s = args[0]>;\n" +
- " }\n" +
+ String expectedUnitDisplayString = "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " <SelectionOnLocalName:var s_s = args[0]>;\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "s_s";
String testName = "X.java";
@@ -62,22 +62,22 @@ public class SelectionParserTest10 extends AbstractSelectionTest {
}
public void test002() throws JavaModelException {
- String string = "public class X {\n"
+ String string = "public class X {\n"
+ " public static void main(String[] args) {\n"
+ " var s_s = args[0];\n"
+ " }\n"
- + "}\n";
+ + "}\n";
String selection = "var";
String expectedSelection = "<SelectOnType:var>";
String completionIdentifier = "var";
- String expectedUnitDisplayString = "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
+ String expectedUnitDisplayString = "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
" <SelectOnType:var> s_s = args[0];\n" +
- " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "var";
String testName = "X.java";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest12.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest12.java
index 7912c9e4b..34b1c4a6e 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest12.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest12.java
@@ -50,21 +50,21 @@ public void test001() throws JavaModelException {
String selectionIdentifier = "ONE";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static final String ONE;\n" +
- " static final String TWO;\n" +
- " static final String THREE;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(String num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:ONE> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " static final String ONE;\n" +
+ " static final String TWO;\n" +
+ " static final String THREE;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(String num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:ONE> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ONE";
String testName = "X.java";
@@ -96,25 +96,25 @@ public void test002() throws JavaModelException {
String selectionIdentifier = "ONE";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:ONE> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:ONE> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ONE";
String testName = "X.java";
@@ -146,21 +146,21 @@ public void test003() throws JavaModelException {
String selectionIdentifier = "TWO";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static final String ONE;\n" +
- " static final String TWO;\n" +
- " static final String THREE;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(String num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:TWO> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " static final String ONE;\n" +
+ " static final String TWO;\n" +
+ " static final String THREE;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(String num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:TWO> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "TWO";
String testName = "X.java";
@@ -192,25 +192,25 @@ public void test004() throws JavaModelException {
String selectionIdentifier = "TWO";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:TWO> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:TWO> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "TWO";
String testName = "X.java";
@@ -243,21 +243,21 @@ public void test005() throws JavaModelException {
String expectedSelection = selectKey + selection + ">";
String selectionIdentifier = "ONE";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static final String ONE;\n" +
- " static final String TWO;\n" +
- " static final String THREE;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(String num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:ONE> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " static final String ONE;\n" +
+ " static final String TWO;\n" +
+ " static final String THREE;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(String num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:ONE> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ONE";
String testName = "X.java";
@@ -289,25 +289,25 @@ public void test006() throws JavaModelException {
String selectionIdentifier = "ONE";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:ONE> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:ONE> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ONE";
String testName = "X.java";
@@ -339,21 +339,21 @@ public void test007() throws JavaModelException {
String selectionIdentifier = "TWO";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static final String ONE;\n" +
- " static final String TWO;\n" +
- " static final String THREE;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(String num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:TWO> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " static final String ONE;\n" +
+ " static final String TWO;\n" +
+ " static final String THREE;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(String num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:TWO> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "TWO";
String testName = "X.java";
@@ -385,25 +385,25 @@ public void test008() throws JavaModelException {
String selectionIdentifier = "TWO";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:TWO> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:TWO> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "TWO";
String testName = "X.java";
@@ -436,23 +436,23 @@ public void test009() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num_) {\n" +
- " {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num_) {\n" +
+ " {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -487,28 +487,28 @@ public void test010() throws JavaModelException {
String selectionIdentifier = "i_j";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num_) {\n" +
- " switch (num_) {\n" +
- " case THREE ->\n" +
- " {\n" +
- " int i_j;\n" +
- " System.out.println(<SelectOnName:i_j>);\n" +
- " break;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num_) {\n" +
+ " switch (num_) {\n" +
+ " case THREE ->\n" +
+ " {\n" +
+ " int i_j;\n" +
+ " System.out.println(<SelectOnName:i_j>);\n" +
+ " break;\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "i_j";
String testName = "X.java";
@@ -540,21 +540,21 @@ public void test011() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num_) {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num_) {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -585,12 +585,12 @@ public void test012() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(int num_) {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(int num_) {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -609,7 +609,7 @@ public void test013() throws JavaModelException {
" public static void foo(int num_) {\n" +
" int i = switch (num_) {\n" +
" case 1, 2, 3 -> (num_ + 1);\n" +
- " default -> 0;\n" +
+ " default -> 0;\n" +
" }" +
" }\n" +
"}";
@@ -620,15 +620,15 @@ public void test013() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(int num_) {\n" +
- " int i;\n" +
- " {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(int num_) {\n" +
+ " int i;\n" +
+ " {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -647,7 +647,7 @@ public void test014() throws JavaModelException {
" public static void foo(int num_) {\n" +
" int i = switch (num_) {\n" +
" case 1, 2, 3 -> 0;\n" +
- " default -> (num_ + 1);\n" +
+ " default -> (num_ + 1);\n" +
" }" +
" }\n" +
"}";
@@ -658,15 +658,15 @@ public void test014() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(int num_) {\n" +
- " int i;\n" +
- " {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(int num_) {\n" +
+ " int i;\n" +
+ " {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -685,7 +685,7 @@ public void test015() throws JavaModelException {
" public static void foo(int num_) {\n" +
" int i = switch (num_) {\n" +
" case 1, 2, 3 -> 0;\n" +
- " default -> (num_ + 1);\n" +
+ " default -> (num_ + 1);\n" +
" }" +
" }\n" +
"}";
@@ -696,15 +696,15 @@ public void test015() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(int num_) {\n" +
- " int i;\n" +
- " {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(int num_) {\n" +
+ " int i;\n" +
+ " {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -719,13 +719,13 @@ public void test015() throws JavaModelException {
* Multi constant case statement with '->', selection is a referenced name of type int in switch expression
*/
public void test016() throws JavaModelException {
- String string = "public class X {\n" +
- " public void bar(int s) {\n" +
- " int i_j = switch (s) {\n" +
+ String string = "public class X {\n" +
+ " public void bar(int s) {\n" +
+ " int i_j = switch (s) {\n" +
" case 1, 2, 3 -> (s+1);\n" +
- " default -> i_j;\n" +
- " };\n" +
- " }\n" +
+ " default -> i_j;\n" +
+ " };\n" +
+ " }\n" +
"}\n";
String selection = "i_j";
@@ -734,15 +734,15 @@ public void test016() throws JavaModelException {
String selectionIdentifier = "i_j";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public void bar(int s) {\n" +
- " int i_j;\n" +
- " {\n" +
- " <SelectOnName:i_j>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public void bar(int s) {\n" +
+ " int i_j;\n" +
+ " {\n" +
+ " <SelectOnName:i_j>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "i_j";
String testName = "X.java";
@@ -754,13 +754,13 @@ public void test016() throws JavaModelException {
selectionIdentifier, expectedReplacedSource, testName);
}
public void test017() throws JavaModelException {
- String string = "public class X {\n" +
- " public void bar(int s) {\n" +
- " int i_j = switch (s) {\n" +
+ String string = "public class X {\n" +
+ " public void bar(int s) {\n" +
+ " int i_j = switch (s) {\n" +
" case 1, 2, 3 -> (s+1);\n" +
- " default -> (1+i_j);\n" +
- " };\n" +
- " }\n" +
+ " default -> (1+i_j);\n" +
+ " };\n" +
+ " }\n" +
"}\n";
String selection = "i_j";
@@ -769,15 +769,15 @@ public void test017() throws JavaModelException {
String selectionIdentifier = "i_j";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public void bar(int s) {\n" +
- " int i_j;\n" +
- " {\n" +
- " <SelectOnName:i_j>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public void bar(int s) {\n" +
+ " int i_j;\n" +
+ " {\n" +
+ " <SelectOnName:i_j>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "i_j";
String testName = "X.java";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java
index 854d12db8..f6678dd98 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java
@@ -50,21 +50,21 @@ public void test001() throws JavaModelException {
String selectionIdentifier = "ONE";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static final String ONE;\n" +
- " static final String TWO;\n" +
- " static final String THREE;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(String num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:ONE> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " static final String ONE;\n" +
+ " static final String TWO;\n" +
+ " static final String THREE;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(String num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:ONE> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ONE";
String testName = "X.java";
@@ -96,25 +96,25 @@ public void test002() throws JavaModelException {
String selectionIdentifier = "ONE";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:ONE> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:ONE> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ONE";
String testName = "X.java";
@@ -146,21 +146,21 @@ public void test003() throws JavaModelException {
String selectionIdentifier = "TWO";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static final String ONE;\n" +
- " static final String TWO;\n" +
- " static final String THREE;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(String num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:TWO> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " static final String ONE;\n" +
+ " static final String TWO;\n" +
+ " static final String THREE;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(String num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:TWO> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "TWO";
String testName = "X.java";
@@ -192,25 +192,25 @@ public void test004() throws JavaModelException {
String selectionIdentifier = "TWO";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:TWO> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:TWO> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "TWO";
String testName = "X.java";
@@ -243,21 +243,21 @@ public void test005() throws JavaModelException {
String expectedSelection = selectKey + selection + ">";
String selectionIdentifier = "ONE";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static final String ONE;\n" +
- " static final String TWO;\n" +
- " static final String THREE;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(String num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:ONE> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " static final String ONE;\n" +
+ " static final String TWO;\n" +
+ " static final String THREE;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(String num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:ONE> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ONE";
String testName = "X.java";
@@ -289,25 +289,25 @@ public void test006() throws JavaModelException {
String selectionIdentifier = "ONE";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:ONE> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:ONE> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ONE";
String testName = "X.java";
@@ -339,21 +339,21 @@ public void test007() throws JavaModelException {
String selectionIdentifier = "TWO";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static final String ONE;\n" +
- " static final String TWO;\n" +
- " static final String THREE;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(String num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:TWO> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " static final String ONE;\n" +
+ " static final String TWO;\n" +
+ " static final String THREE;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(String num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:TWO> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "TWO";
String testName = "X.java";
@@ -385,25 +385,25 @@ public void test008() throws JavaModelException {
String selectionIdentifier = "TWO";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num) {\n" +
- " {\n" +
- " switch (num) {\n" +
- " case <SelectOnName:TWO> :\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num) {\n" +
+ " {\n" +
+ " switch (num) {\n" +
+ " case <SelectOnName:TWO> :\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "TWO";
String testName = "X.java";
@@ -436,23 +436,23 @@ public void test009() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num_) {\n" +
- " {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num_) {\n" +
+ " {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -487,26 +487,26 @@ public void test010() throws JavaModelException {
String selectionIdentifier = "i_j";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num_) {\n" +
- " {\n" +
- " {\n" +
- " int i_j;\n" +
- " <SelectOnName:i_j>;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num_) {\n" +
+ " {\n" +
+ " {\n" +
+ " int i_j;\n" +
+ " <SelectOnName:i_j>;\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "i_j";
String testName = "X.java";
@@ -538,21 +538,21 @@ public void test011() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " enum Num {\n" +
- " ONE(),\n" +
- " TWO(),\n" +
- " THREE(),\n" +
- " <clinit>() {\n" +
- " }\n" +
- " Num() {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(Num num_) {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
+ "public class X {\n" +
+ " enum Num {\n" +
+ " ONE(),\n" +
+ " TWO(),\n" +
+ " THREE(),\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " Num() {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(Num num_) {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -583,12 +583,12 @@ public void test012() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(int num_) {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(int num_) {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -607,7 +607,7 @@ public void test013() throws JavaModelException {
" public static void foo(int num_) {\n" +
" int i = switch (num_) {\n" +
" case 1, 2, 3 -> (num_ + 1);\n" +
- " default -> 0;\n" +
+ " default -> 0;\n" +
" }" +
" }\n" +
"}";
@@ -618,15 +618,15 @@ public void test013() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(int num_) {\n" +
- " int i;\n" +
- " {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(int num_) {\n" +
+ " int i;\n" +
+ " {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -645,7 +645,7 @@ public void test014() throws JavaModelException {
" public static void foo(int num_) {\n" +
" int i = switch (num_) {\n" +
" case 1, 2, 3 -> 0;\n" +
- " default -> (num_ + 1);\n" +
+ " default -> (num_ + 1);\n" +
" }" +
" }\n" +
"}";
@@ -656,15 +656,15 @@ public void test014() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(int num_) {\n" +
- " int i;\n" +
- " {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(int num_) {\n" +
+ " int i;\n" +
+ " {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -683,7 +683,7 @@ public void test015() throws JavaModelException {
" public static void foo(int num_) {\n" +
" int i = switch (num_) {\n" +
" case 1, 2, 3 -> 0;\n" +
- " default -> (num_ + 1);\n" +
+ " default -> (num_ + 1);\n" +
" }" +
" }\n" +
"}";
@@ -694,15 +694,15 @@ public void test015() throws JavaModelException {
String selectionIdentifier = "num_";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public static void foo(int num_) {\n" +
- " int i;\n" +
- " {\n" +
- " <SelectOnName:num_>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static void foo(int num_) {\n" +
+ " int i;\n" +
+ " {\n" +
+ " <SelectOnName:num_>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "num_";
String testName = "X.java";
@@ -717,13 +717,13 @@ public void test015() throws JavaModelException {
* Multi constant case statement with '->', selection is a referenced name of type int in switch expression
*/
public void test016() throws JavaModelException {
- String string = "public class X {\n" +
- " public void bar(int s) {\n" +
- " int i_j = switch (s) {\n" +
+ String string = "public class X {\n" +
+ " public void bar(int s) {\n" +
+ " int i_j = switch (s) {\n" +
" case 1, 2, 3 -> (s+1);\n" +
- " default -> i_j;\n" +
- " };\n" +
- " }\n" +
+ " default -> i_j;\n" +
+ " };\n" +
+ " }\n" +
"}\n";
String selection = "i_j";
@@ -732,15 +732,15 @@ public void test016() throws JavaModelException {
String selectionIdentifier = "i_j";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public void bar(int s) {\n" +
- " int i_j;\n" +
- " {\n" +
- " <SelectOnName:i_j>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public void bar(int s) {\n" +
+ " int i_j;\n" +
+ " {\n" +
+ " <SelectOnName:i_j>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "i_j";
String testName = "X.java";
@@ -752,13 +752,13 @@ public void test016() throws JavaModelException {
selectionIdentifier, expectedReplacedSource, testName);
}
public void test017() throws JavaModelException {
- String string = "public class X {\n" +
- " public void bar(int s) {\n" +
- " int i_j = switch (s) {\n" +
+ String string = "public class X {\n" +
+ " public void bar(int s) {\n" +
+ " int i_j = switch (s) {\n" +
" case 1, 2, 3 -> (s+1);\n" +
- " default -> (1+i_j);\n" +
- " };\n" +
- " }\n" +
+ " default -> (1+i_j);\n" +
+ " };\n" +
+ " }\n" +
"}\n";
String selection = "i_j";
@@ -767,15 +767,15 @@ public void test017() throws JavaModelException {
String selectionIdentifier = "i_j";
String expectedUnitDisplayString =
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " public void bar(int s) {\n" +
- " int i_j;\n" +
- " {\n" +
- " <SelectOnName:i_j>;\n" +
- " }\n" +
- " }\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public void bar(int s) {\n" +
+ " int i_j;\n" +
+ " {\n" +
+ " <SelectOnName:i_j>;\n" +
+ " }\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "i_j";
String testName = "X.java";
@@ -787,20 +787,20 @@ public void test017() throws JavaModelException {
selectionIdentifier, expectedReplacedSource, testName);
}
public void test018() throws JavaModelException {
- String string = "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {} \n" +
- "interface IN1 extends IN0 {} \n" +
- "interface IN2 extends IN0 {}\n" +
- "public class X {\n" +
- " IN1 n_1() { return new IN1() {}; } \n" +
- " IN2 n_2() { return null; } \n" +
- " <M> void m( Supplier< M> m2) { } \n" +
- " void testSw(int i) { \n" +
- " m(switch(i) { \n" +
- " case 1 -> this::n_1; \n" +
- " default -> this::n_2; }); \n" +
- " }\n" +
+ String string = "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {} \n" +
+ "interface IN1 extends IN0 {} \n" +
+ "interface IN2 extends IN0 {}\n" +
+ "public class X {\n" +
+ " IN1 n_1() { return new IN1() {}; } \n" +
+ " IN2 n_2() { return null; } \n" +
+ " <M> void m( Supplier< M> m2) { } \n" +
+ " void testSw(int i) { \n" +
+ " m(switch(i) { \n" +
+ " case 1 -> this::n_1; \n" +
+ " default -> this::n_2; }); \n" +
+ " }\n" +
"}";
String selection = "n_1";
@@ -809,31 +809,31 @@ public void test018() throws JavaModelException {
String selectionIdentifier = "n_1";
String expectedUnitDisplayString =
- "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {\n" +
- "}\n" +
- "interface IN1 extends IN0 {\n" +
- "}\n" +
- "interface IN2 extends IN0 {\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " IN1 n_1() {\n" +
- " }\n" +
- " IN2 n_2() {\n" +
- " }\n" +
- " <M>void m(Supplier<M> m2) {\n" +
- " }\n" +
- " void testSw(int i) {\n" +
- " m(switch (i) {\n" +
- "case 1 ->\n" +
- " <SelectionOnReferenceExpressionName:this::n_1>;\n" +
- "default ->\n" +
- " this::n_2;\n" +
- "});\n" +
- " }\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {\n" +
+ "}\n" +
+ "interface IN1 extends IN0 {\n" +
+ "}\n" +
+ "interface IN2 extends IN0 {\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " IN1 n_1() {\n" +
+ " }\n" +
+ " IN2 n_2() {\n" +
+ " }\n" +
+ " <M>void m(Supplier<M> m2) {\n" +
+ " }\n" +
+ " void testSw(int i) {\n" +
+ " m(switch (i) {\n" +
+ "case 1 ->\n" +
+ " <SelectionOnReferenceExpressionName:this::n_1>;\n" +
+ "default ->\n" +
+ " this::n_2;\n" +
+ "});\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "this::n_1";
String testName = "X.java";
@@ -845,20 +845,20 @@ public void test018() throws JavaModelException {
selectionIdentifier, expectedReplacedSource, testName);
}
public void test019() throws JavaModelException {
- String string = "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {} \n" +
- "interface IN1 extends IN0 {} \n" +
- "interface IN2 extends IN0 {}\n" +
- "public class X {\n" +
- " IN1 n_1() { return new IN1() {}; } \n" +
- " IN2 n_2() { return null; } \n" +
- " <M> void m( Supplier< M> m2) { } \n" +
- " void testSw(int i) { \n" +
- " m(switch(i) { \n" +
- " case 2 -> () -> n_1(); \n" +
- " default -> this::n_2; }); \n" +
- " }\n" +
+ String string = "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {} \n" +
+ "interface IN1 extends IN0 {} \n" +
+ "interface IN2 extends IN0 {}\n" +
+ "public class X {\n" +
+ " IN1 n_1() { return new IN1() {}; } \n" +
+ " IN2 n_2() { return null; } \n" +
+ " <M> void m( Supplier< M> m2) { } \n" +
+ " void testSw(int i) { \n" +
+ " m(switch(i) { \n" +
+ " case 2 -> () -> n_1(); \n" +
+ " default -> this::n_2; }); \n" +
+ " }\n" +
"}";
String selection = "n_1";
@@ -867,31 +867,31 @@ public void test019() throws JavaModelException {
String selectionIdentifier = "n_1";
String expectedUnitDisplayString =
- "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {\n" +
- "}\n" +
- "interface IN1 extends IN0 {\n" +
- "}\n" +
- "interface IN2 extends IN0 {\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " IN1 n_1() {\n" +
- " }\n" +
- " IN2 n_2() {\n" +
- " }\n" +
- " <M>void m(Supplier<M> m2) {\n" +
- " }\n" +
- " void testSw(int i) {\n" +
- " m(switch (i) {\n" +
- "case 2 ->\n" +
- " () -> <SelectOnMessageSend:n_1()>;\n" +
- "default ->\n" +
- " this::n_2;\n" +
- "});\n" +
- " }\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {\n" +
+ "}\n" +
+ "interface IN1 extends IN0 {\n" +
+ "}\n" +
+ "interface IN2 extends IN0 {\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " IN1 n_1() {\n" +
+ " }\n" +
+ " IN2 n_2() {\n" +
+ " }\n" +
+ " <M>void m(Supplier<M> m2) {\n" +
+ " }\n" +
+ " void testSw(int i) {\n" +
+ " m(switch (i) {\n" +
+ "case 2 ->\n" +
+ " () -> <SelectOnMessageSend:n_1()>;\n" +
+ "default ->\n" +
+ " this::n_2;\n" +
+ "});\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "n_1()";
String testName = "X.java";
@@ -903,19 +903,19 @@ public void test019() throws JavaModelException {
selectionIdentifier, expectedReplacedSource, testName);
}
public void test020() throws JavaModelException {
- String string = "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {} \n" +
- "interface IN1 extends IN0 {} \n" +
- "interface IN2 extends IN0 {}\n" +
- "public class X {\n" +
- " IN1 n_1() { return new IN1() {}; } \n" +
- " IN2 n_2() { return null; } \n" +
- " <M> void m( Supplier< M> m2) { } \n" +
- " void testSw(int i) { \n" +
- " m(switch(i) { \n" +
- " default -> this::n_2; }); \n" +
- " }\n" +
+ String string = "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {} \n" +
+ "interface IN1 extends IN0 {} \n" +
+ "interface IN2 extends IN0 {}\n" +
+ "public class X {\n" +
+ " IN1 n_1() { return new IN1() {}; } \n" +
+ " IN2 n_2() { return null; } \n" +
+ " <M> void m( Supplier< M> m2) { } \n" +
+ " void testSw(int i) { \n" +
+ " m(switch(i) { \n" +
+ " default -> this::n_2; }); \n" +
+ " }\n" +
"}";
String selection = "n_2";
@@ -924,29 +924,29 @@ public void test020() throws JavaModelException {
String selectionIdentifier = "n_2";
String expectedUnitDisplayString =
- "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {\n" +
- "}\n" +
- "interface IN1 extends IN0 {\n" +
- "}\n" +
- "interface IN2 extends IN0 {\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " IN1 n_1() {\n" +
- " }\n" +
- " IN2 n_2() {\n" +
- " }\n" +
- " <M>void m(Supplier<M> m2) {\n" +
- " }\n" +
- " void testSw(int i) {\n" +
- " m(switch (i) {\n" +
- "default ->\n" +
- " <SelectionOnReferenceExpressionName:this::n_2>;\n" +
- "});\n" +
- " }\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {\n" +
+ "}\n" +
+ "interface IN1 extends IN0 {\n" +
+ "}\n" +
+ "interface IN2 extends IN0 {\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " IN1 n_1() {\n" +
+ " }\n" +
+ " IN2 n_2() {\n" +
+ " }\n" +
+ " <M>void m(Supplier<M> m2) {\n" +
+ " }\n" +
+ " void testSw(int i) {\n" +
+ " m(switch (i) {\n" +
+ "default ->\n" +
+ " <SelectionOnReferenceExpressionName:this::n_2>;\n" +
+ "});\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "this::n_2";
String testName = "X.java";
@@ -958,19 +958,19 @@ public void test020() throws JavaModelException {
selectionIdentifier, expectedReplacedSource, testName);
}
public void test021() throws JavaModelException {
- String string = "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {} \n" +
- "interface IN1 extends IN0 {} \n" +
- "interface IN2 extends IN0 {}\n" +
- "public class X {\n" +
- " IN1 n_1(int ijk) { return new IN1() {}; } \n" +
- " IN2 n_2() { return null; } \n" +
- " <M> void m( Supplier< M> m2) { } \n" +
- " void testSw(int ijk) { \n" +
- " m(switch(ijk) { \n" +
- " default -> () -> n_1(ijk); }); \n" +
- " }\n" +
+ String string = "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {} \n" +
+ "interface IN1 extends IN0 {} \n" +
+ "interface IN2 extends IN0 {}\n" +
+ "public class X {\n" +
+ " IN1 n_1(int ijk) { return new IN1() {}; } \n" +
+ " IN2 n_2() { return null; } \n" +
+ " <M> void m( Supplier< M> m2) { } \n" +
+ " void testSw(int ijk) { \n" +
+ " m(switch(ijk) { \n" +
+ " default -> () -> n_1(ijk); }); \n" +
+ " }\n" +
"}";
String selection = "n_1";
@@ -979,29 +979,29 @@ public void test021() throws JavaModelException {
String selectionIdentifier = "n_1";
String expectedUnitDisplayString =
- "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {\n" +
- "}\n" +
- "interface IN1 extends IN0 {\n" +
- "}\n" +
- "interface IN2 extends IN0 {\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " IN1 n_1(int ijk) {\n" +
- " }\n" +
- " IN2 n_2() {\n" +
- " }\n" +
- " <M>void m(Supplier<M> m2) {\n" +
- " }\n" +
- " void testSw(int ijk) {\n" +
- " m(switch (ijk) {\n" +
- "default ->\n" +
- " () -> <SelectOnMessageSend:n_1(ijk)>;\n" +
- "});\n" +
- " }\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {\n" +
+ "}\n" +
+ "interface IN1 extends IN0 {\n" +
+ "}\n" +
+ "interface IN2 extends IN0 {\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " IN1 n_1(int ijk) {\n" +
+ " }\n" +
+ " IN2 n_2() {\n" +
+ " }\n" +
+ " <M>void m(Supplier<M> m2) {\n" +
+ " }\n" +
+ " void testSw(int ijk) {\n" +
+ " m(switch (ijk) {\n" +
+ "default ->\n" +
+ " () -> <SelectOnMessageSend:n_1(ijk)>;\n" +
+ "});\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "n_1(ijk)";
String testName = "X.java";
@@ -1013,19 +1013,19 @@ public void test021() throws JavaModelException {
selectionIdentifier, expectedReplacedSource, testName);
}
public void test022() throws JavaModelException {
- String string = "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {} \n" +
- "interface IN1 extends IN0 {} \n" +
- "interface IN2 extends IN0 {}\n" +
- "public class X {\n" +
- " IN1 n_1(int ijk) { return new IN1() {}; } \n" +
- " IN2 n_2() { return null; } \n" +
- " <M> void m( Supplier< M> m2) { } \n" +
- " void testSw(int ijk) { \n" +
- " m(switch(ijk) { \n" +
- " default -> () -> n_1(ijk); }); \n" +
- " }\n" +
+ String string = "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {} \n" +
+ "interface IN1 extends IN0 {} \n" +
+ "interface IN2 extends IN0 {}\n" +
+ "public class X {\n" +
+ " IN1 n_1(int ijk) { return new IN1() {}; } \n" +
+ " IN2 n_2() { return null; } \n" +
+ " <M> void m( Supplier< M> m2) { } \n" +
+ " void testSw(int ijk) { \n" +
+ " m(switch(ijk) { \n" +
+ " default -> () -> n_1(ijk); }); \n" +
+ " }\n" +
"}";
String selection = "ijk";
@@ -1034,29 +1034,29 @@ public void test022() throws JavaModelException {
String selectionIdentifier = "ijk";
String expectedUnitDisplayString =
- "import org.eclipse.jdt.annotation.*;\n" +
- "import java.util.function.*;\n" +
- "interface IN0 {\n" +
- "}\n" +
- "interface IN1 extends IN0 {\n" +
- "}\n" +
- "interface IN2 extends IN0 {\n" +
- "}\n" +
- "public class X {\n" +
- " public X() {\n" +
- " }\n" +
- " IN1 n_1(int ijk) {\n" +
- " }\n" +
- " IN2 n_2() {\n" +
- " }\n" +
- " <M>void m(Supplier<M> m2) {\n" +
- " }\n" +
- " void testSw(int ijk) {\n" +
- " m(switch (ijk) {\n" +
- "default ->\n" +
- " () -> n_1(<SelectOnName:ijk>);\n" +
- "});\n" +
- " }\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.function.*;\n" +
+ "interface IN0 {\n" +
+ "}\n" +
+ "interface IN1 extends IN0 {\n" +
+ "}\n" +
+ "interface IN2 extends IN0 {\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " }\n" +
+ " IN1 n_1(int ijk) {\n" +
+ " }\n" +
+ " IN2 n_2() {\n" +
+ " }\n" +
+ " <M>void m(Supplier<M> m2) {\n" +
+ " }\n" +
+ " void testSw(int ijk) {\n" +
+ " m(switch (ijk) {\n" +
+ "default ->\n" +
+ " () -> n_1(<SelectOnName:ijk>);\n" +
+ "});\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "ijk";
String testName = "X.java";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest18.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest18.java
index 72fadde93..d5eaba2ac 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest18.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest18.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -32,7 +32,7 @@ public SelectionParserTest18(String testName) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=424110, [1.8][hovering] Hover, F3 does not work for method reference in method invocation
public void test424110() throws JavaModelException {
- String string =
+ String string =
"public class X {\n" +
" static F f = X::m; // [1] Works\n" +
" int i = fun(X::m); // [2] Does not work\n" +
@@ -53,20 +53,20 @@ public void test424110() throws JavaModelException {
String completionIdentifier = "m";
String expectedUnitDisplayString =
- "public class X {\n" +
- " static F f = <SelectionOnReferenceExpressionName:X::m>;\n" +
- " int i;\n" +
- " <clinit>() {\n" +
- " }\n" +
- " public X() {\n" +
- " }\n" +
- " public static int m(int x) {\n" +
- " }\n" +
- " private int fun(F f) {\n" +
- " }\n" +
- "}\n" +
- "interface F {\n" +
- " int foo(int x);\n" +
+ "public class X {\n" +
+ " static F f = <SelectionOnReferenceExpressionName:X::m>;\n" +
+ " int i;\n" +
+ " <clinit>() {\n" +
+ " }\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static int m(int x) {\n" +
+ " }\n" +
+ " private int fun(F f) {\n" +
+ " }\n" +
+ "}\n" +
+ "interface F {\n" +
+ " int foo(int x);\n" +
"}\n";
String expectedReplacedSource = "X::m";
String testName = "<select>";
@@ -86,7 +86,7 @@ public void test424110() throws JavaModelException {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=424110, [1.8][hovering] Hover, F3 does not work for method reference in method invocation
public void test424110a() throws JavaModelException {
- String string =
+ String string =
"public class X {\n" +
" int i = fun(X::m); // [2] Does not work\n" +
" public static int m(int x) {\n" +
@@ -106,17 +106,17 @@ public void test424110a() throws JavaModelException {
String completionIdentifier = "m";
String expectedUnitDisplayString =
- "public class X {\n" +
- " int i = fun(<SelectionOnReferenceExpressionName:X::m>);\n" +
- " public X() {\n" +
- " }\n" +
- " public static int m(int x) {\n" +
- " }\n" +
- " private int fun(F f) {\n" +
- " }\n" +
- "}\n" +
- "interface F {\n" +
- " int foo(int x);\n" +
+ "public class X {\n" +
+ " int i = fun(<SelectionOnReferenceExpressionName:X::m>);\n" +
+ " public X() {\n" +
+ " }\n" +
+ " public static int m(int x) {\n" +
+ " }\n" +
+ " private int fun(F f) {\n" +
+ " }\n" +
+ "}\n" +
+ "interface F {\n" +
+ " int foo(int x);\n" +
"}\n";
String expectedReplacedSource = "X::m";
String testName = "<select>";
@@ -136,7 +136,7 @@ public void test424110a() throws JavaModelException {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=430572, [1.8] CCE on hovering over 'super' in lambda expression
public void test430572() throws JavaModelException {
- String string =
+ String string =
"@FunctionalInterface\n" +
"interface FI {\n" +
" default int getID() {\n" +
@@ -154,15 +154,15 @@ public void test430572() throws JavaModelException {
String completionIdentifier = "super";
String expectedUnitDisplayString =
- "@FunctionalInterface interface FI {\n" +
- " default int getID() {\n" +
- " }\n" +
- " void print();\n" +
- "}\n" +
- "class T {\n" +
- " FI f2 = () -> System.out.println(<SelectOnSuper:super>.toString());\n" +
- " T() {\n" +
- " }\n" +
+ "@FunctionalInterface interface FI {\n" +
+ " default int getID() {\n" +
+ " }\n" +
+ " void print();\n" +
+ "}\n" +
+ "class T {\n" +
+ " FI f2 = () -> System.out.println(<SelectOnSuper:super>.toString());\n" +
+ " T() {\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "super";
String testName = "<select>";
@@ -182,7 +182,7 @@ public void test430572() throws JavaModelException {
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=476693
public void test476693() throws JavaModelException {
- String string =
+ String string =
"import static java.util.stream.Collectors.toList;\n" +
"import java.util.List;\n" +
"import java.util.Spliterator;\n" +
@@ -254,7 +254,7 @@ public void test476693() throws JavaModelException {
testName);
}
public void test495912() {
- String string =
+ String string =
"package xy;\n" +
"public class Test {\n" +
" {\n" +
@@ -276,27 +276,27 @@ public void test495912() {
String completionIdentifier = "byteValue";
String expectedUnitDisplayString =
- "package xy;\n" +
- "public class Test {\n" +
- " {\n" +
- " {\n" +
- " Runnable r = () -> {\n" +
- " Integer i;\n" +
- " byte b = <SelectOnMessageSend:i.byteValue()>;\n" +
- " if (true)\n" +
- " {\n" +
- " if (false)\n" +
- " {\n" +
- " }\n" +
- " }\n" +
- " String s;\n" +
+ "package xy;\n" +
+ "public class Test {\n" +
+ " {\n" +
+ " {\n" +
+ " Runnable r = () -> {\n" +
+ " Integer i;\n" +
+ " byte b = <SelectOnMessageSend:i.byteValue()>;\n" +
+ " if (true)\n" +
+ " {\n" +
+ " if (false)\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
+ " String s;\n" +
" };\n" +
- " }\n" +
- " }\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo(Runnable r) {\n" +
- " }\n" +
+ " }\n" +
+ " }\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void foo(Runnable r) {\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "i.byteValue()";
String testName = "<select>";
@@ -315,7 +315,7 @@ public void test495912() {
testName);
}
public void test495912a() {
- String string =
+ String string =
"package xy;\n" +
"public class Test {\n" +
" {\n" +
@@ -338,29 +338,29 @@ public void test495912a() {
String completionIdentifier = "byteValue";
String expectedUnitDisplayString =
- "package xy;\n" +
- "public class Test {\n" +
- " {\n" +
+ "package xy;\n" +
+ "public class Test {\n" +
+ " {\n" +
" {\n" +
- " Runnable r = () -> {\n" +
- " Integer i;\n" +
- " byte b = <SelectOnMessageSend:i.byteValue()>;\n" +
+ " Runnable r = () -> {\n" +
+ " Integer i;\n" +
+ " byte b = <SelectOnMessageSend:i.byteValue()>;\n" +
" if (true)\n" +
" {\n" +
" if (false)\n" +
" {\n" +
" }\n" +
" }\n" +
- " for (int i1;; (i1 < 42); i1 ++) \n" +
- " {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " }\n" +
- " public Test() {\n" +
- " }\n" +
- " public void foo(Runnable r) {\n" +
- " }\n" +
+ " for (int i1;; (i1 < 42); i1 ++) \n" +
+ " {\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ " }\n" +
+ " public Test() {\n" +
+ " }\n" +
+ " public void foo(Runnable r) {\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "i.byteValue()";
String testName = "<select>";
@@ -379,7 +379,7 @@ public void test495912a() {
testName);
}
public void test495912b() {
- String string =
+ String string =
"package xy;\n" +
"import org.eclipse.e4.ui.internal.workbench.PartServiceImpl;\n" +
"import org.eclipse.e4.ui.model.application.ui.basic.MPart;\n" +
@@ -413,36 +413,36 @@ public void test495912b() {
String selectionIdentifier = "getTransientData";
String expectedUnitDisplayString =
- "package xy;\n" +
- "import org.eclipse.e4.ui.internal.workbench.PartServiceImpl;\n" +
- "import org.eclipse.e4.ui.model.application.ui.basic.MPart;\n" +
- "import org.eclipse.swt.widgets.Table;\n" +
- "import org.eclipse.ui.IWorkbenchWindow;\n" +
- "public abstract class CycleViewHandler extends CycleBaseHandler {\n" +
- " public CycleViewHandler() {\n" +
- " }\n" +
- " protected @Override void addItems(Table table, WorkbenchPage page) {\n" +
+ "package xy;\n" +
+ "import org.eclipse.e4.ui.internal.workbench.PartServiceImpl;\n" +
+ "import org.eclipse.e4.ui.model.application.ui.basic.MPart;\n" +
+ "import org.eclipse.swt.widgets.Table;\n" +
+ "import org.eclipse.ui.IWorkbenchWindow;\n" +
+ "public abstract class CycleViewHandler extends CycleBaseHandler {\n" +
+ " public CycleViewHandler() {\n" +
+ " }\n" +
+ " protected @Override void addItems(Table table, WorkbenchPage page) {\n" +
" List<MPart> parts;\n" + // this is the missing part without the fix in RecoveredMethod#add(Block....)
- " parts.stream().sorted((<no type> firstPart, <no type> secondPart) -> {\n" +
- " Long firstPartActivationTime = (Long) <SelectOnMessageSend:firstPart.getTransientData()>.getOrDefault(PartServiceImpl.PART_ACTIVATION_TIME, Long.MIN_VALUE);\n" +
- " Long secondPartActivationTime;\n" +
- " return 0;\n" +
- "}).forEach((<no type> part) -> {\n" +
- " if (true)\n" +
- " {\n" +
- " if (true)\n" +
- " {\n" +
- " }\n" +
- " }\n" +
- " else\n" +
- " {\n" +
- " IWorkbenchWindow iwbw;\n" +
- " if (true)\n" +
- " {\n" +
- " }\n" +
- " }\n" +
- "});\n" +
- " }\n" +
+ " parts.stream().sorted((<no type> firstPart, <no type> secondPart) -> {\n" +
+ " Long firstPartActivationTime = (Long) <SelectOnMessageSend:firstPart.getTransientData()>.getOrDefault(PartServiceImpl.PART_ACTIVATION_TIME, Long.MIN_VALUE);\n" +
+ " Long secondPartActivationTime;\n" +
+ " return 0;\n" +
+ "}).forEach((<no type> part) -> {\n" +
+ " if (true)\n" +
+ " {\n" +
+ " if (true)\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
+ " else\n" +
+ " {\n" +
+ " IWorkbenchWindow iwbw;\n" +
+ " if (true)\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
+ "});\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "firstPart.getTransientData()";
String testName = "<select>";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java
index 39d934b0c..7869e3d62 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java
@@ -2481,21 +2481,21 @@ public void _test56() {
String completionIdentifier = "zoo";
String expectedUnitDisplayString =
- "class X {\n" +
- " void foo() {\n" +
- " new X(null) {\n" +
- " void goo() {\n" +
- " new X(<SelectOnMessageSend:zoo()>) {\n" +
- " void voo() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " Object zoo() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- " X(Object k) {\n" +
- " }\n" +
+ "class X {\n" +
+ " void foo() {\n" +
+ " new X(null) {\n" +
+ " void goo() {\n" +
+ " new X(<SelectOnMessageSend:zoo()>) {\n" +
+ " void voo() {\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ " Object zoo() {\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ " X(Object k) {\n" +
+ " }\n" +
"}\n";
String expectedReplacedSource = "zoo()";
String testName = "<select>";
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
index 479115892..d15208ff8 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
@@ -5309,68 +5309,68 @@ public void test81() {
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
-
+
String s =
- "import java.util.Collection;\n" +
- "\n" +
- "public class X {\n" +
- " public abstract class AbstractData {}\n" +
- " \n" +
- " public interface IScalarData<T extends AbstractData> {}\n" +
- "\n" +
- " private static interface ValueObjectPropertyIterator {\n" +
- " public <T extends AbstractData> void iterateOnValueObjectProperty(IScalarData<T> scalarObject, T valueObject, Class<?> valueObjectType, final String name, final Class<?> scalarType) throws Exception;\n" +
- " }\n" +
- "\n" +
- " private static <T extends AbstractData> void iterateOnValueObjectProperties(IScalarData<T> scalarObject, T valueObject, ValueObjectPropertyIterator valueObjectPropertyIterator) {}\n" +
- " \n" +
- " public static <T extends AbstractData> void loadScalarFromValueObject(IScalarData<T> scalarObject, T valueObject) {\n" +
- " iterateOnValueObjectProperties(scalarObject, valueObject, new ValueObjectPropertyIterator() {\n" +
- " public <T extends AbstractData> void iterateOnValueObjectProperty(IScalarData<T> scalarObject, T valueObject, Class<?> valueObjectType, String name, Class<?> scalarType) throws Exception {\n" +
- " if (true) {\n" +
- " if (true) {\n" +
- " if (true) {\n" +
- " final Collection<IScalarData<AbstractData>> lazyCollection = createLazyCollection(\n" +
- " name, scalarType, null, null,\n" +
- " new CollectionProviderForTargetCollection<IScalarData<AbstractData>>() {\n" +
- " @Override\n" +
- " public Collection<IScalarData<AbstractData>> provideCollection(\n" +
- " final Collection<IScalarData<AbstractData> targetCollection, final Class<IScalarData<AbstractData>> scalarCollectionType) {\n" +
- " return null;\n" +
- " }\n" +
- " });\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "\n" +
- " abstract class CollectionProviderForTargetCollection<S> {\n" +
- " abstract public Collection<S> provideCollection(Collection<S> targetCollection, Class<S> scalarCollectionType);\n" +
- " }\n" +
- "\n" +
- " private <S> Collection<S> createLazyCollection(String name,\n" +
- " Class<?> scalarType, final Collection<AbstractData> valueObjectCollection,\n" +
- " final Class<S> scalarCollectionType, CollectionProviderForTargetCollection<S> collectionProvider) {\n" +
- " return null;\n" +
- " }\n" +
- " });\n" +
- " }\n" +
+ "import java.util.Collection;\n" +
+ "\n" +
+ "public class X {\n" +
+ " public abstract class AbstractData {}\n" +
+ " \n" +
+ " public interface IScalarData<T extends AbstractData> {}\n" +
+ "\n" +
+ " private static interface ValueObjectPropertyIterator {\n" +
+ " public <T extends AbstractData> void iterateOnValueObjectProperty(IScalarData<T> scalarObject, T valueObject, Class<?> valueObjectType, final String name, final Class<?> scalarType) throws Exception;\n" +
+ " }\n" +
+ "\n" +
+ " private static <T extends AbstractData> void iterateOnValueObjectProperties(IScalarData<T> scalarObject, T valueObject, ValueObjectPropertyIterator valueObjectPropertyIterator) {}\n" +
+ " \n" +
+ " public static <T extends AbstractData> void loadScalarFromValueObject(IScalarData<T> scalarObject, T valueObject) {\n" +
+ " iterateOnValueObjectProperties(scalarObject, valueObject, new ValueObjectPropertyIterator() {\n" +
+ " public <T extends AbstractData> void iterateOnValueObjectProperty(IScalarData<T> scalarObject, T valueObject, Class<?> valueObjectType, String name, Class<?> scalarType) throws Exception {\n" +
+ " if (true) {\n" +
+ " if (true) {\n" +
+ " if (true) {\n" +
+ " final Collection<IScalarData<AbstractData>> lazyCollection = createLazyCollection(\n" +
+ " name, scalarType, null, null,\n" +
+ " new CollectionProviderForTargetCollection<IScalarData<AbstractData>>() {\n" +
+ " @Override\n" +
+ " public Collection<IScalarData<AbstractData>> provideCollection(\n" +
+ " final Collection<IScalarData<AbstractData> targetCollection, final Class<IScalarData<AbstractData>> scalarCollectionType) {\n" +
+ " return null;\n" +
+ " }\n" +
+ " });\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ " abstract class CollectionProviderForTargetCollection<S> {\n" +
+ " abstract public Collection<S> provideCollection(Collection<S> targetCollection, Class<S> scalarCollectionType);\n" +
+ " }\n" +
+ "\n" +
+ " private <S> Collection<S> createLazyCollection(String name,\n" +
+ " Class<?> scalarType, final Collection<AbstractData> valueObjectCollection,\n" +
+ " final Class<S> scalarCollectionType, CollectionProviderForTargetCollection<S> collectionProvider) {\n" +
+ " return null;\n" +
+ " }\n" +
+ " });\n" +
+ " }\n" +
"}";
String expectedUnitToString =
- "import java.util.Collection;\n" +
- "public class X {\n" +
- " public abstract class AbstractData {\n" +
- " java.lang.Object(0)\n" +
- " }\n" +
- " public interface IScalarData {\n" +
- " }\n" +
- " private static interface ValueObjectPropertyIterator {\n" +
- " public void iterateOnValueObjectProperty(IScalarData<T> scalarObject, T valueObject, Class<?> valueObjectType, String name, Class<?> scalarType, ) throws Exception, {}\n" +
- " }\n" +
- " java.lang.Object(0)\n" +
- " private static void iterateOnValueObjectProperties(IScalarData<T> scalarObject, T valueObject, ValueObjectPropertyIterator valueObjectPropertyIterator, ) {}\n" +
- " public static void loadScalarFromValueObject(IScalarData<T> scalarObject, T valueObject, ) {}\n" +
+ "import java.util.Collection;\n" +
+ "public class X {\n" +
+ " public abstract class AbstractData {\n" +
+ " java.lang.Object(0)\n" +
+ " }\n" +
+ " public interface IScalarData {\n" +
+ " }\n" +
+ " private static interface ValueObjectPropertyIterator {\n" +
+ " public void iterateOnValueObjectProperty(IScalarData<T> scalarObject, T valueObject, Class<?> valueObjectType, String name, Class<?> scalarType, ) throws Exception, {}\n" +
+ " }\n" +
+ " java.lang.Object(0)\n" +
+ " private static void iterateOnValueObjectProperties(IScalarData<T> scalarObject, T valueObject, ValueObjectPropertyIterator valueObjectPropertyIterator, ) {}\n" +
+ " public static void loadScalarFromValueObject(IScalarData<T> scalarObject, T valueObject, ) {}\n" +
"}";
String testName = "test81: full parse";
@@ -5384,7 +5384,7 @@ public void test81() {
public void acceptBaseReference(char[][] typeName, int sourceStart,
int sourceEnd) {
// TODO Auto-generated method stub
-
+
}
public void enterCallinMapping(CallinInfo callinInfo) {}
public void enterCalloutMapping(CalloutInfo calloutInfo) {}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest.java
index de1c44590..8690004d7 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest.java
@@ -3881,48 +3881,48 @@ public void test0047() {
public void testBug430336() {
String s =
- "package test1;\n" +
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " void foo(Collection collection) {\n" +
- " collection\n" +
- " }\n" +
+ "package test1;\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " void foo(Collection collection) {\n" +
+ " collection\n" +
+ " }\n" +
"}\n";
String expectedDietUnitToString =
- "package test1;\n" +
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " }\n" +
- " void foo(Collection collection) {\n" +
- " }\n" +
+ "package test1;\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " }\n" +
+ " void foo(Collection collection) {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "package test1;\n" +
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(Collection collection) {\n" +
- " }\n" +
+ "package test1;\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(Collection collection) {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "package test1;\n" +
- "import java.util.Collection;\n" +
- "public class E {\n" +
- " public E() {\n" +
- " super();\n" +
- " }\n" +
+ "package test1;\n" +
+ "import java.util.Collection;\n" +
+ "public class E {\n" +
+ " public E() {\n" +
+ " super();\n" +
+ " }\n" +
" void foo(Collection collection) {\n" +
- " collection = $missing$;\n" +
- " }\n" +
+ " collection = $missing$;\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest_1_5.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest_1_5.java
index c245ba5e4..729c8269e 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest_1_5.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest_1_5.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -737,43 +737,43 @@ public void test0007() {
// incorrectly used modifier
public void test0008() {
String s =
- "public class Try {\n" +
- "\n" +
- " void m() {\n" +
- "\n" +
- " synchronized new Object();\n" +
- "\n" +
+ "public class Try {\n" +
+ "\n" +
+ " void m() {\n" +
+ "\n" +
+ " synchronized new Object();\n" +
+ "\n" +
" }\n" +
- "}\n" +
+ "}\n" +
"\n";
String expectedDietUnitToString =
- "public class Try {\n" +
- " public Try() {\n" +
- " }\n" +
- " void m() {\n" +
- " }\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " }\n" +
+ " void m() {\n" +
+ " }\n" +
"}\n";
String expectedDietWithStatementRecoveryUnitToString =
expectedDietUnitToString;
String expectedDietPlusBodyUnitToString =
- "public class Try {\n" +
- " public Try() {\n" +
- " super();\n" +
- " }\n" +
- " void m() {\n" +
- " }\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void m() {\n" +
+ " }\n" +
"}\n";
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
- "public class Try {\n" +
- " public Try() {\n" +
- " super();\n" +
- " }\n" +
- " void m() {\n" +
- " }\n" +
+ "public class Try {\n" +
+ " public Try() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void m() {\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java
index 26e13171c..fb7494dcc 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java
@@ -46,7 +46,7 @@ public class TypeAnnotationSyntaxTest extends AbstractSyntaxTreeTest {
private static String jsr308TestScratchArea = "c:\\Jsr308TestScratchArea";
private static String referenceCompiler = "C:\\jdk-7-ea-bin-b75-windows-i586-30_oct_2009\\jdk7\\bin\\javac.exe";
-
+
static {
// TESTS_NAMES = new String [] { "test0137" };
}
@@ -59,7 +59,7 @@ public class TypeAnnotationSyntaxTest extends AbstractSyntaxTreeTest {
public static Test suite() {
return buildMinimalComplianceTestSuite(testClass(), F_1_8);
}
-
+
static final class LocationPrinterVisitor extends ASTVisitor {
TypeReference enclosingReference;
Map locations;
@@ -126,7 +126,7 @@ public class TypeAnnotationSyntaxTest extends AbstractSyntaxTreeTest {
this.locations.put(key, null);
return;
}
-
+
StringBuffer buffer = new StringBuffer("[");
for (int i = 0, max = tab.length; i < max; i += 2) {
if (i > 0) {
@@ -246,31 +246,31 @@ public void test0001() throws IOException {
"@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" +
"@Marker class E extends String {}\n;";
- String expectedUnitToString =
- "@Marker class A extends String {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "@Marker class B extends @Marker String {\n" +
- " B() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "@Marker class C extends @Marker @SingleMember(0) String {\n" +
- " C() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" +
- " D() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "@Marker class E extends String {\n" +
- " E() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "@Marker class A extends String {\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "@Marker class B extends @Marker String {\n" +
+ " B() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "@Marker class C extends @Marker @SingleMember(0) String {\n" +
+ " C() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "@Marker class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" +
+ " D() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "@Marker class E extends String {\n" +
+ " E() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0001", expectedUnitToString);
}
@@ -280,32 +280,32 @@ public void test0002() throws IOException {
"class C extends @Marker @SingleMember(0) String {}\n" +
"class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {}\n" +
"class E extends String {}\n;";
-
- String expectedUnitToString =
- "class A extends String {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "class B extends @Marker String {\n" +
- " B() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "class C extends @Marker @SingleMember(0) String {\n" +
- " C() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" +
- " D() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "class E extends String {\n" +
- " E() {\n" +
- " super();\n" +
- " }\n" +
+
+ String expectedUnitToString =
+ "class A extends String {\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "class B extends @Marker String {\n" +
+ " B() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "class C extends @Marker @SingleMember(0) String {\n" +
+ " C() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "class D extends @Marker @SingleMember(0) @Normal(Value = 0) String {\n" +
+ " D() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "class E extends String {\n" +
+ " E() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0002", expectedUnitToString);
}
@@ -314,11 +314,11 @@ public void test0003() throws IOException {
" @Marker Serializable," +
" Cloneable {\n" +
"}\n";
- String expectedUnitToString =
- "@Marker class A implements Comparable, @Marker Serializable, Cloneable {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "@Marker class A implements Comparable, @Marker Serializable, Cloneable {\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0003", expectedUnitToString);
}
@@ -327,11 +327,11 @@ public void test0004() throws IOException {
" @Marker @SingleMember(0) Serializable," +
" Cloneable {\n" +
"}\n";
- String expectedUnitToString =
- "@Marker class A implements Comparable, @Marker @SingleMember(0) Serializable, Cloneable {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "@Marker class A implements Comparable, @Marker @SingleMember(0) Serializable, Cloneable {\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0004", expectedUnitToString);
}
@@ -340,11 +340,11 @@ public void test0005() throws IOException {
" @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
" Cloneable {\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Marker class A implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0005", expectedUnitToString);
}
@@ -353,11 +353,11 @@ public void test0006() throws IOException {
" @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
" @Marker Cloneable {\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Marker class A implements @Marker Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, @Marker Cloneable {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0006", expectedUnitToString);
}
@@ -366,11 +366,11 @@ public void test007() throws IOException {
" @Marker @SingleMember(10) @Normal(Value=0) Serializable," +
" Cloneable {\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Marker class A extends Object implements Comparable, @Marker @SingleMember(10) @Normal(Value = 0) Serializable, Cloneable {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0007", expectedUnitToString);
}
@@ -379,11 +379,11 @@ public void test0008() throws IOException {
" @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
" Cloneable {\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Marker class A extends @Marker Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0008", expectedUnitToString);
}
@@ -392,11 +392,11 @@ public void test0009() throws IOException {
" @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
" Cloneable {\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Marker class A extends @Marker @SingleMember(0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0009", expectedUnitToString);
}
@@ -405,11 +405,11 @@ public void test0010() throws IOException {
" @Marker @SingleMember(0) @Normal(Value=0) Serializable," +
" Cloneable {\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"@Marker class A extends @Marker @SingleMember(0) @Normal(Value = 0) Object implements Comparable, @Marker @SingleMember(0) @Normal(Value = 0) Serializable, Cloneable {\n" +
- " A() {\n" +
- " super();\n" +
- " }\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0010", expectedUnitToString);
}
@@ -419,14 +419,14 @@ public void test0011() throws IOException {
" @Marker String[] @Marker[][] s[] @SingleMember(0)[][] @Normal(Value = 0)[][];\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker String[] @Marker [][][] @SingleMember(0) [][] @Normal(Value = 0) [][] s;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker String[] @Marker [][][] @SingleMember(0) [][] @Normal(Value = 0) [][] s;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0011", expectedUnitToString);
}
@@ -440,18 +440,18 @@ public void test0012() throws IOException {
" s = new @Readonly String @NonNull[5] @Nullable[];\n" +
"}\n" +
"}\n";
- String expectedUnitToString =
- "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
- " int[][] f;\n" +
- " @English String[] @NonNull [][] @Nullable [][] s;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " @Readonly String @Nullable [] @NonNull [] s;\n" +
- " s = new @Readonly String @NonNull [5] @Nullable [];\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
+ " int[][] f;\n" +
+ " @English String[] @NonNull [][] @Nullable [][] s;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " @Readonly String @Nullable [] @NonNull [] s;\n" +
+ " s = new @Readonly String @NonNull [5] @Nullable [];\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0012", expectedUnitToString);
}
@@ -465,18 +465,18 @@ public void test0013() throws IOException {
" s = new @Readonly String @NonNull[] @Nullable[] { {\"Hello\"}, {\"World\"}} [0][0];\n" +
"}\n" +
"}\n";
- String expectedUnitToString =
- "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
- " int[][] f;\n" +
- " @English String[] @NonNull [][] @Nullable [][] s;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " @Readonly String s;\n" +
- " s = new @Readonly String @NonNull [] @Nullable []{{\"Hello\"}, {\"World\"}}[0][0];\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
+ " int[][] f;\n" +
+ " @English String[] @NonNull [][] @Nullable [][] s;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " @Readonly String s;\n" +
+ " s = new @Readonly String @NonNull [] @Nullable []{{\"Hello\"}, {\"World\"}}[0][0];\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0013", expectedUnitToString);
}
@@ -490,18 +490,18 @@ public void test0014() throws IOException {
" s = new @Readonly String @NonNull[5] @Nullable[];\n" +
"}\n" +
"}\n";
- String expectedUnitToString =
- "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
- " int[][] f;\n" +
- " @English String[] @NonNull [][] @Nullable [][] s;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
+ " int[][] f;\n" +
+ " @English String[] @NonNull [][] @Nullable [][] s;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
" public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) {\n" +
- " @Readonly String @Nullable [] @NonNull [] s;\n" +
- " s = new @Readonly String @NonNull [5] @Nullable [];\n" +
- " }\n" +
+ " @Readonly String @Nullable [] @NonNull [] s;\n" +
+ " s = new @Readonly String @NonNull [5] @Nullable [];\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0014", expectedUnitToString);
@@ -517,18 +517,18 @@ public void test0015() throws IOException {
"}\n" +
"@Marker public A () {}\n" +
"}\n";
- String expectedUnitToString =
- "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
- " int[][] f;\n" +
- " @English String[] @NonNull [][] @Nullable [][] s;\n" +
- " float[][] p;\n" +
- " public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) {\n" +
- " @Readonly String @Nullable [] @NonNull [] s;\n" +
- " s = new @Readonly String @NonNull [5] @Nullable [];\n" +
- " }\n" +
- " public @Marker A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
+ " int[][] f;\n" +
+ " @English String[] @NonNull [][] @Nullable [][] s;\n" +
+ " float[][] p;\n" +
+ " public static int[] @Marker [][] @Marker @SingleMember(0) @Normal(Value = 0) [][] main(String[] args) {\n" +
+ " @Readonly String @Nullable [] @NonNull [] s;\n" +
+ " s = new @Readonly String @NonNull [5] @Nullable [];\n" +
+ " }\n" +
+ " public @Marker A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0015", expectedUnitToString);
}
@@ -538,13 +538,13 @@ public void test0016() throws IOException {
"@Marker public int[] @Marker[][] main(int[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] {\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0016", expectedUnitToString);
}
@@ -553,13 +553,13 @@ public void test0017() throws IOException {
"@Marker public int[] @Marker[][] main(String[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] {\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][][] @Normal(Value = 10) [][] args) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0017", expectedUnitToString);
}
@@ -568,13 +568,13 @@ public void test0018() throws IOException {
"@Marker public int[] @Marker[][] main(HashMap<String, Object>[] @SingleMember(10)[][] args[] @Normal(Value = 10)[][])[] @Marker[][] {\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>[] @Normal(Value = 10) [][][] @SingleMember(10) [][] args) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>[] @Normal(Value = 10) [][][] @SingleMember(10) [][] args) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0018", expectedUnitToString);
}
@@ -583,13 +583,13 @@ public void test0019() throws IOException {
"@Marker public int[] @Marker [][] main(HashMap<String, Object>.Iterator[] @SingleMember(10) [][] args[] @Normal(Value = 10) [][])[] @Marker [][] {\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>.Iterator[] @Normal(Value = 10) [][][] @SingleMember(10) [][] args) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<String, Object>.Iterator[] @Normal(Value = 10) [][][] @SingleMember(10) [][] args) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0019", expectedUnitToString);
}
@@ -599,13 +599,13 @@ public void test0020() throws IOException {
"@Marker public int[] @Marker[][] main(int[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] {\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][] @Marker ... args) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @Marker [][][] @Marker [][] main(int[] @SingleMember(10) [][] @Marker ... args) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0020", expectedUnitToString);
}
@@ -614,13 +614,13 @@ public void test0021() throws IOException {
"@Marker public int[] @Marker[][] main(String[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] {\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][] @Marker ... args) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @Marker [][][] @Marker [][] main(String[] @SingleMember(10) [][] @Marker ... args) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0021", expectedUnitToString);
}
@@ -629,13 +629,13 @@ public void test0022() throws IOException {
"@Marker public int[] @Marker[][] main(HashMap<Integer,String>[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] {\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>[] @SingleMember(10) [][] @Marker ... args) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>[] @SingleMember(10) [][] @Marker ... args) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0022", expectedUnitToString);
}
@@ -644,13 +644,13 @@ public void test0023() throws IOException {
"@Marker public int[] @Marker[][] main(HashMap<Integer,String>.Iterator[] @SingleMember(10)[][] @Marker ... args )[] @Marker[][] {\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>.Iterator[] @SingleMember(10) [][] @Marker ... args) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @Marker [][][] @Marker [][] main(HashMap<Integer, String>.Iterator[] @SingleMember(10) [][] @Marker ... args) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0023", expectedUnitToString);
}
@@ -663,16 +663,16 @@ public void test0024() throws IOException {
" float[] p[];\n" +
"}\n" +
"}\n";
- String expectedUnitToString =
- "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " int[][] f;\n" +
- " @English String[] @NonNull [][] @Nullable [][] s;\n" +
- " float[][] p;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A implements @Readonly Comparable, @NonNull Serializable, Cloneable {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " int[][] f;\n" +
+ " @English String[] @NonNull [][] @Nullable [][] s;\n" +
+ " float[][] p;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0024", expectedUnitToString);
}
@@ -682,13 +682,13 @@ public void test0025() throws IOException {
"public <Integer, @Positive Integer, @Negative Integer, Integer> void foo() {\n" +
"}\n" +
"}\n";
- String expectedUnitToString =
- "class A {\n" +
- " A() {\n" +
- " super();\n" +
+ String expectedUnitToString =
+ "class A {\n" +
+ " A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public <Integer, @Positive Integer, @Negative Integer, Integer>void foo() {\n" +
" }\n" +
- " public <Integer, @Positive Integer, @Negative Integer, Integer>void foo() {\n" +
- " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0025", expectedUnitToString);
}
@@ -803,14 +803,14 @@ public void test0034() throws IOException {
" @Marker int k;\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker int k;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker int k;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0034", expectedUnitToString);
}
@@ -821,14 +821,14 @@ public void test0035() throws IOException {
" @Marker String k;\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker String k;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker String k;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0035", expectedUnitToString);
}
@@ -839,14 +839,14 @@ public void test0036() throws IOException {
" @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker HashMap<@Positive Integer, @Negative Integer> k;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0036", expectedUnitToString);
}
@@ -857,14 +857,14 @@ public void test0037() throws IOException {
" @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator k;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0037", expectedUnitToString);
}
@@ -875,14 +875,14 @@ public void test0038() throws IOException {
" @Marker int[] @NonEmpty[][] k;\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker int[] @NonEmpty [][] k;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker int[] @NonEmpty [][] k;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0038", expectedUnitToString);
}
@@ -893,14 +893,14 @@ public void test0039() throws IOException {
" @Marker String[] @NonEmpty[][]k;\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker String[] @NonEmpty [][] k;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker String[] @NonEmpty [][] k;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0039", expectedUnitToString);
}
@@ -911,14 +911,14 @@ public void test0040() throws IOException {
" @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty[][] k;\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] k;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] k;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0040", expectedUnitToString);
}
@@ -929,14 +929,14 @@ public void test0041() throws IOException {
" @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] k;\n" +
" float[] p[];\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " int[][] f;\n" +
- " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] k;\n" +
- " float[][] p;\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " int[][] f;\n" +
+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] k;\n" +
+ " float[][] p;\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0041", expectedUnitToString);
}
@@ -946,17 +946,17 @@ public void test0042() throws IOException {
" public @Marker int foo() { return 0; }\n" +
" public int bar() { return 0; }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int foo() {\n" +
- " return 0;\n" +
- " }\n" +
- " public int bar() {\n" +
- " return 0;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int foo() {\n" +
+ " return 0;\n" +
+ " }\n" +
+ " public int bar() {\n" +
+ " return 0;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0042", expectedUnitToString);
}
@@ -966,17 +966,17 @@ public void test0043() throws IOException {
" public @Marker String foo() { return null; }\n" +
" public String bar() { return null; }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker String foo() {\n" +
- " return null;\n" +
- " }\n" +
- " public String bar() {\n" +
- " return null;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker String foo() {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public String bar() {\n" +
+ " return null;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0043", expectedUnitToString);
}
@@ -986,17 +986,17 @@ public void test0044() throws IOException {
" public @Marker HashMap<@Positive Integer, @Negative Integer> foo() { return null; }\n" +
" public HashMap<@Positive Integer, @Negative Integer> bar() { return null; }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker HashMap<@Positive Integer, @Negative Integer> foo() {\n" +
- " return null;\n" +
- " }\n" +
- " public HashMap<@Positive Integer, @Negative Integer> bar() {\n" +
- " return null;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker HashMap<@Positive Integer, @Negative Integer> foo() {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public HashMap<@Positive Integer, @Negative Integer> bar() {\n" +
+ " return null;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0044", expectedUnitToString);
}
@@ -1006,17 +1006,17 @@ public void test0045() throws IOException {
" public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() { return null; }\n" +
" public HashMap<@Positive Integer, @Negative Integer>.Iterator bar() { return null; }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() {\n" +
- " return null;\n" +
- " }\n" +
- " public HashMap<@Positive Integer, @Negative Integer>.Iterator bar() {\n" +
- " return null;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator foo() {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public HashMap<@Positive Integer, @Negative Integer>.Iterator bar() {\n" +
+ " return null;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0045", expectedUnitToString);
}
@@ -1026,17 +1026,17 @@ public void test0046() throws IOException {
" public @Marker int[] foo() @NonEmpty[][] { return 0; }\n" +
" public int[] @NonEmpty[][] bar() { return 0; }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker int[] @NonEmpty [][] foo() {\n" +
- " return 0;\n" +
- " }\n" +
- " public int[] @NonEmpty [][] bar() {\n" +
- " return 0;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker int[] @NonEmpty [][] foo() {\n" +
+ " return 0;\n" +
+ " }\n" +
+ " public int[] @NonEmpty [][] bar() {\n" +
+ " return 0;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0046", expectedUnitToString);
}
@@ -1046,17 +1046,17 @@ public void test0047() throws IOException {
" public @Marker String[] foo() @NonEmpty[][] { return null; }\n" +
" public String[] @NonEmpty[][] bar() { return null; }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker String[] @NonEmpty [][] foo() {\n" +
- " return null;\n" +
- " }\n" +
- " public String[] @NonEmpty [][] bar() {\n" +
- " return null;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker String[] @NonEmpty [][] foo() {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public String[] @NonEmpty [][] bar() {\n" +
+ " return null;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0047", expectedUnitToString);
}
@@ -1066,17 +1066,17 @@ public void test0048() throws IOException {
" public @Marker HashMap<@Positive Integer, @Negative Integer>[] foo() @NonEmpty[][] { return null; }\n" +
" public HashMap<@Positive Integer, @Negative Integer> [] @NonEmpty[][] bar() { return null; }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker HashMap<@Positive Integer, @Negative Integer> @NonEmpty [][][] foo() {\n" +
- " return null;\n" +
- " }\n" +
- " public HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] bar() {\n" +
- " return null;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker HashMap<@Positive Integer, @Negative Integer> @NonEmpty [][][] foo() {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public HashMap<@Positive Integer, @Negative Integer>[] @NonEmpty [][] bar() {\n" +
+ " return null;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0048", expectedUnitToString);
}
@@ -1086,17 +1086,17 @@ public void test0049() throws IOException {
" public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] foo() @NonEmpty[][] { return null; }\n" +
" public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] bar() { return null; }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator @NonEmpty [][][] foo() {\n" +
- " return null;\n" +
- " }\n" +
- " public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] bar() {\n" +
- " return null;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator @NonEmpty [][][] foo() {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][] bar() {\n" +
+ " return null;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0049", expectedUnitToString);
}
@@ -1105,18 +1105,18 @@ public void test0050() throws IOException {
String source = "public class A {\n" +
" public void foo() {\n" +
" @Marker int p;\n" +
- " int q;\n" +
+ " int q;\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " @Marker int p;\n" +
- " int q;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " @Marker int p;\n" +
+ " int q;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0050", expectedUnitToString);
}
@@ -1125,18 +1125,18 @@ public void test0051() throws IOException {
String source = "public class A {\n" +
" public void foo() {\n" +
" @Marker String p;\n" +
- " String q;\n" +
+ " String q;\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " @Marker String p;\n" +
- " String q;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " @Marker String p;\n" +
+ " String q;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0051", expectedUnitToString);
}
@@ -1145,18 +1145,18 @@ public void test0052() throws IOException {
String source = "public class A {\n" +
" public void foo() {\n" +
" @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" +
- " HashMap<@Positive Integer, @Negative Integer> q;\n" +
+ " HashMap<@Positive Integer, @Negative Integer> q;\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" +
- " HashMap<@Positive Integer, @Negative Integer> q;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " @Marker HashMap<@Positive Integer, @Negative Integer> p;\n" +
+ " HashMap<@Positive Integer, @Negative Integer> q;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0052", expectedUnitToString);
}
@@ -1165,18 +1165,18 @@ public void test0053() throws IOException {
String source = "public class A {\n" +
" public void foo() {\n" +
" @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" +
- " HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" +
+ " HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" +
- " HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator p;\n" +
+ " HashMap<@Positive Integer, @Negative Integer>.Iterator q;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0053", expectedUnitToString);
}
@@ -1185,18 +1185,18 @@ public void test0054() throws IOException {
String source = "public class A {\n" +
" public void foo() {\n" +
" @Marker int[] @NonNull[] p @NonEmpty[][];\n" +
- " int[] @NonNull[] q @NonEmpty[][];\n" +
+ " int[] @NonNull[] q @NonEmpty[][];\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " @Marker int[] @NonNull [] @NonEmpty [][] p;\n" +
- " int[] @NonNull [] @NonEmpty [][] q;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " @Marker int[] @NonNull [] @NonEmpty [][] p;\n" +
+ " int[] @NonNull [] @NonEmpty [][] q;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0054", expectedUnitToString);
}
@@ -1205,18 +1205,18 @@ public void test0055() throws IOException {
String source = "public class A {\n" +
" public void foo() {\n" +
" @Marker String[] @NonNull[] p @NonEmpty[][];\n" +
- " String[] @NonNull[] q @NonEmpty[][];\n" +
+ " String[] @NonNull[] q @NonEmpty[][];\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " @Marker String[] @NonNull [] @NonEmpty [][] p;\n" +
- " String[] @NonNull [] @NonEmpty [][] q;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " @Marker String[] @NonNull [] @NonEmpty [][] p;\n" +
+ " String[] @NonNull [] @NonEmpty [][] q;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0055", expectedUnitToString);
}
@@ -1225,18 +1225,18 @@ public void test0056() throws IOException {
String source = "public class A {\n" +
" public void foo() {\n" +
" @Marker HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] p @NonEmpty[][];\n" +
- " HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] q @NonEmpty[][];\n" +
+ " HashMap<@Positive Integer, @Negative Integer>[] @NonNull[] q @NonEmpty[][];\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " @Marker HashMap<@Positive Integer, @Negative Integer> @NonEmpty [][][] @NonNull [] p;\n" +
- " HashMap<@Positive Integer, @Negative Integer> @NonEmpty [][][] @NonNull [] q;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " @Marker HashMap<@Positive Integer, @Negative Integer> @NonEmpty [][][] @NonNull [] p;\n" +
+ " HashMap<@Positive Integer, @Negative Integer> @NonEmpty [][][] @NonNull [] q;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0056", expectedUnitToString);
}
@@ -1245,18 +1245,18 @@ public void test0057() throws IOException {
String source = "public class A {\n" +
" public void foo() {\n" +
" @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] p @NonEmpty[][];\n" +
- " HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] @NonEmpty[][] q;\n" +
+ " HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull[] @NonEmpty[][] q;\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator @NonEmpty [][][] @NonNull [] p;\n" +
- " HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] q;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " @Marker HashMap<@Positive Integer, @Negative Integer>.Iterator @NonEmpty [][][] @NonNull [] p;\n" +
+ " HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonNull [] @NonEmpty [][] q;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0057", expectedUnitToString);
}
@@ -1269,20 +1269,20 @@ public void test0058() throws IOException {
" for (String @NonNull[] sii @Marker[] : s) {}\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " String @NonNull [] @Marker [] @Readonly [] s;\n" +
- " for (@Readonly String @NonNull [] @Marker [] si : s) \n" +
- " {\n" +
- " }\n" +
- " for (String @NonNull [] @Marker [] sii : s) \n" +
- " {\n" +
- " }\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " String @NonNull [] @Marker [] @Readonly [] s;\n" +
+ " for (@Readonly String @NonNull [] @Marker [] si : s) \n" +
+ " {\n" +
+ " }\n" +
+ " for (String @NonNull [] @Marker [] sii : s) \n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0058", expectedUnitToString);
}
@@ -1295,20 +1295,20 @@ public void test0059() throws IOException {
" for (int @NonNull[] sii @Marker[] : s) {}\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class A {\n" +
- " public A() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " int @NonNull [] @Marker [] @Readonly [] s;\n" +
- " for (@Readonly int @NonNull [] @Marker [] si : s) \n" +
- " {\n" +
- " }\n" +
- " for (int @NonNull [] @Marker [] sii : s) \n" +
- " {\n" +
- " }\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class A {\n" +
+ " public A() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " int @NonNull [] @Marker [] @Readonly [] s;\n" +
+ " for (@Readonly int @NonNull [] @Marker [] si : s) \n" +
+ " {\n" +
+ " }\n" +
+ " for (int @NonNull [] @Marker [] sii : s) \n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0059", expectedUnitToString);
}
@@ -1344,15 +1344,15 @@ public void test0060() throws IOException {
"(@Readonly int) 10;\n" +
"}\n" +
"}\n";
- String expectedUnitToString =
- "public class Clazz {\n" +
- " public Clazz() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " int x;\n" +
- " x = (Integer) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Normal(Value = 0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Marker [][]) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Normal(Value = 0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Marker [][]) (@Readonly Object) (@Readonly String[] @Normal(Value = 0) [][]) (@Readonly String[] @SingleMember(0) [][]) (@Readonly String[] @Marker [][]) (@Readonly Object) (@Readonly int[] @Normal(Value = 0) [][]) (@Readonly int[] @SingleMember(0) [][]) (@Readonly int[] @Marker [][]) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>) (@Readonly Object) (@ReadOnly String) (@Readonly Object) (@Readonly int) 10;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class Clazz {\n" +
+ " public Clazz() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " int x;\n" +
+ " x = (Integer) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Normal(Value = 0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @Marker [][]) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Normal(Value = 0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, @Negative Integer>[] @Marker [][]) (@Readonly Object) (@Readonly String[] @Normal(Value = 0) [][]) (@Readonly String[] @SingleMember(0) [][]) (@Readonly String[] @Marker [][]) (@Readonly Object) (@Readonly int[] @Normal(Value = 0) [][]) (@Readonly int[] @SingleMember(0) [][]) (@Readonly int[] @Marker [][]) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) (@Readonly Object) (@Readonly HashMap<@Positive Integer, @Negative Integer>) (@Readonly Object) (@ReadOnly String) (@Readonly Object) (@Readonly int) 10;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0060", expectedUnitToString);
}
@@ -1388,19 +1388,19 @@ public void test0061() throws IOException {
"(@Readonly int) 10;\n" +
"}\n" +
"}\n";
- String expectedUnitToString =
- "public class Clazz {\n" +
- " public Clazz() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " int x;\n" +
- " x = (Integer) (Object) (@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Normal(Value = 0) [][]) (HashMap<@Positive Integer, Integer>.Iterator[] @SingleMember(0) [][]) (@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Marker [][]) (Object) (@Readonly HashMap<@Positive Integer, Integer>[] @Normal(Value = 0) [][]) (HashMap<Integer, @Negative Integer>[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, Integer>[] @Marker [][]) (Object) (@Readonly String[] @Normal(Value = 0) [][]) (String[] @SingleMember(0) [][]) (@Readonly String[] @Marker [][]) (Object) (@Readonly int[] @Normal(Value = 0) [][]) (int[] @SingleMember(0) [][]) (@Readonly int[] @Marker [][]) (Object) (@Readonly HashMap<Integer, @Negative Integer>.Iterator) (Object) (@Readonly HashMap<@Positive Integer, Integer>) (Object) (@ReadOnly String) (Object) (@Readonly int) 10;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class Clazz {\n" +
+ " public Clazz() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " int x;\n" +
+ " x = (Integer) (Object) (@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Normal(Value = 0) [][]) (HashMap<@Positive Integer, Integer>.Iterator[] @SingleMember(0) [][]) (@Readonly HashMap<Integer, @Negative Integer>.Iterator[] @Marker [][]) (Object) (@Readonly HashMap<@Positive Integer, Integer>[] @Normal(Value = 0) [][]) (HashMap<Integer, @Negative Integer>[] @SingleMember(0) [][]) (@Readonly HashMap<@Positive Integer, Integer>[] @Marker [][]) (Object) (@Readonly String[] @Normal(Value = 0) [][]) (String[] @SingleMember(0) [][]) (@Readonly String[] @Marker [][]) (Object) (@Readonly int[] @Normal(Value = 0) [][]) (int[] @SingleMember(0) [][]) (@Readonly int[] @Marker [][]) (Object) (@Readonly HashMap<Integer, @Negative Integer>.Iterator) (Object) (@Readonly HashMap<@Positive Integer, Integer>) (Object) (@ReadOnly String) (Object) (@Readonly int) 10;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0061", expectedUnitToString);
}
-// instanceof checks
+// instanceof checks
public void test0062() throws IOException {
String source = "public class Clazz {\n" +
"public static void main(Object o) {\n" +
@@ -1408,58 +1408,58 @@ public void test0062() throws IOException {
"} else if (o instanceof @Readonly int[] @NonEmpty[][] ) {\n" +
"} else if (o instanceof @Readonly String[] @NonEmpty[][] ) {\n" +
"} else if (o instanceof @Readonly HashMap<?,?>[] @NonEmpty[][] ) {\n" +
- "} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] ) {\n" +
+ "} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty[][] ) {\n" +
"} else if (o instanceof @Readonly HashMap<?,?>) {\n" +
"} else if (o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator) {\n" +
"}\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class Clazz {\n" +
- " public Clazz() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(Object o) {\n" +
- " if ((o instanceof @Readonly String))\n" +
- " {\n" +
- " }\n" +
- " else\n" +
- " if ((o instanceof @Readonly int[] @NonEmpty [][]))\n" +
- " {\n" +
- " }\n" +
- " else\n" +
- " if ((o instanceof @Readonly String[] @NonEmpty [][]))\n" +
- " {\n" +
- " }\n" +
- " else\n" +
- " if ((o instanceof @Readonly HashMap<?, ?>[] @NonEmpty [][]))\n" +
- " {\n" +
- " }\n" +
- " else\n" +
- " if ((o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][]))\n" +
- " {\n" +
- " }\n" +
- " else\n" +
- " if ((o instanceof @Readonly HashMap<?, ?>))\n" +
- " {\n" +
- " }\n" +
- " else\n" +
- " if ((o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator))\n" +
- " {\n" +
- " }\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class Clazz {\n" +
+ " public Clazz() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(Object o) {\n" +
+ " if ((o instanceof @Readonly String))\n" +
+ " {\n" +
+ " }\n" +
+ " else\n" +
+ " if ((o instanceof @Readonly int[] @NonEmpty [][]))\n" +
+ " {\n" +
+ " }\n" +
+ " else\n" +
+ " if ((o instanceof @Readonly String[] @NonEmpty [][]))\n" +
+ " {\n" +
+ " }\n" +
+ " else\n" +
+ " if ((o instanceof @Readonly HashMap<?, ?>[] @NonEmpty [][]))\n" +
+ " {\n" +
+ " }\n" +
+ " else\n" +
+ " if ((o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator[] @NonEmpty [][]))\n" +
+ " {\n" +
+ " }\n" +
+ " else\n" +
+ " if ((o instanceof @Readonly HashMap<?, ?>))\n" +
+ " {\n" +
+ " }\n" +
+ " else\n" +
+ " if ((o instanceof @Readonly HashMap<@Positive Integer, @Negative Integer>.Iterator))\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0062", expectedUnitToString);
}
-// assorted unclassified
+// assorted unclassified
public void test0063() throws IOException {
String source = "import java.util.HashMap;\n" +
- "import java.util.Map; \n" +
+ "import java.util.Map; \n" +
"\n" +
"public class Clazz <@A M extends @B String, @C N extends @D Comparable> extends\n" +
" @E Object implements @F Comparable <@G Object> {\n" +
" \n" +
- " Clazz(char[] ...args) { \n" +
+ " Clazz(char[] ...args) { \n" +
" }\n" +
" \n" +
" int @I[] f @J[], g, h[], i@K[];\n" +
@@ -1501,68 +1501,68 @@ public void test0063() throws IOException {
" return null;\n" +
" }\n" +
"}\n";
-
-
- String expectedUnitToString = "import java.util.HashMap;\n" +
- "import java.util.Map;\n" +
- "public class Clazz<@A M extends @B String, @C N extends @D Comparable> extends @E Object implements @F Comparable<@G Object> {\n" +
- " int @I [] @J [] f;\n" +
- " int @I [] g;\n" +
- " int @I [][] h;\n" +
- " int @I [] @K [] i;\n" +
- " int @L [][] @M [] f2;\n" +
- " Clazz(char[]... args) {\n" +
- " super();\n" +
- " }\n" +
- " Clazz(int @N [] @O ... a) {\n" +
- " super();\n" +
- " }\n" +
- " int @R [] @S [] aa() {\n" +
- " }\n" +
- " int @T [] @U [] @V [] @W [] @X [] @Y [] a() {\n" +
- " return null;\n" +
- " }\n" +
- " public void main(String @A [] @B ... args) throws @D Exception {\n" +
- " HashMap<@E String, @F String> b1;\n" +
+
+
+ String expectedUnitToString = "import java.util.HashMap;\n" +
+ "import java.util.Map;\n" +
+ "public class Clazz<@A M extends @B String, @C N extends @D Comparable> extends @E Object implements @F Comparable<@G Object> {\n" +
+ " int @I [] @J [] f;\n" +
+ " int @I [] g;\n" +
+ " int @I [][] h;\n" +
+ " int @I [] @K [] i;\n" +
+ " int @L [][] @M [] f2;\n" +
+ " Clazz(char[]... args) {\n" +
+ " super();\n" +
+ " }\n" +
+ " Clazz(int @N [] @O ... a) {\n" +
+ " super();\n" +
+ " }\n" +
+ " int @R [] @S [] aa() {\n" +
+ " }\n" +
+ " int @T [] @U [] @V [] @W [] @X [] @Y [] a() {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public void main(String @A [] @B ... args) throws @D Exception {\n" +
+ " HashMap<@E String, @F String> b1;\n" +
" int b;\n" +
- " b = (@G int) 10;\n" +
+ " b = (@G int) 10;\n" +
" char @H [] @I [] ch;\n" +
- " ch = (@K char @L [] @M []) (@N char @O [] @P []) null;\n" +
+ " ch = (@K char @L [] @M []) (@N char @O [] @P []) null;\n" +
" int[] i;\n" +
- " i = new @Q int @R [10];\n" +
+ " i = new @Q int @R [10];\n" +
" Integer w;\n" +
- " w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" +
- " throw new @V Exception(\"test\");\n" +
+ " w = new X<@S String, @T Integer>().get(new @U Integer(12));\n" +
+ " throw new @V Exception(\"test\");\n" +
" boolean c;\n" +
- " c = (null instanceof @W String);\n" +
- " }\n" +
- " public <@X X, @Y Y>void foo(X x, Y @Z ... y) {\n" +
- " }\n" +
- " void foo(Map<? super @A Object, ? extends @B String> m) {\n" +
- " }\n" +
- " public int compareTo(Object arg0) {\n" +
- " return 0;\n" +
- " }\n" +
- "}\n" +
- "class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " public Integer get(Integer integer) {\n" +
- " return null;\n" +
- " }\n" +
+ " c = (null instanceof @W String);\n" +
+ " }\n" +
+ " public <@X X, @Y Y>void foo(X x, Y @Z ... y) {\n" +
+ " }\n" +
+ " void foo(Map<? super @A Object, ? extends @B String> m) {\n" +
+ " }\n" +
+ " public int compareTo(Object arg0) {\n" +
+ " return 0;\n" +
+ " }\n" +
+ "}\n" +
+ "class X<@C K, @D T extends @E Object & @F Comparable<? super @G T>> {\n" +
+ " X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public Integer get(Integer integer) {\n" +
+ " return null;\n" +
+ " }\n" +
"}\n";
// indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly.
// this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long)
checkParse(CHECK_ALL & ~CHECK_INDEXING_PARSER & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0063", expectedUnitToString);
}
-//assorted unclassified
+//assorted unclassified
public void test0064() throws IOException {
String source = "class X<T extends @E Object & @F Comparable<? super T>> {}\n";
- String expectedUnitToString = "class X<T extends @E Object & @F Comparable<? super T>> {\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString = "class X<T extends @E Object & @F Comparable<? super T>> {\n" +
+ " X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
// indexing parser avoids creating lots of nodes, so parse tree comes out incorrectly.
// this is not bug, but intended behavior - see IndexingParser.newSingleNameReference(char[], long)
@@ -1570,50 +1570,50 @@ public void test0064() throws IOException {
}
//type class literal expression
public void test0066() throws IOException {
- String source = "public class X {\n" +
- " <T extends Y<@A String @C[][]@B[]> & Cloneable> void foo(T t) {}\n" +
+ String source = "public class X {\n" +
+ " <T extends Y<@A String @C[][]@B[]> & Cloneable> void foo(T t) {}\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " <T extends Y<@A String @C [][] @B []> & Cloneable>void foo(T t) {\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " <T extends Y<@A String @C [][] @B []> & Cloneable>void foo(T t) {\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0066", expectedUnitToString);
}
//check locations
public void test0067() throws IOException {
- String source =
- "public class X {\n" +
- " @H String @E[] @F[] @G[] field;\n" +
- " @A Map<@B String, @C List<@D Object>> field2;\n" +
- " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" +
+ String source =
+ "public class X {\n" +
+ " @H String @E[] @F[] @G[] field;\n" +
+ " @A Map<@B String, @C List<@D Object>> field2;\n" +
+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @H String @E [] @F [] @G [] field;\n" +
- " @A Map<@B String, @C List<@D Object>> field2;\n" +
- " @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @H String @E [] @F [] @G [] field;\n" +
+ " @A Map<@B String, @C List<@D Object>> field2;\n" +
+ " @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0067", expectedUnitToString);
}
//check locations
public void test0068() throws IOException {
- String source =
- "public class X {\n" +
- " @H String @E[] @F[] @G[] field;\n" +
+ String source =
+ "public class X {\n" +
+ " @H String @E[] @F[] @G[] field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @H String @E [] @F [] @G [] field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @H String @E [] @F [] @G [] field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0068", expectedUnitToString, visitor);
@@ -1626,16 +1626,16 @@ public void test0068() throws IOException {
}
//check locations
public void test0069() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@B String, @H String> field3;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@B String, @H String> field3;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@B String, @H String> field3;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@B String, @H String> field3;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0069", expectedUnitToString, visitor);
@@ -1647,16 +1647,16 @@ public void test0069() throws IOException {
}
//check locations
public void test0070() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@B String, @H String @E[] @F[] @G[]> field3;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@B String, @H String @E [] @F [] @G []> field3;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0070", expectedUnitToString, visitor);
@@ -1671,16 +1671,16 @@ public void test0070() throws IOException {
}
//check locations
public void test0071() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@B String, @C List<@H String @E[][] @G[]>> field;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@B String, @C List<@H String @E[][] @G[]>> field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@B String, @C List<@H String @E [][] @G []>> field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@B String, @C List<@H String @E [][] @G []>> field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0071", expectedUnitToString, visitor);
@@ -1695,16 +1695,16 @@ public void test0071() throws IOException {
}
//check locations
public void test0072() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@B String, @C List<@H String @E[][] @G[]>>[] @I[] @J[] field;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@B String, @C List<@H String @E[][] @G[]>>[] @I[] @J[] field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@B String, @C List<@H String @E [][] @G []>>[] @I [] @J [] field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@B String, @C List<@H String @E [][] @G []>>[] @I [] @J [] field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0072", expectedUnitToString, visitor);
@@ -1721,16 +1721,16 @@ public void test0072() throws IOException {
}
//check locations
public void test0073() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@B String, @C List<@H String @E[][] @G[]>> @I[][] @J[] field;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@B String, @C List<@H String @E[][] @G[]>> @I[][] @J[] field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@B String, @C List<@H String @E [][] @G []>> @I [][] @J [] field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@B String, @C List<@H String @E [][] @G []>> @I [][] @J [] field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0073", expectedUnitToString, visitor);
@@ -1747,16 +1747,16 @@ public void test0073() throws IOException {
}
//check locations
public void test0074() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@C List<@H String @E[][] @G[]>, String @B[] @D[]> @I[] @F[] @J[] field;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@C List<@H String @E[][] @G[]>, String @B[] @D[]> @I[] @F[] @J[] field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@C List<@H String @E [][] @G []>, String @B [] @D []> @I [] @F [] @J [] field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@C List<@H String @E [][] @G []>, String @B [] @D []> @I [] @F [] @J [] field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0074", expectedUnitToString, visitor);
@@ -1775,16 +1775,16 @@ public void test0074() throws IOException {
}
//check locations
public void test0075() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@C List<@H String @E[][] @G[]>, @B List<String [] @D[]>> [] @I[] @F[] @J[] field;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@C List<@H String @E[][] @G[]>, @B List<String [] @D[]>> [] @I[] @F[] @J[] field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@C List<@H String @E [][] @G []>, @B List<String[] @D []>>[] @I [] @F [] @J [] field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@C List<@H String @E [][] @G []>, @B List<String[] @D []>>[] @I [] @F [] @J [] field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0075", expectedUnitToString, visitor);
@@ -1803,16 +1803,16 @@ public void test0075() throws IOException {
}
//check locations
public void test0076() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@B String, @C List<@D Object>> field;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@B String, @C List<@D Object>> field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@B String, @C List<@D Object>> field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@B String, @C List<@D Object>> field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0076", expectedUnitToString, visitor);
@@ -1825,16 +1825,16 @@ public void test0076() throws IOException {
}
//check locations
public void test0077() throws IOException {
- String source =
- "public class X {\n" +
- " @H String @E[] @F[] @G[] field;\n" +
+ String source =
+ "public class X {\n" +
+ " @H String @E[] @F[] @G[] field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @H String @E [] @F [] @G [] field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @H String @E [] @F [] @G [] field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0077", expectedUnitToString, visitor);
@@ -1847,16 +1847,16 @@ public void test0077() throws IOException {
}
//check locations
public void test0078() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0078", expectedUnitToString, visitor);
@@ -1873,16 +1873,16 @@ public void test0078() throws IOException {
}
//check locations
public void test0079() throws IOException {
- String source =
- "public class X {\n" +
- " @A java.util.Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" +
+ String source =
+ "public class X {\n" +
+ " @A java.util.Map<@B Comparable<@C Object @D[] @E[] @F[]>, @G List<@H Document>> field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A java.util.Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A java.util.Map<@B Comparable<@C Object @D [] @E [] @F []>, @G List<@H Document>> field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0079", expectedUnitToString, visitor);
@@ -1899,16 +1899,16 @@ public void test0079() throws IOException {
}
//check locations
public void test0080() throws IOException {
- String source =
- "public class X {\n" +
- " @B Map<? extends Z, ? extends @A Z> field;\n" +
+ String source =
+ "public class X {\n" +
+ " @B Map<? extends Z, ? extends @A Z> field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @B Map<? extends Z, ? extends @A Z> field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @B Map<? extends Z, ? extends @A Z> field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0080", expectedUnitToString, visitor);
@@ -1919,16 +1919,16 @@ public void test0080() throws IOException {
}
//check locations
public void test0081() throws IOException {
- String source =
- "public class X {\n" +
- " @H java.lang.String @E[] @F[] @G[] field;\n" +
+ String source =
+ "public class X {\n" +
+ " @H java.lang.String @E[] @F[] @G[] field;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @H java.lang.String @E [] @F [] @G [] field;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @H java.lang.String @E [] @F [] @G [] field;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0081", expectedUnitToString, visitor);
@@ -1941,16 +1941,16 @@ public void test0081() throws IOException {
}
//check locations
public void test0082() throws IOException {
- String source =
- "public class X {\n" +
- " @A Map<@B java.lang.String, @H java.lang.String @E[] @F[] @G[]> field3;\n" +
+ String source =
+ "public class X {\n" +
+ " @A Map<@B java.lang.String, @H java.lang.String @E[] @F[] @G[]> field3;\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " @A Map<@B java.lang.String, @H java.lang.String @E [] @F [] @G []> field3;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " @A Map<@B java.lang.String, @H java.lang.String @E [] @F [] @G []> field3;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
LocationPrinterVisitor visitor = new LocationPrinterVisitor();
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0082", expectedUnitToString, visitor);
@@ -3415,10 +3415,10 @@ public void test0125() throws IOException {
String source =
"public class X extends @A(\"Hello, World!\") Y<@B @C('(') String[] @D[]> {}";
String expectedUnitToString =
- "public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ "public class X extends @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0125", expectedUnitToString );
}
@@ -3429,11 +3429,11 @@ public void test0126() throws IOException {
" @A(\"Hello, World!\") @B @C('(') String@E[] @D[] f;\n" +
"}";
String expectedUnitToString =
- "public class X {\n" +
- " @A(\"Hello, World!\") @B @C(\'(\') String @E [] @D [] f;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ "public class X {\n" +
+ " @A(\"Hello, World!\") @B @C(\'(\') String @E [] @D [] f;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0126", expectedUnitToString );
}
@@ -3444,52 +3444,52 @@ public void test0127() throws IOException {
" @A(\"Hello, World!\") Y<@B @C('(') String[] @D[]> f;\n" +
"}";
String expectedUnitToString =
- "public class X {\n" +
- " @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> f;\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
+ "public class X {\n" +
+ " @A(\"Hello, World!\") Y<@B @C(\'(\') String[] @D []> f;\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0127", expectedUnitToString );
}
//type class literal expression
public void test0128() throws IOException {
- String source =
- "public class X {\n" +
- " public boolean foo(String s) {\n" +
- " return (s instanceof @C('_') Object[]);\n" +
- " }\n" +
- " public Object foo1(String s) {\n" +
- " return new @B(3) @A(\"new Object\") Object[] {};\n" +
- " }\n" +
- " public Class foo2(String s) {\n" +
- " return null;\n" +
- " }\n" +
- " public Class foo3(String s) {\n" +
- " return null;\n" +
- " }\n" +
+ String source =
+ "public class X {\n" +
+ " public boolean foo(String s) {\n" +
+ " return (s instanceof @C('_') Object[]);\n" +
+ " }\n" +
+ " public Object foo1(String s) {\n" +
+ " return new @B(3) @A(\"new Object\") Object[] {};\n" +
+ " }\n" +
+ " public Class foo2(String s) {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public Class foo3(String s) {\n" +
+ " return null;\n" +
+ " }\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public boolean foo(String s) {\n" +
- " return (s instanceof @C(\'_\') Object[]);\n" +
- " }\n" +
- " public Object foo1(String s) {\n" +
- " return new @B(3) @A(\"new Object\") Object[]{};\n" +
- " }\n" +
- " public Class foo2(String s) {\n" +
- " return null;\n" +
- " }\n" +
- " public Class foo3(String s) {\n" +
- " return null;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public boolean foo(String s) {\n" +
+ " return (s instanceof @C(\'_\') Object[]);\n" +
+ " }\n" +
+ " public Object foo1(String s) {\n" +
+ " return new @B(3) @A(\"new Object\") Object[]{};\n" +
+ " }\n" +
+ " public Class foo2(String s) {\n" +
+ " return null;\n" +
+ " }\n" +
+ " public Class foo3(String s) {\n" +
+ " return null;\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0128", expectedUnitToString );
}
-//instanceof checks
+//instanceof checks
public void test0129() throws IOException {
String source = "public class Clazz {\n" +
"public static void main(Object o) {\n" +
@@ -3497,92 +3497,92 @@ public void test0129() throws IOException {
"}\n" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class Clazz {\n" +
- " public Clazz() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(Object o) {\n" +
- " if ((o instanceof @Readonly String))\n" +
- " {\n" +
- " }\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class Clazz {\n" +
+ " public Clazz() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(Object o) {\n" +
+ " if ((o instanceof @Readonly String))\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0129", expectedUnitToString);
}
-//instanceof checks
+//instanceof checks
public void test0130() throws IOException {
String source = "public class Clazz {\n" +
"public static void foo() {\n" +
" if (o instanceof @Readonly String[]) {}" +
"}\n" +
"}";
- String expectedUnitToString =
- "public class Clazz {\n" +
- " public Clazz() {\n" +
- " super();\n" +
- " }\n" +
- " public static void foo() {\n" +
- " if ((o instanceof @Readonly String[]))\n" +
- " {\n" +
- " }\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class Clazz {\n" +
+ " public Clazz() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void foo() {\n" +
+ " if ((o instanceof @Readonly String[]))\n" +
+ " {\n" +
+ " }\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_ALL & ~CHECK_JAVAC_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
}
//cast
public void test0131() throws IOException {
String source =
- "public class X {\n" +
- " public void foo(Object o) {\n" +
+ "public class X {\n" +
+ " public void foo(Object o) {\n" +
" if (o instanceof String[][]) {\n" +
" String[][] tab = (@C('_') @B(3) String[] @A[]) o;\n" +
" System.out.println(tab.length);\n" +
- " }\n" +
+ " }\n" +
" System.out.println(o);\n" +
- " }\n" +
+ " }\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(Object o) {\n" +
- " if ((o instanceof String[][]))\n" +
- " {\n" +
- " String[][] tab = (@C(\'_\') @B(3) String[] @A []) o;\n" +
- " System.out.println(tab.length);\n" +
- " }\n" +
- " System.out.println(o);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(Object o) {\n" +
+ " if ((o instanceof String[][]))\n" +
+ " {\n" +
+ " String[][] tab = (@C(\'_\') @B(3) String[] @A []) o;\n" +
+ " System.out.println(tab.length);\n" +
+ " }\n" +
+ " System.out.println(o);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
}
//cast
public void test0132() throws IOException {
String source =
- "public class X {\n" +
- " public void foo(Object o) {\n" +
+ "public class X {\n" +
+ " public void foo(Object o) {\n" +
" if (o instanceof String[][]) {\n" +
" String[][] tab = (@C('_') @B(3) String@D[] @A[]) o;\n" +
" System.out.println(tab.length);\n" +
- " }\n" +
+ " }\n" +
" System.out.println(o);\n" +
- " }\n" +
+ " }\n" +
"}";
- String expectedUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo(Object o) {\n" +
- " if ((o instanceof String[][]))\n" +
- " {\n" +
- " String[][] tab = (@C(\'_\') @B(3) String @D [] @A []) o;\n" +
- " System.out.println(tab.length);\n" +
- " }\n" +
- " System.out.println(o);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo(Object o) {\n" +
+ " if ((o instanceof String[][]))\n" +
+ " {\n" +
+ " String[][] tab = (@C(\'_\') @B(3) String @D [] @A []) o;\n" +
+ " System.out.println(tab.length);\n" +
+ " }\n" +
+ " System.out.println(o);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
}
@@ -3597,17 +3597,17 @@ public void test0133() throws IOException {
" System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " static <T, U>T foo(T t, U u) {\n" +
- " return t;\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " static <T, U>T foo(T t, U u) {\n" +
+ " return t;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(X.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
}
@@ -3624,18 +3624,18 @@ public void test0134() throws IOException {
" System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " <T, U>T foo(T t, U u) {\n" +
- " return t;\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " <T, U>T foo(T t, U u) {\n" +
+ " return t;\n" +
+ " }\n" +
" public static void main(String[] args) {\n" +
" X x = new X();\n" +
- " System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
- " }\n" +
+ " System.out.println(x.<@D() @A(value = \"hello\") String, @B X>foo(\"SUCCESS\", null));\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
}
@@ -3650,15 +3650,15 @@ public void test0135() throws IOException {
" System.out.println(x);\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class X {\n" +
- " <T, U>X(T t, U u) {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " X x = new <@D() @A(value = \"hello\") String, @B X>X();\n" +
- " System.out.println(x);\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X {\n" +
+ " <T, U>X(T t, U u) {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " X x = new <@D() @A(value = \"hello\") String, @B X>X();\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
}
@@ -3678,33 +3678,33 @@ public void test0136() throws IOException {
" new X<String>().new Y<Integer>().new Z();\n" +
" }\n" +
"}\n";
- String expectedUnitToString =
- "public class X<T> {\n" +
- " public class Y<K> {\n" +
- " public class Z {\n" +
- " Z(@D() @A(value = \"hello\") X<T>.Y<K> X.Y.this) {\n" +
- " super();\n" +
- " }\n" +
- " }\n" +
- " public Y() {\n" +
- " super();\n" +
- " }\n" +
- " void foo(@Marker X<T> this) {\n" +
- " }\n" +
- " }\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " new X<String>().new Y<Integer>().new Z();\n" +
- " }\n" +
+ String expectedUnitToString =
+ "public class X<T> {\n" +
+ " public class Y<K> {\n" +
+ " public class Z {\n" +
+ " Z(@D() @A(value = \"hello\") X<T>.Y<K> X.Y.this) {\n" +
+ " super();\n" +
+ " }\n" +
+ " }\n" +
+ " public Y() {\n" +
+ " super();\n" +
+ " }\n" +
+ " void foo(@Marker X<T> this) {\n" +
+ " }\n" +
+ " }\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " new X<String>().new Y<Integer>().new Z();\n" +
+ " }\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0130", expectedUnitToString);
}
// Support type annotations for wildcard
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=388085
public void test0137() throws IOException {
- String source =
+ String source =
"class X {\n" +
" public void main(Four<@Marker ? super String, @Marker ? extends Object> param) {\n" +
" One<@Marker ? extends Two<@Marker ? extends Three<@Marker ? extends Four<@Marker ? super String,@Marker ? extends Object>>>> one = null;\n" +
@@ -3718,44 +3718,44 @@ public void test0137() throws IOException {
"class Three<T> {}\n" +
"class Four<U, V> {}\n" +
"@interface Marker {}";
- String expectedUnitToString =
- "class X {\n" +
- " X() {\n" +
- " super();\n" +
- " }\n" +
- " public void main(Four<@Marker ? super String, @Marker ? extends Object> param) {\n" +
- " One<@Marker ? extends Two<@Marker ? extends Three<@Marker ? extends Four<@Marker ? super String, @Marker ? extends Object>>>> one = null;\n" +
- " Two<@Marker ? extends Three<@Marker ? extends Four<@Marker ? super String, @Marker ? extends Object>>> two = null;\n" +
- " Three<@Marker ? extends Four<@Marker ? super String, @Marker ? extends Object>> three = null;\n" +
- " Four<@Marker ? super String, @Marker ? extends Object> four = param;\n" +
- " }\n" +
- "}\n" +
- "class One<R> {\n" +
- " One() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "class Two<S> {\n" +
- " Two() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "class Three<T> {\n" +
- " Three() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "class Four<U, V> {\n" +
- " Four() {\n" +
- " super();\n" +
- " }\n" +
- "}\n" +
- "@interface Marker {\n" +
+ String expectedUnitToString =
+ "class X {\n" +
+ " X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void main(Four<@Marker ? super String, @Marker ? extends Object> param) {\n" +
+ " One<@Marker ? extends Two<@Marker ? extends Three<@Marker ? extends Four<@Marker ? super String, @Marker ? extends Object>>>> one = null;\n" +
+ " Two<@Marker ? extends Three<@Marker ? extends Four<@Marker ? super String, @Marker ? extends Object>>> two = null;\n" +
+ " Three<@Marker ? extends Four<@Marker ? super String, @Marker ? extends Object>> three = null;\n" +
+ " Four<@Marker ? super String, @Marker ? extends Object> four = param;\n" +
+ " }\n" +
+ "}\n" +
+ "class One<R> {\n" +
+ " One() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "class Two<S> {\n" +
+ " Two() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "class Three<T> {\n" +
+ " Three() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "class Four<U, V> {\n" +
+ " Four() {\n" +
+ " super();\n" +
+ " }\n" +
+ "}\n" +
+ "@interface Marker {\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0137", expectedUnitToString);
}
public void test0138() throws IOException {
- String source =
+ String source =
"import java.lang.annotation.Target;\n" +
"import static java.lang.annotation.ElementType.*;\n" +
"public class X {\n" +
@@ -3767,41 +3767,41 @@ public void test0138() throws IOException {
" return 2;\n" +
" }\n" +
" public static int bar2(int k) {\n" +
- " return k;\n" +
+ " return k;\n" +
" }\n" +
"}\n" +
"@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
"@interface Marker {}\n" +
"@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
"@interface Marker2 {}\n";
- String expectedUnitToString =
- "import java.lang.annotation.Target;\n" +
- "import static java.lang.annotation.ElementType.*;\n" +
- "public class X {\n" +
- " public X() {\n" +
- " super();\n" +
- " }\n" +
- " public void foo() {\n" +
- " int @Marker [][][] i = new @Marker2 int @Marker @Marker2 [2] @Marker @Marker2 [bar()] @Marker @Marker2 [];\n" +
- " int @Marker [][][] j = new @Marker2 int @Marker @Marker2 [2] @Marker @Marker2 [X.bar2(2)] @Marker @Marker2 [];\n" +
- " }\n" +
- " public int bar() {\n" +
- " return 2;\n" +
- " }\n" +
- " public static int bar2(int k) {\n" +
- " return k;\n" +
- " }\n" +
- "}\n" +
- "@Target(java.lang.annotation.ElementType.TYPE_USE) @interface Marker {\n" +
- "}\n" +
- "@Target(java.lang.annotation.ElementType.TYPE_USE) @interface Marker2 {\n" +
+ String expectedUnitToString =
+ "import java.lang.annotation.Target;\n" +
+ "import static java.lang.annotation.ElementType.*;\n" +
+ "public class X {\n" +
+ " public X() {\n" +
+ " super();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " int @Marker [][][] i = new @Marker2 int @Marker @Marker2 [2] @Marker @Marker2 [bar()] @Marker @Marker2 [];\n" +
+ " int @Marker [][][] j = new @Marker2 int @Marker @Marker2 [2] @Marker @Marker2 [X.bar2(2)] @Marker @Marker2 [];\n" +
+ " }\n" +
+ " public int bar() {\n" +
+ " return 2;\n" +
+ " }\n" +
+ " public static int bar2(int k) {\n" +
+ " return k;\n" +
+ " }\n" +
+ "}\n" +
+ "@Target(java.lang.annotation.ElementType.TYPE_USE) @interface Marker {\n" +
+ "}\n" +
+ "@Target(java.lang.annotation.ElementType.TYPE_USE) @interface Marker2 {\n" +
"}\n";
checkParse(CHECK_PARSER, source.toCharArray(), null, "test0137", expectedUnitToString);
}
// Support for annotations on ellipsis in lambda expression
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=432574
public void test0139() throws IOException {
- String source =
+ String source =
"import java.lang.annotation.ElementType;\n" +
"import java.lang.annotation.Target;\n" +
"public class X {\n" +
@@ -3813,7 +3813,7 @@ public void test0139() throws IOException {
"@Target(ElementType.TYPE_USE)\n" +
"@interface T1 {\n" +
"}\n";
- String expectedUnitToString =
+ String expectedUnitToString =
"import java.lang.annotation.ElementType;\n" +
"import java.lang.annotation.Target;\n" +
"public class X {\n" +

Back to the top