<div dir="ltr">Removing the imports still doesn't fix the errors.<div><br></div><div>I've create a Github repo with the reproducer: <a href="https://github.com/Thihup/module-import-bug">https://github.com/Thihup/module-import-bug</a></div><div><p>Best regards,</p><p>Thiago</p></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em sex., 13 de set. de 2024 às 12:41, Alex Buckley <<a href="mailto:alex.buckley@oracle.com">alex.buckley@oracle.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I assume that the package my.nice.project is colocated with the other <br>
two packages -- my.nice.project.pkg.{a,b} -- in the module my.nice.project.<br>
<br>
If so, then all three packages should be able to access each others' <br>
public types (SomeInterface, SomeRecord) without error.<br>
<br>
The fact that you're getting an error looks like a javac bug.<br>
<br>
You don't need to `import module my.nice.project` in the source files of <br>
that module. Try removing those imports and see if my.nice.project.Main <br>
compiles (it should).<br>
<br>
Alex<br>
<br>
On 9/13/2024 5:00 AM, Thiago Henrique Hupner wrote:<br>
> Dear Amber Team,<br>
> <br>
> I hope you're doing well. I’ve encountered a behavior related to JEP <br>
> 476: Module Import Declarations and wanted to ask for clarification.<br>
> <br>
> I’m working with a module setup where two packages are defined but not <br>
> initially exported:<br>
> <br>
> |module my.nice.project { //exports my.nice.project.pkg.a to <br>
> my.nice.project; //exports my.nice.project.pkg.b to my.nice.project; } |<br>
> <br>
> Here’s a simplified version of the code structure:<br>
> <br>
> <br>
> |package my.nice.project;<br>
> |<br>
> |<br>
> |import module my.nice.project;|<br>
> <br>
> |<br>
> |public class Main { public static void main(String[] args) <br>
> { SomeInterface someInterface = new SomeInterface() { @Override public <br>
> SomeRecord someMethod() { return new SomeRecord(); } }; } }|<br>
> <br>
> |<br>
> |<br>
> |package my.nice.project.pkg.a; import module my.nice.project;|<br>
> |<br>
> |<br>
> |public interface SomeInterface { public SomeRecord someMethod(); }|<br>
> <br>
> |package my.nice.project.pkg.b; public record SomeRecord() {} |<br>
> <br>
> When attempting to compile this code with the exports commented out, I <br>
> received several "cannot find symbol" errors. However, after <br>
> uncommenting the exports:<br>
> <br>
> <br>
> |exports my.nice.project.pkg.a to my.nice.project; exports <br>
> my.nice.project.pkg.b to my.nice.project; |<br>
> <br>
> The code compiled and ran as expected.<br>
> <br>
> Given this behavior, I wanted to confirm if this restriction on package <br>
> visibility within a module is the intended design under the Amber <br>
> project and the module system, or if there’s another approach or best <br>
> practice I might be overlooking in terms of package exports.<br>
> <br>
> Thank you for your time and insight.<br>
> <br>
> Best regards,<br>
> <br>
> Thiago<br>
> <br>
<br>
</blockquote></div>