diff options
author | Stephan Herrmann | 2010-04-01 21:40:57 +0000 |
---|---|---|
committer | Stephan Herrmann | 2010-04-01 21:40:57 +0000 |
commit | 5ed21e440e8c273ccf2ab4b282dce60f86b214ad (patch) | |
tree | 5fe2174dcfdf41c299a781d1b145d877a3bd2533 /org.eclipse.jdt.core.tests.compiler | |
parent | 46f28fa4a15702c65d55ee5d74eb42a26cb0c806 (diff) | |
download | org.eclipse.objectteams-5ed21e440e8c273ccf2ab4b282dce60f86b214ad.tar.gz org.eclipse.objectteams-5ed21e440e8c273ccf2ab4b282dce60f86b214ad.tar.xz org.eclipse.objectteams-5ed21e440e8c273ccf2ab4b282dce60f86b214ad.zip |
initial commit in accordance with CQ 3784
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler')
191 files changed, 353825 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/.classpath b/org.eclipse.jdt.core.tests.compiler/.classpath new file mode 100644 index 000000000..b7464f3ca --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.eclipse.jdt.core.tests.compiler/.cvsignore b/org.eclipse.jdt.core.tests.compiler/.cvsignore new file mode 100644 index 000000000..c5e82d745 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/.cvsignore @@ -0,0 +1 @@ +bin
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.compiler/.project b/org.eclipse.jdt.core.tests.compiler/.project new file mode 100644 index 000000000..bce5dfc9c --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/.project @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.jdt.core.tests.compiler</name> + <comment></comment> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + </natures> +</projectDescription> diff --git a/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..1dc542fc2 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,98 @@ +#Tue Oct 27 09:15:25 EDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning +org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/org.eclipse.jdt.core.tests.compiler/CompilerInvocationTests (manual).launch b/org.eclipse.jdt.core.tests.compiler/CompilerInvocationTests (manual).launch new file mode 100644 index 000000000..e00d167cc --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/CompilerInvocationTests (manual).launch @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig"> +<booleanAttribute key="append.args" value="true"/> +<booleanAttribute key="askclear" value="false"/> +<booleanAttribute key="automaticAdd" value="true"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="[NONE]"/> +<booleanAttribute key="clearConfig" value="true"/> +<booleanAttribute key="clearws" value="true"/> +<booleanAttribute key="clearwslog" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/CompilerInvocationTests (manual)"/> +<booleanAttribute key="default" value="true"/> +<booleanAttribute key="includeOptional" value="true"/> +<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> +<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> +<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> +<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/> +<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-openjdk"/> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.jdt.core.tests.compiler.regression.CompilerInvocationTests"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jdt.core.tests.compiler"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx768m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dosgi.support.class.certificate=false -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dot.dump=1 -Dot.log=1 -Dotequinox.log=OK -Dosgi.hook.configurators.include=org.eclipse.objectteams.otequinox.hook.HookConfigurator -Dosgi.framework.extensions=org.eclipse.objectteams.otequinox.hook,org.eclipse.objectteams.otequinox.runtime -Dot.equinox=1"/> +<booleanAttribute key="org.objectteams.launch" value="false"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="product" value="org.eclipse.sdk.ide"/> +<booleanAttribute key="run_in_ui_thread" value="true"/> +<booleanAttribute key="show_selected_only" value="false"/> +<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/> +<booleanAttribute key="tracing" value="false"/> +<booleanAttribute key="useDefaultConfig" value="true"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<booleanAttribute key="useProduct" value="true"/> +</launchConfiguration> diff --git a/org.eclipse.jdt.core.tests.compiler/CompilerInvocationTests.launch b/org.eclipse.jdt.core.tests.compiler/CompilerInvocationTests.launch new file mode 100644 index 000000000..d6b913ae3 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/CompilerInvocationTests.launch @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig"> +<booleanAttribute key="append.args" value="true"/> +<booleanAttribute key="askclear" value="false"/> +<booleanAttribute key="automaticAdd" value="true"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="[NONE]"/> +<booleanAttribute key="clearConfig" value="true"/> +<booleanAttribute key="clearws" value="true"/> +<booleanAttribute key="clearwslog" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/CompilerInvocationTests"/> +<booleanAttribute key="default" value="true"/> +<booleanAttribute key="includeOptional" value="true"/> +<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> +<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> +<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> +<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/> +<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-openjdk"/> +<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.jdt.core.tests.compiler.regression.CompilerInvocationTests"/> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jdt.core.tests.compiler"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx768m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dosgi.support.class.certificate=false -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass"/> +<booleanAttribute key="org.objectteams.launch" value="true"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="product" value="org.eclipse.sdk.ide"/> +<booleanAttribute key="run_in_ui_thread" value="true"/> +<booleanAttribute key="show_selected_only" value="false"/> +<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/> +<booleanAttribute key="tracing" value="false"/> +<booleanAttribute key="useDefaultConfig" value="true"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<booleanAttribute key="useProduct" value="true"/> +</launchConfiguration> diff --git a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF new file mode 100644 index 000000000..d2043016c --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.jdt.core.tests.compiler +Bundle-Version: 3.3.100 +Bundle-ClassPath: jdtcoretestscompiler.jar +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Export-Package: org.eclipse.jdt.core.tests.compiler.parser, + org.eclipse.jdt.core.tests.compiler.regression, + org.eclipse.jdt.core.tests.eval, + org.eclipse.jdt.core.tests.eval.target, + org.eclipse.jdt.core.tests.junit.extension, + org.eclipse.jdt.core.tests.runtime, + org.eclipse.jdt.core.tests.util +Require-Bundle: org.junit;bundle-version="3.8.1", + org.eclipse.jdt.debug;bundle-version="[3.2.0,4.0.0)", + org.eclipse.jdt.core;bundle-version="[3.3.0,4.0.0)", + org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", + org.eclipse.test.performance;bundle-version="[3.1.0,4.0.0)", + org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", + org.eclipse.objectteams.otdt;bundle-version="[1.3.0,2.0.0)" +Bundle-RequiredExecutionEnvironment: J2SE-1.4 diff --git a/org.eclipse.jdt.core.tests.compiler/about.html b/org.eclipse.jdt.core.tests.compiler/about.html new file mode 100644 index 000000000..460233046 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 2, 2006</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.compiler/build.properties b/org.eclipse.jdt.core.tests.compiler/build.properties new file mode 100644 index 000000000..3269b69f5 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/build.properties @@ -0,0 +1,18 @@ +############################################################################### +# Copyright (c) 2000, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +bin.includes = test.xml,\ + about.html,\ + jdtcoretestscompiler.jar,\ + META-INF/,\ + plugin.properties +source.jdtcoretestscompiler.jar = src/ +output.jdtcoretestscompiler.jar = bin/ +src.includes = about.html diff --git a/org.eclipse.jdt.core.tests.compiler/plugin.properties b/org.eclipse.jdt.core.tests.compiler/plugin.properties new file mode 100644 index 000000000..8e46efbde --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/plugin.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2000, 2006 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +providerName=Eclipse.org +pluginName=Java Compiler Tests diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java new file mode 100644 index 000000000..9f0f5bf27 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java @@ -0,0 +1,442 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + +import java.util.Locale; + +import org.eclipse.jdt.internal.codeassist.complete.CompletionParser; +import org.eclipse.jdt.internal.codeassist.complete.CompletionScanner; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Initializer; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; +import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; + +public abstract class AbstractCompletionTest extends AbstractCompilerTest { + + public final static String NONE = "<NONE>"; + public final static String NULL = "null"; +public AbstractCompletionTest(String testName){ + super(testName); +} +/* + * DietParse with completionNode check + */ +public void checkDietParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + this.checkDietParse( + source, + cursorLocation, + expectedCompletion, + null, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + testName); +} +/* + * DietParse with completionNode check + */ +public void checkDietParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedParentCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + CompletionParser parser = + new CompletionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + false); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, cursorLocation); + + checkParse( + expectedCompletion, + expectedParentCompletion, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + testName, + parser, + unit); +} +/* + * Parse a method with completionNode check + */ +public void checkMethodParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedParentCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String[] expectedLabels, + String testName) { + + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + CompletionParser parser = + new CompletionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + false); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, cursorLocation); + + ASTNode foundMethod = null; + if (unit.types != null) { + for (int i = 0; i < unit.types.length; i++) { + TypeDeclaration type = unit.types[i]; + ASTNode method = findMethod(type, cursorLocation); + if (method != null) { + foundMethod = method; + break; + } + } + } + + if (foundMethod != null) { + if (foundMethod instanceof AbstractMethodDeclaration) { + parser.parseBlockStatements((AbstractMethodDeclaration)foundMethod, unit); + } else { + TypeDeclaration type = (TypeDeclaration)foundMethod; + if (type.fields != null) { + done : for (int i = 0; i < type.fields.length; i++) { + FieldDeclaration field = type.fields[i]; + if (field.declarationSourceStart <= cursorLocation && (cursorLocation <= field.declarationSourceEnd || field.declarationSourceEnd == 0)) { + if (field instanceof Initializer) { + parser.parseBlockStatements((Initializer)field, type, unit); + break; + } + break done; // field initializer + } + } + } + } + } + + checkParse( + expectedCompletion, + expectedParentCompletion, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + testName, + parser, + unit); +} +/* + * Parse a method with completionNode check + */ +public void checkMethodParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + this.checkMethodParse( + source, + cursorLocation, + expectedCompletion, + null, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + null, + testName); +} +/* + * Parse a method with completionNode check + */ +public void checkMethodParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedParentCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + this.checkMethodParse( + source, + cursorLocation, + expectedCompletion, + expectedParentCompletion, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + null, + testName); +} +/* + * Parse a method with completionNode check + */ +public void checkMethodParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String[] expectedLabels, + String testName) { + + this.checkMethodParse( + source, + cursorLocation, + expectedCompletion, + null, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + expectedLabels, + testName); +} +private void checkParse( + String expectedCompletion, + String expectedParentCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName, + CompletionParser parser, + CompilationUnitDeclaration unit) { + String computedCompletion = parser.assistNode == null + ? NONE + : parser.assistNode.toString(); + + String computedParentCompletion = NULL; + if (expectedParentCompletion != null) { + computedParentCompletion = parser.assistNodeParent == null + ? NONE + : parser.assistNodeParent.toString(); + } + + String computedUnitToString = unit.toString(); + //System.out.println(computedUnitToString); + //System.out.println(Util.displayString(computedUnitToString)); + //System.out.println(expectedUnitToString); + + if (!expectedCompletion.equals(computedCompletion)) { + System.out.println(Util.displayString(computedCompletion)); + } + + if(expectedParentCompletion != null) { + if (!expectedParentCompletion.equals(computedParentCompletion)) { + System.out.println(Util.displayString(computedParentCompletion)); + } + } + + if (!expectedUnitToString.equals(computedUnitToString)) { + System.out.println(Util.displayString(computedUnitToString)); + } + + String computedCompletionIdentifier = NULL; + if (expectedCompletionIdentifier != null){ + char[] chars = ((CompletionScanner)parser.scanner).completionIdentifier; + computedCompletionIdentifier = chars == null ? NONE : new String(chars); + } + + String computedReplacedSource = NULL; + if (expectedReplacedSource != null){ + char[] chars = null; + if (parser.assistNode != null){ + chars = CharOperation.subarray( + parser.scanner.source, + parser.assistNode.sourceStart, + parser.assistNode.sourceEnd + 1); + } else { + if (parser.assistIdentifier() != null){ + if (((CompletionScanner)parser.scanner).completedIdentifierEnd + >= ((CompletionScanner)parser.scanner).completedIdentifierStart){ + chars = CharOperation.subarray( + parser.scanner.source, + ((CompletionScanner)parser.scanner).completedIdentifierStart, + ((CompletionScanner)parser.scanner).completedIdentifierEnd + 1); + } + } + } + computedReplacedSource = chars == null ? NONE : new String(chars); + } + assertEquals( + testName, + concatResults( + expectedCompletion, + expectedParentCompletion, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource), + concatResults(computedCompletion, + computedParentCompletion, + computedUnitToString, + computedCompletionIdentifier, + computedReplacedSource)); +} +private String concatResults( + String completionNode, + String parentCompletionNode, + String unitToString, + String completionIdentifier, + String replacedSource) { + StringBuffer buffer = new StringBuffer(); + buffer.append("### Completion node ###\n"); + buffer.append(completionNode); + buffer.append("\n### Parent completion node ###\n"); + buffer.append(parentCompletionNode); + buffer.append("\n### Completed identifier ###\n"); + buffer.append(completionIdentifier); + buffer.append("\n### Replaced source ###\n"); + buffer.append(replacedSource); + buffer.append("\n### Completed unit ###\n"); + buffer.append(unitToString); + return buffer.toString(); +} +/* + * Returns the method, the constructor or the type declaring the initializer + * at the cursor location in the given type. + * Returns null if not found. + */ +private ASTNode findMethod(TypeDeclaration type, int cursorLocation) { + if (type.methods != null) { + for (int i = 0; i < type.methods.length; i++) { + AbstractMethodDeclaration method = type.methods[i]; + if (method.declarationSourceStart <= cursorLocation && (cursorLocation <= method.declarationSourceEnd || method.declarationSourceEnd == 0)) { + return method; + } + } + } + if (type.memberTypes != null) { + for (int i = 0; i < type.memberTypes.length; i++) { + TypeDeclaration memberType = type.memberTypes[i]; + ASTNode method = findMethod(memberType, cursorLocation); + if (method != null) { + return method; + } + } + } + if (type.fields != null) { + for (int i = 0; i < type.fields.length; i++) { + FieldDeclaration field = type.fields[i]; + if (field instanceof Initializer && field.declarationSourceStart <= cursorLocation && (cursorLocation <= field.declarationSourceEnd || field.declarationSourceEnd == 0)) { + return type; + } + } + } + return null; +} +/** + * Runs the given test that checks that diet completion parsing returns the given completion. + */ +protected void runTestCheckDietParse( + String compilationUnit, + String completeBehind, + String expectedCompletionNodeToString, + String expectedUnitDisplayString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + int cursorLocation = compilationUnit.indexOf(completeBehind) + completeBehind.length() - 1; + this.checkDietParse( + compilationUnit.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + expectedCompletionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Runs the given test that checks that method completion parsing returns the given completion. + */ +protected void runTestCheckMethodParse( + String compilationUnit, + String completeBehind, + String expectedCompletionNodeToString, + String expectedUnitDisplayString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String[] expectedLabels, + String testName) { + + int completeBehindStart = compilationUnit.indexOf(completeBehind); + assertTrue("completeBehind string not found", completeBehindStart >= 0); + int cursorLocation = completeBehindStart + completeBehind.length() - 1; + this.checkMethodParse( + compilationUnit.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + expectedCompletionIdentifier, + expectedReplacedSource, + expectedLabels, + testName); +} +/** + * Runs the given test that checks that method completion parsing returns the given completion. + */ +protected void runTestCheckMethodParse( + String compilationUnit, + String completeBehind, + String expectedCompletionNodeToString, + String expectedUnitDisplayString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + this.runTestCheckMethodParse( + compilationUnit, + completeBehind, + expectedCompletionNodeToString, + expectedUnitDisplayString, + expectedCompletionIdentifier, + expectedReplacedSource, + null, + testName); +} +} diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java new file mode 100644 index 000000000..e9b1b4de2 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java @@ -0,0 +1,346 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Technical University Berlin - adapted for Object Teams + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + +import java.util.Locale; + +import org.eclipse.jdt.internal.codeassist.select.SelectionParser; +import org.eclipse.jdt.internal.codeassist.select.SelectionScanner; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.Block; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Initializer; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; +import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.objectteams.otdt.internal.core.compiler.ast.AbstractMethodMappingDeclaration; + +public abstract class AbstractSelectionTest extends AbstractCompilerTest { + + public final static String NONE = "<NONE>"; +public AbstractSelectionTest(String testName){ + super(testName); +} +/* + * DietParse with selectionNode check + */ +public void checkDietParse( + char[] source, + int selectionStart, + int selectionEnd, + String expectedSelection, + String expectedUnitToString, + String expectedSelectionIdentifier, + String expectedSelectedSource, + String testName) { + + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + SelectionParser parser = + new SelectionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault()))); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, selectionStart, selectionEnd); + + String computedUnitToString = unit.toString(); + //System.out.println(computedUnitToString); + //System.out.println(Util.displayString(computedUnitToString)); + //System.out.println(expectedUnitToString); + + String computedSelection = parser.assistNode == null + ? NONE + : parser.assistNode.toString(); + assertEquals( + "invalid selection node-" + testName, + expectedSelection, + computedSelection); + + if (!expectedUnitToString.equals(computedUnitToString)) { + System.out.println(Util.displayString(computedUnitToString, 2)); + } + assertEquals( + "invalid selection unit-" + testName, + expectedUnitToString, + computedUnitToString); + + if (expectedSelectionIdentifier != null){ + char[] chars = ((SelectionScanner)parser.scanner).selectionIdentifier; + String computedSelectionIdentifier = chars == null ? NONE : new String(chars); + assertEquals( + "invalid selection identifier-" + testName, + expectedSelectionIdentifier, + computedSelectionIdentifier); + } + if (expectedSelectedSource != null){ + char[] chars = null; + if (parser.assistNode != null){ + chars = CharOperation.subarray( + parser.scanner.source, + parser.assistNode.sourceStart, + parser.assistNode.sourceEnd + 1); + } else { + if (parser.assistIdentifier() != null){ + if (((SelectionScanner)parser.scanner).selectionEnd + >= ((SelectionScanner)parser.scanner).selectionStart){ + chars = CharOperation.subarray( + parser.scanner.source, + ((SelectionScanner)parser.scanner).selectionStart, + ((SelectionScanner)parser.scanner).selectionEnd + 1); + } + } + } + String computedSelectedSource = chars == null ? NONE : new String(chars); + assertEquals( + "invalid replaced source-" + testName, + expectedSelectedSource, + computedSelectedSource); + } +} +/* + * Parse a method with selectionNode check + */ +public void checkMethodParse( + char[] source, + int selectionStart, + int selectionEnd, + String expectedSelection, + String expectedUnitToString, + String expectedSelectionIdentifier, + String expectedSelectedSource, + String[] expectedLabels, + String testName) { + + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + SelectionParser parser = + new SelectionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault()))); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, selectionStart, selectionEnd); + + ASTNode foundMethod = null; + if (unit.types != null) { + for (int i = 0; i < unit.types.length; i++) { + TypeDeclaration type = unit.types[i]; + ASTNode method = findMethod(type, selectionStart); + if (method != null) { + foundMethod = method; + break; + } + } + } + assertTrue("no method found at cursor location", foundMethod != null); + if (foundMethod instanceof AbstractMethodDeclaration) { + parser.parseBlockStatements((AbstractMethodDeclaration)foundMethod, unit); +//{ObjectTeams: + } else if (foundMethod instanceof AbstractMethodMappingDeclaration) { + parser.parseBlockStatements((AbstractMethodMappingDeclaration)foundMethod, unit); +// SH} + } else { + TypeDeclaration type = (TypeDeclaration)foundMethod; + if (type.fields != null) { + for (int i = 0; i < type.fields.length; i++) { + FieldDeclaration field = type.fields[i]; + if (field instanceof Initializer && field.sourceStart <= selectionStart && selectionStart <= field.sourceEnd) { + parser.parseBlockStatements((Initializer)field, type, unit); + break; + } + } + } + } + + String computedUnitToString = unit.toString(); + //System.out.println(computedUnitToString); + //System.out.println(expectedUnitToString); + + String computedCompletion = parser.assistNode == null + ? NONE + : parser.assistNode.toString(); + assertEquals( + "invalid selection node-" + testName, + expectedSelection, + computedCompletion); + + if (!expectedUnitToString.equals(computedUnitToString)) { + System.out.println(Util.displayString(computedUnitToString, 2)); + } + assertEquals( + "invalid selection unit-"+testName, + expectedUnitToString, + computedUnitToString); + + if (expectedSelectionIdentifier != null){ + char[] chars = ((SelectionScanner)parser.scanner).selectionIdentifier; + String computedSelectionIdentifier = chars == null ? NONE : new String(chars); + assertEquals( + "invalid selection identifier-" + testName, + expectedSelectionIdentifier, + computedSelectionIdentifier); + } + if (expectedSelectedSource != null){ + char[] chars = null; + if (parser.assistNode != null){ + chars = CharOperation.subarray( + parser.scanner.source, + parser.assistNode.sourceStart, + parser.assistNode.sourceEnd + 1); + } else { + if (parser.assistIdentifier() != null){ + if (((SelectionScanner)parser.scanner).selectionEnd + >= ((SelectionScanner)parser.scanner).selectionStart){ + chars = CharOperation.subarray( + parser.scanner.source, + ((SelectionScanner)parser.scanner).selectionStart, + ((SelectionScanner)parser.scanner).selectionEnd + 1); + } + } + } + String computedReplacedSource = chars == null ? NONE : new String(chars); + assertEquals( + "invalid replaced source-" + testName, + expectedSelectedSource, + computedReplacedSource); + } + if (expectedLabels != null) { +/* + assert("no labels-" + testName, parser.labels != null); + int length = parser.labels.length; + assertEquals("invalid number of labels-" + testName, expectedLabels.length, length); + for (int i = 0; i < length; i++) { + String label = new String(parser.labels[i]); + assertEquals("invalid label-" + testName, expectedLabels[i], label); + } +*/ + } +} +/* + * Parse a method with selectionNode check + */ +public void checkMethodParse( + char[] source, + int selectionStart, + int selectionEnd, + String expectedSelection, + String expectedUnitToString, + String expectedSelectionIdentifier, + String expectedSelectedSource, + String testName) { + + this.checkMethodParse( + source, + selectionStart, + selectionEnd, + expectedSelection, + expectedUnitToString, + expectedSelectionIdentifier, + expectedSelectedSource, + null, + testName); +} +/* + * Returns the method, the constructor or the type declaring the initializer + * at the cursor location in the given type. + * Returns null if not found. + */ +protected ASTNode findMethod(TypeDeclaration type, int cursorLocation) { + if (type.methods != null) { + for (int i = 0; i < type.methods.length; i++) { + AbstractMethodDeclaration method = type.methods[i]; + if (method.declarationSourceStart <= cursorLocation && (cursorLocation <= method.declarationSourceEnd || method.declarationSourceEnd == 0)) { + return method; + } + } + } +//{ObjectTeams: or callin/callout: + if (type.callinCallouts != null) { + for (int i = 0; i < type.callinCallouts.length; i++) { + AbstractMethodMappingDeclaration mapping= type.callinCallouts[i]; + if (mapping.declarationSourceStart <= cursorLocation && (cursorLocation <= mapping.declarationSourceEnd || mapping.declarationSourceEnd == 0)) { + return mapping; + } + } + } +// SH} + if (type.memberTypes != null) { + for (int i = 0; i < type.memberTypes.length; i++) { + TypeDeclaration memberType = type.memberTypes[i]; + ASTNode method = findMethod(memberType, cursorLocation); + if (method != null) { + return method; + } + } + } + if (type.fields != null) { + for (int i = 0; i < type.fields.length; i++) { + FieldDeclaration field = type.fields[i]; + if (field instanceof Initializer) { + Initializer initializer = (Initializer)field; + Block block = initializer.block; + if (block != null && block.sourceStart <= cursorLocation && (cursorLocation <= block.sourceEnd || block.sourceEnd == 0)) { + return type; + } + } + } + } + return null; +} +/** + * Runs the given test that checks that method completion parsing returns the given completion. + */ +protected void runTestCheckMethodParse( + String compilationUnit, + String selectionStartBehind, + String selectionEndBehind, + String expectedSelectionNodeToString, + String expectedUnitDisplayString, + String expectedSelectionIdentifier, + String expectedReplacedSource, + String testName) { + + int selectionStartBehindStart = compilationUnit.indexOf(selectionStartBehind); + assertTrue("selectionStartBehind string not found", selectionStartBehindStart != -1); + int selectionStart = selectionStartBehindStart + selectionStartBehind.length(); + int selectionEndBehindStart = compilationUnit.indexOf(selectionEndBehind); + assertTrue("selectionEndBehind string not found", selectionEndBehindStart != -1); + int selectionEnd = selectionEndBehindStart + selectionEndBehind.length() - 1; + + this.checkMethodParse( + compilationUnit.toCharArray(), + selectionStart, + selectionEnd, + expectedSelectionNodeToString, + expectedUnitDisplayString, + expectedSelectionIdentifier, + expectedReplacedSource, + testName); +} +} diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java new file mode 100644 index 000000000..110bb1b97 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java @@ -0,0 +1,194 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + +import junit.framework.Test; + +/** + * Completion is expected to be an AllocationExpression. + */ +public class AllocationExpressionCompletionTest extends AbstractCompletionTest { +public AllocationExpressionCompletionTest(String testName) { + super(testName); +} +public static Test suite() { + return buildAllCompliancesTestSuite(AllocationExpressionCompletionTest.class); +} +/* + * Completion inside an if statement. + */ +public void testInIfStatement() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " if (true) { \n" + + " new z.y.X(1, 2, i); \n" + + " } \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "<CompleteOnAllocationExpression:new z.y.X(1, 2)>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " {\n" + + " <CompleteOnAllocationExpression:new z.y.X(1, 2)>;\n" + + " }\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "<complete inside an if statement>" + ); +} +/* + * Completion on a constructor invocation with no qualification and using a qualified type name. + * + * ie. ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt + * where ClassType is a qualified type name + */ +public void testNoQualificationQualifiedTypeName() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " new z.y.X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "<CompleteOnAllocationExpression:new z.y.X(1, 2)>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnAllocationExpression:new z.y.X(1, 2)>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "<complete on non qualified instance creation with qualified type name>" + ); +} +/* + * Completion on a constructor invocation with no qualification and using a simple type name. + * + * ie. ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt + * where ClassType is a simple type name + */ +public void testNoQualificationSimpleTypeName() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "<CompleteOnAllocationExpression:new X(1, 2)>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnAllocationExpression:new X(1, 2)>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "<complete on non qualified instance creation with simple type name>" + ); +} +/* + * Completion on a constructor invocation qualified with a name. + * + * ie. ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt + */ +public void testQualifiedWithName() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar {\n" + + " void foo() { \n" + + " Buz.x.new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "<CompleteOnQualifiedAllocationExpression:Buz.x.new X(1, 2)>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnQualifiedAllocationExpression:Buz.x.new X(1, 2)>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "<complete on name qualified instance creation>" + ); +} +/* + * Completion on a constructor invocation qualified with a primary. + * + * ie. ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt + */ +public void testQualifiedWithPrimary() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " primary().new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "<CompleteOnQualifiedAllocationExpression:primary().new X(1, 2)>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnQualifiedAllocationExpression:primary().new X(1, 2)>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "<complete on primary qualified instance creation>" + ); +} +} 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 new file mode 100644 index 000000000..a3eb21f3d --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java @@ -0,0 +1,5134 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + + +import java.util.Map; + +import junit.framework.Test; + +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; + + + +public class AnnotationCompletionParserTest extends AbstractCompletionTest { +public AnnotationCompletionParserTest(String testName) { + super(testName); +} +public static Test suite() { + return buildAllCompliancesTestSuite(AnnotationCompletionParserTest.class); +} + +protected Map getCompilerOptions() { + Map options = super.getCompilerOptions(); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + return options; +} + +public void test0001(){ + String str = + "public @MyAnn class X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0002(){ + String str = + "public @MyAnn interface X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "interface X {\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0003(){ + String str = + "public @MyAnn enum X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "enum X {\n" + + " X() {\n" + + " }\n" + + " <clinit>() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0004(){ + String str = + "public @MyAnn @interface X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "@interface X {\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0005(){ + String str = + "public @MyAnn class X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0006(){ + String str = + "public @MyAnn interface X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "interface X {\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0007(){ + String str = + "public @MyAnn enum X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "enum X {\n" + + " X() {\n" + + " }\n" + + " <clinit>() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0008(){ + String str = + "public @MyAnn @interface X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "@interface X {\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0009(){ + String str = + "public @MyAnn\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0010(){ + String str = + "public class X {\n" + + " public @MyAnn class Y {\n" + + " }\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @<CompleteOnType:MyAnn>\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " }\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0011(){ + String str = + "public class X {\n" + + " public @MyAnn class Y\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @<CompleteOnType:MyAnn>\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " }\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0012(){ + String str = + "public class X {\n" + + " public @MyAnn\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @<CompleteOnType:MyAnn>\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0013_Diet(){ + String str = + "public class X {\n" + + " public void foo() {\n" + + " @MyAnn class Y {\n" + + " }\n" + + " }\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0013_Method(){ + String str = + "public class X {\n" + + " public void foo() {\n" + + " @MyAnn class Y {\n" + + " }\n" + + " }\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public void foo() {\n" + + " @<CompleteOnType:MyAnn>\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0014(){ + String str = + "public @MyAnn(ZORK) class X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0015(){ + String str = + "public @MyAnn(ZORK) class X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0016(){ + String str = + "public @MyAnn(ZORK)\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0017(){ + String str = + "public @MyAnn(v1=\"\", v2=\"\") class X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0018(){ + String str = + "public @MyAnn(v1=\"\", v2=\"\")) class X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0019(){ + String str = + "public @MyAnn(v1=\"\", v2=\"\")\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0020(){ + String str = + "public @MyAnn(v1=\"\""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@<CompleteOnType:MyAnn>\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0021(){ + String str = + "public class X {\n" + + " @MyAnn void foo() {}\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @<CompleteOnType:MyAnn>\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0022(){ + String str = + "public class X {\n" + + " @MyAnn int var;\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @<CompleteOnType:MyAnn>\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0023(){ + String str = + "public class X {\n" + + " void foo(@MyAnn int i) {}\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @<CompleteOnType:MyAnn>\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0024_Diet(){ + String str = + "public class X {\n" + + " void foo() {@MyAnn int i}\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0024_Method(){ + String str = + "public class X {\n" + + " void foo() {@MyAnn int i}\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:MyAnn>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " @<CompleteOnType:MyAnn>\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0025(){ + String str = + "@Annot(foo)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(<CompleteOnAttributeName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0026(){ + String str = + "public class X {\n" + + " @Annot(foo)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0027(){ + String str = + "public class X {\n" + + " @Annot(foo)\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0028_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0028_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0029_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0029_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0030(){ + String str = + "public class X {\n" + + " @Annot(foo)\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0031(){ + String str = + "@Annot(foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(<CompleteOnAttributeName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0032(){ + String str = + "public class X {\n" + + " @Annot(foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0033(){ + String str = + "public class X {\n" + + " @Annot(foo\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0034_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0034_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0035_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0035_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0036(){ + String str = + "public class X {\n" + + " @Annot(foo\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0037(){ + String str = + "@Annot(foo=zzz)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(<CompleteOnAttributeName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0038(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0039(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz)\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0040_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo=zzz)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0040_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo=zzz)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0041_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo=zzz) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0041_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo=zzz) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0042(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz)\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0043(){ + String str = + "@Annot(foo=zzz\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(<CompleteOnAttributeName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0044(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0045(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0046_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo=zzz\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0046_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo=zzz\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0047_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo=zzz int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0047_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo=zzz int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0048(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " zzz X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0049(){ + String str = + "@Annot(yyy=zzz,foo)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0050(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0051(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo)\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0052_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0052_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0053_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0053_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0054(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo)\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0055(){ + String str = + "@Annot(yyy=zzz,foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0056(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0057(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0058_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0058_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0059_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0059_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0060(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0061(){ + String str = + "@Annot(yyy=zzz,foo=zzz)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0062(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0063(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0064_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0064_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0065_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo=zzz) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0065_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo=zzz) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0066(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0067(){ + String str = + "@Annot(yyy=zzz,foo=zzz\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0068(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0069(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0070_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0070_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0071_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo=zzz int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0071_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo=zzz int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0072(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:foo>"; + String expectedParentNodeToString = "@Annot(yyy = zzz,<CompleteOnAttributeName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,<CompleteOnAttributeName:foo>)\n" + + " public X() {\n" + + " }\n" + + " zzz X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0073(){ + String str = + "@Annot(zzz=yyy,f)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "f"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnAttributeName:f>"; + String expectedParentNodeToString = "@Annot(zzz = yyy,<CompleteOnAttributeName:f>)"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + String expectedUnitDisplayString = + "@Annot(zzz = yyy,<CompleteOnAttributeName:f>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0074(){ + String str = + "@Annot(zzz=foo)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public @Annot(zzz = <CompleteOnName:foo>) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0075(){ + String str = + "@Annot(zzz= a && foo)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public @Annot(zzz = (a && <CompleteOnName:foo>)) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0076(){ + String str = + "@Annot(zzz= {foo})\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public @Annot(zzz = {<CompleteOnName:foo>}) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0078(){ + String str = + "@Annot(zzz= {yyy, foo})\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public @Annot(zzz = {yyy, <CompleteOnName:foo>}) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0079(){ + String str = + "@Annot(zzz=foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = <CompleteOnName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0080(){ + String str = + "@Annot(zzz= a && foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = (a && <CompleteOnName:foo>))\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0081(){ + String str = + "@Annot(zzz= {yyy, foo}\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "{yyy, <CompleteOnName:foo>}"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = {yyy, <CompleteOnName:foo>})\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0082(){ + String str = + "@Annot(zzz= {yyy, foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = <CompleteOnName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0083(){ + String str = + "@Annot(zzz= a && (b || (foo && c)))\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public @Annot(zzz = (a && (b || (<CompleteOnName:foo> && c)))) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0084(){ + String str = + "@Annot(zzz= a && (b || (foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = <CompleteOnName:foo>)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0085(){ + String str = + "public class X {\n" + + " @Annot(zzz=foo)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @Annot(zzz = <CompleteOnName:foo>) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0086(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && foo)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @Annot(zzz = (a && <CompleteOnName:foo>)) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0087(){ + String str = + "public class X {\n" + + " @Annot(zzz= {foo})\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @Annot(zzz = {<CompleteOnName:foo>}) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0088(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo})\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @Annot(zzz = {yyy, <CompleteOnName:foo>}) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0089(){ + String str = + "public class X {\n" + + " @Annot(zzz=foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0090(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = (a && <CompleteOnName:foo>))\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0091(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo}\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "{yyy, <CompleteOnName:foo>}"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {yyy, <CompleteOnName:foo>})\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0092(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0093(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && (b || (foo && c)))\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @Annot(zzz = (a && (b || (<CompleteOnName:foo> && c)))) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0094(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && (b || (foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0095(){ + String str = + "public class X {\n" + + " @Annot(zzz=foo)\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = <CompleteOnName:foo>) int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0096(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && foo)\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = (a && <CompleteOnName:foo>)) int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0097(){ + String str = + "public class X {\n" + + " @Annot(zzz= {foo})\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {<CompleteOnName:foo>}) int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0098(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo})\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {yyy, <CompleteOnName:foo>}) int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0099(){ + String str = + "public class X {\n" + + " @Annot(zzz=foo\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0100(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && foo\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = (a && <CompleteOnName:foo>))\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0101(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo}\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "{yyy, <CompleteOnName:foo>}"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {yyy, <CompleteOnName:foo>})\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0102(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0103(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && (b || (foo && c)))\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = (a && (b || (<CompleteOnName:foo> && c)))) int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0104(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && (b || (foo\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0105_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz=foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0105_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz=foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0106_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0106_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = (a && <CompleteOnName:foo>))\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0107_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {foo})\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0107_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {foo})\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0108_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo})\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0108_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo})\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0109_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz=foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0109_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz=foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0110_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " int var;\n" + + " @Annot(zzz= a && foo\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0110_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " int var;\n" + + " @Annot(zzz= a && foo\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " int var;\n" + + " @Annot(zzz = (a && <CompleteOnName:foo>))\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0111_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo}\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0111_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo}\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0112_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0112_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0113_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && (b || (foo && c)))\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0113_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && (b || (foo && c)))\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0114_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && (b || (foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0114_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && (b || (foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0115(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz=foo) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(@Annot(zzz = <CompleteOnName:foo>) int var) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0116(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && foo) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(@Annot(zzz = (a && <CompleteOnName:foo>)) int var) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0117(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= {foo}) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(@Annot(zzz = {<CompleteOnName:foo>}) int var) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0118(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= {yyy, foo}) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(@Annot(zzz = {yyy, <CompleteOnName:foo>}) int var) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0119_Diet(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz=foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0119_Method(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz=foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "zzz = <CompleteOnName:foo>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = <CompleteOnName:foo>)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0120_Diet(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0120_Method(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "(a && <CompleteOnName:foo>)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = (a && <CompleteOnName:foo>))\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0121(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= {yyy, foo} int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "{yyy, <CompleteOnName:foo>}"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {yyy, <CompleteOnName:foo>})\n" + + " int var;\n" + + " {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0122(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= {yyy, foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0123(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && (b || (foo && c))) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(@Annot(zzz = (a && (b || (<CompleteOnName:foo> && c)))) int var) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0124(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && (b || (foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:foo>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=148742 +public void test0125(){ + String str = + "public interface X {\n" + + " public void test(@TestAnnotation int testParam);\n" + + "}"; + + + String completeBehind = "@TestAnnotation"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:TestAnnotation>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "TestAnnotation"; + String expectedReplacedSource = "TestAnnotation"; + String expectedUnitDisplayString = + "public interface X {\n" + + " @<CompleteOnType:TestAnnotation>\n" + + " public void test() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148742 +public void test0126(){ + String str = + "public abstract class X {\n" + + " public abstract void test(@TestAnnotation int testParam);\n" + + "}"; + + + String completeBehind = "@TestAnnotation"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@<CompleteOnType:TestAnnotation>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "TestAnnotation"; + String expectedReplacedSource = "TestAnnotation"; + String expectedUnitDisplayString = + "public abstract class X {\n" + + " @<CompleteOnType:TestAnnotation>\n" + + " public X() {\n" + + " }\n" + + " public abstract void test();\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0127(){ + String str = + "public class Test {\n" + + " public static final int zzint = 0;\n" + + " @ZZAnnotation({ZZ})\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "{ZZ"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:ZZ>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "ZZ"; + String expectedReplacedSource = "ZZ"; + String expectedUnitDisplayString = + "public class Test {\n" + + " public static final int zzint;\n" + + " <clinit>() {\n" + + " }\n" + + " public Test() {\n" + + " }\n" + + " @ZZAnnotation({<CompleteOnName:ZZ>}) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0128(){ + String str = + "public class Test {\n" + + " public static final int zzint = 0;\n" + + " @ZZAnnotation(value={ZZ})\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "{ZZ"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:ZZ>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "ZZ"; + String expectedReplacedSource = "ZZ"; + String expectedUnitDisplayString = + "public class Test {\n" + + " public static final int zzint;\n" + + " <clinit>() {\n" + + " }\n" + + " public Test() {\n" + + " }\n" + + " @ZZAnnotation(value = {<CompleteOnName:ZZ>}) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0129(){ + String str = + "public class Test {\n" + + " public static final int zzint = 0;\n" + + " @ZZAnnotation({ZZ\n" + + "}"; + + + String completeBehind = "{ZZ"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "<CompleteOnName:ZZ>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "ZZ"; + String expectedReplacedSource = "ZZ"; + String expectedUnitDisplayString = + "public class Test {\n" + + " @ZZAnnotation(value = {<CompleteOnName:ZZ>})\n" + + " public static final int zzint;\n" + + " public Test() {\n" + + " }\n" + + " <clinit>() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +} 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 new file mode 100644 index 000000000..695aa4656 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java @@ -0,0 +1,1912 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + +import java.util.Locale; +import java.util.Map; + +import junit.framework.Test; + +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.codeassist.complete.CompletionParser; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; +import org.eclipse.jdt.internal.compiler.SourceElementParser; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.parser.Parser; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; + +// This test suite test the first implementation of the annotation recovery. +// Tests must be updated with annotation recovery improvment +// TODO(david) update test suite +public class AnnotationDietRecoveryTest extends AbstractCompilerTest { + private static final boolean CHECK_ALL_PARSE = true; + public static boolean optimizeStringLiterals = false; + public static long sourceLevel = ClassFileConstants.JDK1_3; //$NON-NLS-1$ + +public AnnotationDietRecoveryTest(String testName){ + super(testName); +} +public static Test suite() { + return buildMinimalComplianceTestSuite(testClass(), F_1_5); +} +public static Class testClass() { + return AnnotationDietRecoveryTest.class; +} +/* + * Toggle compiler in mode -1.5 + */ +protected Map getCompilerOptions() { + Map options = super.getCompilerOptions(); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + return options; +} + +public void checkParse( + char[] source, + String expectedDietUnitToString, + String expectedDietPlusBodyUnitToString, + String expectedFullUnitToString, + String expectedCompletionDietUnitToString, + String testName) { + + /* using regular parser in DIET mode */ + if (CHECK_ALL_PARSE){ + Parser parser = + new Parser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + new CompilerOptions(getCompilerOptions()), + new DefaultProblemFactory(Locale.getDefault())), + optimizeStringLiterals); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); + String computedUnitToString = computedUnit.toString(); + if (!expectedDietUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid unit diet structure" + testName, + expectedDietUnitToString, + computedUnitToString); + } + /* using regular parser in DIET mode + getMethodBodies */ + { + Parser parser = + new Parser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + new CompilerOptions(getCompilerOptions()), + new DefaultProblemFactory(Locale.getDefault())), + optimizeStringLiterals); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); + String computedUnitToString = computedUnit.toString(); + if (!expectedDietUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid unit diet structure" + testName, + expectedDietUnitToString, + computedUnitToString); + if (computedUnit.types != null) { + for (int i = 0, length = computedUnit.types.length; i < length; i++){ + computedUnit.types[i].parseMethods(parser, computedUnit); + } + } + computedUnitToString = computedUnit.toString(); + if (!expectedDietPlusBodyUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + + assertEquals( + "Invalid unit diet+body structure" + testName, + expectedDietPlusBodyUnitToString, + computedUnitToString); + } + /* using regular parser in FULL mode */ + if (CHECK_ALL_PARSE){ + Parser parser = + new Parser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + new CompilerOptions(getCompilerOptions()), + new DefaultProblemFactory(Locale.getDefault())), + optimizeStringLiterals); + + 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)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid unit full structure" + testName, + expectedFullUnitToString, + computedUnitToString); + + } + /* using source element parser in DIET mode */ + if (CHECK_ALL_PARSE){ + SourceElementParser parser = + new SourceElementParser( + new TestSourceElementRequestor(), + new DefaultProblemFactory(Locale.getDefault()), + new CompilerOptions(getCompilerOptions()), + false/*don't record local declarations*/, + true/*optimize string literals*/); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); + String computedUnitToString = computedUnit.toString(); + if (!expectedDietUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid source element diet structure" + testName, + expectedDietUnitToString, + computedUnitToString); + } + /* using source element parser in FULL mode */ + if (CHECK_ALL_PARSE){ + SourceElementParser parser = + new SourceElementParser( + new TestSourceElementRequestor(), + new DefaultProblemFactory(Locale.getDefault()), + new CompilerOptions(getCompilerOptions()), + false/*don't record local declarations*/, + true/*optimize string literals*/); + + 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)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid source element full structure" + testName, + expectedFullUnitToString, + computedUnitToString); + } + /* using completion parser in DIET mode */ + if (CHECK_ALL_PARSE){ + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + CompletionParser parser = + new CompletionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + false); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, Integer.MAX_VALUE); + String computedUnitToString = computedUnit.toString(); + if (!expectedCompletionDietUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid completion diet structure" + testName, + expectedCompletionDietUnitToString, + computedUnitToString); + } +} + +public void test0001() { + + String s = + "package a; \n" + + "public @interface X \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0002() { + + String s = + "package a; \n" + + "public @interface X <T> { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X<T> {\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0003() { + + String s = + "package a; \n" + + "public @interface X { \n" + + " String foo() \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + " String foo() {\n" + +" }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0004() { + + String s = + "package a; \n" + + "public @interface X { \n" + + " String foo() default \"blabla\" \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + " String foo() default \"blabla\" {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +/* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79770 + */ +public void test0005() { + + String s = + "@Documented \n" + + "@Rentention(RententionPolicy.RUNTIME) \n" + + "@Target(ElementType.TYPE) \n" + + "@interface MyAnn { \n" + + " String value() default \"Default Message\" \n" + + "} \n" + + "public class X { \n" + + " public @MyAnn void something() { } \n" + + "} \n"; + + String expectedDietUnitToString = + "@Documented @Rentention(RententionPolicy.RUNTIME) @Target(ElementType.TYPE) @interface MyAnn {\n" + + " String value() default \"Default Message\" {\n" + + " }\n" + + "}\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public @MyAnn void something() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "@Documented @Rentention(RententionPolicy.RUNTIME) @Target(ElementType.TYPE) @interface MyAnn {\n" + + " String value() default \"Default Message\" {\n" + + " }\n" + + "}\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " public @MyAnn void something() {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0006() { + + String s = + "package a; \n" + + "public @interface X { \n" + + " String foo() {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + " String foo() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0007() { + + String s = + "package a; \n" + + "public @interface X { \n" + + " String foo( \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + " String foo() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0008() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int var1, @Annot(at1=zzz, at2) int var2 { \n" + + " } \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int var1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int var1) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0009() { + + String s = + "package a; \n" + + "public class X { \n" + + " @SuppressWarnings(\"unchecked\");\n" + + " List<Test> l; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " @SuppressWarnings(\"unchecked\") List<Test> l;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " @SuppressWarnings(\"unchecked\") List<Test> l;\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " List<Test> l;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0010() { + + String s = + "package a; \n" + + "public class X { \n" + + " String foo() { \n" + + " @interface Y { \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " @interface Y {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " String foo() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " @interface Y {\n" + + " }\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " String foo() {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=176725 +public void test0011() { + + String s = + "package a; \n" + + "public class X { \n" + + " # \n" + + " @AnAnnotation({var}) \n" + + " public void foo() { \n" + + " } \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public @AnAnnotation({var}) void foo() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " public @AnAnnotation({var}) void foo() {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=210404 +public void test0012() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int var1, @Annot(at1=zzz, at2=@Annot(at3=zzz, at4)) int var2 { \n" + + " } \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int var1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int var1) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0013() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietPlusBodyUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0014() { + + String s = + "package a; \n" + + "# \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0015() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "# \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0016() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2) \n" + + "# \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0017() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "# \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0018() { + + String s = + "package a; \n" + + "@AnAnnotation(name=) \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name = $missing$) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name = $missing$) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0019() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2=) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2 = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2 = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0020() { + + String s = + "package a; \n" + + "public class X { \n" + + " @AnAnnotation(name) # \n" + + " int field; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " @AnAnnotation(name) int field;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " @AnAnnotation(name) int field;\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " int field;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0021() { + + String s = + "package a; \n" + + "public class X { \n" + + " @AnAnnotation(name=) \n" + + " int field; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " @AnAnnotation(name = $missing$) int field;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " @AnAnnotation(name = $missing$) int field;\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " int field;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0022() { + + String s = + "package a; \n" + + "public class X { \n" + + " @AnAnnotation(name) # \n" + + " void foo() {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @AnAnnotation(name) void foo() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " @AnAnnotation(name) void foo() {\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0023() { + + String s = + "package a; \n" + + "public class X { \n" + + " @AnAnnotation(name=) \n" + + " void foo() {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @AnAnnotation(name = $missing$) void foo() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " @AnAnnotation(name = $missing$) void foo() {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0024() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int param1, @AnAnnotation(name) # int param2) {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0025() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int param1, @AnAnnotation(name=) int param2) {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0026() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int param1, @AnAnnotation(@AnAnnotation1(name1=\"a\", name2=) int param2) {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0027() { + + String s = + "package a; \n" + + "@AnAnnotation1(name1=\"a\", #) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name1 = \"a\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name1 = \"a\") class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0028() { + + String s = + "package a; \n" + + "@AnAnnotation1(name1=\"a\", name2=@AnAnnotation2(name3=\"b\"), #) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name1 = \"a\",name2 = @AnAnnotation2(name3 = \"b\")) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name1 = \"a\",name2 = @AnAnnotation2(name3 = \"b\")) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0030() { + + String s = + "package a; \n" + + "@AnAnnotation1(\"a\"#) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0031() { + + String s = + "package a; \n" + + "@AnAnnotation1(\"a\", name2=@AnAnnotation2(name3=\"b\"), #) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") @AnAnnotation2(name3 = \"b\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") @AnAnnotation2(name3 = \"b\") class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0032() { + + String s = + "package a; \n" + + "@AnAnnotation1(\"a\", name2=@AnAnnotation2(name3=\"b\")) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") @AnAnnotation2(name3 = \"b\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") @AnAnnotation2(name3 = \"b\") class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0033() { + + String s = + "package a; \n" + + "@AnAnnotation1(name=new Object() {}) # \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = new Object() {\n" + + "}) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = new Object() {\n" + + "}) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0034() { + + String s = + "package a; \n" + + "@AnAnnotation1(name=new Object() {},#) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = new Object() {\n" + + "}) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = new Object() {\n" + + "}) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0035() { + + String s = + "package a; \n" + + "@AnAnnotation1(name=new Object() {#}) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=227855 +public void test0036() { + + String s = + "package a; \n" + + "# \n" + + "public class Test { \n" + + " public Test() {} \n" + + " @SuppressWarnings(value=\"\") \n" + + " private int id; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class Test {\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class Test {\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class Test {\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=227855 +public void test0037() { + + String s = + "package a; \n" + + "# \n" + + "public class Test { \n" + + " public int id0; \n" + + " @SuppressWarnings(value=\"\") \n" + + " private int id; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class Test {\n" + + " public int id0;\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class Test {\n" + + " public int id0;\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class Test {\n" + + " public int id0;\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=228464 +public void test0038() { + + String s = + "package a; \n" + + "@AnAnnotation(name=) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=228464 +public void test0039() { + + String s = + "package a; \n" + + "@AnAnnotation(name1=a,name2=) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name1 = a,name2 = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name1 = a,name2 = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=228464 +public void test0040() { + + String s = + "package a; \n" + + "@AnAnnotation(name1=a,name2=,name3=c) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name1 = a,name2 = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name1 = a,name2 = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = "<generic type recovery>"; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +} diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationSelectionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationSelectionTest.java new file mode 100644 index 000000000..4cbc1bdb3 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationSelectionTest.java @@ -0,0 +1,642 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + +public class AnnotationSelectionTest extends AbstractSelectionTest { +public AnnotationSelectionTest(String testName) { + super(testName); +} +/* + * Selection at specific location + */ +public void test0001() { + + String str = + "public @MyAnn class X { \n" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn> class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0002() { + + String str = + "public @MyAnn.ZZ class X { \n" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn> class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0003() { + + String str = + "public @MyAnn.ZZ class X { \n" + + "} \n"; + + String selection = "ZZ"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn.ZZ>"; + + String completionIdentifier = "ZZ"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn.ZZ> class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn.ZZ"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0004() { + + String str = + "public @MyAnn.ZZ class X { \n" + + " \n"; + + String selection = "ZZ"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn.ZZ>"; + + String completionIdentifier = "ZZ"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn.ZZ> class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn.ZZ"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +//TODO enable this test when selection parser support this test case +public void _test0005() { + + String str = + "public @MyAnn.ZZ" + + " \n"; + + String selection = "ZZ"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn.ZZ>"; + + String completionIdentifier = "ZZ"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn.ZZ> class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn.ZZ"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0006() { + + String str = + "public class X {" + + " public @MyAnn void foo() {" + + " }" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public @<SelectOnType:MyAnn> void foo() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0007() { + + String str = + "public class X {" + + " public @MyAnn void foo(" + + " " + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public @<SelectOnType:MyAnn> void foo() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0008() { + + String str = + "public class X {" + + " public @MyAnn Object var;" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public @<SelectOnType:MyAnn> Object var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0009() { + + String str = + "public class X {" + + " public @MyAnn Object var" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public @<SelectOnType:MyAnn> Object var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} + +/* + * Selection at specific location + */ +public void test0010() { + + String str = + "public class X {" + + " public void foo(@MyAnn int i) {" + + " }" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public void foo(@<SelectOnType:MyAnn> int i) {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0011() { + + String str = + "public class X {" + + " public @MyAnn class Y {" + + " }" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public @<SelectOnType:MyAnn> class Y {\n" + + " public Y() {\n" + + " }\n" + + " }\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0012() { + + String str = + "public class X {" + + " public void foo() {" + + " @MyAnn int i;" + + " }" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public void foo() {\n" + + " @<SelectOnType:MyAnn> int i;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0013() { + + String str = + "public @MyAnn() class X {" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn>() class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0014() { + + String str = + "public @MyAnn(A.B) class X {" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn>(A.B) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0015() { + + String str = + "public @MyAnn(value = \"\") class X {" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn>(value = \"\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0016() { + + String str = + "public @MyAnn(value1 = \"\", value2 = \"\") class X {" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = "<SelectOnType:MyAnn>"; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @<SelectOnType:MyAnn>(value1 = \"\",value2 = \"\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0017() { + + String str = + "public @MyAnn(value1 = \"\", value2 = \"\") class X {" + + "} \n"; + + String selection = "value1"; + + String expectedCompletionNodeToString = "<SelectOnName:value1>"; + + String completionIdentifier = "value1"; + String expectedUnitDisplayString = + "public @MyAnn(<SelectOnName:value1>,value2 = \"\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "value1"; + String testName = "<select type>"; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +} diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java new file mode 100644 index 000000000..a3acc8328 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + +import junit.framework.Test; + +/** + * Completion is expected to be a ClassLiteralAccess. + */ +public class ClassLiteralAccessCompletionTest extends AbstractCompletionTest { +public ClassLiteralAccessCompletionTest(String testName) { + super(testName); +} +public static Test suite() { + return buildAllCompliancesTestSuite(ClassLiteralAccessCompletionTest.class); +} +/* + * Completion on the keyword 'class' on an array type + */ +public void testArrayType() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " String[].; \n" + + " } \n" + + "} \n", + // completeBehind: + "String[].", + // expectedCompletionNodeToString: + "<CompleteOnClassLiteralAccess:String[].>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnClassLiteralAccess:String[].>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "String[].", + // test name + "<complete on array type member>" + ); +} +/* + * Test access to the keyword 'class' on an array type + * where the keyword is non empty. + */ +public void testArrayTypeWithNonEmptyIdentifier() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " String[].class; \n" + + " } \n" + + "} \n", + // completeBehind: + "String[].cl", + // expectedCompletionNodeToString: + "<CompleteOnClassLiteralAccess:String[].cl>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnClassLiteralAccess:String[].cl>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "cl", + // expectedReplacedSource: + "String[].class", + // test name + "<complete on array type member with non empty identifier>" + ); +} +/* + * Completion on the keyword 'class' on a primitive array type + */ +public void testPrimitiveArrayType() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " int[].; \n" + + " } \n" + + "} \n", + // completeBehind: + "int[].", + // expectedCompletionNodeToString: + "<CompleteOnClassLiteralAccess:int[].>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnClassLiteralAccess:int[].>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "int[].", + // test name + "<complete on primitive array type member>" + ); +} +/* + * Completion on the keyword 'class' on a primitive array type where the + * keyword is non empty + */ +public void testPrimitiveArrayTypeWithNonEmptyIdentifier() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " int[].class; \n" + + " } \n" + + "} \n", + // completeBehind: + "int[].cl", + // expectedCompletionNodeToString: + "<CompleteOnClassLiteralAccess:int[].cl>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnClassLiteralAccess:int[].cl>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "cl", + // expectedReplacedSource: + "int[].class", + // test name + "<complete on primitive array type member with non empty identifier>" + ); +} +/* + * Completion on the keyword 'class' on a primitive type + */ +public void testPrimitiveType() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " int.; \n" + + " } \n" + + "} \n", + // completeBehind: + "int.", + // expectedCompletionNodeToString: + "<CompleteOnClassLiteralAccess:int.>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnClassLiteralAccess:int.>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "int.", + // test name + "<complete on primitive type member>" + ); +} +/* + * Completion on the keyword 'class' on a primitive type where the + * keyword is non empty + */ +public void testPrimitiveTypeWithNonEmptyIdentifier() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " int.class; \n" + + " } \n" + + "} \n", + // completeBehind: + "int.cl", + // expectedCompletionNodeToString: + "<CompleteOnClassLiteralAccess:int.cl>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnClassLiteralAccess:int.cl>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "cl", + // expectedReplacedSource: + "int.class", + // test name + "<complete on primitive type member with non empty identifier>" + ); +} +} 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 new file mode 100644 index 000000000..fcd6a2c09 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java @@ -0,0 +1,8637 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + +import junit.framework.Test; + +import org.eclipse.jdt.internal.codeassist.complete.*; + +public class CompletionParserTest extends AbstractCompletionTest { +public CompletionParserTest(String testName) { + super(testName); +} +static { +// TESTS_NAMES = new String[] { "testXA_1FGGUQF_1FHSL8H_1" }; +} +public static Test suite() { + return buildAllCompliancesTestSuite(CompletionParserTest.class); +} +public void testA() { + String str = + "package p; \n" + + "public class A {\n" + + " public void foo(\n" + + " java.util.Locale, \n" + + " java.util.Vector) {\n" + + " int i;\n" + + " if (i instanceof O) {\n" + + " }\n" + + " String s = \"hello\";\n" + + " s.}\n" + + "}\n"; + + String testName = "<complete on methods/fields>"; + String completeBehind = "s."; + String expectedCompletionNodeToString = "<CompleteOnName:s.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "s."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class A {\n" + + " public A() {\n" + + " }\n" + + " public void foo() {\n" + + " {\n" + + " int i;\n" + + " String s;\n" + + " <CompleteOnName:s.>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testAA_1() { + String str = + "package p; \n" + + "import something; \n" + + "import p2.; \n" + + "public class AA {\n" + + " void foo() {\n" + + " int maxUnits = 0;\n" + + " for (int i = 0; \n" + + " i < maxUnits; \n" + + " i++) {\n" + + " CompilationUnitResult unitResult = \n" + + " new CompilationUnitResult(\n" + + " null, \n" + + " i, \n" + + " maxUnits); \n" + + " }\n" + + " }\n" + + "}\n"; + + String completeBehind = "n"; + String expectedCompletionNodeToString = "<CompleteOnName:n>"; + String completionIdentifier = "n"; + String expectedUnitDisplayString = + "package p;\n" + + "import something;\n" + + "public class AA {\n" + + " public AA() {\n" + + " }\n" + + " void foo() {\n" + + " int maxUnits;\n" + + " int i;\n" + + " {\n" + + " CompilationUnitResult unitResult = <CompleteOnName:n>;\n" + + " }\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "new"; + String testName = "<complete on initializer (new)>"; + + int cursorLocation = str.indexOf("new CompilationUnitResult(") + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testAA_2() { + String str = + "package p; \n" + + "import something; \n" + + "import p2.; \n" + + "public class AA {\n" + + " void foo() {\n" + + " int maxUnits = 0;\n" + + " for (int i = 0; \n" + + " i < maxUnits; \n" + + " i++) {\n" + + " CompilationUnitResult unitResult = \n" + + " new CompilationUnitResult(\n" + + " null, \n" + + " i, \n" + + " maxUnits); \n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method call argument>"; + String completeBehind = "n"; + String expectedCompletionNodeToString = "<CompleteOnName:n>"; + String completionIdentifier = "n"; + String expectedReplacedSource = "null"; + int cursorLocation = str.indexOf("null, ") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import something;\n" + + "public class AA {\n" + + " public AA() {\n" + + " }\n" + + " void foo() {\n" + + " int maxUnits;\n" + + " int i;\n" + + " {\n" + + " CompilationUnitResult unitResult = new CompilationUnitResult(<CompleteOnName:n>);\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testAA_3() { + String str = + "package p; \n" + + "import something; \n" + + "import p2.; \n" + + "public class AA {\n" + + " void foo() {\n" + + " int maxUnits = 0;\n" + + " for (int i = 0; \n" + + " i < maxUnits; \n" + + " i++) {\n" + + " CompilationUnitResult unitResult = \n" + + " new CompilationUnitResult(\n" + + " null, \n" + + " i, \n" + + " maxUnits); \n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on call to constructor argument>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = "<CompleteOnName:i>"; + String completionIdentifier = "i"; + String expectedReplacedSource = "i"; + int cursorLocation = str.indexOf("i, ") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import something;\n" + + "public class AA {\n" + + " public AA() {\n" + + " }\n" + + " void foo() {\n" + + " int maxUnits;\n" + + " int i;\n" + + " {\n" + + " CompilationUnitResult unitResult = new CompilationUnitResult(null, <CompleteOnName:i>);\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testAA_4() { + String str = + "package p; \n" + + "import something; \n" + + "import p2.; \n" + + "public class AA {\n" + + " void foo() {\n" + + " int maxUnits = 0;\n" + + " for (int i = 0; \n" + + " i < maxUnits; \n" + + " i++) {\n" + + " CompilationUnitResult unitResult = \n" + + " new CompilationUnitResult(\n" + + " null, \n" + + " i, \n" + + " maxUnits); \n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on constructor call argument>"; + String completeBehind = "max"; + String expectedCompletionNodeToString = "<CompleteOnName:max>"; + String completionIdentifier = "max"; + String expectedReplacedSource = "maxUnits"; + int cursorLocation = str.indexOf("maxUnits); ") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import something;\n" + + "public class AA {\n" + + " public AA() {\n" + + " }\n" + + " void foo() {\n" + + " int maxUnits;\n" + + " int i;\n" + + " {\n" + + " CompilationUnitResult unitResult = new CompilationUnitResult(null, i, <CompleteOnName:max>);\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testAB_1FHU9LU() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHU9LU\n" + + " */\n" + + "class SuperClass {\n" + + " static void eFooStatic() {\n" + + " }\n" + + " void eFoo() {\n" + + " }\n" + + "}\n" + + "public class AB\n" + + " extends SuperClass {\n" + + " void eBar() {\n" + + " super.eFoo();\n" + + " }\n" + + "}\n"; + + String testName = "<complete on methods/fields from super class>"; + String completeBehind = "super."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:super.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "super."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class SuperClass {\n" + + " SuperClass() {\n" + + " }\n" + + " static void eFooStatic() {\n" + + " }\n" + + " void eFoo() {\n" + + " }\n" + + "}\n" + + "public class AB extends SuperClass {\n" + + " public AB() {\n" + + " }\n" + + " void eBar() {\n" + + " <CompleteOnMemberAccess:super.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testAC_1FJ8D9Z_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ8D9Z\n" + + " */\n" + + "import java.io.*;\n" + + "public class AC {\n" + + " AC() {\n" + + " }\n" + + " AC(int i) {\n" + + " }\n" + + " AC(int i, String s) {\n" + + " }\n" + + " void foo() {\n" + + " new AC(new File(\n" + + " new java\n" + + " .util\n" + + " .Vector(}\n" + + "}\n"; + + String testName = "<complete on constructor argument>"; + String completeBehind = "new AC("; + String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new AC()>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.io.*;\n" + + "public class AC {\n" + + " AC() {\n" + + " }\n" + + " AC(int i) {\n" + + " }\n" + + " AC(int i, String s) {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnAllocationExpression:new AC()>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testAC_1FJ8D9Z_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ8D9Z\n" + + " */\n" + + "import java.io.*;\n" + + "public class AC {\n" + + " AC() {\n" + + " }\n" + + " AC(int i) {\n" + + " }\n" + + " AC(int i, String s) {\n" + + " }\n" + + " void foo() {\n" + + " new AC(new File(\n" + + " new java\n" + + " .util\n" + + " .Vector(}\n" + + "}\n"; + + String testName = "<complete on constructor argument>"; + String completeBehind = "new File("; + String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new File()>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.io.*;\n" + + "public class AC {\n" + + " AC() {\n" + + " }\n" + + " AC(int i) {\n" + + " }\n" + + " AC(int i, String s) {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnAllocationExpression:new File()>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testAC_1FJ8D9Z_3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ8D9Z\n" + + " */\n" + + "import java.io.*;\n" + + "public class AC {\n" + + " AC() {\n" + + " }\n" + + " AC(int i) {\n" + + " }\n" + + " AC(int i, String s) {\n" + + " }\n" + + " void foo() {\n" + + " new AC(new File(\n" + + " new java.util.Vector(}\n" + + "}\n"; + + String testName = "<complete on constructor argument>"; + String completeBehind = "new java.util.Vector("; + String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new java.util.Vector()>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.io.*;\n" + + "public class AC {\n" + + " AC() {\n" + + " }\n" + + " AC(int i) {\n" + + " }\n" + + " AC(int i, String s) {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnAllocationExpression:new java.util.Vector()>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testB() { + String str = + "package p; \n" + + "public class B {\n" + + " Object o = new Object }\n"; + + String testName = "<complete on type into type creation>"; + String completeBehind = "new Object"; + String expectedCompletionNodeToString = "<CompleteOnType:Object>"; + String completionIdentifier = "Object"; + String expectedReplacedSource = "Object"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class B {\n" + + " Object o = new <CompleteOnType:Object>();\n" + + " public B() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testBA_1() { + String str = + "package p; \n" + + "public class BA {\n" + + " void foo() {\n" + + " java.util.Vector v2;\n" + + " java.util.Vector v1;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on package name>"; + String completeBehind = "java."; + String expectedCompletionNodeToString = "<CompleteOnName:java.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "java."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class BA {\n" + + " public BA() {\n" + + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:java.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testBA_2() { + String str = + "package p; \n" + + "public class BA {\n" + + " void foo() {\n" + + " java.util.Vector v2;\n" + + " java.util.Vector v1;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on package contents>"; + String completeBehind = "java.util."; + String expectedCompletionNodeToString = "<CompleteOnName:java.util.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "java.util."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class BA {\n" + + " public BA() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:java.util.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testBB_1FHJ8H9() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHJ8H9\n" + + " */\n" + + "public class BB {\n" + + " void bar() {\n" + + " f }\n" + + "}\n"; + + String testName = "<complete on method/field from implicit method call>"; + String completeBehind = "f"; + String expectedCompletionNodeToString = "<CompleteOnName:f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class BB {\n" + + " public BB() {\n" + + " }\n" + + " void bar() {\n" + + " <CompleteOnName:f>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testBC_1FJ4GSG_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ4GSG\n" + + " */\n" + + "import java.util.Vector;\n" + + "public class BC {\n" + + " int Value1 = 0;\n" + + " interface Constants {\n" + + " int OK = 1;\n" + + " int CANCEL = 2;\n" + + " }\n" + + " void foo() {\n" + + " Vector v = \n" + + " new Vector(\n" + + " Value1, \n" + + " BC.Constants.OK\n" + + " | BC.Constants.CANCEL); \n" + + " Object ans = v.elementAt(1);\n" + + " }\n" + + "}\n"; + + String testName = "<complete on member type>"; + String completeBehind = "BC."; + String expectedCompletionNodeToString = "<CompleteOnName:BC.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "BC."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.util.Vector;\n" + + "public class BC {\n" + + " interface Constants {\n" + + " int OK;\n" + + " int CANCEL;\n" + + " <clinit>() {\n" + + " }\n" + + " }\n" + + " int Value1;\n" + + " public BC() {\n" + + " }\n" + + " void foo() {\n" + + " Vector v = new Vector(Value1, <CompleteOnName:BC.>);\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testBC_1FJ4GSG_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ4GSG\n" + + " */\n" + + "import java.util.Vector;\n" + + "public class BC {\n" + + " int Value1 = 0;\n" + + " interface Constants {\n" + + " int OK = 1;\n" + + " int CANCEL = 2;\n" + + " }\n" + + " void foo() {\n" + + " Vector v = \n" + + " new Vector(\n" + + " Value1, \n" + + " BC.Constants.OK\n" + + " | BC.Constants.CANCEL); \n" + + " Object ans = v.elementAt(1);\n" + + " }\n" + + "}\n"; + + String testName = "<complete on member type method/field>"; + String completeBehind = "| BC.Constants."; + String expectedCompletionNodeToString = "<CompleteOnName:BC.Constants.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "BC.Constants."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.util.Vector;\n" + + "public class BC {\n" + + " interface Constants {\n" + + " int OK;\n" + + " int CANCEL;\n" + + " <clinit>() {\n" + + " }\n" + + " }\n" + + " int Value1;\n" + + " public BC() {\n" + + " }\n" + + " void foo() {\n" + + " Vector v = (BC.Constants.OK | <CompleteOnName:BC.Constants.>);\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testBC_1FJ4GSG_3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ4GSG\n" + + " */\n" + + "import java.util.Vector;\n" + + "public class BC {\n" + + " int Value1 = 0;\n" + + " interface Constants {\n" + + " int OK = 1;\n" + + " int CANCEL = 2;\n" + + " }\n" + + " void foo() {\n" + + " Vector v = \n" + + " new Vector(\n" + + " Value1, \n" + + " BC.Constants.OK\n" + + " | BC.Constants.CANCEL); \n" + + " Object ans = v.elementAt(1);\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "v."; + String expectedCompletionNodeToString = "<CompleteOnName:v.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "v."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.util.Vector;\n" + + "public class BC {\n" + + " interface Constants {\n" + + " int OK;\n" + + " int CANCEL;\n" + + " <clinit>() {\n" + + " }\n" + + " }\n" + + " int Value1;\n" + + " public BC() {\n" + + " }\n" + + " void foo() {\n" + + " Vector v;\n" + + " Object ans = <CompleteOnName:v.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testC() { + String str = + "package p; \n" + + "public class C {\n" + + " void foo() {\n" + + " String string = n;\n" + + " }\n" + + "}\n"; + + String completeBehind = "= n"; + String expectedCompletionNodeToString = "<CompleteOnName:n>"; + String completionIdentifier = "n"; + String expectedUnitDisplayString = + "package p;\n" + + "public class C {\n" + + " public C() {\n" + + " }\n" + + " void foo() {\n" + + " String string = <CompleteOnName:n>;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "n"; + String testName = "<complete on local variable initializer>"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testCA_1FGPJQZ() { + String str = + "package p; \n" + + "import p2.X; \n" + + "/**\n" + + " * 1FGPJQZ\n" + + " */\n" + + "public class CA {\n" + + " void moo() {\n" + + " unknownField.}\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "unknownField."; + String expectedCompletionNodeToString = "<CompleteOnName:unknownField.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "unknownField."; + String expectedUnitDisplayString = + "package p;\n" + + "import p2.X;\n" + + "public class CA {\n" + + " public CA() {\n" + + " }\n" + + " void moo() {\n" + + " <CompleteOnName:unknownField.>;\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testCB_1FHSKQ9_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHSKQ9\n" + + " */\n" + + "public class CB {\n" + + " void foo() {\n" + + " int i = 0;\n" + + " int[] tab1 = new int[10];\n" + + " int j = tab1[i];\n" + + " System.out.println(\n" + + " \" \" + (i + 1)); \n" + + " }\n" + + "}\n"; + + String testName = "<complete on method call argument>"; + String completeBehind = "+ (i"; + String expectedCompletionNodeToString = "<CompleteOnName:i>"; + String completionIdentifier = "i"; + String expectedReplacedSource = "i"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class CB {\n" + + " public CB() {\n" + + " }\n" + + " void foo() {\n" + + " int i;\n" + + " int[] tab1;\n" + + " int j;\n" + + " (\" \" + <CompleteOnName:i>);\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testCB_1FHSKQ9_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHSKQ9\n" + + " */\n" + + "public class CB {\n" + + " void foo() {\n" + + " int i = 0;\n" + + " int[] tab1 = new int[10];\n" + + " int j = tab1[i];\n" + + " System.out.println(\n" + + " \" \" + (i + 1)); \n" + + " }\n" + + "}\n"; + + String completeBehind = "i + 1"; + String expectedCompletionNodeToString = NONE; + String completionIdentifier = ""; + String expectedUnitDisplayString = null; + String expectedReplacedSource = NONE; + String testName = "<complete on digit into method call argument>"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + + try { + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); + assertTrue("failed to detect invalid cursor location", false); + } catch(InvalidCursorLocation e){ + assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_NUMBER); + } +} +public void testCC_1FJ64I9() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ64I9\n" + + " */\n" + + "class CCHelper {\n" + + " class Member1 {\n" + + " }\n" + + " class Member2 {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class CC {\n" + + " void foo() {\n" + + " new CCHelper()\n" + + " .new CCHelper()\n" + + " .new M }\n" + + "}\n"; + + String testName = "<complete on qualified member type>"; + String completeBehind = ".new M"; + String expectedCompletionNodeToString = "<CompleteOnType:M>"; + String completionIdentifier = "M"; + String expectedReplacedSource = "M"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class CCHelper {\n" + + " class Member1 {\n" + + " Member1() {\n" + + " }\n" + + " }\n" + + " class Member2 {\n" + + " Member2() {\n" + + " }\n" + + " }\n" + + " CCHelper() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class CC {\n" + + " public CC() {\n" + + " }\n" + + " void foo() {\n" + + " new CCHelper().new CCHelper().new <CompleteOnType:M>();\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testD_1() { + String str = + "package p; \n" + + "import java.util.*;\n" + + "public class D {\n" + + " static int i;\n" + + " static {\n" + + " i = 5;\n" + + " }\n" + + " public int j;\n" + + " Vector a = new Vector();\n" + + " void foo(String s) {\n" + + " String string = null;\n" + + " int soso;\n" + + " float f;\n" + + " string.regionMatches(\n" + + " 0, \n" + + " \"\", \n" + + " 0, \n" + + " 0); \n" + + " }\n" + + "}\n"; + + String testName = "<complete on variable into type initializer>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = "<CompleteOnName:i>"; + String completionIdentifier = "i"; + String expectedReplacedSource = "i"; + int cursorLocation = str.indexOf("i = 5;") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.util.*;\n" + + "public class D {\n" + + " static int i;\n" + + " static {\n" + + " <CompleteOnName:i>;\n" + + " }\n" + + " public int j;\n" + + " Vector a;\n" + + " <clinit>() {\n" + + " }\n" + + " public D() {\n" + + " }\n" + + " void foo(String s) {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testD_2() { + String str = + "package p; \n" + + "import java.util.*;\n" + + "public class D {\n" + + " static int i;\n" + + " static {\n" + + " i = 5;\n" + + " }\n" + + " public int j;\n" + + " Vector a = new Vector();\n" + + " void foo(String s) {\n" + + " String string = null;\n" + + " int soso;\n" + + " float f;\n" + + " string.regionMatches(\n" + + " 0, \n" + + " \"\", \n" + + " 0, \n" + + " 0); \n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "string."; + String expectedCompletionNodeToString = "<CompleteOnName:string.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "string."; + String expectedUnitDisplayString = + "package p;\n" + + "import java.util.*;\n" + + "public class D {\n" + + " static int i;\n" + + " static {\n" + + " }\n" + + " public int j;\n" + + " Vector a;\n" + + " <clinit>() {\n" + + " }\n" + + " public D() {\n" + + " }\n" + + " void foo(String s) {\n" + + " String string;\n" + + " int soso;\n" + + " float f;\n" + + " <CompleteOnName:string.>;\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testDA_1() { + String str = + "package p; \n" + + "public class DA {\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " };\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field into anonymous declaration>"; + String completeBehind = "v"; + String expectedCompletionNodeToString = "<CompleteOnName:v>"; + String completionIdentifier = "v"; + String expectedReplacedSource = "v"; + int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class DA {\n" + + " public DA() {\n" + + " }\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111;\n" + + " <CompleteOnName:v>;\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testDA_2() { + String str = + "package p; \n" + + "public class DA {\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " };\n" + + " }\n" + + "}\n"; + + String completeBehind = "protected v"; + String expectedCompletionNodeToString = "<CompleteOnType:v>"; + String completionIdentifier = "v"; + String expectedUnitDisplayString = + "package p;\n" + + "public class DA {\n" + + " public DA() {\n" + + " }\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " <CompleteOnType:v>;\n" + + " runTest() {\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "void"; + String testName = "<complete on return type into anonymous declaration>"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testDA_3() { + String str = + "package p; \n" + + "public class DA {\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " };\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method selector into anonymous declaration>"; + String completeBehind = "r"; + String expectedCompletionNodeToString = "<CompleteOnFieldName:void r>;"; + String completionIdentifier = "r"; + String expectedReplacedSource = "runTest"; + int cursorLocation = str.indexOf("runTest") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class DA {\n" + + " public DA() {\n" + + " }\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " <CompleteOnFieldName:void r>;\n" + + " {\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testDA_4() { + String str = + "package p; \n" + + "public class DA {\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " };\n" + + " }\n" + + "}\n"; + + String testName = "<complete on local variable type into anonymous declaration>"; + String completeBehind = "V"; + String expectedCompletionNodeToString = "<CompleteOnName:V>"; + String completionIdentifier = "V"; + String expectedReplacedSource = "Vector"; + int cursorLocation = str.indexOf("Vector v11111") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class DA {\n" + + " public DA() {\n" + + " }\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " protected void runTest() {\n" + + " <CompleteOnName:V>;\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testDA_5() { + String str = + "package p; \n" + + "public class DA {\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " };\n" + + " }\n" + + "}\n"; + + String testName = "<complete on local type into anonymous declaration>"; + String completeBehind = "v"; + String expectedCompletionNodeToString = "<CompleteOnName:v>"; + String completionIdentifier = "v"; + String expectedReplacedSource = "v"; + int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class DA {\n" + + " public DA() {\n" + + " }\n" + + " void foo() {\n" + + " new TestCase(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111;\n" + + " <CompleteOnName:v>;\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testDB_1FHSLDR() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHSLDR\n" + + " */\n" + + "public class DB {\n" + + " void foo() {\n" + + " try {\n" + + " System.out.println(\"\");\n" + + " }\n" + + " fi }\n" + + "}\n"; + + String testName = "<complete on finally keyword>"; + String completeBehind = "fi"; + String expectedCompletionNodeToString = "<CompleteOnKeyword:fi>"; + String completionIdentifier = "fi"; + String expectedReplacedSource = "fi"; + int cursorLocation = str.indexOf("fi }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class DB {\n" + + " public DB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnKeyword:fi>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testDC_1FJJ0JR_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJJ0JR\n" + + " */\n" + + "public class DC\n" + + " extends ModelChangeOperation {\n" + + " ISec public SetSecondarySourceOperation(\n" + + " ISecondarySourceContainer element, \n" + + " VersionID id) {\n" + + " }\n" + + " protected abstract void doExecute(IProgressMonitor monitor)\n" + + " throws OperationFailedException {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method return type>"; + String completeBehind = "ISec"; + String expectedCompletionNodeToString = "<CompleteOnType:ISec>"; + String completionIdentifier = "ISec"; + String expectedReplacedSource = "ISec"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class DC extends ModelChangeOperation {\n" + + " <CompleteOnType:ISec>;\n" + + " public DC() {\n" + + " }\n" + + " public SetSecondarySourceOperation(ISecondarySourceContainer element, VersionID id) {\n" + + " }\n" + + " protected abstract void doExecute(IProgressMonitor monitor) throws OperationFailedException;\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testE_1FG1YDS_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FG1YDS\n" + + " */\n" + + "public class E {\n" + + " {\n" + + " new Y()\n" + + " }\n" + + " {\n" + + " new Y().}\n" + + " class Y\n" + + " extends java.util.Vector {\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on type into type creation>"; + String completeBehind = "Y"; + String expectedCompletionNodeToString = "<CompleteOnType:Y>"; + String completionIdentifier = "Y"; + String expectedReplacedSource = "Y"; + String expectedUnitDisplayString = + "package p;\n" + + "public class E {\n" + + " class Y extends java.util.Vector {\n" + + " Y() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " {\n" + + " new <CompleteOnType:Y>();\n" + + " }\n" + + " {\n" + + " }\n" + + " public E() {\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf("Y()\n") + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testE_1FG1YDS_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FG1YDS\n" + + " */\n" + + "public class E {\n" + + " {\n" + + " new Y()\n" + + " }\n" + + " {\n" + + " new Y().}\n" + + " class Y\n" + + " extends java.util.Vector {\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on implicit method call into intializer>"; + String completeBehind = "new Y()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "package p;\n" + + "public class E {\n" + + " class Y extends java.util.Vector {\n" + + " Y() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " {\n" + + " }\n" + + " {\n" + + " <CompleteOnMemberAccess:new Y().>;\n" + + " }\n" + + " public E() {\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testE_1FG1YDS_3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FG1YDS\n" + + " */\n" + + "public class E {\n" + + " {\n" + + " new Y()\n" + + " }\n" + + " {\n" + + " new Y().}\n" + + " class Y\n" + + " extends java.util.Vector {\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on extend type>"; + String completeBehind = "java.util."; + String expectedCompletionNodeToString = "<CompleteOnClass:java.util.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "java.util.Vector"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class E {\n" + + " class Y extends <CompleteOnClass:java.util.> {\n" + + " Y() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " {\n" + + " }\n" + + " {\n" + + " }\n" + + " public E() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testEA_1() { + String str = + "package p; \n" + + "public class EA {\n" + + " void foo() {\n" + + " try {\n" + + " throw new Error();\n" + + " } catch (Exception eeee) {\n" + + " eeee.}\n" + + " }\n" + + "}\n"; + + String testName = "<complete on catch block exception type declaration>"; + String completeBehind = "E"; + String expectedCompletionNodeToString = "<CompleteOnException:E>"; + String completionIdentifier = "E"; + String expectedReplacedSource = "Exception"; + String expectedUnitDisplayString = + "package p;\n" + + "public class EA {\n" + + " public EA() {\n" + + " }\n" + + " void foo() {\n" + + " try \n" + + " {\n" + + " throw new Error();\n" + + " }\n" + + " catch (<CompleteOnException:E> ) {\n" + + " }\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf("Exception eeee") + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testEA_2() { + String str = + "package p; \n" + + "public class EA {\n" + + " void foo() {\n" + + " try {\n" + + " throw new Error();\n" + + " } catch (Exception eeee) {\n" + + " eeee.}\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of thrown exception into catch block>"; + String completeBehind = "eeee."; + String expectedCompletionNodeToString = "<CompleteOnName:eeee.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "eeee."; + String expectedUnitDisplayString = + "package p;\n" + + "public class EA {\n" + + " public EA() {\n" + + " }\n" + + " void foo() {\n" + + " {\n" + + " Exception eeee;\n" + + " <CompleteOnName:eeee.>;\n" + + " }\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testEB_1FI74S3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FI74S3\n" + + " */\n" + + "public class EB {\n" + + " int[] table;\n" + + " void foo() {\n" + + " int x = table.}\n" + + "}\n"; + + String testName = "<complete on method/field of array>"; + String completeBehind = "table."; + String expectedCompletionNodeToString = "<CompleteOnName:table.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "table."; + String expectedUnitDisplayString = + "package p;\n" + + "public class EB {\n" + + " int[] table;\n" + + " public EB() {\n" + + " }\n" + + " void foo() {\n" + + " int x = <CompleteOnName:table.>;\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testEC_1FSBZ2Y() { + String str = + "package p; \n" + + "/**\n" + + " * 1FSBZ2Y\n" + + " */\n" + + "class EC {\n" + + " void foo() {\n" + + " EC\n" + + " }\n" + + "}\n" + + "class ECOtherTopLevel {\n" + + "}\n"; + + String testName = "<complete on local variable decaration type>"; + String completeBehind = "EC"; + String expectedCompletionNodeToString = "<CompleteOnName:EC>"; + String completionIdentifier = "EC"; + String expectedReplacedSource = "EC"; + String expectedUnitDisplayString = + "package p;\n" + + "class EC {\n" + + " EC() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:EC>;\n" + + " }\n" + + "}\n" + + "class ECOtherTopLevel {\n" + + " ECOtherTopLevel() {\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf("EC\n") + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testF() { + String str = + "package p; \n" + + "public class F {\n" + + " void bar() {\n" + + " }\n" + + " class Y {\n" + + " void foo() {\n" + + " ba }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field explicit access>"; + String completeBehind = "ba"; + String expectedCompletionNodeToString = "<CompleteOnName:ba>"; + String completionIdentifier = "ba"; + String expectedReplacedSource = "ba"; + String expectedUnitDisplayString = + "package p;\n" + + "public class F {\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:ba>;\n" + + " }\n" + + " }\n" + + " public F() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf("ba }") + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testFA_1() { + String str = + "package p; \n" + + "public class FA {\n" + + " byte value;\n" + + " public float foo() {\n" + + " return (float) value;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on cast expression type>"; + String completeBehind = "f"; + String expectedCompletionNodeToString = "<CompleteOnName:f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "float"; + String expectedUnitDisplayString = + "package p;\n" + + "public class FA {\n" + + " byte value;\n" + + " public FA() {\n" + + " }\n" + + " public float foo() {\n" + + " <CompleteOnName:f>;\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf("float)") + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testFA_2() { + String str = + "package p; \n" + + "public class FA {\n" + + " byte value;\n" + + " public float foo() {\n" + + " return (float) value; \n" + + " }\n" + + "}\n"; + + String testName = "<complete on returned value>"; + String completeBehind = "v"; + String expectedCompletionNodeToString = "<CompleteOnName:v>"; + String completionIdentifier = "v"; + String expectedReplacedSource = "value"; + String expectedUnitDisplayString = + "package p;\n" + + "public class FA {\n" + + " byte value;\n" + + " public FA() {\n" + + " }\n" + + " public float foo() {\n" + + " (float) <CompleteOnName:v>;\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf("value; \n") + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testFB_1FI74S3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FI74S3\n" + + " */\n" + + "public class FB {\n" + + " int[] table;\n" + + " void foo() {\n" + + " int x = table[1].}\n" + + "}\n"; + + String testName = "<complete on method/field of array element>"; + String completeBehind = "table[1]."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:table[1].>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "package p;\n" + + "public class FB {\n" + + " int[] table;\n" + + " public FB() {\n" + + " }\n" + + " void foo() {\n" + + " int x = <CompleteOnMemberAccess:table[1].>;\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testFC_1FSBZ9B() { + String str = + "package p; \n" + + "/**\n" + + " * 1FSBZ9B\n" + + " */\n" + + "class FC {\n" + + " UNKOWNTYPE field;\n" + + " void foo() {\n" + + " f\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field implicit access>"; + String completeBehind = "f"; + String expectedCompletionNodeToString = "<CompleteOnName:f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + int cursorLocation = str.indexOf("f\n") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class FC {\n" + + " UNKOWNTYPE field;\n" + + " FC() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:f>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testG() { + String str = + "package p; \n" + + "public class G {\n" + + " int bar() {\n" + + " }\n" + + " class Y {\n" + + " void foo(int b) {\n" + + " return b }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on return value>"; + String completeBehind = "b"; + String expectedCompletionNodeToString = "<CompleteOnName:b>"; + String completionIdentifier = "b"; + String expectedReplacedSource = "b"; + String expectedUnitDisplayString = + "package p;\n" + + "public class G {\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " void foo(int b) {\n" + + " return <CompleteOnName:b>;\n" + + " }\n" + + " }\n" + + " public G() {\n" + + " }\n" + + " int bar() {\n" + + " }\n" + + "}\n"; + + int cursorLocation = str.indexOf("b }") + completeBehind.length() - 1; + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testGA() { + String str = + "package p; \n" + + "public class GA {\n" + + " void foo(String s) {\n" + + " String string = s;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on local variable initializer>"; + String completeBehind = "s"; + String expectedCompletionNodeToString = "<CompleteOnName:s>"; + String completionIdentifier = "s"; + String expectedReplacedSource = "s"; + int cursorLocation = str.indexOf("s;") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class GA {\n" + + " public GA() {\n" + + " }\n" + + " void foo(String s) {\n" + + " String string = <CompleteOnName:s>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testGB_1FI74S3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FI74S3\n" + + " */\n" + + "public class GB {\n" + + " String[] table;\n" + + " void foo() {\n" + + " int x = table[1].}\n" + + "}\n"; + + String testName = "<complete on method/field of array element>"; + String completeBehind = "table[1]."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:table[1].>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class GB {\n" + + " String[] table;\n" + + " public GB() {\n" + + " }\n" + + " void foo() {\n" + + " int x = <CompleteOnMemberAccess:table[1].>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testGC_1FSHLHV_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FSHLHV\n" + + " */\n" + + "public class GC {\n" + + "public static void main(String[] args) {\n" + + " Object l = new Object() {\n" + + " public void handleEvent(String[] event) {\n" + + " String s = new String();\n" + + " s.\n" + + " try {\n" + + " event.;\n" + + " }\n" + + " catch (Exception e) {\n" + + " e.\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n" + + "}\n"; + + String testName = "<complete on anonymous declaration type>"; + String completeBehind = "O"; + String expectedCompletionNodeToString = "<CompleteOnType:O>"; + String completionIdentifier = "O"; + String expectedReplacedSource = "Object"; + int cursorLocation = str.indexOf("Object()") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class GC {\n" + + " public GC() {\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " Object l = new <CompleteOnType:O>();\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testGC_1FSHLHV_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FSHLHV\n" + + " */\n" + + "public class GC {\n" + + "public static void main(String[] args) {\n" + + " Object l = new Object() {\n" + + " public void handleEvent(String[] event) {\n" + + " String s = new String();\n" + + " s.\n" + + " try {\n" + + " event.;\n" + + " }\n" + + " catch (Exception e) {\n" + + " e.\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n" + + "}\n"; + + String testName = "<complete on method/field of local variable into anonymous declaration>"; + String completeBehind = "s."; + String expectedCompletionNodeToString = "<CompleteOnName:s.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "s."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class GC {\n" + + " public GC() {\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " Object l;\n" + + " new Object() {\n" + + " public void handleEvent(String[] event) {\n" + + " String s;\n" + + " <CompleteOnName:s.>;\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testGC_1FSHLHV_3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FSHLHV\n" + + " */\n" + + "public class GC {\n" + + "public static void main(String[] args) {\n" + + " Object l = new Object() {\n" + + " public void handleEvent(String[] event) {\n" + + " String s = new String();\n" + + " s.\n" + + " try {\n" + + " event.;\n" + + " }\n" + + " catch (Exception e) {\n" + + " e.\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n" + + "}\n"; + + String testName = "<complete on method/field of array>"; + String completeBehind = "event."; + String expectedCompletionNodeToString = "<CompleteOnName:event.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "event."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class GC {\n" + + " public GC() {\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " Object l;\n" + + " new Object() {\n" + + " public void handleEvent(String[] event) {\n" + + " String s;\n" + + " {\n" + + " <CompleteOnName:event.>;\n" + + " }\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testGC_1FSHLHV_4() { + String str = + "package p; \n" + + "/**\n" + + " * 1FSHLHV\n" + + " */\n" + + "public class GC {\n" + + "public static void main(String[] args) {\n" + + " Object l = new Object() {\n" + + " public void handleEvent(String[] event) {\n" + + " String s = new String();\n" + + " s.\n" + + " try {\n" + + " event.;\n" + + " }\n" + + " catch (Exception e) {\n" + + " e.\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n" + + "}\n"; + + String testName = "<complete on method/field of thrown exception into catch block into anonymous declaration>"; + String completeBehind = "e."; + String expectedCompletionNodeToString = "<CompleteOnName:e.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "e."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class GC {\n" + + " public GC() {\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " Object l;\n" + + " new Object() {\n" + + " public void handleEvent(String[] event) {\n" + + " String s;\n" + + " {\n" + + " Exception e;\n" + + " <CompleteOnName:e.>;\n" + + " }\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testH() { + String str = + "package p; \n" + + "public class H {\n" + + " void foo(boolean bbbb) {\n" + + " while (Xbm }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on while keyword argument>"; + String completeBehind = "Xbm"; + String expectedCompletionNodeToString = "<CompleteOnName:Xbm>"; + String completionIdentifier = "Xbm"; + String expectedReplacedSource = "Xbm"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class H {\n" + + " public H() {\n" + + " }\n" + + " void foo(boolean bbbb) {\n" + + " while (<CompleteOnName:Xbm>) ;\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testHA_1() { + String str = + "package p; \n" + + "public class HA {\n" + + " void foo() {\n" + + " x.y.Z[] field1; \n" + + " field1[1].}\n" + + "}\n"; + + String testName = "<complete on package member type>"; + String completeBehind = "x.y."; + String expectedCompletionNodeToString = "<CompleteOnName:x.y.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "x.y."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class HA {\n" + + " public HA() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:x.y.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testHA_2() { + String str = + "package p; \n" + + "public class HA {\n" + + " void foo() {\n" + + " x.y.Z[] field1; \n" + + " field1[1].}\n" + + "}\n"; + + String testName = "<complete on method/field of array element>"; + String completeBehind = "field1[1]."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:field1[1].>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class HA {\n" + + " public HA() {\n" + + " }\n" + + " void foo() {\n" + + " x.y.Z[] field1;\n" + + " <CompleteOnMemberAccess:field1[1].>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testHB_1FHSLDR() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHSLDR\n" + + " */\n" + + "public class HB {\n" + + " void foo() {\n" + + " for (; i < totalUnits; i++) {\n" + + " unit = unitsToProcess[i];\n" + + " try {\n" + + " if (options.verbose) {\n" + + " System.out.println(\n" + + " \"process \"\n" + + " + (i + 1)\n" + + " + \"/\"\n" + + " + totalUnits\n" + + " + \" : \"\n" + + " + unitsToProcess[i]\n" + + " .sourceFileName()); \n" + + " }\n" + + " process(unit, i);\n" + + " }\n" + + " fi }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on finally keyword>"; + String completeBehind = "fi"; + String expectedCompletionNodeToString = "<CompleteOnKeyword:fi>"; + String completionIdentifier = "fi"; + String expectedReplacedSource = "fi"; + int cursorLocation = str.indexOf("fi }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class HB {\n" + + " public HB() {\n" + + " }\n" + + " void foo() {\n" + + " {\n" + + " <CompleteOnKeyword:fi>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testHC_1FMPYO3_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FMPYO3\n" + + " */\n" + + "class HC {\n" + + " HC(Object o){}\n" + + " void foo(){\n" + + " HC a = new HC(new Object()).\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of object creation>"; + String completeBehind = "new HC(new Object())."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new HC(new Object()).>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class HC {\n" + + " HC(Object o) {\n" + + " }\n" + + " void foo() {\n" + + " HC a = <CompleteOnMemberAccess:new HC(new Object()).>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testHC_1FMPYO3_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FMPYO3\n" + + " */\n" + + "class HC {\n" + + " HC(Object o){}\n" + + " void foo(){\n" + + " A a = new A(new Object()).\n" + + " }\n" + + "}\n"; + + String testName = "<complete on object of nested object creation declaration>"; + String completeBehind = "O"; + String expectedCompletionNodeToString = "<CompleteOnType:O>"; + String completionIdentifier = "O"; + String expectedReplacedSource = "Object"; + int cursorLocation = str.indexOf("Object()") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class HC {\n" + + " HC(Object o) {\n" + + " }\n" + + " void foo() {\n" + + " A a = new A(new <CompleteOnType:O>());\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testI() { + String str = + "package p; \n" + + "public class I {\n" + + " Component }\n"; + + String testName = "<complete on incomplete field declaration type>"; + String completeBehind = "C"; + String expectedCompletionNodeToString = "<CompleteOnType:C>"; + String completionIdentifier = "C"; + String expectedReplacedSource = "Component"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class I {\n" + + " <CompleteOnType:C>;\n" + + " public I() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testIA_1FGNBPR_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGNBPR\n" + + " */\n" + + "public class IA {\n" + + " void foo1() {\n" + + " label1 : while (true) {\n" + + " class A {\n" + + " void foo2() {\n" + + " label2 : while (true) {\n" + + " break la }\n" + + " }\n" + + " }\n" + + " A a = new A();\n" + + " break la }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on label name>"; + String completeBehind = "la"; + String expectedCompletionNodeToString = "break <CompleteOnLabel:la>;"; + String completionIdentifier = "la"; + String expectedReplacedSource = "la"; + int cursorLocation = str.indexOf("la }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class IA {\n" + + " public IA() {\n" + + " }\n" + + " void foo1() {\n" + + " {\n" + + " class A {\n" + + " A() {\n" + + " }\n" + + " void foo2() {\n" + + " break <CompleteOnLabel:la>;\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testIA_1FGNBPR_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGNBPR\n" + + " */\n" + + "public class IA {\n" + + " void foo1() {\n" + + " label1 : while (true) {\n" + + " class A {\n" + + " void foo2() {\n" + + " label2 : while (true) {\n" + + " break la }\n" + + " }\n" + + " }\n" + + " A a = new A();\n" + + " break la }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on label name>"; + String completeBehind = "la"; + String expectedCompletionNodeToString = "break <CompleteOnLabel:la>;"; + String completionIdentifier = "la"; + String expectedReplacedSource = "la"; + int cursorLocation = str.indexOf("la }", str.indexOf("la }") + 1) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class IA {\n" + + " public IA() {\n" + + " }\n" + + " void foo1() {\n" + + " {\n" + + " class A {\n" + + " A() {\n" + + " super();\n" + // could be optimized out ? + " }\n" + + " void foo2() {\n" + + " }\n" + + " }\n" + + " A a;\n" + + " break <CompleteOnLabel:la>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testIB() { + String str = + "package p; \n" + + "public class IB {\n" + + " UnknownFieldTYPE field;\n" + + " void foo() {\n" + + " field.}\n" + + "}\n"; + + String testName = "<complete on method/field of field of unkown type>"; + String completeBehind = "field."; + String expectedCompletionNodeToString = "<CompleteOnName:field.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "field."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class IB {\n" + + " UnknownFieldTYPE field;\n" + + " public IB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:field.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testIC_1FMGUPR() { + String str = + "package p; \n" + + "/**\n" + + " * 1FMGUPR\n" + + " */\n" + + "public class IC {\n" + + " void foo(){\n" + + " new String().toString().\n" + + " }\n" + + "}\n"; + + String testName = "<complete on multiple method/field call>"; + String completeBehind = "new String().toString()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String().toString().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class IC {\n" + + " public IC() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:new String().toString().>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testJ() { + String str = + "package p; \n" + + "public class J {\n" + + " int foo1()[void foo2() int i;\n" + + " void foo3() {\n" + + " f }\n"; + + String testName = "<complete on method/field access into corrupted method declaration>"; + String completeBehind = "f"; + String expectedCompletionNodeToString = "<CompleteOnName:f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class J {\n" + + " public J() {\n" + + " }\n" + + " int foo1() {\n" + + " }\n" + + " void foo2() {\n" + + " }\n" + + " void foo3() {\n" + + " <CompleteOnName:f>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testJA_1FGQVW2_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGQVW2\n" + + " */\n" + + "public class JA {\n" + + " void foo() {\n" + + " \"abc.txt\". 'a'.}\n" + + "}\n"; + + String testName = "<complete on string literal>"; + String completeBehind = "\"abc.txt\"."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:\"abc.txt\".>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class JA {\n" + + " public JA() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:\"abc.txt\".>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testJA_1FGQVW2_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGQVW2\n" + + " */\n" + + "public class JA {\n" + + " void foo() {\n" + + " \"abc.txt\". 'a'.}\n" + + "}\n"; + + String testName = "<complete on char literal>"; + String completeBehind = "'a'."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:'a'.>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class JA {\n" + + " public JA() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:'a'.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testJB() { + String str = + "package p; \n" + + "public class JB\n" + + " extends UnknownSUPERCLASS\n" + + " implements UnknownSUPERINTERFACE {\n" + + " void foo() {\n" + + " f }\n" + + "}\n"; + + String testName = "<complete into method declared into corrupted class declaration>"; + String completeBehind = "f"; + String expectedCompletionNodeToString = "<CompleteOnName:f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class JB extends UnknownSUPERCLASS implements UnknownSUPERINTERFACE {\n" + + " public JB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:f>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testJC_1FLG1ZC() { + String str = + "package p; \n" + + "/**\n" + + " * 1FLG1ZC\n" + + " */\n" + + "public class JC {\n" + + " void foo() {\n" + + " new String ().\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of object creation with dummy spaces>"; + String completeBehind = "new String ()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class JC {\n" + + " public JC() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:new String().>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testK_1() { + String str = + "package p; \n" + + "class Other {\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class K {\n" + + " public static void main(\n" + + " java.lang.String[] args) {\n" + + " java.io.File bbbb = \n" + + " new File(\"c:\\abc.txt\"); \n" + + " O bb bbbb.}\n" + + "}\n"; + +// str = +// "public class K {\n" + +// " void foo() {\n" + +// " new X(\"c:abc.txt\"); \n" + +// " O" + +// " }\n" + +// "}\n"; + + String testName = "<complete on corrupted local variable declaration>"; + String completeBehind = " O"; + String expectedCompletionNodeToString = "<CompleteOnName:O>"; + String completionIdentifier = "O"; + String expectedReplacedSource = "O"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class Other {\n" + + " Other() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class K {\n" + + " public K() {\n" + + " }\n" + + " public static void main(java.lang.String[] args) {\n" + + " java.io.File bbbb;\n" + + " <CompleteOnName:O>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testK_2() { + String str = + "package p; \n" + + "class Other {\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class K {\n" + + " public static void main(\n" + + " java.lang.String[] args) {\n" + + " java.io.File bbbb = \n" + + " new File(\"c:\\abc.txt\"); \n" + + " O bb bbbb.}\n" + + "}\n"; + + String testName = "<complete on corrupted local variable declaration name>"; + String completeBehind = "bb"; + String expectedCompletionNodeToString = "<CompleteOnLocalName:O bb>;"; + String completionIdentifier = "bb"; + String expectedReplacedSource = "bb"; + int cursorLocation = str.indexOf("bb bbbb.") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class Other {\n" + + " Other() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class K {\n" + + " public K() {\n" + + " }\n" + + " public static void main(java.lang.String[] args) {\n" + + " java.io.File bbbb;\n" + + " <CompleteOnLocalName:O bb>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testK_3() { + String str = + "package p; \n" + + "class Other {\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class K {\n" + + " public static void main(\n" + + " java.lang.String[] args) {\n" + + " java.io.File bbbb = \n" + + " new File(\"c:\\abc.txt\"); \n" + + " O bb bbbb.}\n" + + "}\n"; + + String testName = "<complete on corrupted local variable declaration>"; + String completeBehind = "bbbb"; + String expectedCompletionNodeToString = "<CompleteOnName:bbbb>"; + String completionIdentifier = "bbbb"; + String expectedReplacedSource = "bbbb"; + int cursorLocation = str.indexOf("bbbb.}") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class Other {\n" + + " Other() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class K {\n" + + " public K() {\n" + + " }\n" + + " public static void main(java.lang.String[] args) {\n" + + " java.io.File bbbb;\n" + + " O bb;\n" + + " <CompleteOnName:bbbb>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testK_4() { + String str = + "package p; \n" + + "class Other {\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class K {\n" + + " public static void main(\n" + + " java.lang.String[] args) {\n" + + " java.io.File bbbb = \n" + + " new File(\"c:\\abc.txt\"); \n" + + " O bb bbbb.}\n" + + "}\n"; + + String testName = "<complete on method/field of local variable with corrupted declaration>"; + String completeBehind = "bbbb."; + String expectedCompletionNodeToString = "<CompleteOnName:bbbb.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "bbbb."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class Other {\n" + + " Other() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n" + + "public class K {\n" + + " public K() {\n" + + " }\n" + + " public static void main(java.lang.String[] args) {\n" + + " java.io.File bbbb;\n" + + " O bb;\n" + + " <CompleteOnName:bbbb.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testKA_1FH5SU5() { + String str = + "package p; \n" + + "/**\n" + + " * 1FH5SU5\n" + + " */\n" + + "class KAHelper\n" + + " extends java.util.Vector {\n" + + "}\n" + + "public class KA {\n" + + " public int hashCode() {\n" + + " return 10;\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " KA a = new KA;\n" + + " a.has }\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "a.has"; + String expectedCompletionNodeToString = "<CompleteOnName:a.has>"; + String completionIdentifier = "has"; + String expectedReplacedSource = "a.has"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class KAHelper extends java.util.Vector {\n" + + " KAHelper() {\n" + + " }\n" + + "}\n" + + "public class KA {\n" + + " public KA() {\n" + + " }\n" + + " public int hashCode() {\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " KA a;\n" + + " <CompleteOnName:a.has>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testKB() { + String str = + "package p; \n" + + "public class KB {\n" + + " void foo()[i }\n" + + "}\n"; + + String testName = "<complete on corrupted method header>"; + String completeBehind = "void foo()[i"; + String expectedCompletionNodeToString = NONE; + String completionIdentifier = "i"; + String expectedReplacedSource = "i"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class KB {\n" + + " public KB() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testKC_1FLG1ZC() { + String str = + "package p; \n" + + "/**\n" + + " * 1FLG1ZC\n" + + " */\n" + + "import java.io.*;\n" + + "public class KC {\n" + + "private static char[] read(String fileName){\n" + + " try {\n" + + " File file = new File(fileName);\n" + + " FileReader reader =\n" + + " new FileReader(file);\n" + + " int length;\n" + + " char[] contents =\n" + + " new char[\n" + + " length =\n" + + " (int) file.length()];\n" + + " int len = 0;\n" + + " int readSize = 0;\n" + + " while ((readSize != -1)\n" + + " && (len != length)) {\n" + + " readSize = reader.read(\n" + + " contents,\n" + + " len,\n" + + " length - len);\n" + + " len += readSize;\n" + + " }\n" + + " reader. t\n"; + + String testName = "<complete on method/field with dummy spaces>"; + String completeBehind = "reader. t"; + String expectedCompletionNodeToString = "<CompleteOnName:reader.t>"; + String completionIdentifier = "t"; + String expectedReplacedSource = "reader. t"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.io.*;\n" + + "public class KC {\n" + + " public KC() {\n" + + " }\n" + + " private static char[] read(String fileName) {\n" + + " {\n" + + " File file;\n" + + " FileReader reader;\n" + + " int length;\n" + + " char[] contents;\n" + + " int len;\n" + + " int readSize;\n" + + " <CompleteOnName:reader.t>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testL_1() { + String str = + "package p; \n" + + "public class L {\n" + + " void foo() {\n" + + " x.y.Z[] field1, \n" + + " field2; \n" + + " field1.if (int[].class }\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "field1."; + String expectedCompletionNodeToString = "<CompleteOnName:field1.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "field1."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class L {\n" + + " public L() {\n" + + " }\n" + + " void foo() {\n" + + " x.y.Z[] field1;\n" + + " x.y.Z[] field2;\n" + + " <CompleteOnName:field1.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testL_2() { + String str = + "package p; \n" + + "public class L {\n" + + " void foo() {\n" + + " x.y.Z[] field1, \n" + + " field2; \n" + + " field1.if (int[].class }\n" + + "}\n"; + + String testName = "<complete on method/field of array>"; + String completeBehind = "int[]."; + String expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:int[].>"; + String completionIdentifier = ""; + String expectedReplacedSource = "int[]."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class L {\n" + + " public L() {\n" + + " }\n" + + " void foo() {\n" + + " x.y.Z[] field1;\n" + + " x.y.Z[] field2;\n" + + " <CompleteOnClassLiteralAccess:int[].>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testL_3() { + String str = + "package p; \n" + + "public class L {\n" + + " void foo() {\n" + + " x.y.Z[] field1, \n" + + " field2; \n" + + " field1.if (int[].class }\n" + + "}\n"; + + String testName = "<complete on argument of corrupted if statement>"; + String completeBehind = "int"; + String expectedCompletionNodeToString = "<CompleteOnName:int>"; + String completionIdentifier = "int"; + String expectedReplacedSource = "int"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class L {\n" + + " public L() {\n" + + " }\n" + + " void foo() {\n" + + " x.y.Z[] field1;\n" + + " x.y.Z[] field2;\n" + + " if (<CompleteOnName:int>)\n" + + " ;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testLA_1FGLMOF() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGLMOF\n" + + " */\n" + + "public class LA {\n" + + " void[] foo() {\n" + + " }\n" + + " void bar() {\n" + + " f }\n" + + "}\n"; + + String testName = "<complete on method/field with corrupted method header>"; + String completeBehind = "f"; + String expectedCompletionNodeToString = "<CompleteOnName:f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class LA {\n" + + " public LA() {\n" + + " }\n" + + " void[] foo() {\n" + + " }\n" + + " void bar() {\n" + + " <CompleteOnName:f>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testLB() { + String str = + "package p; \n" + + "public class LB {\n" + + " void foo() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " void bar() {\n" + + " i }\n" + + "}\n"; + + String testName = "<complete on method/field with duplicate method declaration>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = "<CompleteOnName:i>"; + String completionIdentifier = "i"; + String expectedReplacedSource = "i"; + int cursorLocation = str.indexOf("i }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class LB {\n" + + " public LB() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " void bar() {\n" + + " <CompleteOnName:i>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testLC_1FLG1E2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FLG1E2\n" + + " */\n" + + "public class LC {\n" + + " void foo() {\n" + + " Object[] x = new Object[10];\n" + + " x [1].\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of array element with dummy spaces>"; + String completeBehind = "x [1]."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:x[1].>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class LC {\n" + + " public LC() {\n" + + " }\n" + + " void foo() {\n" + + " Object[] x;\n" + + " <CompleteOnMemberAccess:x[1].>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testM_1FGGLMT() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGGLMT\n" + + " */\n" + + "public class M {\n" + + " class Member {\n" + + " void fooMember() {\n" + + " }\n" + + " }\n" + + " void foo() {\n" + + " new Member().}\n" + + "}\n" + + "class MemberOfCU {\n" + + "}\n"; + + String testName = "<complete on method/field of explicit object creation>"; + String completeBehind = "new Member()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Member().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class M {\n" + + " class Member {\n" + + " Member() {\n" + + " }\n" + + " void fooMember() {\n" + + " }\n" + + " }\n" + + " public M() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:new Member().>;\n" + + " }\n" + + "}\n" + + "class MemberOfCU {\n" + + " MemberOfCU() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testMA_1() { + String str = + "package p; \n" + + "public class MA {\n" + + " class Member\n" + + " extends java.util.Vector {\n" + + " static void fooStaticMember() {\n" + + " }\n" + + " void fooMember() {\n" + + " }\n" + + " class MemberMember {\n" + + " void fooMemberMember() {\n" + + " MemberOfCUMA m = \n" + + " new MemberOfCUMA(); \n" + + " }\n" + + " }\n" + + " class MemberMember2 {\n" + + " }\n" + + " }\n" + + " void foo() {\n" + + " Membe }\n" + + " void foobar() {\n" + + " new Member().}\n" + + " class Member2 {\n" + + " }\n" + + "}\n" + + "class MemberOfCUMA {\n" + + "}\n"; + + String testName = "<complete on local variable declaration type>"; + String completeBehind = "Membe"; + String expectedCompletionNodeToString = "<CompleteOnName:Membe>"; + String completionIdentifier = "Membe"; + String expectedReplacedSource = "Membe"; + int cursorLocation = str.indexOf("Membe }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class MA {\n" + + " class Member extends java.util.Vector {\n" + + " class MemberMember {\n" + + " MemberMember() {\n" + + " }\n" + + " void fooMemberMember() {\n" + + " }\n" + + " }\n" + + " class MemberMember2 {\n" + + " MemberMember2() {\n" + + " }\n" + + " }\n" + + " Member() {\n" + + " }\n" + + " static void fooStaticMember() {\n" + + " }\n" + + " void fooMember() {\n" + + " }\n" + + " }\n" + + " class Member2 {\n" + + " Member2() {\n" + + " }\n" + + " }\n" + + " public MA() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:Membe>;\n" + + " }\n" + + " void foobar() {\n" + + " }\n" + + "}\n" + + "class MemberOfCUMA {\n" + + " MemberOfCUMA() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testMA_2() { + String str = + "package p; \n" + + "public class MA {\n" + + " class Member\n" + + " extends java.util.Vector {\n" + + " static void fooStaticMember() {\n" + + " }\n" + + " void fooMember() {\n" + + " }\n" + + " class MemberMember {\n" + + " void fooMemberMember() {\n" + + " MemberOfCUMA m = \n" + + " new MemberOfCUMA(); \n" + + " }\n" + + " }\n" + + " class MemberMember2 {\n" + + " }\n" + + " }\n" + + " void foo() {\n" + + " Membe }\n" + + " void foobar() {\n" + + " new Member().}\n" + + " class Member2 {\n" + + " }\n" + + "}\n" + + "class MemberOfCUMA {\n" + + "}\n"; + + String testName = "<complete on object creation type>"; + String completeBehind = "MemberOfCU"; + String expectedCompletionNodeToString = "<CompleteOnType:MemberOfCU>"; + String completionIdentifier = "MemberOfCU"; + String expectedReplacedSource = "MemberOfCUMA"; + int cursorLocation = str.indexOf("MemberOfCUMA();") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class MA {\n" + + " class Member extends java.util.Vector {\n" + + " class MemberMember {\n" + + " MemberMember() {\n" + + " }\n" + + " void fooMemberMember() {\n" + + " MemberOfCUMA m = new <CompleteOnType:MemberOfCU>();\n" + + " }\n" + + " }\n" + + " class MemberMember2 {\n" + + " MemberMember2() {\n" + + " }\n" + + " }\n" + + " Member() {\n" + + " }\n" + + " static void fooStaticMember() {\n" + + " }\n" + + " void fooMember() {\n" + + " }\n" + + " }\n" + + " class Member2 {\n" + + " Member2() {\n" + + " }\n" + + " }\n" + + " public MA() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " void foobar() {\n" + + " }\n" + + "}\n" + + "class MemberOfCUMA {\n" + + " MemberOfCUMA() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testMA_3() { + String str = + "package p; \n" + + "public class MA {\n" + + " class Member\n" + + " extends java.util.Vector {\n" + + " static void fooStaticMember() {\n" + + " }\n" + + " void fooMember() {\n" + + " }\n" + + " class MemberMember {\n" + + " void fooMemberMember() {\n" + + " MemberOfCUMA m = \n" + + " new MemberOfCUMA(); \n" + + " }\n" + + " }\n" + + " class MemberMember2 {\n" + + " }\n" + + " }\n" + + " void foo() {\n" + + " Membe }\n" + + " void foobar() {\n" + + " new Member().}\n" + + " class Member2 {\n" + + " }\n" + + "}\n" + + "class MemberOfCUMA {\n" + + "}\n"; + + String testName = "<complete on method/field of object creation>"; + String completeBehind = "new Member()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Member().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class MA {\n" + + " class Member extends java.util.Vector {\n" + + " class MemberMember {\n" + + " MemberMember() {\n" + + " }\n" + + " void fooMemberMember() {\n" + + " }\n" + + " }\n" + + " class MemberMember2 {\n" + + " MemberMember2() {\n" + + " }\n" + + " }\n" + + " Member() {\n" + + " }\n" + + " static void fooStaticMember() {\n" + + " }\n" + + " void fooMember() {\n" + + " }\n" + + " }\n" + + " class Member2 {\n" + + " Member2() {\n" + + " }\n" + + " }\n" + + " public MA() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " void foobar() {\n" + + " <CompleteOnMemberAccess:new Member().>;\n" + + " }\n" + + "}\n" + + "class MemberOfCUMA {\n" + + " MemberOfCUMA() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testMB_1FHSLMQ_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHSLMQ\n" + + " */\n" + + "public class MB {\n" + + " void foo() {\n" + + " try {\n" + + " System.out.println(\"\");\n" + + " } catch (Exception eFirst) {\n" + + " e } catch (Exception eSecond) {\n" + + " e }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on local variable name into catch block>"; + String completeBehind = "e"; + String expectedCompletionNodeToString = "<CompleteOnName:e>"; + String completionIdentifier = "e"; + String expectedReplacedSource = "e"; + int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class MB {\n" + + " public MB() {\n" + + " }\n" + + " void foo() {\n" + + " {\n" + + " Exception eFirst;\n" + + " <CompleteOnName:e>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testMB_1FHSLMQ_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHSLMQ\n" + + " */\n" + + "public class MB {\n" + + " void foo() {\n" + + " try {\n" + + " System.out.println(\"\");\n" + + " } catch (Exeption eFirst) {\n" + + " e } catch (Exception eSecond) {\n" + + " e }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on local variable name into catch block>"; + String completeBehind = "e"; + String expectedCompletionNodeToString = "<CompleteOnName:e>"; + String completionIdentifier = "e"; + String expectedReplacedSource = "e"; + int cursorLocation = str.indexOf("e }\n") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class MB {\n" + + " public MB() {\n" + + " }\n" + + " void foo() {\n" + + " {\n" + + " Exception eSecond;\n" + + " <CompleteOnName:e>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testMC_1FJ8D9Z() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ8D9Z\n" + + " */\n" + + "public class MC {\n" + + " p2.X someField;\n" + + " public void foo() {\n" + + " new p2.X(\n" + + " }\n" + + "}\n"; + + String testName = "<complete on object creation argument>"; + String completeBehind = "new p2.X("; + String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new p2.X()>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class MC {\n" + + " p2.X someField;\n" + + " public MC() {\n" + + " }\n" + + " public void foo() {\n" + + " <CompleteOnAllocationExpression:new p2.X()>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testN() { + String str = + "package p; \n" + + "public class N extends p.M {\n" + + " void foo() {\n" + + " class MLocal\n" + + " extends Schmurz {\n" + + " void foo() {\n" + + " }\n" + + " int field1;\n" + + " class MLocalMember\n" + + " extends myInnerC {\n" + + " void foo() {\n" + + " }\n" + + " void bar() {\n" + + " new M }\n" + + " }\n" + + " class MLocalMember2 {\n" + + " void fooMyInnerC() {\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on object creation type>"; + String completeBehind = "new M"; + String expectedCompletionNodeToString = "<CompleteOnType:M>"; + String completionIdentifier = "M"; + String expectedReplacedSource = "M"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class N extends p.M {\n" + + " public N() {\n" + + " }\n" + + " void foo() {\n" + + " class MLocal extends Schmurz {\n" + + " class MLocalMember extends myInnerC {\n" + + " MLocalMember() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " void bar() {\n" + + " new <CompleteOnType:M>();\n" + + " }\n" + + " }\n" + + " class MLocalMember2 {\n" + + " MLocalMember2() {\n" + + " }\n" + + " void fooMyInnerC() {\n" + + " }\n" + + " }\n" + + " int field1;\n" + + " MLocal() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testNA_1() { + String str = + "package p; \n" + + "class NException2\n" + + " extends NoClassDefFoundError {\n" + + "}\n" + + "interface NInterface {\n" + + " void foo();\n" + + "}\n" + + "class DAB {\n" + + " public DA foo() {\n" + + " }\n" + + " public int foufou;\n" + + "}\n" + + "class DANA {\n" + + " public int f;\n" + + " N fieldC;\n" + + "}\n" + + "public class NA\n" + + " extends NException2\n" + + " implements N {\n" + + " DA fieldB;\n" + + " class freak {\n" + + " }\n" + + " void dede() {\n" + + " DA local;\n" + + " local.fieldC.foo();\n" + + " }\n" + + "}\n" + + "interface NCool {\n" + + "}\n"; + + String testName = "<complete on local variable name>"; + String completeBehind = "l"; + String expectedCompletionNodeToString = "<CompleteOnName:l>"; + String completionIdentifier = "l"; + String expectedReplacedSource = "local"; + int cursorLocation = str.indexOf("local.") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class NException2 extends NoClassDefFoundError {\n" + + " NException2() {\n" + + " }\n" + + "}\n" + + "interface NInterface {\n" + + " void foo();\n" + + "}\n" + + "class DAB {\n" + + " public int foufou;\n" + + " DAB() {\n" + + " }\n" + + " public DA foo() {\n" + + " }\n" + + "}\n" + + "class DANA {\n" + + " public int f;\n" + + " N fieldC;\n" + + " DANA() {\n" + + " }\n" + + "}\n" + + "public class NA extends NException2 implements N {\n" + + " class freak {\n" + + " freak() {\n" + + " }\n" + + " }\n" + + " DA fieldB;\n" + + " public NA() {\n" + + " }\n" + + " void dede() {\n" + + " DA local;\n" + + " <CompleteOnName:l>;\n" + + " }\n" + + "}\n" + + "interface NCool {\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testNA_2() { + String str = + "package p; \n" + + "class NException2\n" + + " extends NoClassDefFoundError {\n" + + "}\n" + + "interface NInterface {\n" + + " void foo();\n" + + "}\n" + + "class DAB {\n" + + " public DA foo() {\n" + + " }\n" + + " public int foufou;\n" + + "}\n" + + "class DANA {\n" + + " public int f;\n" + + " N fieldC;\n" + + "}\n" + + "public class NA\n" + + " extends NException2\n" + + " implements N {\n" + + " DA fieldB;\n" + + " class freak {\n" + + " }\n" + + " void dede() {\n" + + " DA local;\n" + + " local.fieldC.foo();\n" + + " }\n" + + "}\n" + + "interface NCool {\n" + + "}\n"; + + String testName = "<complete on method/field of local variable>"; + String completeBehind = "local.f"; + String expectedCompletionNodeToString = "<CompleteOnName:local.f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "local.fieldC"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class NException2 extends NoClassDefFoundError {\n" + + " NException2() {\n" + + " }\n" + + "}\n" + + "interface NInterface {\n" + + " void foo();\n" + + "}\n" + + "class DAB {\n" + + " public int foufou;\n" + + " DAB() {\n" + + " }\n" + + " public DA foo() {\n" + + " }\n" + + "}\n" + + "class DANA {\n" + + " public int f;\n" + + " N fieldC;\n" + + " DANA() {\n" + + " }\n" + + "}\n" + + "public class NA extends NException2 implements N {\n" + + " class freak {\n" + + " freak() {\n" + + " }\n" + + " }\n" + + " DA fieldB;\n" + + " public NA() {\n" + + " }\n" + + " void dede() {\n" + + " DA local;\n" + + " <CompleteOnName:local.f>;\n" + + " }\n" + + "}\n" + + "interface NCool {\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testNA_3() { + String str = + "package p; \n" + + "class NException2\n" + + " extends NoClassDefFoundError {\n" + + "}\n" + + "interface NInterface {\n" + + " void foo();\n" + + "}\n" + + "class DAB {\n" + + " public DA foo() {\n" + + " }\n" + + " public int foufou;\n" + + "}\n" + + "class DANA {\n" + + " public int f;\n" + + " N fieldC;\n" + + "}\n" + + "public class NA\n" + + " extends NException2\n" + + " implements N {\n" + + " DA fieldB;\n" + + " class freak {\n" + + " }\n" + + " void dede() {\n" + + " DA local;\n" + + " local.fieldC.foo();\n" + + " }\n" + + "}\n" + + "interface NCool {\n" + + "}\n"; + + String testName = "<complete on method/field of local variable>"; + String completeBehind = "local.fieldC."; + String expectedCompletionNodeToString = "<CompleteOnName:local.fieldC.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "local.fieldC."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class NException2 extends NoClassDefFoundError {\n" + + " NException2() {\n" + + " }\n" + + "}\n" + + "interface NInterface {\n" + + " void foo();\n" + + "}\n" + + "class DAB {\n" + + " public int foufou;\n" + + " DAB() {\n" + + " }\n" + + " public DA foo() {\n" + + " }\n" + + "}\n" + + "class DANA {\n" + + " public int f;\n" + + " N fieldC;\n" + + " DANA() {\n" + + " }\n" + + "}\n" + + "public class NA extends NException2 implements N {\n" + + " class freak {\n" + + " freak() {\n" + + " }\n" + + " }\n" + + " DA fieldB;\n" + + " public NA() {\n" + + " }\n" + + " void dede() {\n" + + " DA local;\n" + + " <CompleteOnName:local.fieldC.>;\n" + + " }\n" + + "}\n" + + "interface NCool {\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testNB() { + String str = + "package p; \n" + + "public class NB {\n" + + " void foo() {\n" + + " int iOutside;\n" + + " if (i != 0) {\n" + + " for (int i = 10; --i >= 0;)\n" + + " unit[i].parseMethod(\n" + + " parser, \n" + + " unit); \n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on variable name into for statement>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = "<CompleteOnName:i>"; + String completionIdentifier = "i"; + String expectedReplacedSource = "i"; + int cursorLocation = str.indexOf("i >=") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class NB {\n" + + " public NB() {\n" + + " }\n" + + " void foo() {\n" + + " int iOutside;\n" + + " {\n" + + " int i;\n" + + " -- <CompleteOnName:i>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testNC_1FJ8D9Z() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ8D9Z\n" + + " */\n" + + "public class NC {\n" + + " String s = new String(\n"; + + String testName = "<complete on field intializer into corrupted class declaration>"; + String completeBehind = "new String("; + String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new String()>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class NC {\n" + + " String s = <CompleteOnAllocationExpression:new String()>;\n" + + " public NC() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testO_1FG1YU0() { + String str = + "package p; \n" + + "/**\n" + + " * 1FG1YU0\n" + + " */\n" + + "public class O\n" + + " extends java.util.Vector {\n" + + " void bar(boolean bbbb) {\n" + + " this.}\n" + + "}\n"; + + String testName = "<complete on method/field of explicit this>"; + String completeBehind = "this."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "this."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class O extends java.util.Vector {\n" + + " public O() {\n" + + " }\n" + + " void bar(boolean bbbb) {\n" + + " <CompleteOnMemberAccess:this.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testOA_1() { + String str = + "package p; \n" + + "public class OA {\n" + + " void proc() {\n" + + " int[] a = new int[10];\n" + + " Object b = a;\n" + + " Class c = a.getClass();\n" + + " String s = a.toString();\n" + + " boolean l = a.equals(b);\n" + + " int h = a.hashCode();\n" + + " try {\n" + + " a.wait();\n" + + " a.wait(3);\n" + + " a.wait(4, 5);\n" + + " } catch (Exception e) {\n" + + " }\n" + + " a.notify();\n" + + " a.notifyAll();\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of array>"; + String completeBehind = "a.n"; + String expectedCompletionNodeToString = "<CompleteOnName:a.n>"; + String completionIdentifier = "n"; + String expectedReplacedSource = "a.notify"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class OA {\n" + + " public OA() {\n" + + " }\n" + + " void proc() {\n" + + " int[] a;\n" + + " Object b;\n" + + " Class c;\n" + + " String s;\n" + + " boolean l;\n" + + " int h;\n" + + " <CompleteOnName:a.n>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testOA_2() { + String str = + "package p; \n" + + "public class OA {\n" + + " void proc() {\n" + + " int[] a = new int[10];\n" + + " Object b = a;\n" + + " Class c = a.getClass();\n" + + " String s = a.toString();\n" + + " boolean l = a.equals(b);\n" + + " int h = a.hashCode();\n" + + " try {\n" + + " a.wait();\n" + + " a.wait(3);\n" + + " a.wait(4, 5);\n" + + " } catch (Exception e) {\n" + + " }\n" + + " a.notify();\n" + + " a.notifyAll();\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of array>"; + String completeBehind = "a.w"; + String expectedCompletionNodeToString = "<CompleteOnName:a.w>"; + String completionIdentifier = "w"; + String expectedReplacedSource = "a.wait"; + int cursorLocation = str.indexOf("a.wait(4, 5)") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class OA {\n" + + " public OA() {\n" + + " }\n" + + " void proc() {\n" + + " int[] a;\n" + + " Object b;\n" + + " Class c;\n" + + " String s;\n" + + " boolean l;\n" + + " int h;\n" + + " {\n" + + " <CompleteOnName:a.w>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testOB_1() { + String str = + "package p; \n" + + "public class OB {\n" + + " void foo() {\n" + + " label : while (true) {\n" + + " System.out.println(\"\");\n" + + " break label;\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on keyword>"; + String completeBehind = "b"; + String expectedCompletionNodeToString = "<CompleteOnName:b>"; + String completionIdentifier = "b"; + String expectedReplacedSource = "break"; + int cursorLocation = str.indexOf("break") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class OB {\n" + + " public OB() {\n" + + " }\n" + + " void foo() {\n" + + " {\n" + + " <CompleteOnName:b>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testOB_2() { + String str = + "package p; \n" + + "public class OB {\n" + + " void foo() {\n" + + " label : while (true) {\n" + + " System.out.println(\"\");\n" + + " break label;\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on label name>"; + String completeBehind = "l"; + String expectedCompletionNodeToString = "<CompleteOnName:l>"; + String completionIdentifier = "l"; + String expectedReplacedSource = "label"; + int cursorLocation = str.indexOf("label") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class OB {\n" + + " public OB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:l>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testOC_1FM7J7F() { + String str = + "package p; \n" + + "/**\n" + + " * 1FM7J7F\n" + + " */\n" + + "class OC {\n" + + " String s = new String(\n" + + "}\n"; + + String testName = "<complete on field initializer>"; + String completeBehind = "new String("; + String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new String()>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class OC {\n" + + " String s = <CompleteOnAllocationExpression:new String()>;\n" + + " OC() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testP_1FG1YU0() { + String str = + "package p; \n" + + "/**\n" + + " * 1FG1YU0\n" + + " */\n" + + "public class P {\n" + + " {\n" + + " void bar() {\n" + + " f }\n" + + " void foo() {\n" + + " }\n" + + " }\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "f"; + String expectedCompletionNodeToString = "<CompleteOnName:f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class P {\n" + + " {\n" + + " }\n" + + " public P() {\n" + + " }\n" + + " void bar() {\n" + + " <CompleteOnName:f>;\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); } +public void testPA_1() { + String str = + "package p; \n" + + "class PAHelper {\n" + + " public int fieldPublic;\n" + + " protected int fieldProtected;\n" + + " private int fieldPrivate;\n" + + " int fieldDefault;\n" + + " static void staticFoo() {\n" + + " }\n" + + " static int i = 1;\n" + + " int neuneu1() {\n" + + " return 0;\n" + + " }\n" + + " void neuneu2() {\n" + + " }\n" + + "}\n" + + "public class PA\n" + + " extends PAHelper {\n" + + " void foo() {\n" + + " B[] b = \n" + + " new java.lang.Number[]; \n" + + " java.lang.Short s;\n" + + " // b[1].;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on comment>"; + String completeBehind = "b[1]."; + String expectedCompletionNodeToString = NONE; + String completionIdentifier = ""; + String expectedReplacedSource = NONE; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = null; + + try { + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); + assertTrue("failed to detect invalid cursor location", false); + } catch(InvalidCursorLocation e){ + assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); + } +} +public void testPA_2() { + String str = + "package p; \n" + + "class PAHelper {\n" + + " public int fieldPublic;\n" + + " protected int fieldProtected;\n" + + " private int fieldPrivate;\n" + + " int fieldDefault;\n" + + " static void staticFoo() {\n" + + " }\n" + + " static int i = 1;\n" + + " int neuneu1() {\n" + + " return 0;\n" + + " }\n" + + " void neuneu2() {\n" + + " }\n" + + "}\n" + + "public class PA\n" + + " extends PAHelper {\n" + + " void foo() {\n" + + " B[] b = \n" + + " new java.lang.Number[]; \n" + + " java.lang.Short s;\n" + + " // b[1].;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on new keyword>"; + String completeBehind = "n"; + String expectedCompletionNodeToString = "<CompleteOnName:n>"; + String completionIdentifier = "n"; + String expectedReplacedSource = "new"; + int cursorLocation = str.indexOf("new ") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class PAHelper {\n" + + " public int fieldPublic;\n" + + " protected int fieldProtected;\n" + + " private int fieldPrivate;\n" + + " int fieldDefault;\n" + + " static int i;\n" + + " <clinit>() {\n" + + " }\n" + + " PAHelper() {\n" + + " }\n" + + " static void staticFoo() {\n" + + " }\n" + + " int neuneu1() {\n" + + " }\n" + + " void neuneu2() {\n" + + " }\n" + + "}\n" + + "public class PA extends PAHelper {\n" + + " public PA() {\n" + + " }\n" + + " void foo() {\n" + + " B[] b = <CompleteOnName:n>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testPB() { + String str = + "package p; \n" + + "public class PB {\n" + + " void foo() {\n" + + " class Local {\n" + + " void foo() {\n" + + " }\n" + + " class LocalMember1 {\n" + + " void foo() {\n" + + " class LocalMemberLocal {\n" + + " void foo() {\n" + + " f\n"+ + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " class LocalMember2 {\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field into nested local type>"; + String completeBehind = "f"; + String expectedCompletionNodeToString = "<CompleteOnName:f>"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + int cursorLocation = str.indexOf("f\n") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class PB {\n" + + " public PB() {\n" + + " }\n" + + " void foo() {\n" + + " class Local {\n" + + " class LocalMember1 {\n" + + " LocalMember1() {\n" + + " }\n" + + " void foo() {\n" + + " class LocalMemberLocal {\n" + + " LocalMemberLocal() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:f>;\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " class LocalMember2 {\n" + + " LocalMember2() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " Local() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testPC_1FSU4EF() { + String str = + "package p; \n" + + "/**\n" + + " * 1FSU4EF\n" + + " */\n" + + "import java.util.Vector;\n" + + "public class PC {\n" + + " void foo() {\n" + + " class Inner {\n" + + " Vector v = new Vector();\n" + + " void foo() {\n" + + " Vector v = new Vector();\n" + + " v.addElement();\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field into local type>"; + String completeBehind = "v.a"; + String expectedCompletionNodeToString = "<CompleteOnName:v.a>"; + String completionIdentifier = "a"; + String expectedReplacedSource = "v.addElement"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.util.Vector;\n" + + "public class PC {\n" + + " public PC() {\n" + + " }\n" + + " void foo() {\n" + + " class Inner {\n" + + " Vector v;\n" + + " Inner() {\n" + + " }\n" + + " void foo() {\n" + + " Vector v;\n" + + " <CompleteOnName:v.a>;\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testQ_1FG1YU0() { + String str = + "package p; \n" + + "/**\n" + + " * 1FG1YU0\n" + + " */\n" + + "public class Q {\n" + + " void bar(boolean bbbb) {\n" + + " this.}\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "this."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "this."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class Q {\n" + + " public Q() {\n" + + " }\n" + + " void bar(boolean bbbb) {\n" + + " <CompleteOnMemberAccess:this.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testQA_1() { + String str = + "package p; \n" + + "class QAHelper {\n" + + " int i = 10;\n" + + " void f() {\n" + + " Chk.chkIntVal(\n" + + " \"err_0\", \n" + + " \"i\", \n" + + " this.i, \n" + + " i); \n" + + " }\n" + + " static class Y\n" + + " extends QAHelper {\n" + + " public void f() {\n" + + " super.f();\n" + + " int j = super.i;\n" + + " }\n" + + " public static void main(String a[]) {\n" + + " Y oy = new Y();\n" + + " oy.f();\n" + + " }\n" + + " }\n" + + "}\n" + + "public class QA {\n" + + " static String s[] = \n" + + " {\"Dolby\", \"Thx\",}; \n" + + " void check() {\n" + + " new QAHelper().new Y().main(\n" + + " s); \n" + + " }\n" + + " static public void main(String args[]) {\n" + + " new QA().check();\n" + + " Chk.endTest(\"ciner111\");\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "new QAHelper().new Y().m"; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().new Y().m>"; + String completionIdentifier = "m"; + String expectedReplacedSource = "main"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class QAHelper {\n" + + " static class Y extends QAHelper {\n" + + " Y() {\n" + + " }\n" + + " public void f() {\n" + + " }\n" + + " public static void main(String[] a) {\n" + + " }\n" + + " }\n" + + " int i;\n" + + " QAHelper() {\n" + + " }\n" + + " void f() {\n" + + " }\n" + + "}\n" + + "public class QA {\n" + + " static String[] s;\n" + + " <clinit>() {\n" + + " }\n" + + " public QA() {\n" + + " }\n" + + " void check() {\n" + + " <CompleteOnMemberAccess:new QAHelper().new Y().m>;\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testQA_2() { + String str = + "package p; \n" + + "class QAHelper {\n" + + " int i = 10;\n" + + " void f() {\n" + + " Chk.chkIntVal(\n" + + " \"err_0\", \n" + + " \"i\", \n" + + " this.i, \n" + + " i); \n" + + " }\n" + + " static class Y\n" + + " extends QAHelper {\n" + + " public void f() {\n" + + " super.f();\n" + + " int j = super.i;\n" + + " }\n" + + " public static void main(String a[]) {\n" + + " Y oy = new Y();\n" + + " oy.f();\n" + + " }\n" + + " }\n" + + "}\n" + + "public class QA {\n" + + " static String s[] = \n" + + " {\"Dolby\", \"Thx\",}; \n" + + " void check() {\n" + + " new QAHelper().new Y().main(\n" + + " s); \n" + + " }\n" + + " static public void main(String args[]) {\n" + + " new QA().check();\n" + + " Chk.endTest(\"ciner111\");\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of object creation>"; + String completeBehind = "new QAHelper()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class QAHelper {\n" + + " static class Y extends QAHelper {\n" + + " Y() {\n" + + " }\n" + + " public void f() {\n" + + " }\n" + + " public static void main(String[] a) {\n" + + " }\n" + + " }\n" + + " int i;\n" + + " QAHelper() {\n" + + " }\n" + + " void f() {\n" + + " }\n" + + "}\n" + + "public class QA {\n" + + " static String[] s;\n" + + " <clinit>() {\n" + + " }\n" + + " public QA() {\n" + + " }\n" + + " void check() {\n" + + " <CompleteOnMemberAccess:new QAHelper().>;\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testQA_3() { + String str = + "package p; \n" + + "class QAHelper {\n" + + " int i = 10;\n" + + " void f() {\n" + + " Chk.chkIntVal(\n" + + " \"err_0\", \n" + + " \"i\", \n" + + " this.i, \n" + + " i); \n" + + " }\n" + + " static class Y\n" + + " extends QAHelper {\n" + + " public void f() {\n" + + " super.f();\n" + + " int j = super.i;\n" + + " }\n" + + " public static void main(String a[]) {\n" + + " Y oy = new Y();\n" + + " oy.f();\n" + + " }\n" + + " }\n" + + "}\n" + + "public class QA {\n" + + " static String s[] = \n" + + " {\"Dolby\", \"Thx\",}; \n" + + " void check() {\n" + + " new QAHelper().new Y().main(\n" + + " s); \n" + + " }\n" + + " static public void main(String args[]) {\n" + + " new QA().check();\n" + + " Chk.endTest(\"ciner111\");\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of object creation>"; + String completeBehind = "new QAHelper().new Y()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().new Y().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class QAHelper {\n" + + " static class Y extends QAHelper {\n" + + " Y() {\n" + + " }\n" + + " public void f() {\n" + + " }\n" + + " public static void main(String[] a) {\n" + + " }\n" + + " }\n" + + " int i;\n" + + " QAHelper() {\n" + + " }\n" + + " void f() {\n" + + " }\n" + + "}\n" + + "public class QA {\n" + + " static String[] s;\n" + + " <clinit>() {\n" + + " }\n" + + " public QA() {\n" + + " }\n" + + " void check() {\n" + + " <CompleteOnMemberAccess:new QAHelper().new Y().>;\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testQA_4() { + String str = + "package p; \n" + + "class QAHelper {\n" + + " int i = 10;\n" + + " void f() {\n" + + " Chk.chkIntVal(\n" + + " \"err_0\", \n" + + " \"i\", \n" + + " this.i, \n" + + " i); \n" + + " }\n" + + " static class Y\n" + + " extends QAHelper {\n" + + " public void f() {\n" + + " super.f();\n" + + " int j = super.i;\n" + + " }\n" + + " public static void main(String a[]) {\n" + + " Y oy = new Y();\n" + + " oy.f();\n" + + " }\n" + + " }\n" + + "}\n" + + "public class QA {\n" + + " static String s[] = \n" + + " {\"Dolby\", \"Thx\",}; \n" + + " void check() {\n" + + " new QAHelper().new Y().main(\n" + + " s); \n" + + " }\n" + + " static public void main(String args[]) {\n" + + " new QA().check();\n" + + " Chk.endTest(\"ciner111\");\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of object creation>"; + String completeBehind = "new QA()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QA().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class QAHelper {\n" + + " static class Y extends QAHelper {\n" + + " Y() {\n" + + " }\n" + + " public void f() {\n" + + " }\n" + + " public static void main(String[] a) {\n" + + " }\n" + + " }\n" + + " int i;\n" + + " QAHelper() {\n" + + " }\n" + + " void f() {\n" + + " }\n" + + "}\n" + + "public class QA {\n" + + " static String[] s;\n" + + " <clinit>() {\n" + + " }\n" + + " public QA() {\n" + + " }\n" + + " void check() {\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " <CompleteOnMemberAccess:new QA().>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testQB_1FIK820() { + String str = + "package p; \n" + + "/**\n" + + " * 1FIK820\n" + + " */\n" + + "public class QB {\n" + + " void foo() {\n" + + " {\n" + + " }\n" + + " .}\n" + + "}\n"; + + String testName = "<complete on block (no answers wanted)>"; + String completeBehind = "."; + String expectedCompletionNodeToString = "<CompleteOnName:>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(".}") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class QB {\n" + + " public QB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testR_1FGD31E() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGD31E\n" + + " */\n" + + "public class R {\n" + + " void moo() {\n" + + " b }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "b"; + String expectedCompletionNodeToString = "<CompleteOnName:b>"; + String completionIdentifier = "b"; + String expectedReplacedSource = "b"; + int cursorLocation = str.indexOf("b }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class R {\n" + + " public R() {\n" + + " }\n" + + " void moo() {\n" + + " <CompleteOnName:b>;\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testRA_1() { + String str = + "package p; \n" + + "public class RA extends A {\n" + + " private int f = 5;\n" + + " int i(int k) {\n" + + " }\n" + + " class B extends I {\n" + + " void foo();\n" + + " class C extends Z {\n" + + " }\n" + + " final int fo;\n" + + " }\n" + + " final void foo(k j) {\n" + + " }\n" + + " o o() throws Exc, Exc {\n" + + " }\n" + + " static {\n" + + " this.ff = 5;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on incorrect this call>"; + String completeBehind = "t"; + String expectedCompletionNodeToString = "<CompleteOnName:t>"; + String completionIdentifier = "t"; + String expectedReplacedSource = "this"; + int cursorLocation = str.indexOf("this.ff") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class RA extends A {\n" + + " class B extends I {\n" + + " class C extends Z {\n" + + " C() {\n" + + " }\n" + + " }\n" + + " final int fo;\n" + + " B() {\n" + + " }\n" + + " void foo();\n" + + " }\n" + + " private int f;\n" + + " static {\n" + + " <CompleteOnName:t>;\n" + + " }\n" + + " <clinit>() {\n" + + " }\n" + + " public RA() {\n" + + " }\n" + + " int i(int k) {\n" + + " }\n" + + " final void foo(k j) {\n" + + " }\n" + + " o o() throws Exc, Exc {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testRA_2() { + String str = + "package p; \n" + + "public class RA extends A {\n" + + " private int f = 5;\n" + + " int i(int k) {\n" + + " }\n" + + " class B extends I {\n" + + " void foo();\n" + + " class C extends Z {\n" + + " }\n" + + " final int fo;\n" + + " }\n" + + " final void foo(k j) {\n" + + " }\n" + + " o o() throws Exc, Exc {\n" + + " }\n" + + " static {\n" + + " this.ff = 5;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on t>"; + String completeBehind = "t"; + String expectedCompletionNodeToString = "<CompleteOnName:t>"; + String completionIdentifier = "t"; + String expectedReplacedSource = "this"; + int cursorLocation = str.indexOf("this") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class RA extends A {\n" + + " class B extends I {\n" + + " class C extends Z {\n" + + " C() {\n" + + " }\n" + + " }\n" + + " final int fo;\n" + + " B() {\n" + + " }\n" + + " void foo();\n" + + " }\n" + + " private int f;\n" + + " static {\n" + + " <CompleteOnName:t>;\n" + + " }\n" + + " <clinit>() {\n" + + " }\n" + + " public RA() {\n" + + " }\n" + + " int i(int k) {\n" + + " }\n" + + " final void foo(k j) {\n" + + " }\n" + + " o o() throws Exc, Exc {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testRA_3() { + String str = + "package p; \n" + + "public class RA extends A {\n" + + " private int f = 5;\n" + + " int i(int k) {\n" + + " }\n" + + " class B extends I {\n" + + " void foo();\n" + + " class C extends Z {\n" + + " }\n" + + " final int fo;\n" + + " }\n" + + " final void foo(k j) {\n" + + " }\n" + + " o o() throws Exc, Exc {\n" + + " }\n" + + " static {\n" + + " this.ff = 5;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on exception type>"; + String completeBehind = "Exc"; + String expectedCompletionNodeToString = "<CompleteOnException:Exc>"; + String completionIdentifier = "Exc"; + String expectedReplacedSource = "Exc"; + int cursorLocation = str.indexOf("Exc {") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class RA extends A {\n" + + " class B extends I {\n" + + " class C extends Z {\n" + + " C() {\n" + + " }\n" + + " }\n" + + " final int fo;\n" + + " B() {\n" + + " }\n" + + " void foo();\n" + + " }\n" + + " private int f;\n" + + " static {\n" + + " }\n" + + " <clinit>() {\n" + + " }\n" + + " public RA() {\n" + + " }\n" + + " int i(int k) {\n" + + " }\n" + + " final void foo(k j) {\n" + + " }\n" + + " o o() throws Exc, <CompleteOnException:Exc> {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testRB_1FI74S3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FI74S3\n" + + " */\n" + + "public class RB {\n" + + " int[] table;\n" + + " void foo() {\n" + + " int x = table.}\n" + + "}\n"; + + String testName = "<complete on method/field of arry>"; + String completeBehind = "table."; + String expectedCompletionNodeToString = "<CompleteOnName:table.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "table."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class RB {\n" + + " int[] table;\n" + + " public RB() {\n" + + " }\n" + + " void foo() {\n" + + " int x = <CompleteOnName:table.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testS_1FGF64P_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGF64P\n" + + " */\n" + + "public class S {\n" + + " {\n" + + " new Y()..}\n" + + " class Y {\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on incorrect call>"; + String completeBehind = "new Y().."; + String expectedCompletionNodeToString = "<CompleteOnName:>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class S {\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " {\n" + + " {\n" + + " <CompleteOnName:>;\n" + + " }\n" + + " }\n" + + " public S() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testS_1FGF64P_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGF64P\n" + + " */\n" + + "public class S {\n" + + " {\n" + + " new Y()..}\n" + + " class Y {\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of object creation>"; + String completeBehind = "new Y()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class S {\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " {\n" + + " <CompleteOnMemberAccess:new Y().>;\n" + + " }\n" + + " public S() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testS_1FGF64P_3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGF64P\n" + + " */\n" + + "public class S {\n" + + " {\n" + + " new Y()..}\n" + + " class Y {\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on incorrect call>"; + String completeBehind = "new Y().."; + String expectedCompletionNodeToString = "<CompleteOnName:>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class S {\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " {\n" + + " {\n" + + " <CompleteOnName:>;\n" + + " }\n" + + " }\n" + + " public S() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testSA() { + String str = + "package p; \n" + + "public class SA {\n" + + " public sy void foo() {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method modifier>"; + String completeBehind = "sy"; + String expectedCompletionNodeToString = "<CompleteOnType:sy>"; + String completionIdentifier = "sy"; + String expectedReplacedSource = "sy"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class SA {\n" + + " <CompleteOnType:sy>;\n" + + " public SA() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testSB_1FILFDG() { + String str = + "package p; \n" + + "/**\n" + + " * 1FILFDG\n" + + " */\n" + + "public class SB {\n" + + " public void foo() {\n" + + " String s = \"hello\n" + + " int}\n" + + "}\n"; + + String testName = "<complete on field declaration type>"; + String completeBehind = "int"; + String expectedCompletionNodeToString = "<CompleteOnName:int>"; + String completionIdentifier = "int"; + String expectedReplacedSource = "int"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class SB {\n" + + " public SB() {\n" + + " }\n" + + " public void foo() {\n" + + " String s;\n" + + " <CompleteOnName:int>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testT_1FGF64P() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGF64P\n" + + " */\n" + + "public class T {\n" + + " {\n" + + " new Y().}\n" + + " class Y {\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on object creation>"; + String completeBehind = "new Y()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class T {\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + " }\n" + + " {\n" + + " <CompleteOnMemberAccess:new Y().>;\n" + + " }\n" + + " public T() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testTA_1FHISJJ_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHISJJ\n" + + " */\n" + + "public class TA {\n" + + " void foo() {\n" + + " Object[] items = \n" + + " {\n" + + " \"Mark unublishable\", \n" + + " null, \n" + + " \"Properties...\"}\n" + + " .;\n" + + " items.}\n" + + "}\n"; + + String testName = "<complete on array intializer value>"; + String completeBehind = "n"; + String expectedCompletionNodeToString = "<CompleteOnName:n>"; + String completionIdentifier = "n"; + String expectedReplacedSource = "null"; + int cursorLocation = str.indexOf("null, ") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class TA {\n" + + " public TA() {\n" + + " }\n" + + " void foo() {\n" + + " Object[] items = {<CompleteOnName:n>};\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testTA_1FHISJJ_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHISJJ\n" + + " */\n" + + "public class TA {\n" + + " void foo() {\n" + + " Object[] items = \n" + + " {\n" + + " \"Mark unublishable\", \n" + + " null, \n" + + " \"Properties...\"}\n" + + " .;\n" + + " items.}\n" + + "}\n"; + + String testName = "<complete on method/field of array intializer>"; + String completeBehind = + " {\n" + + " \"Mark unublishable\", \n" + + " null, \n" + + " \"Properties...\"}\n" + + " ."; + String expectedCompletionNodeToString = "<CompleteOnName:>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class TA {\n" + + " public TA() {\n" + + " }\n" + + " void foo() {\n" + + " Object[] items;\n" + + " <CompleteOnName:>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testTA_1FHISJJ_3() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHISJJ\n" + + " */\n" + + "public class TA {\n" + + " void foo() {\n" + + " Object[] items = \n" + + " {\n" + + " \"Mark unublishable\", \n" + + " null, \n" + + " \"Properties...\"}\n" + + " .;\n" + + " items.}\n" + + "}\n"; + + String testName = "<complete on method/field of array>"; + String completeBehind = "items."; + String expectedCompletionNodeToString = "<CompleteOnName:items.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "items."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class TA {\n" + + " public TA() {\n" + + " }\n" + + " void foo() {\n" + + " Object[] items;\n" + + " <CompleteOnName:items.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testTB_1FHSLMQ() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHSLMQ\n" + + " */\n" + + "public class TB {\n" + + " void foo() {\n" + + " if (true)\n" + + " System.out.println(\"\");\n" + + " e }\n" + + "}\n"; + + String testName = "<complete on else keyword>"; + String completeBehind = "e"; + String expectedCompletionNodeToString = "<CompleteOnName:e>"; + String completionIdentifier = "e"; + String expectedReplacedSource = "e"; + int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class TB {\n" + + " public TB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:e>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testU_1FGGUME() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGGUME\n" + + " */\n" + + "public class U {\n" + + " public static final int Source = \n" + + " 5; \n" + + "}\n"; + + String testName = "<complete on digit>"; + String completeBehind = "5"; + String expectedCompletionNodeToString = NONE; + String completionIdentifier = ""; + String expectedReplacedSource = NONE; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = null; + + try { + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); + assertTrue("failed to detect invalid cursor location", false); + } catch(InvalidCursorLocation e){ + assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_NUMBER); + } +} +public void testUA_1FHISJJ_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHISJJ\n" + + " */\n" + + "public class UA {\n" + + " void foo() {\n" + + " Object[] items = \n" + + " new String[] {\n" + + " \"Mark unublishable\", \n" + + " null, \n" + + " \"Properties...\"}\n" + + " .;\n" + + " items.}\n" + + "}\n"; + + String testName = "<complete on array initializer>"; + String completeBehind = + "new String[] {\n" + + " \"Mark unublishable\", \n" + + " null, \n" + + " \"Properties...\"}\n" + + " ."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String[]{\"Mark unublishable\", null, \"Properties...\"}.>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class UA {\n" + + " public UA() {\n" + + " }\n" + + " void foo() {\n" + + " Object[] items = <CompleteOnMemberAccess:new String[]{\"Mark unublishable\", null, \"Properties...\"}.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testUA_1FHISJJ_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHISJJ\n" + + " */\n" + + "public class UA {\n" + + " void foo() {\n" + + " Object[] items = \n" + + " new String[] {\n" + + " \"Mark unublishable\", \n" + + " null, \n" + + " \"Properties...\"}\n" + + " .;\n" + + " items.}\n" + + "}\n"; + + String testName = "<complete on method/field of array>"; + String completeBehind = "items."; + String expectedCompletionNodeToString = "<CompleteOnName:items.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "items."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class UA {\n" + + " public UA() {\n" + + " }\n" + + " void foo() {\n" + + " Object[] items;\n" + + " <CompleteOnName:items.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testUB_1FSBZ02() { + String str = + "package p; \n" + + "/**\n" + + " * 1FSBZ02\n" + + " */\n" + + "class UB {\n" + + " void bar() {\n" + + " }\n" + + " class UBMember {\n" + + " void bar2() {\n" + + " }\n" + + " void foo() {\n" + + " b\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on keyword>"; + String completeBehind = "b"; + String expectedCompletionNodeToString = "<CompleteOnName:b>"; + String completionIdentifier = "b"; + String expectedReplacedSource = "b"; + int cursorLocation = str.indexOf("b\n") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class UB {\n" + + " class UBMember {\n" + + " UBMember() {\n" + + " }\n" + + " void bar2() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnName:b>;\n" + + " }\n" + + " }\n" + + " UB() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testV_1FGGUOO_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGGUOO\n" + + " */\n" + + "public class V i java\n" + + " .io\n" + + " .Serializable {\n" + + "}\n"; + + String testName = "<complete on implements keyword>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = "<CompleteOnKeyword:i>"; + String completionIdentifier = "i"; + String expectedReplacedSource = "i"; + int cursorLocation = str.indexOf("i java") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class V extends <CompleteOnKeyword:i> {\n" + + " {\n" + + " }\n" + + " public V() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testV_1FGGUOO_2() { + String str = + "package x.y.z; \n" + + "/**\n" + + " * 1FGGUOO\n" + + " */\n" + + "public class V implements java.io.Serializable {\n" + + "}\n"; + + String testName = "<complete on package>"; + String completeBehind = "y"; + String expectedCompletionNodeToString = "<CompleteOnPackage:x.y>"; + String completionIdentifier = "y"; + String expectedReplacedSource = + "x.y.z"; + int cursorLocation = str.indexOf("y") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package <CompleteOnPackage:x.y>;\n" + + "public class V implements java.io.Serializable {\n" + + " public V() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testVA_1FHISJJ_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHISJJ\n" + + " */\n" + + "public class VA {\n" + + " void foo() {\n" + + " Object item = new String() {\n" + + " public boolean equals() {\n" + + " return false;\n" + + " }\n" + + " }\n" + + " .;\n" + + " item.}\n" + + "}\n"; + + String testName = "<complete on anonymous type declaration>"; + String completeBehind = + "new String() {\n" + + " public boolean equals() {\n" + + " return false;\n" + + " }\n" + + " }\n" + + " ."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String() {\n" + + " public boolean equals() {\n" + + " return false;\n" + + " }\n" + + "}.>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class VA {\n" + + " public VA() {\n" + + " }\n" + + " void foo() {\n" + + " Object item = <CompleteOnMemberAccess:new String() {\n" + + " public boolean equals() {\n" + + " return false;\n" + + " }\n" + + "}.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testVA_1FHISJJ_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FHISJJ\n" + + " */\n" + + "public class VA {\n" + + " void foo() {\n" + + " Object item = new String() {\n" + + " public boolean equals() {\n" + + " return false;\n" + + " }\n" + + " }\n" + + " .;\n" + + " item.}\n" + + "}\n"; + + String testName = "<complete on local variable>"; + String completeBehind = "item."; + String expectedCompletionNodeToString = "<CompleteOnName:item.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "item."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class VA {\n" + + " public VA() {\n" + + " }\n" + + " void foo() {\n" + + " Object item;\n" + + " <CompleteOnName:item.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testVB_1() { + String str = + "package p; \n" + + "public class VB {\n" + + " void foo() {\n" + + " new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }\n" + + " .;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on local variable name into anonymous declaration>"; + String completeBehind = "v"; + String expectedCompletionNodeToString = "<CompleteOnName:v>"; + String completionIdentifier = "v"; + String expectedReplacedSource = "v"; + int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class VB {\n" + + " public VB() {\n" + + " }\n" + + " void foo() {\n" + + " new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111;\n" + + " <CompleteOnName:v>;\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +// TODO excluded test (completion on field access on anonymous inner class with syntax error) +public void _testVB_2() { + String str = + "package p; \n" + + "public class VB {\n" + + " void foo() {\n" + + " new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }.\n" + + " }\n" + + "}\n"; + + String testName = "<complete on anonymous type declaration>"; + String completeBehind = + "new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }."; + String expectedCompletionNodeToString = + "<CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " }\n" + + "}.>"; + String completionIdentifier = ""; + String expectedReplacedSource = + "new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class VB {\n" + + " public VB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " }\n" + + "}.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testVB_3() { + String str = + "package p; \n" + + "public class VB {\n" + + " void foo() {\n" + + " new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }\n" + + " .;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on constructor>"; + String completeBehind = "new java.io.File("; + String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new java.io.File()>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class VB {\n" + + " public VB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnAllocationExpression:new java.io.File()>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +// TODO excluded test (completion on field access on anonymous inner class with syntax error) +public void _testVB_4() { + String str = + "package p; \n" + + "public class VB {\n" + + " void foo() {\n" + + " new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }\n" + + " .;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on anonymous type declaration with dummy spaces>"; + String completeBehind = + "new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }\n" + + " ."; + String expectedCompletionNodeToString = + "<CompleteOnName:new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " }\n" + + "}.>"; + String completionIdentifier = ""; + String expectedReplacedSource = + "new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }\n" + + " ."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class VB {\n" + + " public VB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " }\n" + + "}.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +// TODO excluded test (completion on field access on anonymous inner class with syntax error) +public void _testVB_5() { + String str = + "package p; \n" + + "public class VB {\n" + + " void foo() {\n" + + " new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }.;\n" + + " }\n" + + "}\n"; + + String testName = "<complete on anonymous type declaration with trailing semi-colon>"; + String completeBehind = + "new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }."; + String expectedCompletionNodeToString = + "<CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " }\n" + + "}.>"; + String completionIdentifier = ""; + String expectedReplacedSource = + "new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " Vector v11111 = new Vector();\n" + + " v }\n" + + " }."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class VB {\n" + + " public VB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + + " protected void runTest() {\n" + + " }\n" + + "}.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testW_1FGGUS4() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGGUS4\n" + + " */\n" + + "public class W {\n" + + " public static final int LA = \n" + + " 1; \n" + + " public static final int LAB = \n" + + " 2; \n" + + " public static final int LABO = \n" + + " 4; \n" + + " public int produceDebugAttributes = \n" + + " LABO; \n" + + "}\n"; + + String testName = "<complete on field initializer>"; + String completeBehind = "L"; + String expectedCompletionNodeToString = "<CompleteOnName:L>"; + String completionIdentifier = "L"; + String expectedReplacedSource = "LABO"; + int cursorLocation = str.indexOf("LABO;") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class W {\n" + + " public static final int LA;\n" + + " public static final int LAB;\n" + + " public static final int LABO;\n" + + " public int produceDebugAttributes = <CompleteOnName:L>;\n" + + " public W() {\n" + + " }\n" + + " <clinit>() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testWA_1() { + String str = + "package p; \n" + + "public class WA {\n" + + " void foo() {\n" + + " int value = 10;\n" + + " v int[] tab = new int[value];\n" + + " }\n"; + + String testName = "<complete on array size value>"; + String completeBehind = "v"; + String expectedCompletionNodeToString = "<CompleteOnName:v>"; + String completionIdentifier = "v"; + String expectedReplacedSource = "value"; + int cursorLocation = str.indexOf("value];") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class WA {\n" + + " public WA() {\n" + + " }\n" + + " void foo() {\n" + + " int value;\n" + + " int[] tab = new int[<CompleteOnName:v>];\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testWA_2() { + String str = + "package p; \n" + + "public class WA {\n" + + " void foo() {\n" + + " int value = 10;\n" + + " v int[] tab = new int[value];\n" + + " }\n"; + + String testName = "<complete on corrupter local variable declaration>"; + String completeBehind = "v"; + String expectedCompletionNodeToString = "<CompleteOnName:v>"; + String completionIdentifier = "v"; + String expectedReplacedSource = "v"; + int cursorLocation = str.indexOf("v int[]") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class WA {\n" + + " public WA() {\n" + + " }\n" + + " void foo() {\n" + + " int value;\n" + + " <CompleteOnName:v>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testWB_1FI313C() { + String str = + "package p; \n" + + "/*\n" + + " * 1FI313C\n" + + " */\n" + + "class WBHelper {\n" + + " public int fieldPublic;\n" + + " protected int fieldProtected;\n" + + " private int fieldPrivate;\n" + + " int fieldDefault;\n" + + " static void staticFoo() {\n" + + " }\n" + + " static int i = d;\n" + + " int neuneu1() {\n" + + " }\n" + + " void neuneu2() {\n" + + " }\n" + + "}\n" + + "public class WB\n" + + " extends WBHelper {\n" + + " void foo() {\n" + + " BIJOUR[] b = \n" + + " new java.lang.Number[]; \n" + + " java.lang.Short s;\n" + + " b[1].}\n" + + " B() {\n" + + " }\n" + + " B(int) {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of array element>"; + String completeBehind = "b[1]."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:b[1].>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "class WBHelper {\n" + + " public int fieldPublic;\n" + + " protected int fieldProtected;\n" + + " private int fieldPrivate;\n" + + " int fieldDefault;\n" + + " static int i;\n" + + " WBHelper() {\n" + + " }\n" + + " <clinit>() {\n" + + " }\n" + + " static void staticFoo() {\n" + + " }\n" + + " int neuneu1() {\n" + + " }\n" + + " void neuneu2() {\n" + + " }\n" + + "}\n" + + "public class WB extends WBHelper {\n" + + " public WB() {\n" + + " }\n" + + " void foo() {\n" + + " BIJOUR[] b;\n" + + " java.lang.Short s;\n" + + " <CompleteOnMemberAccess:b[1].>;\n" + + " }\n" + + " B() {\n" + + " }\n" + + " B() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testX_1FGGV8C_1() { + String str = + "package p; \n" + + "import p2.Y; \n" + + "/**\n" + + " * 1FGGV8C and 1FGPE8E\n" + + " */\n" + + "public class X {\n" + + " public static final float Vars; \n" + + " public static final float Lines; \n" + + " public static final float Source; \n" + + " public static final float UnreachableCode; \n" + + " public static final float produceDebugAttributes; \n" + + " void foo() {\n" + + " int locale, \n" + + " errorThreshold, \n" + + " preserveAllLocalVariables; \n" + + " return new Y[] {\n" + + " new Y(\n" + + " \"debug.vars\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Vars)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.lines\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Lines)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.source\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Source)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.preserveAllLocals\", \n" + + " this, \n" + + " locale, \n" + + " preserveAllLocalVariables\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"optionalError.unReachableCode\", \n" + + " this, \n" + + " locale, \n" + + " (errorThreshold\n" + + " & UnreachableCode)\n" + + " != 0\n" + + " ? 0\n" + + " : 1)\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on argument of anonymous type declaration>"; + String completeBehind = "t"; + String expectedCompletionNodeToString = "<CompleteOnName:t>"; + String completionIdentifier = "t"; + String expectedReplacedSource = "this"; + int cursorLocation = str.indexOf("this, ") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import p2.Y;\n" + + "public class X {\n" + + " public static final float Vars;\n" + + " public static final float Lines;\n" + + " public static final float Source;\n" + + " public static final float UnreachableCode;\n" + + " public static final float produceDebugAttributes;\n" + + " <clinit>() {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " int locale;\n" + + " int errorThreshold;\n" + + " int preserveAllLocalVariables;\n" + + " new Y(\"debug.vars\", <CompleteOnName:t>);\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testX_1FGGV8C_2() { + String str = + "package p; \n" + + "import p2.YZA; \n" + + "/**\n" + + " * 1FGGV8C and 1FGPE8E\n" + + " */\n" + + "public class X {\n" + + " public static final float Vars; \n" + + " public static final float Lines; \n" + + " public static final float Source; \n" + + " public static final float UnreachableCode; \n" + + " public static final float produceDebugAttributes; \n" + + " void foo() {\n" + + " int locale, \n" + + " errorThreshold, \n" + + " preserveAllLocalVariables; \n" + + " return new YZA[] {\n" + + " new YZA(\n" + + " \"debug.vars\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Vars)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new YZA(\n" + + " \"debug.lines\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Lines)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new YZA(\n" + + " \"debug.source\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Source)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new YZA(\n" + + " \"debug.preserveAllLocals\", \n" + + " this, \n" + + " locale, \n" + + " preserveAllLocalVariables\n" + + " ? 0\n" + + " : 1), \n" + + " new YZA(\n" + + " \"optionalError.unReachableCode\", \n" + + " this, \n" + + " locale, \n" + + " (errorThreshold\n" + + " & UnreachableCode)\n" + + " != 0\n" + + " ? 0\n" + + " : 1)\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on anonymous type declaration into a return statement>"; + String completeBehind = "Y"; + String expectedCompletionNodeToString = "<CompleteOnType:Y>"; + String completionIdentifier = "Y"; + String expectedReplacedSource = "YZA"; + int cursorLocation = str.indexOf("YZA[]") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import p2.YZA;\n" + + "public class X {\n" + + " public static final float Vars;\n" + + " public static final float Lines;\n" + + " public static final float Source;\n" + + " public static final float UnreachableCode;\n" + + " public static final float produceDebugAttributes;\n" + + " <clinit>() {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " int locale;\n" + + " int errorThreshold;\n" + + " int preserveAllLocalVariables;\n" + + " return new <CompleteOnType:Y>();\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testX_1FGGV8C_3() { + String str = + "package p; \n" + + "import p2.YZA; \n" + + "/**\n" + + " * 1FGGV8C and 1FGPE8E\n" + + " */\n" + + "public class X {\n" + + " public static final float Vars; \n" + + " public static final float Lines; \n" + + " public static final float Source; \n" + + " public static final float UnreachableCode; \n" + + " public static final float produceDebugAttributes; \n" + + " void foo() {\n" + + " int locale, \n" + + " errorThreshold, \n" + + " preserveAllLocalVariables; \n" + + " return new YZA[] {\n" + + " new YZA(\n" + + " \"debug.vars\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Vars)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new YZA(\n" + + " \"debug.lines\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Lines)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new YZA(\n" + + " \"debug.source\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Source)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new YZA(\n" + + " \"debug.preserveAllLocals\", \n" + + " this, \n" + + " locale, \n" + + " preserveAllLocalVariables\n" + + " ? 0\n" + + " : 1), \n" + + " new YZA(\n" + + " \"optionalError.unReachableCode\", \n" + + " this, \n" + + " locale, \n" + + " (errorThreshold\n" + + " & UnreachableCode)\n" + + " != 0\n" + + " ? 0\n" + + " : 1)\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on anonymous type declaration nested into an array initializer>"; + String completeBehind = "Y"; + String expectedCompletionNodeToString = "<CompleteOnType:Y>"; + String completionIdentifier = "Y"; + String expectedReplacedSource = "YZA"; + int cursorLocation = str.indexOf("YZA(") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import p2.YZA;\n" + + "public class X {\n" + + " public static final float Vars;\n" + + " public static final float Lines;\n" + + " public static final float Source;\n" + + " public static final float UnreachableCode;\n" + + " public static final float produceDebugAttributes;\n" + + " <clinit>() {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " int locale;\n" + + " int errorThreshold;\n" + + " int preserveAllLocalVariables;\n" + + " new YZA[]{new <CompleteOnType:Y>()};\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testX_1FGGV8C_4() { + String str = + "package p; \n" + + "import p2.Y; \n" + + "/**\n" + + " * 1FGGV8C and 1FGPE8E\n" + + " */\n" + + "public class X {\n" + + " public static final float Vars; \n" + + " public static final float Lines; \n" + + " public static final float Source; \n" + + " public static final float UnreachableCode; \n" + + " public static final float produceDebugAttributes; \n" + + " void foo() {\n" + + " int locale, \n" + + " errorThreshold, \n" + + " preserveAllLocalVariables; \n" + + " return new Y[] {\n" + + " new Y(\n" + + " \"debug.vars\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Vars)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.lines\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Lines)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.source\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Source)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.preserveAllLocals\", \n" + + " this, \n" + + " locale, \n" + + " preserveAllLocalVariables\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"optionalError.unReachableCode\", \n" + + " this, \n" + + " locale, \n" + + " (errorThreshold\n" + + " & UnreachableCode)\n" + + " != 0\n" + + " ? 0\n" + + " : 1)\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field into array intializer>"; + String completeBehind = "n"; + String expectedCompletionNodeToString = "<CompleteOnName:n>"; + String completionIdentifier = "n"; + String expectedReplacedSource = "new"; + int cursorLocation = str.indexOf("new Y(") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import p2.Y;\n" + + "public class X {\n" + + " public static final float Vars;\n" + + " public static final float Lines;\n" + + " public static final float Source;\n" + + " public static final float UnreachableCode;\n" + + " public static final float produceDebugAttributes;\n" + + " <clinit>() {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " int locale;\n" + + " int errorThreshold;\n" + + " int preserveAllLocalVariables;\n" + + " new Y[]{<CompleteOnName:n>};\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testX_1FGPE8E() { + String str = + "package p; \n" + + "import p2.Y; \n" + + "/**\n" + + " * 1FGGV8C and 1FGPE8E\n" + + " */\n" + + "public class X {\n" + + " public static final float Vars; \n" + + " public static final float Lines; \n" + + " public static final float Source; \n" + + " public static final float UnreachableCode; \n" + + " public static final float produceDebugAttributes; \n" + + " void foo() {\n" + + " int locale, \n" + + " errorThreshold, \n" + + " preserveAllLocalVariables; \n" + + " return new Y[] {\n" + + " new Y(\n" + + " \"debug.vars\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Vars)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.lines\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Lines)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.source\", \n" + + " this, \n" + + " locale, \n" + + " (produceDebugAttributes\n" + + " & Source)\n" + + " != 0\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"debug.preserveAllLocals\", \n" + + " this, \n" + + " locale, \n" + + " preserveAllLocalVariables\n" + + " ? 0\n" + + " : 1), \n" + + " new Y(\n" + + " \"optionalError.unReachableCode\", \n" + + " this, \n" + + " locale, \n" + + " (errorThreshold\n" + + " & UnreachableCode)\n" + + " != 0\n" + + " ? 0\n" + + " : 1)\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field into return statement>"; + String completeBehind = "n"; + String expectedCompletionNodeToString = "<CompleteOnName:n>"; + String completionIdentifier = "n"; + String expectedReplacedSource = "new"; + int cursorLocation = str.indexOf("new Y[]") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import p2.Y;\n" + + "public class X {\n" + + " public static final float Vars;\n" + + " public static final float Lines;\n" + + " public static final float Source;\n" + + " public static final float UnreachableCode;\n" + + " public static final float produceDebugAttributes;\n" + + " <clinit>() {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " int locale;\n" + + " int errorThreshold;\n" + + " int preserveAllLocalVariables;\n" + + " return <CompleteOnName:n>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +// Disabled since javadoc completion has been implemented +public void _testXA_1FGGUQF_1FHSL8H_1() { + String str = + "// int\n" + + "package p; \n" + + "/**\n" + + " * 1FGGUQF and 1FHSL8H\n" + + " */\n" + + "/**\n" + + " * int\n" + + " */\n" + + "/*\n" + + " * int\n" + + " */\n" + + "// int\n" + + "/**\n" + + "int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + "/**\n" + + " * int\n" + + " */\n" + + "public class XA {\n" + + " // int\n" + + " /* int */\n" + + " /** int */\n" + + " /**\n" + + " int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + " void /* int */\n" + + " foo() {\n" + + " // int\n" + + " /* int */\n" + + " /** int */\n" + + " }\n" + + " /**\n" + + " int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + " int field /* int */\n" + + " ;\n" + + " /*\n" + + " int\n" + + " */\n" + + " static {\n" + + " // int\n" + + " }\n" + + "}\n" + + "// int\n" + + "/* int */\n" + + "/** int */\n"; + + String testName = "<complete on comment>"; + String completeBehind = "int."; + String expectedCompletionNodeToString = NONE; + String completionIdentifier = ""; + String expectedReplacedSource = NONE; + int cursorLocation = str.indexOf("int.\n") + completeBehind.length() - 1; + String expectedUnitDisplayString = null; + + try { + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); + assertTrue("failed to detect invalid cursor location", false); + } catch(InvalidCursorLocation e){ + assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); + } +} +public void testXA_1FGGUQF_1FHSL8H_2() { + String str = + "// int\n" + + "package p; \n" + + "/**\n" + + " * 1FGGUQF and 1FHSL8H\n" + + " */\n" + + "/**\n" + + " * int\n" + + " */\n" + + "/*\n" + + " * int\n" + + " */\n" + + "// int\n" + + "/**\n" + + "int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + "/**\n" + + " * int\n" + + " */\n" + + "public class XA {\n" + + " // int\n" + + " /* int */\n" + + " /** int */\n" + + " /**\n" + + " int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + " void /* int */\n" + + " foo() {\n" + + " // int\n" + + " /* int */\n" + + " /** int */\n" + + " }\n" + + " /**\n" + + " int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + " int field /* int */\n" + + " ;\n" + + " /*\n" + + " int\n" + + " */\n" + + " static {\n" + + " // int\n" + + " }\n" + + "}\n" + + "// int\n" + + "/* int */\n" + + "/** int */\n"; + + String testName = "<complete on comment>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = NONE; + String completionIdentifier = ""; + String expectedReplacedSource = NONE; + int cursorLocation = str.indexOf("int\n") + completeBehind.length() - 1; + String expectedUnitDisplayString = null; + + try { + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); + assertTrue("failed to detect invalid cursor location", false); + } catch(InvalidCursorLocation e){ + assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); + } +} +public void testXA_1FGGUQF_1FHSL8H_3() { + String str = + "// int\n" + + "package p; \n" + + "/**\n" + + " * 1FGGUQF and 1FHSL8H\n" + + " */\n" + + "/**\n" + + " * int\n" + + " */\n" + + "/*\n" + + " * int\n" + + " */\n" + + "// int\n" + + "/**\n" + + "int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + "/**\n" + + " * int\n" + + " */\n" + + "public class XA {\n" + + " // int\n" + + " /* int */\n" + + " /** int */\n" + + " /**\n" + + " int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + " void /* int */ foo() {\n" + + " // int\n" + + " /* int */\n" + + " /** int */\n" + + " }\n" + + " /**\n" + + " int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + " int field /* int */\n" + + " ;\n" + + " /*\n" + + " int\n" + + " */\n" + + " static {\n" + + " // int\n" + + " }\n" + + "}\n" + + "// int\n" + + "/* int */\n" + + "/** int */\n"; + + String testName = "<complete on comment>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = NONE; + String completionIdentifier = ""; + String expectedReplacedSource = NONE; + int cursorLocation = str.indexOf("int */") + completeBehind.length() - 1; + String expectedUnitDisplayString = null; + + try { + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); + assertTrue("failed to detect invalid cursor location", false); + } catch(InvalidCursorLocation e){ + assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); + } +} +public void testXA_1FGGUQF_1FHSL8H_4() { + String str = + "// int\n" + + "package p; \n" + + "/**\n" + + " * 1FGGUQF and 1FHSL8H\n" + + " */\n" + + "/**\n" + + " * int\n" + + " */\n" + + "/*\n" + + " * int\n" + + " */\n" + + "// int\n" + + "/**\n" + + "int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + "/**\n" + + " * int\n" + + " */\n" + + "public class XA {\n" + + " // int\n" + + " /* int */\n" + + " /** int */\n" + + " /**\n" + + " int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + " void /* int */ foo() {\n" + + " // int\n" + + " /* int */\n" + + " /** int */\n" + + " }\n" + + " /**\n" + + " int.\n" + + " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + + " */\n" + + " int field /* int */\n" + + " ;\n" + + " /*\n" + + " int\n" + + " */\n" + + " static {\n" + + " // int\n" + + " }\n" + + "}\n" + + "// int\n" + + "/* int */\n" + + "/** int */\n"; + + String testName = "<complete on comment>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = NONE; + String completionIdentifier = ""; + String expectedReplacedSource = NONE; + int cursorLocation = str.indexOf("int */ foo()") + completeBehind.length() - 1; + String expectedUnitDisplayString = null; + + try { + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); + assertTrue("failed to detect invalid cursor location", false); + } catch(InvalidCursorLocation e){ + assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); + } +} +public void testXB_1FIYM5I_1() { + String str = + "package p; \n" + + "/*\n" + + " * 1FIYM5I\n" + + " */\n" + + "public class XB\n" + + " extends java.io.File {\n" + + " void foo() {\n" + + " XB xb = new XB();\n" + + " this.separator.;\n" + + " this.bar().;\n" + + " }\n" + + " String bar() {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of explicit this access>"; + String completeBehind = "this.s"; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.s>"; + String completionIdentifier = "s"; + String expectedReplacedSource = "this.separator"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class XB extends java.io.File {\n" + + " public XB() {\n" + + " }\n" + + " void foo() {\n" + + " XB xb;\n" + + " <CompleteOnMemberAccess:this.s>;\n" + + " }\n" + + " String bar() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testXB_1FIYM5I_2() { + String str = + "package p; \n" + + "/*\n" + + " * 1FIYM5I\n" + + " */\n" + + "public class XB\n" + + " extends java.io.File {\n" + + " void foo() {\n" + + " XB xb = new XB();\n" + + " this.separator.;\n" + + " this.bar().;\n" + + " }\n" + + " String bar() {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of explicitly accessed field>"; + String completeBehind = "this.separator."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.separator.>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class XB extends java.io.File {\n" + + " public XB() {\n" + + " }\n" + + " void foo() {\n" + + " XB xb;\n" + + " <CompleteOnMemberAccess:this.separator.>;\n" + + " }\n" + + " String bar() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testXB_1FIYM5I_3() { + String str = + "package p; \n" + + "/*\n" + + " * 1FIYM5I\n" + + " */\n" + + "public class XB\n" + + " extends java.io.File {\n" + + " void foo() {\n" + + " XB xb = new XB();\n" + + " this.separator.;\n" + + " this.bar().;\n" + + " }\n" + + " String bar() {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of explicit this access>"; + String completeBehind = "this.b"; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.b>"; + String completionIdentifier = "b"; + String expectedReplacedSource = "this.bar"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class XB extends java.io.File {\n" + + " public XB() {\n" + + " }\n" + + " void foo() {\n" + + " XB xb;\n" + + " <CompleteOnMemberAccess:this.b>;\n" + + " }\n" + + " String bar() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testXB_1FIYM5I_4() { + String str = + "package p; \n" + + "/*\n" + + " * 1FIYM5I\n" + + " */\n" + + "public class XB\n" + + " extends java.io.File {\n" + + " void foo() {\n" + + " XB xb = new XB();\n" + + " this.separator.;\n" + + " this.bar().;\n" + + " }\n" + + " String bar() {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field of explicitly accessed method>"; + String completeBehind = "this.bar()."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.bar().>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class XB extends java.io.File {\n" + + " public XB() {\n" + + " }\n" + + " void foo() {\n" + + " XB xb;\n" + + " <CompleteOnMemberAccess:this.bar().>;\n" + + " }\n" + + " String bar() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testY_1FGPESI() { + String str = + "package p; \n" + + "import p2.; \n" + + "/**\n" + + " * 1FGPESI\n" + + " */\n" + + "public class Y {\n" + + "}\n"; + + String testName = "<complete on imports>"; + String completeBehind = "p2."; + String expectedCompletionNodeToString = "<CompleteOnImport:p2.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "p2."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import <CompleteOnImport:p2.>;\n" + + "public class Y {\n" + + " public Y() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testYA_1FGRIUH() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGRIUH\n" + + " */\n" + + "public class YA\n" + + " extends YASecondTopLevel {\n" + + " void eFoo() {\n" + + " }\n" + + " class YAMember {\n" + + " void eFoo() {\n" + + " }\n" + + " void eBar() {\n" + + " e }\n" + + " }\n" + + "}\n" + + "class YASecondTopLevel {\n" + + " public boolean equals(YA yaya) {\n" + + " return true;\n" + + " }\n" + + " public eFoo() {\n" + + " }\n" + + " public void eFooBar() {\n" + + " }\n" + + "}\n"; + + String testName = "<complete on method/field>"; + String completeBehind = "e"; + String expectedCompletionNodeToString = "<CompleteOnName:e>"; + String completionIdentifier = "e"; + String expectedReplacedSource = "e"; + int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class YA extends YASecondTopLevel {\n" + + " class YAMember {\n" + + " YAMember() {\n" + + " }\n" + + " void eFoo() {\n" + + " }\n" + + " void eBar() {\n" + + " <CompleteOnName:e>;\n" + + " }\n" + + " }\n" + + " public YA() {\n" + + " }\n" + + " void eFoo() {\n" + + " }\n" + + "}\n" + + "class YASecondTopLevel {\n" + + " YASecondTopLevel() {\n" + + " }\n" + + " public boolean equals(YA yaya) {\n" + + " }\n" + + " public eFoo() {\n" + + " }\n" + + " public void eFooBar() {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testYB_1FJ4D46_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ4D46\n" + + " */\n" + + "public class YB {\n" + + " void foo() {\n" + + " new String(\"asdf\".getBytes()).}\n" + + "}\n"; + + String testName = "<complete on method/field of object creation>"; + String completeBehind = "new String(\"asdf\".getBytes())."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String(\"asdf\".getBytes()).>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class YB {\n" + + " public YB() {\n" + + " }\n" + + " void foo() {\n" + + " <CompleteOnMemberAccess:new String(\"asdf\".getBytes()).>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testZ_1FGPF3D_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGPF3D\n" + + " */\n" + + "public class Z imp Pro.Sev, \n" + + " Bla.Blo {\n" + + "}\n"; + + String testName = "<complete on implements keyword>"; + String completeBehind = "imp"; + String expectedCompletionNodeToString = "<CompleteOnKeyword:imp>"; + String completionIdentifier = "imp"; + String expectedReplacedSource = "imp"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class Z extends <CompleteOnKeyword:imp> {\n" + + " {\n" + + " }\n" + + " public Z() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testZ_1FGPF3D_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FGPF3D\n" + + " */\n" + + "public class Z implements Pro.Sev, \n" + + " Bla.Blo {\n" + + "}\n"; + + String testName = "<complete on implented interface>"; + String completeBehind = "P"; + String expectedCompletionNodeToString = "<CompleteOnInterface:P>"; + String completionIdentifier = "P"; + String expectedReplacedSource = "Pro"; + int cursorLocation = str.indexOf("Pro.Sev") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class Z implements <CompleteOnInterface:P>, Bla.Blo {\n" + + " public Z() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testZA_1() { + String str = + "package p; \n" + + "import java.util.Vector;\n"; + + String testName = "<complete on import keyword>"; + String completeBehind = "i"; + String expectedCompletionNodeToString = "<CompleteOnKeyword:i>"; + String completionIdentifier = "i"; + String expectedReplacedSource = "import"; + int cursorLocation = str.indexOf("import") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import <CompleteOnKeyword:i>;\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testZA_2() { + String str = + "package p; \n" + + "import java.util.Vector;\n"; + + String testName = "<complete on imported package>"; + String completeBehind = "jav"; + String expectedCompletionNodeToString = "<CompleteOnImport:jav>"; + String completionIdentifier = "jav"; + String expectedReplacedSource = "java.util.Vector"; + int cursorLocation = str.indexOf("java.util.Vector") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import <CompleteOnImport:jav>;\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testZA_3() { + String str = + "package p; \n" + + "import java.util.Vector;\n"; + + String testName = "<complete on imported type>"; + String completeBehind = "java.util.V"; + String expectedCompletionNodeToString = "<CompleteOnImport:java.util.V>"; + String completionIdentifier = "V"; + String expectedReplacedSource = "java.util.Vector"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import <CompleteOnImport:java.util.V>;\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testZB_1FJ4D46_1() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ4D46\n" + + " */\n" + + "import java.util.zip.CRC32;\n" + + "import java.io.*;\n" + + "public class ZB {\n" + + " public static void main(\n" + + " java.lang.String[] args) {\n" + + " File file = \n" + + " new File(\"d:\\\\314\"); \n" + + " CRC32 crc = new CRC32();\n" + + " file.}\n" + + "}\n"; + + String testName = "<complete on method/field of local variable>"; + String completeBehind = "file."; + String expectedCompletionNodeToString = "<CompleteOnName:file.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "file."; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.util.zip.CRC32;\n" + + "import java.io.*;\n" + + "public class ZB {\n" + + " public ZB() {\n" + + " }\n" + + " public static void main(java.lang.String[] args) {\n" + + " File file;\n" + + " CRC32 crc;\n" + + " <CompleteOnName:file.>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void testZB_1FJ4D46_2() { + String str = + "package p; \n" + + "/**\n" + + " * 1FJ4D46\n" + + " */\n" + + "import java.util.zip.CRC32;\n" + + "import java.io.*;\n" + + "public class ZB {\n" + + " public static void main(\n" + + " java.lang.String[] args) {\n" + + " File file = \n" + + " new File(\"d:\\\\314\"); \n" + + " CRC32 crc = new CRC32();\n" + + " file.}\n" + + "}\n"; + + String testName = "<complete on local variable type>"; + String completeBehind = "CRC"; + String expectedCompletionNodeToString = "<CompleteOnName:CRC>"; + String completionIdentifier = "CRC"; + String expectedReplacedSource = "CRC32"; + int cursorLocation = str.indexOf("CRC32 crc") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "import java.util.zip.CRC32;\n" + + "import java.io.*;\n" + + "public class ZB {\n" + + " public ZB() {\n" + + " }\n" + + " public static void main(java.lang.String[] args) {\n" + + " File file;\n" + + " <CompleteOnName:CRC>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete in initializer + */ +public void test001(){ + String str = + "package p;\n" + + "public class X {\n" + + " void foo(){\n" + + " int v1;\n" + + " {\n" + + " Obj\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete in initializer>"; + String completeBehind = "Obj"; + String expectedCompletionNodeToString = "<CompleteOnName:Obj>"; + String completionIdentifier = "Obj"; + String expectedReplacedSource = "Obj"; + int cursorLocation = str.indexOf("Obj") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " int v1;\n" + + " {\n" + + " <CompleteOnName:Obj>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete after initializer + */ +public void test002(){ + String str = + "package p;\n" + + "public class X {\n" + + " void foo(){\n" + + " int v1;\n" + + " {\n" + + " int v2\n" + + " }\n" + + " Obj" + + " }\n" + + "}\n"; + + String testName = "<complete after initializer>"; + String completeBehind = "Obj"; + String expectedCompletionNodeToString = "<CompleteOnName:Obj>"; + String completionIdentifier = "Obj"; + String expectedReplacedSource = "Obj"; + int cursorLocation = str.indexOf("Obj") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " int v1;\n" + + " <CompleteOnName:Obj>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete in initializer + */ +public void test003(){ + String str = + "package p;\n" + + "public class X {\n" + + " void foo(){\n" + + " int v1;\n" + + " {\n" + + " this.\n" + + " }\n" + + " }\n" + + "}\n"; + + String testName = "<complete in initializer>"; + String completeBehind = "this."; + String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>"; + String completionIdentifier = ""; + String expectedReplacedSource = "this."; + int cursorLocation = str.indexOf("this.") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "package p;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " int v1;\n" + + " {\n" + + " <CompleteOnMemberAccess:this.>;\n" + + " }\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} + +/** + * Complete in switch + */ +public void test004(){ + String str = + "public class X {\n" + + " final static int ZZZ = 1;\n"+ + " void foo(){\n" + + " switch(2)\n" + + " case 0 + ZZZ :\n" + + " case 1 + ZZZ :\n" + + " bar(ZZZ)\n" + + " }\n" + + " void bar(int y) {}\n"+ + "}\n"; + + String testName = "<complete in switch>"; + String completeBehind = "ZZZ"; + String expectedCompletionNodeToString = "<CompleteOnName:ZZZ>"; + String completionIdentifier = "ZZZ"; + String expectedReplacedSource = "ZZZ"; + int cursorLocation = str.lastIndexOf("ZZZ") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " static final int ZZZ;\n" + + " <clinit>() {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " bar(<CompleteOnName:ZZZ>);\n" + + " }\n" + + " void bar(int y) {\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete in method type. + */ +public void test005(){ + String str = + "public class X {\n" + + " clon foo(){\n" + + " }\n" + + "}\n"; + + String testName = "<complete in method type>"; + String completeBehind = "clon"; + String expectedCompletionNodeToString = "<CompleteOnType:clon>"; + String completionIdentifier = "clon"; + String expectedReplacedSource = "clon"; + int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " <CompleteOnType:clon>\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete in method type. + */ +public void test006(){ + String str = + "public class X {\n" + + " clon\n" + + " foo();\n" + + "}\n"; + + String testName = "<complete in method type>"; + String completeBehind = "clon"; + String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; + String completionIdentifier = "clon"; + String expectedReplacedSource = "clon"; + int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " <CompleteOnType:clon>;\n" + + " public X() {\n" + + " }\n" + + " foo();\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete in field type. + */ +public void test007(){ + String str = + "public class X {\n" + + " clon x;\n" + + "}\n"; + + String testName = "<complete in field type>"; + String completeBehind = "clon"; + String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; + String completionIdentifier = "clon"; + String expectedReplacedSource = "clon"; + int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " <CompleteOnType:clon>;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete in field type. + */ +public void test008(){ + String str = + "public class X {\n" + + " clon\n" + + " x;\n" + + "}\n"; + + String testName = "<complete in field type>"; + String completeBehind = "clon"; + String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; + String completionIdentifier = "clon"; + String expectedReplacedSource = "clon"; + int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " <CompleteOnType:clon>;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete in field type. + */ +public void test009(){ + String str = + "public class X {\n" + + " clon\n" + + " x y;\n" + + "}\n"; + + String testName = "<complete in field tpye>"; + String completeBehind = "clon"; + String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; + String completionIdentifier = "clon"; + String expectedReplacedSource = "clon"; + int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " <CompleteOnType:clon>;\n" + + " x y;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Complete in method type. + */ +public void test010(){ + String str = + "public class X {\n" + + " clon\n" + + " x y(){}\n" + + "}\n"; + + String testName = "<complete in method type>"; + String completeBehind = "clon"; + String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; + String completionIdentifier = "clon"; + String expectedReplacedSource = "clon"; + int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " <CompleteOnType:clon>;\n" + + " public X() {\n" + + " }\n" + + " x y() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * http://dev.eclipse.org/bugs/show_bug.cgi?id=25233 + */ +public void test011(){ + String str = + "public class X {\n" + + " void foo() {\n" + + " new Object[]{\n" + + " bar(zzz)\n" + + " };\n" + + " }\n" + + "}\n"; + + String testName = "<bug 25233>"; + String completeBehind = "zzz"; + String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; + String completionIdentifier = "zzz"; + String expectedReplacedSource = "zzz"; + int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " bar(<CompleteOnName:zzz>);\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * http://dev.eclipse.org/bugs/show_bug.cgi?id=27370 + */ +public void test012(){ + String str = + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " Object o = new ZZZ\n" + + "}\n"; + + String testName = "<bug 27370>"; + String completeBehind = "ZZZ"; + String expectedCompletionNodeToString = "<CompleteOnType:ZZZ>"; + String completionIdentifier = "ZZZ"; + String expectedReplacedSource = "ZZZ"; + int cursorLocation = str.lastIndexOf("ZZZ") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class X {\n" + + " Object o = new <CompleteOnType:ZZZ>();\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * http://dev.eclipse.org/bugs/show_bug.cgi?id=27735 + */ +public void test013(){ + String str = + "public class Bar {\n" + + " #\n" + + " Bar foo1 = new Bar(){};\n" + + " {int i;}\n" + + " synchronized void foo3() {}\n" + + " zzz\n" + + "}\n"; + + String testName = "<bug 27735>"; + String completeBehind = "zzz"; + String expectedCompletionNodeToString = "<CompleteOnType:zzz>"; + String completionIdentifier = "zzz"; + String expectedReplacedSource = "zzz"; + int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class Bar {\n" + + " Bar foo1;\n" + + " {\n" + + " }\n" + + " <CompleteOnType:zzz>;\n" + + " public Bar() {\n" + + " }\n" + + " synchronized void foo3() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * http://dev.eclipse.org/bugs/show_bug.cgi?id=27941 + */ +public void test014(){ + String str = + "public class Bar {\n" + + " void foo() {\n" + + " String s = \"a\" + \"b\";\n" + + " zzz\n" + + " }\n" + + "}\n"; + + String testName = "<bug 27941>"; + String completeBehind = "zzz"; + String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; + String completionIdentifier = "zzz"; + String expectedReplacedSource = "zzz"; + int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class Bar {\n" + + " public Bar() {\n" + + " }\n" + + " void foo() {\n" + + " String s;\n" + + " <CompleteOnName:zzz>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * http://dev.eclipse.org/bugs/show_bug.cgi?id=39502 + */ +public void test015(){ + String str = + "public class Bar {\n" + + " void foo() {\n" + + " Object o = new Object[]{};\n" + + " foo();\n" + + " }\n" + + "}\n"; + + String testName = "<bug 39502>"; + String completeBehind = "foo("; + String expectedCompletionNodeToString = "<CompleteOnMessageSend:foo()>"; + String completionIdentifier = ""; + String expectedReplacedSource = "foo("; + int cursorLocation = str.lastIndexOf("foo(") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class Bar {\n" + + " public Bar() {\n" + + " }\n" + + " void foo() {\n" + + " Object o;\n" + + " <CompleteOnMessageSend:foo()>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/** + * http://dev.eclipse.org/bugs/show_bug.cgi?id=39502 + */ +public void test016(){ + String str = + "public class Bar {\n" + + " void foo() {\n" + + " Object o = new Object[0];\n" + + " foo();\n" + + " }\n" + + "}\n"; + + String testName = "<bug 39502>"; + String completeBehind = "foo("; + String expectedCompletionNodeToString = "<CompleteOnMessageSend:foo()>"; + String completionIdentifier = ""; + String expectedReplacedSource = "foo("; + int cursorLocation = str.lastIndexOf("foo(") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class Bar {\n" + + " public Bar() {\n" + + " }\n" + + " void foo() {\n" + + " Object o;\n" + + " <CompleteOnMessageSend:foo()>;\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} + +public void test017(){ + String str = + "public class Bar {\n" + + " String s;\n" + + " /**/\n" + + "}\n"; + + String testName = ""; + String completeBehind = "/**/"; + String expectedCompletionNodeToString = "<CompleteOnType:>"; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + int cursorLocation = str.lastIndexOf("/**/") + completeBehind.length() - 1; + String expectedUnitDisplayString = + "public class Bar {\n" + + " String s;\n" + + " <CompleteOnType:>;\n" + + " public Bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +} 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 new file mode 100644 index 000000000..a5eccbdf1 --- /dev/null +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java @@ -0,0 +1,11806 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.parser; + +import junit.framework.Test; + +public class CompletionParserTest2 extends AbstractCompletionTest { +public CompletionParserTest2(String testName) { + super(testName); +} +public static Test suite() { + return buildAllCompliancesTestSuite(CompletionParserTest2.class); +} +public void test0001(){ + String str = + "package p;\n" + + "public class X {\n" + + " Object o = zzz;\n" + + "}\n"; + + String completeBehind = "zzz"; + int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; + + String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; + String expectedParentNodeToString = "Object o = <CompleteOnName:zzz>;"; + String completionIdentifier = "zzz"; + String expectedReplacedSource = "zzz"; + String expectedUnitDisplayString = + "package p;\n" + + "public class X {\n" + + " Object o = <CompleteOnName:zzz>;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0002_Diet(){ + String str = + "package p;\n" + + "public class X {\n" + + " {\n" + + " Object o = zzz;\n" + + " }\n" + + "}\n"; + + String completeBehind = "zzz"; + int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; + + String expectedCompletionNodeToString = "<NONE>"; + String expectedParentNodeToString = "<NONE>"; + String completionIdentifier = "<NONE>"; + String expectedReplacedSource = "<NONE>"; + String expectedUnitDisplayString = + "package p;\n" + + "public class X {\n" + + " {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0002_Method(){ + String str = + "package p;\n" + + "public class X {\n" + + " {\n" + + " Object o = zzz;\n" + + " }\n" + + "}\n"; + + String completeBehind = "zzz"; + int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; + + String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; + String expectedParentNodeToString = "Object o = <CompleteOnName:zzz>;"; + String completionIdentifier = "zzz"; + String expectedReplacedSource = "zzz"; + |