Daniel,

Thank you! I'll fix it.

-Dmitry

On 2016-09-23 12:48, Daniel Fuchs wrote:
> Hi Dmitry,
> 
> There's a potential bug here. If two directories in the
> classpath contains two different versions of A.class,
> then the wrong version (the one that comes last) will
> be included in the jar:
> 
> LingeredAppForJps::buildJar
> 
>  109         for (String path : testClassPath.split(File.pathSeparator)) {
>  110             String classFullName = path + File.separator +
> className + ".class";
>  111             File f = new File(classFullName);
>  112             if (f.exists()) {
>  113               jarArgs.add("-C");
>  114               jarArgs.add(path);
>  115               jarArgs.add(".");
>  116               System.out.println("INFO: scheduled to jar " + path);
>  117             }
>  118         }
> 
> To be more exact you should probably go through the list
> in reverse order:
> 
> String[] paths = testClassPath.split(File.pathSeparator);
> for (int i = paths.length ; --i >= 0 ; ) {
>     String path = paths[i];
>     String classFullName = ...;
>     ...
> }
> 
> or alternatively, keep your loop as it is but break out of it
> as soon as you found the class you're looking for (I don't
> know whether that would be the right solution though, I am
> not familiar with these tests), or yet again keep on looping
> but throw an exception if you encounter the class twice for
> a different path.
> 
> best regards,
> 
> -- daniel
> 
> On 23/09/16 10:01, Dmitry Samersoff wrote:
>> Everybody,
>>
>> Please, review:
>>
>> http://cr.openjdk.java.net/~dsamersoff/JDK-8165500/webrev.02/
>>
>> I refactored the test to improve stability and simplify further
>> debugging.
>>
>> Testing: rbt
>>
>> PS: Diffs is messy, so pleas look at raw files.
>>
>> -Dmitry
>>
> 


-- 
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.

Reply via email to