-
Notifications
You must be signed in to change notification settings - Fork 142
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
Eclipse EE 2023-09 M1 doesn't find record accessor using annotation with constant. #1262
Comments
There's something weird going on with record accessors in Eclipse EE 2023-09 M1. I had a separate record |
Unfortunately the other class (the one without the annotation, in my other comment above) keeps reverting to the error not not being able to find It's even worse now: another class is trying to access I need to work; I lost the whole morning just dealing with this and #1261 (along with eclipse-m2e/m2e-core#1414). I'm going to have to downgrade to Eclipse EE 2023-06 for now. |
@stephan-herrmann : I might be wrong, this is probably duplicate of #1258 and should be fixed on master. @garretwilson: If you can, please update to latest I Build from https://download.eclipse.org/eclipse/downloads/ and check. |
@iloveeclipse thanks for getting back to me on this. I'd love to help verify that it's been fixed, but I also have to balance my ability to progress in work. If you think this issue and #1261 have both been fixed in 2023-09 M2, I'll gladly update and check it out when it's released. Otherwise I'll wait for an M/RC build that fixes both before updating. |
Yes, it looks very much like that. To verify I added an almost empty
I did not test other variations of the problem. |
I just upgraded to Eclipse EE 2023-09 M1 (from 2023-06) and it breaks one of my Java record definitions. I'm using OpenJDK 17 on Windows. I'm using Spring Boot 3.1.2, but I'm guessing the bug probably has to do with annotations, not with Spring Boot itself.
I have the following record class.
Eclipse claims that the line
return Optional.ofNullable(bar())
contains an error, because it can't find abar()
method. Of course we know that this is arecord
type, and Java generates abar()
method automatically.Now here is the strange behavior; likely it will give you a clue to where the problem is:
@ConfigurationProperties(FooConfigurationProperties.CONFIG_KEY_BASE)
to@ConfigurationProperties("foo")
, then the code work! Both versions should work, becauseFooConfigurationProperties.CONFIG_KEY_BASE
is a compile-time literal constant. And the annotation should have no bearing on the accessor to arecord
property. But it does.@ConfigurationProperties
altogether, the code works as well!There's something to do with the compiler needing to look up the compile-time constant to include it in an annotation that is making it confused about what accessors are present in the
record
. (Perhaps the annotation compiler code changed and a reference to therecord
class got criss-crossed with a reference to the annotation class, so it's searching forbar()
on the annotation? Just a wild guess.)The Spring Annotation
@ConfigurationProperties
is the only thing in this case that is not pure Java. The annotation isorg.springframework.boot.context.properties.ConfigurationProperties
. I'll include here in abridged form for your convenience:Here is the Maven declaration of the Spring Boot dependencies:
The text was updated successfully, but these errors were encountered: