1313 *******************************************************************************/
1414package org .eclipse .jdt .ui .tests .quickfix ;
1515
16- import java .io .File ;
1716import java .util .ArrayList ;
1817import java .util .Hashtable ;
1918
2019import org .junit .After ;
2120import org .junit .Before ;
2221import org .junit .Rule ;
2322import org .junit .Test ;
24- import org .osgi .framework .Bundle ;
2523
2624import org .eclipse .jdt .testplugin .JavaProjectHelper ;
2725import org .eclipse .jdt .testplugin .TestOptions ;
2826
29- import org .eclipse .core .runtime .FileLocator ;
3027import org .eclipse .core .runtime .Path ;
31- import org .eclipse .core .runtime .Platform ;
3228
3329import org .eclipse .jface .preference .IPreferenceStore ;
3430
@@ -94,13 +90,8 @@ public void setUp() throws Exception {
9490 fJProject1 = projectSetup .getProject ();
9591
9692 if (ANNOTATION_JAR_PATH == null ) {
97- String version = "[1.1.0,2.0.0)" ; // tests run at 1.8, but still use "old" null annotations
98- Bundle [] bundles = Platform .getBundles ("org.eclipse.jdt.annotation" , version );
99- File bundleFile = FileLocator .getBundleFileLocation (bundles [0 ]).get ();
100- if (bundleFile .isDirectory ())
101- ANNOTATION_JAR_PATH = bundleFile .getPath () + "/bin" ;
102- else
103- ANNOTATION_JAR_PATH = bundleFile .getPath ();
93+ // tests run at 1.8, but still use "old" null annotations:
94+ ANNOTATION_JAR_PATH = NullAnnotationsQuickFixTest .getAnnotationV1LibPath ();
10495 }
10596 JavaProjectHelper .addLibrary (fJProject1 , new Path (ANNOTATION_JAR_PATH ));
10697
@@ -121,9 +112,9 @@ public void testBug473068_elided() throws Exception {
121112 IPackageFragment pack1 = fSourceFolder .createPackageFragment ("testNullAnnotations" , false , null );
122113 String str = """
123114 package testNullAnnotations;
124-
115+
125116 import org.eclipse.jdt.annotation.NonNull;
126-
117+
127118 interface Consumer<T> {
128119 void accept(T t);
129120 }
@@ -134,7 +125,7 @@ public void select(final double min, final double max) {
134125 }
135126 \t
136127 private void doStuff(int a, int b, final double min, final double max, Consumer<Object> postAction) {
137-
128+
138129 }
139130 private void updateSelectionData(final @NonNull Object data) {
140131 }
@@ -152,10 +143,10 @@ private void updateSelectionData(final @NonNull Object data) {
152143
153144 String str1 = """
154145 package testNullAnnotations;
155-
146+
156147 import org.eclipse.jdt.annotation.NonNull;
157148 import org.eclipse.jdt.annotation.Nullable;
158-
149+
159150 interface Consumer<T> {
160151 void accept(T t);
161152 }
@@ -166,7 +157,7 @@ public void select(final double min, final double max) {
166157 }
167158 \t
168159 private void doStuff(int a, int b, final double min, final double max, Consumer<Object> postAction) {
169-
160+
170161 }
171162 private void updateSelectionData(final @Nullable Object data) {
172163 }
@@ -179,9 +170,9 @@ private void updateSelectionData(final @Nullable Object data) {
179170
180171 String str2 = """
181172 package testNullAnnotations;
182-
173+
183174 import org.eclipse.jdt.annotation.NonNull;
184-
175+
185176 interface Consumer<T> {
186177 void accept(T t);
187178 }
@@ -193,7 +184,7 @@ public void select(final double min, final double max) {
193184 }
194185 \t
195186 private void doStuff(int a, int b, final double min, final double max, Consumer<Object> postAction) {
196-
187+
197188 }
198189 private void updateSelectionData(final @NonNull Object data) {
199190 }
@@ -212,9 +203,9 @@ public void testBug473068_explicit_type() throws Exception {
212203 IPackageFragment pack1 = fSourceFolder .createPackageFragment ("testNullAnnotations" , false , null );
213204 String str = """
214205 package testNullAnnotations;
215-
206+
216207 import org.eclipse.jdt.annotation.NonNull;
217-
208+
218209 interface Consumer<T> {
219210 void accept(T t);
220211 }
@@ -225,7 +216,7 @@ public void select(final double min, final double max) {
225216 }
226217 \t
227218 private void doStuff(int a, int b, final double min, final double max, Consumer<Object> postAction) {
228-
219+
229220 }
230221 private void updateSelectionData(final @NonNull Object data) {
231222 }
@@ -243,9 +234,9 @@ private void updateSelectionData(final @NonNull Object data) {
243234
244235 String str1 = """
245236 package testNullAnnotations;
246-
237+
247238 import org.eclipse.jdt.annotation.NonNull;
248-
239+
249240 interface Consumer<T> {
250241 void accept(T t);
251242 }
@@ -256,7 +247,7 @@ public void select(final double min, final double max) {
256247 }
257248 \t
258249 private void doStuff(int a, int b, final double min, final double max, Consumer<Object> postAction) {
259-
250+
260251 }
261252 private void updateSelectionData(final @NonNull Object data) {
262253 }
@@ -269,10 +260,10 @@ private void updateSelectionData(final @NonNull Object data) {
269260
270261 String str2 = """
271262 package testNullAnnotations;
272-
263+
273264 import org.eclipse.jdt.annotation.NonNull;
274265 import org.eclipse.jdt.annotation.Nullable;
275-
266+
276267 interface Consumer<T> {
277268 void accept(T t);
278269 }
@@ -283,7 +274,7 @@ public void select(final double min, final double max) {
283274 }
284275 \t
285276 private void doStuff(int a, int b, final double min, final double max, Consumer<Object> postAction) {
286-
277+
287278 }
288279 private void updateSelectionData(final @Nullable Object data) {
289280 }
@@ -296,9 +287,9 @@ private void updateSelectionData(final @Nullable Object data) {
296287
297288 String str3 = """
298289 package testNullAnnotations;
299-
290+
300291 import org.eclipse.jdt.annotation.NonNull;
301-
292+
302293 interface Consumer<T> {
303294 void accept(T t);
304295 }
@@ -310,7 +301,7 @@ public void select(final double min, final double max) {
310301 }
311302 \t
312303 private void doStuff(int a, int b, final double min, final double max, Consumer<Object> postAction) {
313-
304+
314305 }
315306 private void updateSelectionData(final @NonNull Object data) {
316307 }
0 commit comments