Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive parser errors in NetBeans #124

Open
raupachz opened this issue Feb 18, 2019 · 10 comments
Open

False positive parser errors in NetBeans #124

raupachz opened this issue Feb 18, 2019 · 10 comments

Comments

@raupachz
Copy link
Contributor

Hi there,

is anyone else having false positive parser error messages in NetBeans? The project does compile and run without problems, but the editor shows errors in many files.

For example the module-info.java has a red error icon on line 40. The yellow hint says: "modules are not supported in -source 8 (use -source 9 or higher to enable modules)".

Every file that imports org.joda.convert.FromString or org.joda.convert.ToString is reported with "package org.joda.convert does not exist".

The test classes have a red icon next to package org.threeten.extra.chrono with the hint: "cannot access java.lang Fatal Error: Unable to find java.lang in classpath or bootclasspath". Every @Test annotation is marked with "cannot find symbol".

I am using Apache NetBeans 10 and OpenJDK 10. Anyone else having the same issues? If this is off-topic for ThreeTen-Extra I might ask on the NetBeans mailing list for help.

@jodastephen
Copy link
Member

I edit using Eclipse, and it all works fine there. The module-info is ignored on Java 8. You'll need to ask on a NetBeans forum for more advice I suspect.

@raupachz
Copy link
Contributor Author

@raupachz
Copy link
Contributor Author

Geertjan was so kind and looked into this. The problem is in the java9plus profile section. See the linked issue for reference. Unfortunately, I lack the knowledge to solve this.

@jodastephen
Copy link
Member

I've simplified the build now Java 11 is available. Please test this branch:
57c8e8f

@raupachz
Copy link
Contributor Author

I have tested the branch topic/build-java11 with Apache NetBeans IDE 10 / 11 and OpenJDK 11. Unfortunately, the issue remains.

There is another thing. Out of the box, both versions of NetBeans won't even build Threeten-Extra. This was not introduced in your latest change to the pom.xml.

Rule 0: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
Detected Maven Version: 3.3.9 is not in the allowed range 3.5.0.

NetBeans 10 and 11 are still using Maven 3.3.9. I did open a ticket .

If I change the bundled Maven to a more recent one the false positive parser messages are there, but building the project works.

@jodastephen
Copy link
Member

Did you try changing ThreeTen-Extra to only require v3.3.0 of Maven?

I don't think there is a lot more I can do. The branch represents the minimum necessary to build the system and is a valid maven build which Netbeans should handle. From a quick try, Netbeans doesn't handle this mechanism for building a Java 8 library with module info.

@jodastephen
Copy link
Member

I've added a branch topic/netbeans which I believe works in NetBeans. However, I won't be merging it as it changes the default version to Java 9 which means that Eclipse users (ie. me) would run the risk of including use of a Java 9 API in the project.

When Eclipse sees the pom.xml it runs in Java 8 mode with the module-info.java file effectively ignored. The problem here is that NetBeans doesn't match Eclipse's behaviour, despite it being a standard approach as defied by the Maven team.

@raupachz
Copy link
Contributor Author

I can confirm that topic/netbeans runs fine in Apache NetBeans IDE. Excellent, thank you.

What I tried was moving the module-info.java to /org/threeten/extra. This solved the editor errors for the test packages. However, I got a --module-path not allowed with target 1.8.

https://github.com/raupachz/threeten-extra/tree/topic/build-java11

I am going to check the NetBeans issue for building a Java 8 library with module info. Setting up a minimal project and then report this to NetBeans issues.

@raupachz
Copy link
Contributor Author

I set up a project with the Maven Compiler Plugin documentation for setting up older projects with module-info.java. Same link you provided. That does work with Apache NetBeans. I do not have the errors.

https://github.com/raupachz/NETBEANS-2135

@raupachz
Copy link
Contributor Author

In addition: IntelliJ IDEA doesn't compile the project out of the box, too. Not sure if this is all related. I imported ThreeTen-Extra with Java 8 (Amazon Corretto 8). It should stick to the Java 8 profile but it does not. Compilation breaks because of the module-info.java file. This is all on the master branch.

Checking out the topic/netbeans the build fails with: "invalid source release: 9".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants