Skip to content
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

javac Xlint removal warning in generated code #3546

Closed
jnehlmeier opened this issue Jan 27, 2025 · 8 comments · Fixed by #3549
Closed

javac Xlint removal warning in generated code #3546

jnehlmeier opened this issue Jan 27, 2025 · 8 comments · Fixed by #3549
Assignees
Milestone

Comments

@jnehlmeier
Copy link

I updated to latest ebean and now I have a pair of warnings for every query bean:

  • Warning: [removal] filterMany(String,Object...) in TQAssocMany....
  • Warning: [removal] _filterMany(String,Object...) in TQAssocBean....

I don't call these methods at all in my application code and it is pretty annoying now as it "hides" other, more important warnings.

I can see that public filterMany calls protected _filterMany and both are marked for removal. Maybe all warnings go away if _filterMany would not be marked for removal? My impression is that I should only see a warning if I actually call a deprecated forRemoval method.

@rbygrave
Copy link
Member

as it "hides" other, more important warnings.

"hides" isn't accurate right, in that its more that it produces "noise" and that noise distracts us away from other compiler warnings - isn't that the case?

My impression is that I should only see a warning if I actually call a deprecated forRemoval method.

I believe what you are suggesting is that if we remove the @Deprecated(forRemoval = true) from TQAssocBean._filterMany() [which is an "internal" method only callable via the generated query beans, so it seems reasonable that we could remove that @Deprecated there] then these warnings that we are seeing on the generated query bean code will go away ... and that would be good because they are producing a lot of noise in the compiler output.

@jnehlmeier
Copy link
Author

as it "hides" other, more important warnings.

"hides" isn't accurate right, in that its more that it produces "noise" and that noise distracts us away from other compiler warnings - isn't that the case?

Yes, it was in the sense that noise makes it harder to see other real warnings.

My impression is that I should only see a warning if I actually call a deprecated forRemoval method.

I believe what you are suggesting is that if we remove the @Deprecated(forRemoval = true) from TQAssocBean._filterMany() [which is an "internal" method only callable via the generated query beans, so it seems reasonable that we could remove that @Deprecated there] then these warnings that we are seeing on the generated query bean code will go away ... and that would be good because they are producing a lot of noise in the compiler output.

Yes, in my case I am hoping that all warnings go away as soon as TQAssocBean._filterMany is changed because my code never calls TQAssocMany.filterMany.

Once changed, if javac will still complain about TQAssocMany.filterMany just because I have to compile the generated code then I am not sure what I will do. Probably disabling the check during compilation.

rbygrave added a commit that referenced this issue Jan 28, 2025
This method is effectively internal and called by generated code that also is Deprecated(forRemoval = true)
@rbygrave rbygrave linked a pull request Jan 28, 2025 that will close this issue
@rbygrave
Copy link
Member

Note that this method does not exist on version 15.x, this is a 14.x specific issue.

@rbygrave rbygrave self-assigned this Jan 28, 2025
@rbygrave rbygrave added this to the 14.8.2 milestone Jan 28, 2025
rbygrave added a commit that referenced this issue Jan 28, 2025
#3546 Reduce compiler warning on query bean generated code
@jnehlmeier
Copy link
Author

I just updated the library and sadly I still have warnings for TQAssocMany.filterMany() and all its implementations in query beans even though the method is not called at all.

After some testing it seems like javac will produce the warning if you simply have a method deprecated for removal in an interface and implementations exist, even if you never call these methods.

@rbygrave
Copy link
Member

rbygrave commented Feb 10, 2025 via email

@jnehlmeier
Copy link
Author

  1. Speed up time so a 14.x-javax release without these methods is available

  2. Disable the removal check of javac linter for the time being. It is a Gradle multi-module project so I do not have to disable the check for all modules but only the ebean one. I would need to check if the module contains more than just entities + querybeans. If it does then I would first try to figure out if the generated sources can be written to a dedicated ebean-generated-querybeans module which then has the removal check disabled.

@rbygrave
Copy link
Member

  1. Speed up time so a 14.x-javax release without these methods is available

That is probably not a bad option in this case. Deprecated since around August 2023 and has a good migration option to filterManyRaw(). So I'll look to prepare a PR for this.

@rbygrave
Copy link
Member

Refer #3558

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

Successfully merging a pull request may close this issue.

2 participants