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

Fixed warning for empty Kotlin plugin configuration #702

Merged
merged 1 commit into from
Nov 8, 2024
Merged

Conversation

shanshin
Copy link
Collaborator

@shanshin shanshin commented Nov 4, 2024

When a configuration is specified in the execution for the compile target, but the sourceDirs child element is missing, an error occurred. A check has been added to fix the error.

Fixes #701

When a configuration is specified in the execution for the `compile` target, but the `sourceDirs` child element is missing, an error occurred.
A check has been added to fix the error.

Fixes #701
(execution.configuration as Xpp3Dom).getChild("sourceDirs").children.map { toAbsoluteFile(it.value) }
val config = execution.configuration as Xpp3Dom
val sourceDirs = config.getChild("sourceDirs") ?: return@flatMap emptyList()
sourceDirs.children.map { toAbsoluteFile(it.value) }
Copy link
Member

Choose a reason for hiding this comment

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

If there are <sourceDirs><sourceDirs/>, but no children are specified, will children be a null or an emptyList?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Empty list, it's not mentioned in the docs, but implementation is

    public Xpp3Dom[] getChildren()
    {
        if ( null == childList || childList.isEmpty() )
        {
            return EMPTY_DOM_ARRAY;
        }
        else
        {
            return (Xpp3Dom[]) childList.toArray( new Xpp3Dom[childList.size()] );
        }
    }

@shanshin shanshin merged commit 66cf68e into main Nov 8, 2024
1 check passed
@shanshin shanshin deleted the fix-maven branch November 8, 2024 15:42
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.

Coverage report is generating for a springboot + maven project, but there is an NPE
2 participants