Community
Participate
Working Groups
BETA_JAVA8: As of 8b111, there are a few areas where ECJ and javac differ in that either javac has a clear bug or has not implemented some part of the spec. This CR is to make eclipse mimic javac behavior to the extent possible without introducing bugs that would affect program behavior: At the moment, there are 3 items: 1. '_' as an identifier triggers a warning in javac, an error in eclipse. 2. Annotations are tolerated on dimensions of a class literal expression such as int @T [].class. 3. javac does not yet diagnose the illegal scenario of a repeatable annotation being used along with repeating container. I propose to make all of these warnings at the moment, leave this CR open and revert the right behavior before GA. This is so as to minimize surprises. Since in each case, we warn clearly and since these areas are chosen carefully as ones not affecting run time behavior, we are good. As we discover more such areas, we should update the list and republish the full list as a comment, so up to date issues list can be found by reading the latest comment rather than having to scan through.
For the set of cases identified in comment#0: here is the patch that makes them warnings instead of errors: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=b31cd8ccd51413655d3e805905e8dd7d1404f391
Will tag this item as blocking bug 380190, since these behaviors must be reverted before the release.
(In reply to Srikanth Sankaran from comment #0) > 1. '_' as an identifier triggers a warning in javac, an error in eclipse. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=421711. We are in compliance with the spec now as well as javac.
*** Bug 422337 has been marked as a duplicate of this bug. ***
In http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=712689471fd4116d08552bca059239228ce897f6 I made annotations on class literals an error again.
We have only one at the moment. We emit a warning when the container and the containee are present on the same element. Javac is silent. It should be an error.
In commit http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=4207a2afae6c22729e09d7310b464a6d241a4a46 I am injecting a bug to match javac bug https://bugs.openjdk.java.net/browse/JDK-8031744. This will have to pulled back at a suitable point and the disabled test Java8ElementsTests.testTypeAnnotations27 needs to be reenabled. Javac 8b129 is failing this test while eclipse is passing. An preference has been introduced to control the behavior: org.eclipse.jdt.core.compiler.emulateJavacBug8031744 (enabled/disabled)
Jay, at some point we should check if javac behavior has changed and eliminate the bugs we injected to be compatible. I didn't check the present status.
(In reply to Srikanth Sankaran from comment #8) > Jay, at some point we should check if javac behavior has changed and > eliminate the bugs we injected to be compatible. I didn't check the > present status. As of jdk-8u25, the status hasn't changed
No change as of jdk-8u31. For future reference, here's the test case: import java.lang.annotation.Inherited; import java.lang.annotation.Repeatable; @IFooContainer({@IFoo(1), @IFoo(2)}) @IFoo(1) public class X {} @Repeatable(IFooContainer.class) @Inherited @interface IFoo { int value() default -1; } @Inherited @interface IFooContainer { IFoo [] value(); }
(In reply to Jay Arthanareeswaran from comment #10) > No change as of jdk-8u31. For future reference, here's the test case: > > import java.lang.annotation.Inherited; > import java.lang.annotation.Repeatable; > > @IFooContainer({@IFoo(1), @IFoo(2)}) @IFoo(1) > public class X {} > > @Repeatable(IFooContainer.class) > @Inherited > @interface IFoo { > int value() default -1; > } > @Inherited > @interface IFooContainer { > IFoo [] value(); > } Just to be sure, we're on the same page: we are waiting for javac to report an error, right? Also javac 1.8.0_40-ea is silent.
(In reply to Stephan Herrmann from comment #11) > Just to be sure, we're on the same page: we are waiting for javac to report > an error, right? Yes.
As of jdk-8u45, status quo remains. I wonder if there are plans to address these in the Oracle compiler. For now moving out of Mars.
Javac continues to be quiet wrt as of 8u72. Moving out of 4.6.
(In reply to Jay Arthanareeswaran from comment #12) > (In reply to Stephan Herrmann from comment #11) > > Just to be sure, we're on the same page: we are waiting for javac to report > > an error, right? > > Yes. You may be on the same page, but that doesn't make it the right page ;-) The example in comment 10 is valid Java 8 code. JLS 8 9.7.5 only says: "It is a compile-time error if, in a declaration context or type context, there are multiple annotations of a repeatable annotation type T and any annotations of the containing annotation type of T." Later on, there's an example of a valid use of a single repeatable annotation next to an explicit annotation of the container type: @Foo(1) @FooContainer({@Foo(2)}) class A {} This is structurally equivalent to comment 10.
(In reply to Markus Keller from comment #15) You are right, thanks for digging it out. My bad, I just went along with the comments and didn't bother to check the spec. Or perhaps the spec changed along the course that I failed to notice. In any case, we have nothing more to do for this case.
(In reply to Srikanth Sankaran from comment #0) > 3. javac does not yet diagnose the illegal scenario of a repeatable > annotation > being used along with repeating container. (In reply to Srikanth Sankaran from comment #6) > We have only one at the moment. > > We emit a warning when the container and the containee are present on the > same element. Javac is silent. It should be an error. I think Srikanth misread the spec previews, which already allowed such combinations as long as neither the repeatable annotation nor the container annotation are repeated. => All problems from comment 0 seem to be resolved by now. Comment 7 is a new problem, but that's not about the compiler, but about APT's reflective API javax.lang.model.AnnotatedConstruct#getAnnotationMirrors(), which still seems to be broken up to jdk 9-ea+110 See CompilerOptions.emulateJavacBug8031744 and the commit in comment 7.
Annotations on dimensions of a class literal expression are reported by Java9 build 179. Item (2) from comment #0 can now be fixed.
New Gerrit change created: https://git.eclipse.org/r/103203
Gerrit change https://git.eclipse.org/r/103203 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=6c24ddae93764d9d6cb3f81654b051a09e2227e9
New Gerrit change created: https://git.eclipse.org/r/104149
Gerrit change https://git.eclipse.org/r/104149 was merged to [BETA_JAVA9]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=18a6e1f1d11d3bbd1b371b49b33d0ba3d696a96b
@Jay: Are there any pending items in this? If not please move it to resolved
Bulk move out of 4.8
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.