Open lrozenblyum opened 1 year ago
Works with master (I20230705-1800) with both java 8 / 17 target. Please try latest build https://download.eclipse.org/eclipse/downloads/drops4/I20230707-0600/ and if that still doesn't work for you, please attach full project with project settings, may be some specific compiler option is not default one.
Just to double-check @iloveeclipse - 'works with master' means that Eclipse compiler now produces an error like javac?
Just to double-check @iloveeclipse - 'works with master' means that Eclipse compiler now produces an error like javac?
Oh, I'm sorry, I misread the bug report, I assumed ecj produces error.
So ecj doesn't report any error here, I assume because it inlines the constant value into annotation. Without reading JLS spec I honestly would say that ecj is right. Why should the value be not accessible here?
But @srikanth-sankaran would for sure know right JLS chapter and would explain which rule applies here and who does it wrong - ecj or javac :-)
@iloveeclipse @srikanth-sankaran maybe this post https://stackoverflow.com/a/54424804/1429367 and the referred JLS chapter https://docs.oracle.com/javase/specs/jls/se11/html/jls-6.html#jls-6.6.1 could be helpful.
This is hit upon again in https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1861 - I'll take a look.
See Example 6.6-5. Access to private Fields, Methods, and Constructors here: https://docs.oracle.com/javase/specs/jls/se21/html/jls-6.html#d5e11140
See also https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2355 - From a comment there, "When testing with ejc, with version 3.31.0 and earlier there is this error: The field AClass.DISPLAY_NAME is not visible" - this could be useful to track down the change that introduced the regression
Removed out-of-date 4.34 milestone. Please set valid one if needed.
Eclipse successfully compiles it (via JDK1.8). Reproduced in Eclipse 2022-12 and 2023-06
Javac reports:
The problem was discussed in the past in https://stackoverflow.com/questions/3369731/private-field-in-java-annotations