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

Fixing project loading issues with micronaut complex project. #5124

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

sdedic
Copy link
Member

@sdedic sdedic commented Dec 19, 2022

The bug that provoked the investigation was

java.lang.NullPointerException
    at java.base/java.util.ArrayList.(ArrayList.java:179)
    at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.detectSources(NbProjectInfoBuilder.java:1012)
    at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.lambda$runAndRegisterPerf$9(NbProjectInfoBuilder.java:408)
    at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.runAndRegisterPerf(NbProjectInfoBuilder.java:414)
    at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.runAndRegisterPerf(NbProjectInfoBuilder.java:408)
    at org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.buildAll(NbProjectInfoBuilder.java:211)
    at org.netbeans.modules.gradle.tooling.NetBeansToolingPlugin$NetBeansToolingModelBuilder.buildAll(NetBeansToolingPlugin.java:71)

that was thrown when the project contained kotlin sources. The bug was introduced by a change in getProperty that stopped throwing exceptions on an unknown property, and started to return null instead. The PR just adapts the detectSource code to the new error reporting style.

During testing, I've noticed some other bad behaviour I have not seen before on certain projects:

  • the task Map is not cloned on return by Gradle (it seems), so I've got a ConcurrentModificationException - apparently some of the looped-over calls lazy-populated the collection
  • null default property value was not handled well (changed to Optional.ofNullable).

@sdedic sdedic added the Gradle [ci] enable "build tools" tests label Dec 19, 2022
@sdedic sdedic added this to the NB17 milestone Dec 19, 2022
@sdedic sdedic self-assigned this Dec 19, 2022
Copy link
Contributor

@lkishalmi lkishalmi left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

Looks sane to me

@lkishalmi lkishalmi merged commit 861bbff into apache:master Dec 22, 2022
@lkishalmi lkishalmi added the Cherry Pick Consider cherry picking for release update label Dec 22, 2022
@tbw777 tbw777 mentioned this pull request Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cherry Pick Consider cherry picking for release update Gradle [ci] enable "build tools" tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants