Lines 46-52
Link Here
|
46 |
import java.io.File; |
46 |
import java.io.File; |
47 |
import java.io.FileInputStream; |
47 |
import java.io.FileInputStream; |
48 |
import java.io.IOException; |
48 |
import java.io.IOException; |
49 |
import java.io.InputStream; |
|
|
50 |
import java.io.OutputStream; |
49 |
import java.io.OutputStream; |
51 |
import java.lang.ref.Reference; |
50 |
import java.lang.ref.Reference; |
52 |
import java.lang.ref.WeakReference; |
51 |
import java.lang.ref.WeakReference; |
Lines 351-357
Link Here
|
351 |
public HintTest input(String fileName, String code) throws Exception { |
350 |
public HintTest input(String fileName, String code) throws Exception { |
352 |
return input(fileName, code, true); |
351 |
return input(fileName, code, true); |
353 |
} |
352 |
} |
354 |
|
353 |
|
355 |
/**Create a test file. Any number of files can be created for one test, but the hint |
354 |
/**Create a test file. Any number of files can be created for one test, but the hint |
356 |
* will be run only on the first one. |
355 |
* will be run only on the first one. |
357 |
* |
356 |
* |
Lines 441-453
Link Here
|
441 |
this.testPreferences.putBoolean(preferencesKey, value); |
440 |
this.testPreferences.putBoolean(preferencesKey, value); |
442 |
return this; |
441 |
return this; |
443 |
} |
442 |
} |
444 |
|
443 |
|
445 |
/**Runs the given hint(s) on the first file written by a {@code input} method. |
444 |
/**Runs the given hint(s) on the first file written by a {@code input} method. |
446 |
* |
445 |
* |
447 |
* @param hint all hints in this class will be run on the file |
446 |
* @param hint all hints in this class will be run on the file |
448 |
* @return a wrapper over the hint output that allows verifying results of the hint |
447 |
* @return a wrapper over the hint output that allows verifying results of the hint |
449 |
*/ |
448 |
*/ |
450 |
public HintOutput run(Class<?> hint) throws Exception { |
449 |
public HintOutput run(Class<?> hint) throws Exception { |
|
|
450 |
return run(hint, null); |
451 |
} |
452 |
|
453 |
/**Runs the given hint(s) on the first file written by a {@code input} method. |
454 |
* Runs only hints with the specified {@code hintCode}. Null hintCode includes |
455 |
* all hints from the class |
456 |
* |
457 |
* @param hint all hints in this class will be run on the file |
458 |
* @param hintCode if not {@code null}, only hints with the same id will be run |
459 |
* @return a wrapper over the hint output that allows verifying results of the hint |
460 |
*/ |
461 |
public HintOutput run(Class<?> hint, String hintCode) throws Exception { |
451 |
for (FileObject file : checkCompilable) { |
462 |
for (FileObject file : checkCompilable) { |
452 |
ensureCompilable(file); |
463 |
ensureCompilable(file); |
453 |
} |
464 |
} |
Lines 468-478
Link Here
|
468 |
} |
479 |
} |
469 |
|
480 |
|
470 |
List<HintDescription> total = new LinkedList<HintDescription>(); |
481 |
List<HintDescription> total = new LinkedList<HintDescription>(); |
471 |
|
482 |
|
472 |
for (Collection<? extends HintDescription> l : hints.values()) { |
483 |
for(Map.Entry<HintMetadata, Collection<HintDescription>> e : hints.entrySet()) { |
473 |
total.addAll(l); |
484 |
if (null == hintCode || e.getKey().id.equals(hintCode)) { |
|
|
485 |
total.addAll(e.getValue()); |
486 |
} |
474 |
} |
487 |
} |
475 |
|
|
|
476 |
CompilationInfo info = parse(testFile); |
488 |
CompilationInfo info = parse(testFile); |
477 |
|
489 |
|
478 |
assertNotNull(info); |
490 |
assertNotNull(info); |
Lines 809-815
Link Here
|
809 |
|
821 |
|
810 |
return this; |
822 |
return this; |
811 |
} |
823 |
} |
812 |
|
824 |
|
813 |
/**Find a specific warning. |
825 |
/**Find a specific warning. |
814 |
* |
826 |
* |
815 |
* @param warning the warning to find - must be equivalent to {@code toString()} |
827 |
* @param warning the warning to find - must be equivalent to {@code toString()} |