Lines 111-117
Link Here
|
111 |
public void test001() throws JavaModelException { |
111 |
public void test001() throws JavaModelException { |
112 |
IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$ |
112 |
IPackageFragment packageFragment = this.root.getPackageFragment("p1/p2"); //$NON-NLS-1$ |
113 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
113 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
114 |
String javadoc = packageFragment.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
114 |
String javadoc = packageFragment.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
115 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
115 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
116 |
} |
116 |
} |
117 |
|
117 |
|
Lines 121-127
Link Here
|
121 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
121 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
122 |
IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$ |
122 |
IClassFile classFile = packageFragment.getClassFile("X.class"); //$NON-NLS-1$ |
123 |
assertNotNull(classFile); |
123 |
assertNotNull(classFile); |
124 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
124 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
125 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
125 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
126 |
} |
126 |
} |
127 |
|
127 |
|
Lines 134-140
Link Here
|
134 |
IType type = classFile.getType(); |
134 |
IType type = classFile.getType(); |
135 |
IField field = type.getField("f"); //$NON-NLS-1$ |
135 |
IField field = type.getField("f"); //$NON-NLS-1$ |
136 |
assertNotNull(field); |
136 |
assertNotNull(field); |
137 |
String javadoc = field.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
137 |
String javadoc = field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
138 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
138 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
139 |
} |
139 |
} |
140 |
|
140 |
|
Lines 147-153
Link Here
|
147 |
IType type = classFile.getType(); |
147 |
IType type = classFile.getType(); |
148 |
IMethod method = type.getMethod("foo", new String[] {"I", "J", "Ljava.lang.String;"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
148 |
IMethod method = type.getMethod("foo", new String[] {"I", "J", "Ljava.lang.String;"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
149 |
assertTrue(method.exists()); |
149 |
assertTrue(method.exists()); |
150 |
String javadoc = method.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
150 |
String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
151 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
151 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
152 |
// TODO (olivier) reenable once 117740 is fixed |
152 |
// TODO (olivier) reenable once 117740 is fixed |
153 |
if (false) { |
153 |
if (false) { |
Lines 169-175
Link Here
|
169 |
IType type = classFile.getType(); |
169 |
IType type = classFile.getType(); |
170 |
IMethod method = type.getMethod("X", new String[] {"I"}); //$NON-NLS-1$ //$NON-NLS-2$ |
170 |
IMethod method = type.getMethod("X", new String[] {"I"}); //$NON-NLS-1$ //$NON-NLS-2$ |
171 |
assertTrue(method.exists()); |
171 |
assertTrue(method.exists()); |
172 |
String javadoc = method.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
172 |
String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
173 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
173 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
174 |
// TODO (olivier) reenable once 117740 is fixed |
174 |
// TODO (olivier) reenable once 117740 is fixed |
175 |
if (false) { |
175 |
if (false) { |
Lines 186-192
Link Here
|
186 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
186 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
187 |
IClassFile classFile = packageFragment.getClassFile("X$A.class"); //$NON-NLS-1$ |
187 |
IClassFile classFile = packageFragment.getClassFile("X$A.class"); //$NON-NLS-1$ |
188 |
assertNotNull(classFile); |
188 |
assertNotNull(classFile); |
189 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
189 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
190 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
190 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
191 |
} |
191 |
} |
192 |
|
192 |
|
Lines 199-213
Link Here
|
199 |
IType type = classFile.getType(); |
199 |
IType type = classFile.getType(); |
200 |
IMethod method = type.getMethod("A", new String[] {"Lp1.p2.X;", "F"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
200 |
IMethod method = type.getMethod("A", new String[] {"Lp1.p2.X;", "F"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
201 |
assertTrue(method.exists()); |
201 |
assertTrue(method.exists()); |
202 |
String javadoc = method.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
202 |
String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
203 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
203 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
204 |
// TODO (olivier) reenable once 117740 is fixed |
204 |
String[] paramNames = method.getParameterNames(); |
205 |
if (false) { |
205 |
assertNotNull(paramNames); |
206 |
String[] paramNames = method.getParameterNames(); |
206 |
assertEquals("Wrong size", 1, paramNames.length); //$NON-NLS-1$ |
207 |
assertNotNull(paramNames); |
207 |
assertEquals("Wrong name for first param", "f", paramNames[0]); //$NON-NLS-1$ //$NON-NLS-2$ |
208 |
assertEquals("Wrong size", 1, paramNames.length); //$NON-NLS-1$ |
|
|
209 |
assertEquals("Wrong name for first param", "f", paramNames[0]); //$NON-NLS-1$ //$NON-NLS-2$ |
210 |
} |
211 |
} |
208 |
} |
212 |
|
209 |
|
213 |
// for a method foo2 |
210 |
// for a method foo2 |
Lines 219-232
Link Here
|
219 |
IType type = classFile.getType(); |
216 |
IType type = classFile.getType(); |
220 |
IMethod method = type.getMethod("foo2", new String[0]); //$NON-NLS-1$ |
217 |
IMethod method = type.getMethod("foo2", new String[0]); //$NON-NLS-1$ |
221 |
assertTrue(method.exists()); |
218 |
assertTrue(method.exists()); |
222 |
String javadoc = method.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
219 |
String javadoc = method.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
223 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
220 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
224 |
// TODO (olivier) reenable once 117740 is fixed |
221 |
String[] paramNames = method.getParameterNames(); |
225 |
if (false) { |
222 |
assertNotNull(paramNames); |
226 |
String[] paramNames = method.getParameterNames(); |
223 |
assertEquals("Wrong size", 0, paramNames.length); //$NON-NLS-1$ |
227 |
assertNotNull(paramNames); |
|
|
228 |
assertEquals("Wrong size", 0, paramNames.length); //$NON-NLS-1$ |
229 |
} |
230 |
} |
224 |
} |
231 |
|
225 |
|
232 |
// for a field f2 |
226 |
// for a field f2 |
Lines 238-244
Link Here
|
238 |
IType type = classFile.getType(); |
232 |
IType type = classFile.getType(); |
239 |
IField field = type.getField("f2"); //$NON-NLS-1$ |
233 |
IField field = type.getField("f2"); //$NON-NLS-1$ |
240 |
assertNotNull(field); |
234 |
assertNotNull(field); |
241 |
String javadoc = field.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
235 |
String javadoc = field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
242 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
236 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
243 |
} |
237 |
} |
244 |
|
238 |
|
Lines 279-285
Link Here
|
279 |
IType type = classFile.getType(); |
273 |
IType type = classFile.getType(); |
280 |
IField field = type.getField("f"); //$NON-NLS-1$ |
274 |
IField field = type.getField("f"); //$NON-NLS-1$ |
281 |
assertNotNull(field); |
275 |
assertNotNull(field); |
282 |
String javadoc = field.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
276 |
String javadoc = field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
283 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
277 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
284 |
} finally { |
278 |
} finally { |
285 |
// restore classpath |
279 |
// restore classpath |
Lines 298-304
Link Here
|
298 |
IType type = classFile.getType(); |
292 |
IType type = classFile.getType(); |
299 |
IField field = type.getField("out"); //$NON-NLS-1$ |
293 |
IField field = type.getField("out"); //$NON-NLS-1$ |
300 |
assertNotNull(field); |
294 |
assertNotNull(field); |
301 |
String javadoc = field.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
295 |
String javadoc = field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
302 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
296 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
303 |
} |
297 |
} |
304 |
|
298 |
|
Lines 308-314
Link Here
|
308 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
302 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
309 |
IClassFile classFile = packageFragment.getClassFile("Z.class"); //$NON-NLS-1$ |
303 |
IClassFile classFile = packageFragment.getClassFile("Z.class"); //$NON-NLS-1$ |
310 |
assertNotNull(classFile); |
304 |
assertNotNull(classFile); |
311 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
305 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
312 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
306 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
313 |
assertTrue("Should not contain reference to out", javadoc.indexOf("out") == -1); |
307 |
assertTrue("Should not contain reference to out", javadoc.indexOf("out") == -1); |
314 |
} |
308 |
} |
Lines 319-325
Link Here
|
319 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
313 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
320 |
IClassFile classFile = packageFragment.getClassFile("W.class"); //$NON-NLS-1$ |
314 |
IClassFile classFile = packageFragment.getClassFile("W.class"); //$NON-NLS-1$ |
321 |
assertNotNull(classFile); |
315 |
assertNotNull(classFile); |
322 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
316 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
323 |
assertNull("Should not have a javadoc", javadoc); //$NON-NLS-1$ |
317 |
assertNull("Should not have a javadoc", javadoc); //$NON-NLS-1$ |
324 |
} |
318 |
} |
325 |
|
319 |
|
Lines 329-335
Link Here
|
329 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
323 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
330 |
IClassFile classFile = packageFragment.getClassFile("E.class"); //$NON-NLS-1$ |
324 |
IClassFile classFile = packageFragment.getClassFile("E.class"); //$NON-NLS-1$ |
331 |
assertNotNull(classFile); |
325 |
assertNotNull(classFile); |
332 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
326 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
333 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
327 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
334 |
assertTrue("Should not contain reference to Constant C", javadoc.indexOf("Constant C") == -1); |
328 |
assertTrue("Should not contain reference to Constant C", javadoc.indexOf("Constant C") == -1); |
335 |
} |
329 |
} |
Lines 340-346
Link Here
|
340 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
334 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
341 |
IClassFile classFile = packageFragment.getClassFile("Annot.class"); //$NON-NLS-1$ |
335 |
IClassFile classFile = packageFragment.getClassFile("Annot.class"); //$NON-NLS-1$ |
342 |
assertNotNull(classFile); |
336 |
assertNotNull(classFile); |
343 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
337 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
344 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
338 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
345 |
assertTrue("Should not contain reference to name", javadoc.indexOf("name") == -1); |
339 |
assertTrue("Should not contain reference to name", javadoc.indexOf("name") == -1); |
346 |
} |
340 |
} |
Lines 368-374
Link Here
|
368 |
IType type = classFile.getType(); |
362 |
IType type = classFile.getType(); |
369 |
IField field = type.getField("f"); //$NON-NLS-1$ |
363 |
IField field = type.getField("f"); //$NON-NLS-1$ |
370 |
assertNotNull(field); |
364 |
assertNotNull(field); |
371 |
field.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
365 |
field.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
372 |
assertFalse("Should be unreachable", true); |
366 |
assertFalse("Should be unreachable", true); |
373 |
} catch(JavaModelException e) { |
367 |
} catch(JavaModelException e) { |
374 |
assertTrue("Must occur", true); |
368 |
assertTrue("Must occur", true); |
Lines 387-393
Link Here
|
387 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
381 |
assertNotNull("Should not be null", packageFragment); //$NON-NLS-1$ |
388 |
IClassFile classFile = packageFragment.getClassFile("Annot2.class"); //$NON-NLS-1$ |
382 |
IClassFile classFile = packageFragment.getClassFile("Annot2.class"); //$NON-NLS-1$ |
389 |
assertNotNull(classFile); |
383 |
assertNotNull(classFile); |
390 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor(), "UTF-8"); //$NON-NLS-1$ |
384 |
String javadoc = classFile.getAttachedJavadoc(new NullProgressMonitor()); //$NON-NLS-1$ |
391 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
385 |
assertNotNull("Should have a javadoc", javadoc); //$NON-NLS-1$ |
392 |
assertTrue("Should not contain reference to name2", javadoc.indexOf("name2") == -1); |
386 |
assertTrue("Should not contain reference to name2", javadoc.indexOf("name2") == -1); |
393 |
} |
387 |
} |