-
Notifications
You must be signed in to change notification settings - Fork 5
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
Collection of bugs with Oracle compiler and Eclipse compiler where one of each compiler fails #166
Comments
OK. I was correct. Here is the minimal and simple isolated code to reproduce the bug in oracle compiler:
Works in Eclipse but fails in Oracle java compiler:
|
I filed a bug at http://bugreport.java.com. |
|
BTW: As I added validation builder support I am now hitting more bugs in Oracle java compiler related to generic type inference and bounds matching that do not arise with Eclipse java compiler. These are however rather complex to isolate. I am unsure if I will report them as well, but it seems there is some work left to do in Oracle java compiler...
The error is:
Or
|
I tracked down the second issue and it turned out that here Oracle java compiler is not really wrong:
actually needs to be
After fixing this it works with both compilers. So Oracle java compiler is not wrong in the second case but just more strict than Eclipse java compiler. |
I found further differences in Oracle vs. Eclipse compiler.
where:
is called here:
This is accepted by Eclipse compiler but not by Oracle compiler which says:
So besides the initial issue that I reported as bug in Oracle tracker all the other things I found indicate that Oracle compiler is very strict and picky while Eclipse compiler is sometimes a little lax. |
I am closing as there is no issue in our project left. |
And another issue that is obviously a bug in Oracle java compiler that does not occur with Eclipse java compiler:
|
After getting no response for my bug reports from Oracle, I wont even waste my time to create an isolated test-case for this bug (what should be easy to do for this obvious bug). |
Another candidate that works fine with Eclipse compiler but fails with oracle javac:
IMHO a wildcard (?) is as the name says a placeholder that is not a concrete type replacement. Therefore I can write For what reason should this be different to IMHO this is a bug in oracle javac. |
…ference if I have to cast and add @SuppressWarnings almost everywhere what are generics good for then? As always nobody will care and all these bugs will simply be ignored...
Another insane bug in Eclipse:
The above code gives me a compiler error:
I finally loose my last trust in Java and Eclipse. |
New bug in javac:
Error was (saving as the github action logs will disappear after some time):
I already responded that most likely they have tested |
Tonight I have another jackpot. So here is the next javac bug:
From code:
And the called method has this signature:
And for completeness:
and
So Indeed the workaround was to rename my method from p.s. I am too tired to report this again officially via bugreport.java.com. My hope was always that people who really care about Java might find this issue interesting and would pro-actively work on resolving these generic issues but this seems to be a scattered dream... |
…h of ReadableBean.getClass(ReadableBean) with java.lang.Object.getClass() OMG)
…h of ReadableBean.getClass(ReadableBean) with java.lang.Object.getClass() OMG)
For the record - not javac but javadoc also has buggy differences between JDK and Eclipse: JavaDoc produces this warning:
However, Eclipse produces this reference syntax via auto-suggestion. If I manually change it to what JavaDoc seems to expect (
So who is right and who is wrong? For me the behavior of Eclipse makes sense and feels natural. Why should method references in JavaDoc differ from the references in the code? If I write this code inside the method body:
I get a compile error from javac because the method |
I have isolated the bug https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8319461 into a single class:
I resent this to the oracle bug database so lets see if they still keep this bug closed without fixing anything. |
Could you isolate this into a standalone snippet? |
I constructed the following extract from your snippets:
To me it looks like |
Yes, here you are missing something. If you want you can still follow the link I left pointing the the build from the github action and just by renaming the method from
So there seems to be a build-in magic in javac for the |
I will try it but will take me some weeks since that will require going back in the git history in multiple projects and investing several hours after I can get the bug somehow reproduced in Eclipse... |
I was missing several things 😄 - first I missed that the method was declared in ReadableBean, indeed. As I placed it into AbstractEntityRepository (see above) I figured that prefixing the method call with Now with that corrected it still compiles with all compilers I tried:
So there most be more to it than you showed in the comment above. In fact as long as overload resolution is involved, I wouldn't be sure about anything until I observed and analyzed the bug. There are indeed situations where overload resolution is forced to pick one method before even checking if that method is applicable (I recall one such situations where a static import was used, there may be others). |
+ See m-m-m/util#166 + Prepare tests for run.javac capturing the current differences
If you can provide a minimal reproducer feel free to report this against jdt. |
I tried but due to magic the error also disappeared in its original place and I cannot reproduce it. So maybe some in-determinism or temporary issue but as it seems to real EJC bug I found... |
The bug got scared of the prospect of meeting me 😈 |
+ See m-m-m/util#166 + Prepare tests for run.javac capturing the current differences
+ See m-m-m/util#166 + Prepare tests for run.javac capturing the current differences
With util-property we hit a bug in Oracle java compiler:
We have the interface
BooleanProperty
that is combining a generic methodsetValue(VALUE)
withVALUE
bound toBoolean
with a typed methodsetValue(Boolean)
. AlsoBooleanProperty
has a default method that is callingsetValue
with aBoolean
argument.This is causing the following error in oracle java compiler (invoked via maven):
My environment:
The error does not occur with Eclipse java compiler and I am quite sure that it is actually a bug in Oracle java compiler.
The text was updated successfully, but these errors were encountered: