8217868: Crash for overlap between source path and patch module path

When analyzing implicit files, do not look for containing module, but rather use the already known one.

Reviewed-by: jjg
This commit is contained in:
Jan Lahoda 2019-03-04 10:19:35 +01:00
parent 0d13646cbf
commit 76c916516c
3 changed files with 30 additions and 13 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/*
* @test
* @bug 8160489
* @bug 8160489 8217868
* @summary tests for --patch-modules
* @library /tools/lib
* @modules
@ -192,5 +192,23 @@ public class PatchModulesTest extends ModuleTestBase {
throw new AssertionError();
}
}
@Test
public void testPatchModuleSourcePathClash(Path base) throws Exception {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
"module m { uses test.Test; }",
"package test; public class Test { }");
Path classes = base.resolve("classes");
tb.createDirectories(classes);
new toolbox.JavacTask(tb)
.options("--patch-module", "other=" + src.toString(),
"-sourcepath", src.toString())
.outdir(classes)
.files(findJavaFiles(src.resolve("module-info.java")))
.run()
.writeAll();
}
}