Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] Is Java 9 modularity supported in AST standalone parser?

Hi,

I am trying to setup standalone parser to compile java 9 module based project, but I failed.
No matter how I setup the environment it looks like parser does not see files in context of modules and I got compile errors.

here is the simple example, I have a project with structure:
main
....src
........main
............Main.java
........module-info.java

and here is the content of module-info.java file
module main {
    exports main;
}

and Main.java file

package main;

public class Main {
 public static void main(String[] args)
 {
    System.out.println("hello world!");
 }
}

I compile both of those files using ASTParser.createASTs() method. Main.java compiles fine, but for module-info.java i always got following compile error:

"The package main does not exist or is empty"


My question is how to configure environment to make it pass?
Do you know maybe any example/unit test for similar case? I will be very grateful for that.
Or maybe there should be other question raised: is Java 9 modularity supported in AST standalone parser?

This is very simple example. If I am using two or modules it looks like parser is not able to recognize other modules on classpath. So if use 'requires' directive in module-info.java refering to some other module parser throws an compile error if this module in on classpath/sourcepath.

There is also at least one problem that AST standalone parser is not aware of module-info.class which I reported in https://bugs.eclipse.org/bugs/show_bug.cgi?id=538037

Best Regards,
Robert

Back to the top