Lines 10-15
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.core.tests.model; |
11 |
package org.eclipse.jdt.core.tests.model; |
12 |
|
12 |
|
|
|
13 |
import java.io.IOException; |
14 |
|
15 |
import org.eclipse.core.runtime.CoreException; |
13 |
import org.eclipse.jdt.core.*; |
16 |
import org.eclipse.jdt.core.*; |
14 |
|
17 |
|
15 |
import org.eclipse.jdt.internal.codeassist.RelevanceConstants; |
18 |
import org.eclipse.jdt.internal.codeassist.RelevanceConstants; |
Lines 3914-3917
Link Here
|
3914 |
"completion token location={STATEMENT_START}", |
3917 |
"completion token location={STATEMENT_START}", |
3915 |
result.context); |
3918 |
result.context); |
3916 |
} |
3919 |
} |
|
|
3920 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
3921 |
public void test0143() throws JavaModelException { |
3922 |
this.workingCopies = new ICompilationUnit[1]; |
3923 |
this.workingCopies[0] = getWorkingCopy( |
3924 |
"/Completion/src3/test/X.java", |
3925 |
"package test;\n" + |
3926 |
"zzzz\n" + |
3927 |
"public class X {\n" + |
3928 |
" public int field0;\n" + |
3929 |
"}"); |
3930 |
|
3931 |
String str = this.workingCopies[0].getSource(); |
3932 |
int tokenStart = str.lastIndexOf("zzzz"); |
3933 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
3934 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
3935 |
|
3936 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
3937 |
|
3938 |
assertResults( |
3939 |
"completion offset="+(cursorLocation)+"\n" + |
3940 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
3941 |
"completion token=\"zzzz\"\n" + |
3942 |
"completion token kind=TOKEN_KIND_NAME\n" + |
3943 |
"expectedTypesSignatures=null\n" + |
3944 |
"expectedTypesKeys=null\n" + |
3945 |
"completion token location=UNKNOWN\n" + |
3946 |
"visibleElements={}", |
3947 |
result.context); |
3948 |
} |
3949 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
3950 |
public void test0144() throws JavaModelException { |
3951 |
this.workingCopies = new ICompilationUnit[1]; |
3952 |
this.workingCopies[0] = getWorkingCopy( |
3953 |
"/Completion/src3/test/X.java", |
3954 |
"package test;\n" + |
3955 |
"public class X {\n" + |
3956 |
" zzzz\n" + |
3957 |
" public int field0;\n" + |
3958 |
"}"); |
3959 |
|
3960 |
String str = this.workingCopies[0].getSource(); |
3961 |
int tokenStart = str.lastIndexOf("zzzz"); |
3962 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
3963 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
3964 |
|
3965 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
3966 |
|
3967 |
assertResults( |
3968 |
"completion offset="+(cursorLocation)+"\n" + |
3969 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
3970 |
"completion token=\"zzzz\"\n" + |
3971 |
"completion token kind=TOKEN_KIND_NAME\n" + |
3972 |
"expectedTypesSignatures=null\n" + |
3973 |
"expectedTypesKeys=null\n" + |
3974 |
"completion token location={MEMBER_START}\n" + |
3975 |
"visibleElements={}", |
3976 |
result.context); |
3977 |
} |
3978 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
3979 |
public void test0145() throws JavaModelException { |
3980 |
this.workingCopies = new ICompilationUnit[1]; |
3981 |
this.workingCopies[0] = getWorkingCopy( |
3982 |
"/Completion/src3/test/X.java", |
3983 |
"package test;\n" + |
3984 |
"public class X {\n" + |
3985 |
" public int field0;\n" + |
3986 |
" public int field1 = zzzz;\n" + |
3987 |
"}"); |
3988 |
|
3989 |
String str = this.workingCopies[0].getSource(); |
3990 |
int tokenStart = str.lastIndexOf("zzzz"); |
3991 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
3992 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
3993 |
|
3994 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
3995 |
|
3996 |
String jclPath = getExternalJCLPathString(); |
3997 |
assertResults( |
3998 |
"completion offset="+(cursorLocation)+"\n" + |
3999 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4000 |
"completion token=\"zzzz\"\n" + |
4001 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4002 |
"expectedTypesSignatures={I}\n" + |
4003 |
"expectedTypesKeys={I}\n" + |
4004 |
"completion token location=UNKNOWN\n" + |
4005 |
"visibleElements={\n" + |
4006 |
" field1 {key=Ltest/X;.field1)I} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4007 |
" field0 {key=Ltest/X;.field0)I} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4008 |
" wait(long, int) {key=Ljava/lang/Object;.wait(JI)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4009 |
" wait(long) {key=Ljava/lang/Object;.wait(J)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4010 |
" wait() {key=Ljava/lang/Object;.wait()V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4011 |
" toString() {key=Ljava/lang/Object;.toString()Ljava/lang/String;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4012 |
" notifyAll() {key=Ljava/lang/Object;.notifyAll()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4013 |
" notify() {key=Ljava/lang/Object;.notify()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4014 |
" hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4015 |
" getClass() {key=Ljava/lang/Object;.getClass()Ljava/lang/Class;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4016 |
" finalize() {key=Ljava/lang/Object;.finalize()V|Ljava/lang/Throwable;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4017 |
" equals(java.lang.Object) {key=Ljava/lang/Object;.equals(Ljava/lang/Object;)Z} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4018 |
" clone() {key=Ljava/lang/Object;.clone()Ljava/lang/Object;|Ljava/lang/CloneNotSupportedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4019 |
"}", |
4020 |
result.context); |
4021 |
} |
4022 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4023 |
public void test0146() throws JavaModelException { |
4024 |
this.workingCopies = new ICompilationUnit[1]; |
4025 |
this.workingCopies[0] = getWorkingCopy( |
4026 |
"/Completion/src3/test/X.java", |
4027 |
"package test;\n" + |
4028 |
"public class X {\n" + |
4029 |
" public int field0;\n" + |
4030 |
" { zzzz }\n" + |
4031 |
"}"); |
4032 |
|
4033 |
String str = this.workingCopies[0].getSource(); |
4034 |
int tokenStart = str.lastIndexOf("zzzz"); |
4035 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4036 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4037 |
|
4038 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
4039 |
|
4040 |
String jclPath = getExternalJCLPathString(); |
4041 |
assertResults( |
4042 |
"completion offset="+(cursorLocation)+"\n" + |
4043 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4044 |
"completion token=\"zzzz\"\n" + |
4045 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4046 |
"expectedTypesSignatures=null\n" + |
4047 |
"expectedTypesKeys=null\n" + |
4048 |
"completion token location={STATEMENT_START}\n" + |
4049 |
"visibleElements={\n" + |
4050 |
" field0 {key=Ltest/X;.field0)I} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4051 |
" wait(long, int) {key=Ljava/lang/Object;.wait(JI)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4052 |
" wait(long) {key=Ljava/lang/Object;.wait(J)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4053 |
" wait() {key=Ljava/lang/Object;.wait()V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4054 |
" toString() {key=Ljava/lang/Object;.toString()Ljava/lang/String;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4055 |
" notifyAll() {key=Ljava/lang/Object;.notifyAll()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4056 |
" notify() {key=Ljava/lang/Object;.notify()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4057 |
" hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4058 |
" getClass() {key=Ljava/lang/Object;.getClass()Ljava/lang/Class;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4059 |
" finalize() {key=Ljava/lang/Object;.finalize()V|Ljava/lang/Throwable;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4060 |
" equals(java.lang.Object) {key=Ljava/lang/Object;.equals(Ljava/lang/Object;)Z} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4061 |
" clone() {key=Ljava/lang/Object;.clone()Ljava/lang/Object;|Ljava/lang/CloneNotSupportedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4062 |
"}", |
4063 |
result.context); |
4064 |
} |
4065 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4066 |
public void test0147() throws JavaModelException { |
4067 |
this.workingCopies = new ICompilationUnit[1]; |
4068 |
this.workingCopies[0] = getWorkingCopy( |
4069 |
"/Completion/src3/test/X.java", |
4070 |
"package test;\n" + |
4071 |
"public class X {\n" + |
4072 |
" public int field0;\n" + |
4073 |
" public void foo() {\n" + |
4074 |
" zzzz\n" + |
4075 |
" }\n" + |
4076 |
"}"); |
4077 |
|
4078 |
String str = this.workingCopies[0].getSource(); |
4079 |
int tokenStart = str.lastIndexOf("zzzz"); |
4080 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4081 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4082 |
|
4083 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
4084 |
|
4085 |
String jclPath = getExternalJCLPathString(); |
4086 |
assertResults( |
4087 |
"completion offset="+(cursorLocation)+"\n" + |
4088 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4089 |
"completion token=\"zzzz\"\n" + |
4090 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4091 |
"expectedTypesSignatures=null\n" + |
4092 |
"expectedTypesKeys=null\n" + |
4093 |
"completion token location={STATEMENT_START}\n" + |
4094 |
"visibleElements={\n" + |
4095 |
" field0 {key=Ltest/X;.field0)I} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4096 |
" foo() {key=Ltest/X;.foo()V} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4097 |
" wait(long, int) {key=Ljava/lang/Object;.wait(JI)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4098 |
" wait(long) {key=Ljava/lang/Object;.wait(J)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4099 |
" wait() {key=Ljava/lang/Object;.wait()V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4100 |
" toString() {key=Ljava/lang/Object;.toString()Ljava/lang/String;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4101 |
" notifyAll() {key=Ljava/lang/Object;.notifyAll()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4102 |
" notify() {key=Ljava/lang/Object;.notify()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4103 |
" hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4104 |
" getClass() {key=Ljava/lang/Object;.getClass()Ljava/lang/Class;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4105 |
" finalize() {key=Ljava/lang/Object;.finalize()V|Ljava/lang/Throwable;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4106 |
" equals(java.lang.Object) {key=Ljava/lang/Object;.equals(Ljava/lang/Object;)Z} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4107 |
" clone() {key=Ljava/lang/Object;.clone()Ljava/lang/Object;|Ljava/lang/CloneNotSupportedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4108 |
"}", |
4109 |
result.context); |
4110 |
} |
4111 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4112 |
public void test0148() throws JavaModelException { |
4113 |
this.workingCopies = new ICompilationUnit[1]; |
4114 |
this.workingCopies[0] = getWorkingCopy( |
4115 |
"/Completion/src3/test/X.java", |
4116 |
"package test;\n" + |
4117 |
"public class X {\n" + |
4118 |
" public int field0;\n" + |
4119 |
" public int fieldX0;\n" + |
4120 |
" public class Y {\n" + |
4121 |
" public int field0;\n" + |
4122 |
" public int fieldY0;\n" + |
4123 |
" public void fooY() {\n" + |
4124 |
" int local0;\n" + |
4125 |
" int localfooY0;\n" + |
4126 |
" if (true) {\n" + |
4127 |
" int local0;\n" + |
4128 |
" int localfooY1;\n" + |
4129 |
" zzzz\n" + |
4130 |
" }\n" + |
4131 |
" }\n" + |
4132 |
"}"); |
4133 |
|
4134 |
String str = this.workingCopies[0].getSource(); |
4135 |
int tokenStart = str.lastIndexOf("zzzz"); |
4136 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4137 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4138 |
|
4139 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
4140 |
|
4141 |
String jclPath = getExternalJCLPathString(); |
4142 |
assertResults( |
4143 |
"completion offset="+(cursorLocation)+"\n" + |
4144 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4145 |
"completion token=\"zzzz\"\n" + |
4146 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4147 |
"expectedTypesSignatures=null\n" + |
4148 |
"expectedTypesKeys=null\n" + |
4149 |
"completion token location={STATEMENT_START}\n" + |
4150 |
"visibleElements={\n" + |
4151 |
" local0 [in fooY() [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]]],\n" + |
4152 |
" localfooY0 [in fooY() [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]]],\n" + |
4153 |
" localfooY1 [in fooY() [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]]],\n" + |
4154 |
" fieldY0 {key=Ltest/X$Y;.fieldY0)I} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4155 |
" field0 {key=Ltest/X$Y;.field0)I} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4156 |
" fieldX0 {key=Ltest/X;.fieldX0)I} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4157 |
" fooY() {key=Ltest/X$Y;.fooY()V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4158 |
" wait(long, int) {key=Ljava/lang/Object;.wait(JI)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4159 |
" wait(long) {key=Ljava/lang/Object;.wait(J)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4160 |
" wait() {key=Ljava/lang/Object;.wait()V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4161 |
" toString() {key=Ljava/lang/Object;.toString()Ljava/lang/String;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4162 |
" notifyAll() {key=Ljava/lang/Object;.notifyAll()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4163 |
" notify() {key=Ljava/lang/Object;.notify()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4164 |
" hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4165 |
" getClass() {key=Ljava/lang/Object;.getClass()Ljava/lang/Class;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4166 |
" finalize() {key=Ljava/lang/Object;.finalize()V|Ljava/lang/Throwable;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4167 |
" equals(java.lang.Object) {key=Ljava/lang/Object;.equals(Ljava/lang/Object;)Z} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4168 |
" clone() {key=Ljava/lang/Object;.clone()Ljava/lang/Object;|Ljava/lang/CloneNotSupportedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4169 |
"}", |
4170 |
result.context); |
4171 |
} |
4172 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4173 |
public void test0149() throws JavaModelException { |
4174 |
this.workingCopies = new ICompilationUnit[1]; |
4175 |
this.workingCopies[0] = getWorkingCopy( |
4176 |
"/Completion/src3/test/X.java", |
4177 |
"package test;\n" + |
4178 |
"public class X {\n" + |
4179 |
" public void method0() {}\n" + |
4180 |
" public void method0(int i) {}\n" + |
4181 |
" public class Y {\n" + |
4182 |
" public void method1() {}\n" + |
4183 |
" public void method0(int i) {}\n" + |
4184 |
" public void foo() {\n" + |
4185 |
" zzzz\n" + |
4186 |
" }\n" + |
4187 |
" }\n" + |
4188 |
"}"); |
4189 |
|
4190 |
String str = this.workingCopies[0].getSource(); |
4191 |
int tokenStart = str.lastIndexOf("zzzz"); |
4192 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4193 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4194 |
|
4195 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
4196 |
|
4197 |
String jclPath = getExternalJCLPathString(); |
4198 |
assertResults( |
4199 |
"completion offset="+(cursorLocation)+"\n" + |
4200 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4201 |
"completion token=\"zzzz\"\n" + |
4202 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4203 |
"expectedTypesSignatures=null\n" + |
4204 |
"expectedTypesKeys=null\n" + |
4205 |
"completion token location={STATEMENT_START}\n" + |
4206 |
"visibleElements={\n" + |
4207 |
" method1() {key=Ltest/X$Y;.method1()V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4208 |
" method0(int) {key=Ltest/X$Y;.method0(I)V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4209 |
" foo() {key=Ltest/X$Y;.foo()V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4210 |
" wait(long, int) {key=Ljava/lang/Object;.wait(JI)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4211 |
" wait(long) {key=Ljava/lang/Object;.wait(J)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4212 |
" wait() {key=Ljava/lang/Object;.wait()V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4213 |
" toString() {key=Ljava/lang/Object;.toString()Ljava/lang/String;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4214 |
" notifyAll() {key=Ljava/lang/Object;.notifyAll()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4215 |
" notify() {key=Ljava/lang/Object;.notify()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4216 |
" hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4217 |
" getClass() {key=Ljava/lang/Object;.getClass()Ljava/lang/Class;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4218 |
" finalize() {key=Ljava/lang/Object;.finalize()V|Ljava/lang/Throwable;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4219 |
" equals(java.lang.Object) {key=Ljava/lang/Object;.equals(Ljava/lang/Object;)Z} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4220 |
" clone() {key=Ljava/lang/Object;.clone()Ljava/lang/Object;|Ljava/lang/CloneNotSupportedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4221 |
" method0() {key=Ltest/X;.method0()V} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4222 |
"}", |
4223 |
result.context); |
4224 |
} |
4225 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4226 |
public void test0150() throws JavaModelException { |
4227 |
this.workingCopies = new ICompilationUnit[3]; |
4228 |
this.workingCopies[0] = getWorkingCopy( |
4229 |
"/Completion/src3/test/X.java", |
4230 |
"package test;\n" + |
4231 |
"public class X extends A {\n" + |
4232 |
" public void method0() {}\n" + |
4233 |
" public void method0(int i) {}\n" + |
4234 |
" public class Y extends B {\n" + |
4235 |
" public void method1() {}\n" + |
4236 |
" public void method0(int i) {}\n" + |
4237 |
" public void foo() {\n" + |
4238 |
" zzzz\n" + |
4239 |
" }\n" + |
4240 |
" }\n" + |
4241 |
"}"); |
4242 |
|
4243 |
this.workingCopies[1] = getWorkingCopy( |
4244 |
"/Completion/src3/test/A.java", |
4245 |
"package test;\n" + |
4246 |
"public class A {\n" + |
4247 |
" public void methodA() {}\n" + |
4248 |
" public void method0(int i) {}\n" + |
4249 |
"}"); |
4250 |
|
4251 |
this.workingCopies[2] = getWorkingCopy( |
4252 |
"/Completion/src3/test/B.java", |
4253 |
"package test;\n" + |
4254 |
"public class B {\n" + |
4255 |
" public void methodB() {}\n" + |
4256 |
" public void method0(int i) {}\n" + |
4257 |
"}"); |
4258 |
|
4259 |
String str = this.workingCopies[0].getSource(); |
4260 |
int tokenStart = str.lastIndexOf("zzzz"); |
4261 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4262 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4263 |
|
4264 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
4265 |
|
4266 |
String jclPath = getExternalJCLPathString(); |
4267 |
assertResults( |
4268 |
"completion offset="+(cursorLocation)+"\n" + |
4269 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4270 |
"completion token=\"zzzz\"\n" + |
4271 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4272 |
"expectedTypesSignatures=null\n" + |
4273 |
"expectedTypesKeys=null\n" + |
4274 |
"completion token location={STATEMENT_START}\n" + |
4275 |
"visibleElements={\n" + |
4276 |
" method1() {key=Ltest/X$Y;.method1()V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4277 |
" method0(int) {key=Ltest/X$Y;.method0(I)V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4278 |
" foo() {key=Ltest/X$Y;.foo()V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4279 |
" methodB() {key=Ltest/B;.methodB()V} [in B [in [Working copy] B.java [in test [in src3 [in Completion]]]]],\n" + |
4280 |
" wait(long, int) {key=Ljava/lang/Object;.wait(JI)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4281 |
" wait(long) {key=Ljava/lang/Object;.wait(J)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4282 |
" wait() {key=Ljava/lang/Object;.wait()V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4283 |
" toString() {key=Ljava/lang/Object;.toString()Ljava/lang/String;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4284 |
" notifyAll() {key=Ljava/lang/Object;.notifyAll()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4285 |
" notify() {key=Ljava/lang/Object;.notify()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4286 |
" hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4287 |
" getClass() {key=Ljava/lang/Object;.getClass()Ljava/lang/Class;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4288 |
" finalize() {key=Ljava/lang/Object;.finalize()V|Ljava/lang/Throwable;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4289 |
" equals(java.lang.Object) {key=Ljava/lang/Object;.equals(Ljava/lang/Object;)Z} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4290 |
" clone() {key=Ljava/lang/Object;.clone()Ljava/lang/Object;|Ljava/lang/CloneNotSupportedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4291 |
" method0() {key=Ltest/X;.method0()V} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4292 |
" methodA() {key=Ltest/A;.methodA()V} [in A [in [Working copy] A.java [in test [in src3 [in Completion]]]]],\n" + |
4293 |
"}", |
4294 |
result.context); |
4295 |
} |
4296 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4297 |
public void test0151() throws CoreException, IOException { |
4298 |
this.workingCopies = new ICompilationUnit[3]; |
4299 |
this.workingCopies[0] = getWorkingCopy( |
4300 |
"/Completion/src3/test/X.java", |
4301 |
"package test;\n" + |
4302 |
"public class X extends A {\n" + |
4303 |
" public void method0() {}\n" + |
4304 |
" public void method0(int i) {}\n" + |
4305 |
" public class Y extends B {\n" + |
4306 |
" public void method1() {}\n" + |
4307 |
" public void method0(int i) {}\n" + |
4308 |
" public void foo() {\n" + |
4309 |
" zzzz\n" + |
4310 |
" }\n" + |
4311 |
" }\n" + |
4312 |
"}"); |
4313 |
|
4314 |
this.workingCopies[1] = getWorkingCopy( |
4315 |
"/Completion/src3/test/B.java", |
4316 |
"package test;\n" + |
4317 |
"public class B extends D {\n" + |
4318 |
" public void methodB() {}\n" + |
4319 |
" public void method0(int i) {}\n" + |
4320 |
"}"); |
4321 |
|
4322 |
this.workingCopies[2] = getWorkingCopy( |
4323 |
"/Completion/src3/test/D.java", |
4324 |
"package test;\n" + |
4325 |
"public class D {\n" + |
4326 |
" public void methodD() {}\n" + |
4327 |
" public void method0(int i) {}\n" + |
4328 |
"}"); |
4329 |
|
4330 |
this.addLibrary( |
4331 |
getJavaProject("Completion"), |
4332 |
"test.jar", |
4333 |
"testsrc.zip", |
4334 |
new String[] { |
4335 |
"/Completion/test/A.java", |
4336 |
"package test;\n" + |
4337 |
"public class A extends C {\n" + |
4338 |
" public void methodA() {}\n" + |
4339 |
" public void method0(int i) {}\n" + |
4340 |
"}", |
4341 |
"/Completion/test/C.java", |
4342 |
"package test;\n" + |
4343 |
"public class C {\n" + |
4344 |
" public void methodC() {}\n" + |
4345 |
" public void method0(int i) {}\n" + |
4346 |
"}" |
4347 |
}, |
4348 |
"1.4"); |
4349 |
|
4350 |
|
4351 |
String str = this.workingCopies[0].getSource(); |
4352 |
int tokenStart = str.lastIndexOf("zzzz"); |
4353 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4354 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4355 |
|
4356 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true); |
4357 |
|
4358 |
String jclPath = getExternalJCLPathString(); |
4359 |
assertResults( |
4360 |
"completion offset="+(cursorLocation)+"\n" + |
4361 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4362 |
"completion token=\"zzzz\"\n" + |
4363 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4364 |
"expectedTypesSignatures=null\n" + |
4365 |
"expectedTypesKeys=null\n" + |
4366 |
"completion token location={STATEMENT_START}\n" + |
4367 |
"visibleElements={\n" + |
4368 |
" method1() {key=Ltest/X$Y;.method1()V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4369 |
" method0(int) {key=Ltest/X$Y;.method0(I)V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4370 |
" foo() {key=Ltest/X$Y;.foo()V} [in Y [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + |
4371 |
" methodB() {key=Ltest/B;.methodB()V} [in B [in [Working copy] B.java [in test [in src3 [in Completion]]]]],\n" + |
4372 |
" methodD() {key=Ltest/D;.methodD()V} [in D [in [Working copy] D.java [in test [in src3 [in Completion]]]]],\n" + |
4373 |
" wait(long, int) {key=Ljava/lang/Object;.wait(JI)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4374 |
" wait(long) {key=Ljava/lang/Object;.wait(J)V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4375 |
" wait() {key=Ljava/lang/Object;.wait()V|Ljava/lang/IllegalMonitorStateException;|Ljava/lang/InterruptedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4376 |
" toString() {key=Ljava/lang/Object;.toString()Ljava/lang/String;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4377 |
" notifyAll() {key=Ljava/lang/Object;.notifyAll()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4378 |
" notify() {key=Ljava/lang/Object;.notify()V|Ljava/lang/IllegalMonitorStateException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4379 |
" hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4380 |
" getClass() {key=Ljava/lang/Object;.getClass()Ljava/lang/Class;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4381 |
" finalize() {key=Ljava/lang/Object;.finalize()V|Ljava/lang/Throwable;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4382 |
" equals(java.lang.Object) {key=Ljava/lang/Object;.equals(Ljava/lang/Object;)Z} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4383 |
" clone() {key=Ljava/lang/Object;.clone()Ljava/lang/Object;|Ljava/lang/CloneNotSupportedException;} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + |
4384 |
" method0() {key=Ltest/X;.method0()V} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4385 |
" methodA() {key=Ltest/A;.methodA()V} [in A [in A.class [in test [in test.jar [in Completion]]]]],\n" + |
4386 |
" methodC() {key=Ltest/C;.methodC()V} [in C [in C.class [in test [in test.jar [in Completion]]]]],\n" + |
4387 |
"}", |
4388 |
result.context); |
4389 |
} |
4390 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4391 |
public void test0152() throws JavaModelException { |
4392 |
this.workingCopies = new ICompilationUnit[1]; |
4393 |
this.workingCopies[0] = getWorkingCopy( |
4394 |
"/Completion/src3/test/X.java", |
4395 |
"package test;\n" + |
4396 |
"public class X {\n" + |
4397 |
" public void method0() {}\n" + |
4398 |
" public void method0(int i) {}\n" + |
4399 |
" public class Y {\n" + |
4400 |
" public void method1() {}\n" + |
4401 |
" public void method0(int i) {}\n" + |
4402 |
" public void foo() {\n" + |
4403 |
" zzzz\n" + |
4404 |
" }\n" + |
4405 |
" }\n" + |
4406 |
"}"); |
4407 |
|
4408 |
String str = this.workingCopies[0].getSource(); |
4409 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4410 |
|
4411 |
boolean unsupported = false; |
4412 |
try { |
4413 |
contextComplete0(this.workingCopies[0], cursorLocation, false /*do not use extended context*/,true /*ask enclosing element*/, true /*ask visible elements*/, null); |
4414 |
} catch (UnsupportedOperationException e) { |
4415 |
// this is expected because visible elements computation require heavy context |
4416 |
unsupported = true; |
4417 |
} |
4418 |
assertTrue("getVisibleElements() shouldn't be supported", unsupported); |
4419 |
} |
4420 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4421 |
public void test0153() throws JavaModelException { |
4422 |
this.workingCopies = new ICompilationUnit[2]; |
4423 |
this.workingCopies[0] = getWorkingCopy( |
4424 |
"/Completion/src3/test/X.java", |
4425 |
"package test;\n" + |
4426 |
"public class X {\n" + |
4427 |
" public A methodX() {return null;}\n" + |
4428 |
" public void foo() {\n" + |
4429 |
" zzzz\n" + |
4430 |
" }\n" + |
4431 |
"}"); |
4432 |
|
4433 |
this.workingCopies[1] = getWorkingCopy( |
4434 |
"/Completion/src3/test/A.java", |
4435 |
"package test;\n" + |
4436 |
"public class A {\n" + |
4437 |
"}"); |
4438 |
|
4439 |
|
4440 |
String str = this.workingCopies[0].getSource(); |
4441 |
int tokenStart = str.lastIndexOf("zzzz"); |
4442 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4443 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4444 |
|
4445 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true, "Ltest/A;"); |
4446 |
|
4447 |
assertResults( |
4448 |
"completion offset="+(cursorLocation)+"\n" + |
4449 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4450 |
"completion token=\"zzzz\"\n" + |
4451 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4452 |
"expectedTypesSignatures=null\n" + |
4453 |
"expectedTypesKeys=null\n" + |
4454 |
"completion token location={STATEMENT_START}\n" + |
4455 |
"visibleElements={\n" + |
4456 |
" methodX() {key=Ltest/X;.methodX()Ltest/A;} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4457 |
"}", |
4458 |
result.context); |
4459 |
} |
4460 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4461 |
public void test0154() throws JavaModelException { |
4462 |
this.workingCopies = new ICompilationUnit[3]; |
4463 |
this.workingCopies[0] = getWorkingCopy( |
4464 |
"/Completion/src3/test/X.java", |
4465 |
"package test;\n" + |
4466 |
"public class X {\n" + |
4467 |
" public A methodX() {return null;}\n" + |
4468 |
" public void foo() {\n" + |
4469 |
" zzzz\n" + |
4470 |
" }\n" + |
4471 |
"}"); |
4472 |
|
4473 |
this.workingCopies[1] = getWorkingCopy( |
4474 |
"/Completion/src3/test/A.java", |
4475 |
"package test;\n" + |
4476 |
"public class A {\n" + |
4477 |
"}"); |
4478 |
|
4479 |
this.workingCopies[2] = getWorkingCopy( |
4480 |
"/Completion/src3/test/B.java", |
4481 |
"package test;\n" + |
4482 |
"public class B {\n" + |
4483 |
"}"); |
4484 |
|
4485 |
|
4486 |
String str = this.workingCopies[0].getSource(); |
4487 |
int tokenStart = str.lastIndexOf("zzzz"); |
4488 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4489 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4490 |
|
4491 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true, "Ltest/B;"); |
4492 |
|
4493 |
assertResults( |
4494 |
"completion offset="+(cursorLocation)+"\n" + |
4495 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4496 |
"completion token=\"zzzz\"\n" + |
4497 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4498 |
"expectedTypesSignatures=null\n" + |
4499 |
"expectedTypesKeys=null\n" + |
4500 |
"completion token location={STATEMENT_START}\n" + |
4501 |
"visibleElements={}", |
4502 |
result.context); |
4503 |
} |
4504 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4505 |
public void test0155() throws JavaModelException { |
4506 |
this.workingCopies = new ICompilationUnit[3]; |
4507 |
this.workingCopies[0] = getWorkingCopy( |
4508 |
"/Completion/src3/test/X.java", |
4509 |
"package test;\n" + |
4510 |
"public class X {\n" + |
4511 |
" public A methodX() {return null;}\n" + |
4512 |
" public void foo() {\n" + |
4513 |
" zzzz\n" + |
4514 |
" }\n" + |
4515 |
"}"); |
4516 |
|
4517 |
this.workingCopies[1] = getWorkingCopy( |
4518 |
"/Completion/src3/test/A.java", |
4519 |
"package test;\n" + |
4520 |
"public class A extends B {\n" + |
4521 |
"}"); |
4522 |
|
4523 |
this.workingCopies[2] = getWorkingCopy( |
4524 |
"/Completion/src3/test/B.java", |
4525 |
"package test;\n" + |
4526 |
"public class B {\n" + |
4527 |
"}"); |
4528 |
|
4529 |
|
4530 |
String str = this.workingCopies[0].getSource(); |
4531 |
int tokenStart = str.lastIndexOf("zzzz"); |
4532 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4533 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4534 |
|
4535 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true, "Ltest/B;"); |
4536 |
|
4537 |
assertResults( |
4538 |
"completion offset="+(cursorLocation)+"\n" + |
4539 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4540 |
"completion token=\"zzzz\"\n" + |
4541 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4542 |
"expectedTypesSignatures=null\n" + |
4543 |
"expectedTypesKeys=null\n" + |
4544 |
"completion token location={STATEMENT_START}\n" + |
4545 |
"visibleElements={\n" + |
4546 |
" methodX() {key=Ltest/X;.methodX()Ltest/A;} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4547 |
"}", |
4548 |
result.context); |
4549 |
} |
4550 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4551 |
public void test0156() throws JavaModelException { |
4552 |
this.workingCopies = new ICompilationUnit[3]; |
4553 |
this.workingCopies[0] = getWorkingCopy( |
4554 |
"/Completion/src3/test/X.java", |
4555 |
"package test;\n" + |
4556 |
"public class X {\n" + |
4557 |
" public A methodX() {return null;}\n" + |
4558 |
" public void foo() {\n" + |
4559 |
" zzzz\n" + |
4560 |
" }\n" + |
4561 |
"}"); |
4562 |
|
4563 |
|
4564 |
String str = this.workingCopies[0].getSource(); |
4565 |
int tokenStart = str.lastIndexOf("zzzz"); |
4566 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4567 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4568 |
|
4569 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true, "Ltest/Zork;"); |
4570 |
|
4571 |
assertResults( |
4572 |
"completion offset="+(cursorLocation)+"\n" + |
4573 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4574 |
"completion token=\"zzzz\"\n" + |
4575 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4576 |
"expectedTypesSignatures=null\n" + |
4577 |
"expectedTypesKeys=null\n" + |
4578 |
"completion token location={STATEMENT_START}\n" + |
4579 |
"visibleElements={}", |
4580 |
result.context); |
4581 |
} |
4582 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4583 |
public void test0157() throws JavaModelException { |
4584 |
this.workingCopies = new ICompilationUnit[3]; |
4585 |
this.workingCopies[0] = getWorkingCopy( |
4586 |
"/Completion/src3/test/X.java", |
4587 |
"package test;\n" + |
4588 |
"public class X {\n" + |
4589 |
" public test.Zork methodX() {return null;}\n" + |
4590 |
" public void foo() {\n" + |
4591 |
" zzzz\n" + |
4592 |
" }\n" + |
4593 |
"}"); |
4594 |
|
4595 |
|
4596 |
String str = this.workingCopies[0].getSource(); |
4597 |
int tokenStart = str.lastIndexOf("zzzz"); |
4598 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4599 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4600 |
|
4601 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true, "Ltest/Zork;"); |
4602 |
|
4603 |
assertResults( |
4604 |
"completion offset="+(cursorLocation)+"\n" + |
4605 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4606 |
"completion token=\"zzzz\"\n" + |
4607 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4608 |
"expectedTypesSignatures=null\n" + |
4609 |
"expectedTypesKeys=null\n" + |
4610 |
"completion token location={STATEMENT_START}\n" + |
4611 |
"visibleElements={\n" + |
4612 |
" methodX() {key=Ltest/X;.methodX()Ltest/Zork;} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + |
4613 |
"}", |
4614 |
result.context); |
4615 |
} |
4616 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4617 |
public void test0158() throws JavaModelException { |
4618 |
this.workingCopies = new ICompilationUnit[3]; |
4619 |
this.workingCopies[0] = getWorkingCopy( |
4620 |
"/Completion/src3/test/X.java", |
4621 |
"package test;\n" + |
4622 |
"public class X {\n" + |
4623 |
" public void foo() {\n" + |
4624 |
" zzzz\n" + |
4625 |
" }\n" + |
4626 |
"}"); |
4627 |
|
4628 |
|
4629 |
String str = this.workingCopies[0].getSource(); |
4630 |
int tokenStart = str.lastIndexOf("zzzz"); |
4631 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4632 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4633 |
|
4634 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, true, false); |
4635 |
|
4636 |
assertResults( |
4637 |
"completion offset="+(cursorLocation)+"\n" + |
4638 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4639 |
"completion token=\"zzzz\"\n" + |
4640 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4641 |
"expectedTypesSignatures=null\n" + |
4642 |
"expectedTypesKeys=null\n" + |
4643 |
"completion token location={STATEMENT_START}\n" + |
4644 |
"enclosingElement=foo() {key=Ltest/X;.foo()V} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]", |
4645 |
result.context); |
4646 |
} |
4647 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4648 |
public void test0159() throws JavaModelException { |
4649 |
this.workingCopies = new ICompilationUnit[3]; |
4650 |
this.workingCopies[0] = getWorkingCopy( |
4651 |
"/Completion/src3/test/X.java", |
4652 |
"package test;\n" + |
4653 |
"public class X {\n" + |
4654 |
" public void foo() {}\n" + |
4655 |
" zzzz\n" + |
4656 |
" public void bar() {}\n" + |
4657 |
"}"); |
4658 |
|
4659 |
|
4660 |
String str = this.workingCopies[0].getSource(); |
4661 |
int tokenStart = str.lastIndexOf("zzzz"); |
4662 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4663 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4664 |
|
4665 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, true, false); |
4666 |
|
4667 |
assertResults( |
4668 |
"completion offset="+(cursorLocation)+"\n" + |
4669 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4670 |
"completion token=\"zzzz\"\n" + |
4671 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4672 |
"expectedTypesSignatures=null\n" + |
4673 |
"expectedTypesKeys=null\n" + |
4674 |
"completion token location={MEMBER_START}\n" + |
4675 |
"enclosingElement=X {key=Ltest/X;} [in [Working copy] X.java [in test [in src3 [in Completion]]]]", |
4676 |
result.context); |
4677 |
} |
4678 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4679 |
public void test0160() throws JavaModelException { |
4680 |
this.workingCopies = new ICompilationUnit[3]; |
4681 |
this.workingCopies[0] = getWorkingCopy( |
4682 |
"/Completion/src3/test/X.java", |
4683 |
"package test;\n" + |
4684 |
"zzzz\n" + |
4685 |
"public class X {\n" + |
4686 |
"}"); |
4687 |
|
4688 |
|
4689 |
String str = this.workingCopies[0].getSource(); |
4690 |
int tokenStart = str.lastIndexOf("zzzz"); |
4691 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4692 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4693 |
|
4694 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, true, false); |
4695 |
|
4696 |
assertResults( |
4697 |
"completion offset="+(cursorLocation)+"\n" + |
4698 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4699 |
"completion token=\"zzzz\"\n" + |
4700 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4701 |
"expectedTypesSignatures=null\n" + |
4702 |
"expectedTypesKeys=null\n" + |
4703 |
"completion token location=UNKNOWN\n" + |
4704 |
"enclosingElement=[Working copy] X.java [in test [in src3 [in Completion]]]", |
4705 |
result.context); |
4706 |
} |
4707 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202470 |
4708 |
public void test0161() throws JavaModelException { |
4709 |
this.workingCopies = new ICompilationUnit[3]; |
4710 |
this.workingCopies[0] = getWorkingCopy( |
4711 |
"/Completion/src3/test/X.java", |
4712 |
"package test;\n" + |
4713 |
"public class X {\n" + |
4714 |
" public void foo() {}\n" + |
4715 |
" public class Y {\n" + |
4716 |
" public void fooY() {}\n" + |
4717 |
" zzzz\n" + |
4718 |
" public void barY() {}\n" + |
4719 |
" }\n" + |
4720 |
" public void bar() {}\n" + |
4721 |
"}"); |
4722 |
|
4723 |
|
4724 |
String str = this.workingCopies[0].getSource(); |
4725 |
int tokenStart = str.lastIndexOf("zzzz"); |
4726 |
int tokenEnd = tokenStart + "zzzz".length() - 1; |
4727 |
int cursorLocation = str.lastIndexOf("zzzz") + "zzzz".length(); |
4728 |
|
4729 |
CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, true, false); |
4730 |
|
4731 |
assertResults( |
4732 |
"completion offset="+(cursorLocation)+"\n" + |
4733 |
"completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + |
4734 |
"completion token=\"zzzz\"\n" + |
4735 |
"completion token kind=TOKEN_KIND_NAME\n" + |
4736 |
"expectedTypesSignatures=null\n" + |
4737 |
"expectedTypesKeys=null\n" + |
4738 |
"completion token location={MEMBER_START}\n" + |
4739 |
"enclosingElement=Y {key=Ltest/X$Y;} [in X [in [Working copy] X.java [in test [in src3 [in Completion]]]]]", |
4740 |
result.context); |
4741 |
} |
3917 |
} |
4742 |
} |