-
Notifications
You must be signed in to change notification settings - Fork 749
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
Compilation crash with ambigous overloads #949
Comments
Thanks for the report. Do you have a small, self-contained example that reproduces the crash? |
@cushon The gist mentioned in the original description contains such an example, just remove the package name at the top and it should work |
I'm not seeing a crash. Can you provide a complete repro?
|
@cushon Sorry, I made a false assumption there. The class seems to compile fine, however the code calling one of the static of methods failed to compile. It's going to be hard to extract a case for that, but I'll try doing this today. |
@cushon I have a simple reproducer here https://github.com/BrentDouglas/error-prone-949
|
In com/sun/tools/javac/code/Flags.java POTENTIALLY_AMBIGUOUS is declared as a constant but it isn't included in the enum Flags which is being iterated over. |
@BrentDouglas thanks for the repro! I can work around this with the following patch, with indicates the underlying problem is similar to the one discussed in #781. diff --git a/pom.xml b/pom.xml
index 9452958..a58cf45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,6 +20,7 @@
<source>8</source>
<target>8</target>
<compilerArgument>-Xlint:all</compilerArgument>
+ <compilerArgument>-XDcompilePolicy=simple</compilerArgument>
</configuration>
<dependencies>
<dependency>
@@ -36,4 +37,4 @@
</plugin>
</plugins>
</build> |
Oh nice. Renaming the method so that it is no longer ambiguous as @RoiEXLab did in the previous example also works. |
After looking at this a bit more I'm still confused: changing other javac flags that should have no effect on the output (e.g. |
Never mind: the bug only reproduces with Anyway, it is easy to reproduce outside of maven:
|
Closing since |
Shouldn't this be fixed without the flag anyway as openjdk/jdk@9c60728 adds the missing enum constant? |
Please answer these questions before submitting your issue. Thanks!
What version of Error Prone are you using?
2.1.3 still exists in 2.2.0
Does this issue reproduce with the latest release?
yes
What did you do?
compiling this class.
This gist contains a version of the class that did fail compiling and a version that the compiler crashed on, the only change is the name of an overloaded method.
What did you expect to see?
It should compile normally, just like the normal javac compiler
What did you see instead?
It crashed with this stacktrace:
The text was updated successfully, but these errors were encountered: