Skip to content

Document that spring-boot-configuration-processor cannot detect default value defined externally #22685

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

Closed
wangliang181230 opened this issue Jul 31, 2020 · 7 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@wangliang181230
Copy link

<artifactId>spring-boot-configuration-processor</artifactId> cannot generate the default value to the spring-configuration-metadata.json when the field default value is a constant and the constant not in current class.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 31, 2020
@wilkinsona
Copy link
Member

Depending on exactly where the constant is defined, I have a feeling that it may not be possible to access it from the annotation processor. Can you please expand a bit on what you mean by "and the constant not in current class". Is the constant defined in another class in the project that's being compiled, or is it an external dependency?

@wilkinsona wilkinsona changed the title bug: spring-boot-configuration-processor cannot analysis constant property default value that are not in the current class spring-boot-configuration-processor cannot analysis constant property default value that are not in the current class Jul 31, 2020
@wilkinsona wilkinsona changed the title spring-boot-configuration-processor cannot analysis constant property default value that are not in the current class spring-boot-configuration-processor cannot analyze constant property default value that are not in the current class Jul 31, 2020
@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Jul 31, 2020
@wangliang181230
Copy link
Author

Depending on exactly where the constant is defined, I have a feeling that it may not be possible to access it from the annotation processor. Can you please expand a bit on what you mean by "and the constant not in current class". Is the constant defined in another class in the project that's being compiled, or is it an external dependency?

another class or another jar

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 31, 2020
@wilkinsona
Copy link
Member

Thanks. That's a bit ambiguous. Do you mean another class in another jar, or you have two different cases one where the class is in the same project and one where it is in another jar?

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Jul 31, 2020
@wangliang181230
Copy link
Author

Thanks. That's a bit ambiguous. Do you mean another class in another jar, or you have two different cases one where the class is in the same project and one where it is in another jar?

yes, two cases

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 31, 2020
@wangliang181230
Copy link
Author

Thanks. That's a bit ambiguous. Do you mean another class in another jar, or you have two different cases one where the class is in the same project and one where it is in another jar?

One case is another class in same project.
One case is another class in another jar.

@snicoll
Copy link
Member

snicoll commented Aug 5, 2020

One case is another class in same project.

That's a current limitation of the annotation processor I am afraid. We need to browse through source code elements to figure out what the default value should be and we support a limited set of use cases at the moment.

One case is another class in another jar.

This won't be supported. We don't have access to the source code of classes that are not being compiled so we can't infer what the elements we have in the current class refers to.

@snicoll snicoll added the for: team-attention An issue we'd like other members of the team to review label Aug 5, 2020
@philwebb philwebb added type: documentation A documentation update and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged for: team-attention An issue we'd like other members of the team to review labels Aug 5, 2020
@philwebb philwebb added this to the 2.2.x milestone Aug 5, 2020
@snicoll snicoll changed the title spring-boot-configuration-processor cannot analyze constant property default value that are not in the current class Document that spring-boot-configuration-processor cannot detect default value defined externally Aug 11, 2020
@snicoll snicoll modified the milestones: 2.2.x, 2.2.10 Aug 11, 2020
@snicoll snicoll self-assigned this Aug 11, 2020
@snicoll
Copy link
Member

snicoll commented Aug 11, 2020

We've discussed this one at the team meeting and decided to document the limitation (which is what I've just done). If you need to configure your constants externally, I am afraid we won't be able to detect those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

5 participants