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

[MNG-8482] Use instanceof assignments to get rid of casting expressions #2018

Merged
merged 6 commits into from
Jan 10, 2025

Conversation

breun
Copy link
Contributor

@breun breun commented Jan 3, 2025

JIRA issue: MNG-8482

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MNG-XXX] SUMMARY,
    where you replace MNG-XXX and SUMMARY with the appropriate JIRA issue.
  • Also format the first line of the commit message like [MNG-XXX] SUMMARY.
    Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@cstamas cstamas added this to the 4.0.0-rc-3 milestone Jan 3, 2025
@breun
Copy link
Contributor Author

breun commented Jan 3, 2025

@cstamas I now see that the integration tests use -source 8, which doesn't support pattern matching in instanceof, so the integration tests won't compile. Is it intentional that the integration tests don't use a newer version yet?

@cstamas
Copy link
Member

cstamas commented Jan 3, 2025

@gnodet ^

IMO is just an omission? ITs should be 17 as well.... still, we do have a requirement to run ITs against other Maven builds (not from the reactor of this build)...

@gnodet
Copy link
Contributor

gnodet commented Jan 7, 2025

@gnodet ^

IMO is just an omission? ITs should be 17 as well.... still, we do have a requirement to run ITs against other Maven builds (not from the reactor of this build)...

I think that's why we haven't bumped the source level, isn't it ? Though we did split 3.x and 4.x ITs a while ago, so I don't think we need to support running Maven 3.x against the 4.x ITs, do we ?

@cstamas
Copy link
Member

cstamas commented Jan 7, 2025

@breun Nils, could you please undo the changes below /its directory?

@gnodet As far as I can tell, we still can run ITs with latest 3.9.x of Maven, as we require repo-tail feature...

@cstamas
Copy link
Member

cstamas commented Jan 7, 2025

@breun Nils, could you please undo the changes below /its directory?

@gnodet As far as I can tell, we still can run ITs with latest 3.9.x of Maven, as we require repo-tail feature...

@breun nope, please do not undo the changes, we are still discussing it and we may bite the bullet here

@breun
Copy link
Contributor Author

breun commented Jan 7, 2025

Ok, I'll hold. 😄

@gnodet
Copy link
Contributor

gnodet commented Jan 8, 2025

What about splitting this PR ? Let's keep aside the changes targeting ITs for now, so that we can merge the others.

# Conflicts:
#	compat/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
@breun
Copy link
Contributor Author

breun commented Jan 8, 2025

@gnodet Is that question about splitting directed at @cstamas or me?

@cstamas
Copy link
Member

cstamas commented Jan 8, 2025

@breun for you: in my PR there are two changes you need to pick. One of those two undos any IT code change

@cstamas
Copy link
Member

cstamas commented Jan 8, 2025

In short: let apply this change to maven codebase only, and IT codebase should remain untouched for now (as many of those are still release=8 despite surrounding reactor of maven is 17)

@breun
Copy link
Contributor Author

breun commented Jan 8, 2025

Changes to IT codebase have been undone.

@cstamas cstamas requested a review from gnodet January 9, 2025 14:33
# Conflicts:
#	compat/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
#	compat/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultTransformerContext.java
#	compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java
#	impl/maven-core/src/main/java/org/apache/maven/project/ReactorModelPool.java
if (!Objects.equals(((Xpp3Dom) ${field.name}).getDom(), getDelegate().${pfx}${cap}())) {
update(getDelegate().with${cap}(((Xpp3Dom) ${field.name}).getDom()));
((Xpp3Dom) ${field.name}).setChildrenTracking(this::replace);
if (${field.name} instanceof Xpp3Dom xpp3DomFieldName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xpp3DomFieldName name is wrong here.
I don't see any loop around, so maybe simply xpp3dom ?

@gnodet gnodet merged commit a1f4955 into apache:master Jan 10, 2025
13 checks passed
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 this pull request may close these issues.

3 participants