From 103e16c40f277363c52a498876442a54bfc65e33 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Sat, 6 Jul 2019 06:46:43 +0300 Subject: [PATCH] kotlin-maven-plugin: avoid adding sourceroots to read-only freeArgs list --- .../kotlin/maven/KotlinCompileMojoBase.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/libraries/tools/kotlin-maven-plugin/src/main/java/org/jetbrains/kotlin/maven/KotlinCompileMojoBase.java b/libraries/tools/kotlin-maven-plugin/src/main/java/org/jetbrains/kotlin/maven/KotlinCompileMojoBase.java index 9ba073433e2..11efd63f4d2 100644 --- a/libraries/tools/kotlin-maven-plugin/src/main/java/org/jetbrains/kotlin/maven/KotlinCompileMojoBase.java +++ b/libraries/tools/kotlin-maven-plugin/src/main/java/org/jetbrains/kotlin/maven/KotlinCompileMojoBase.java @@ -1,17 +1,6 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.maven; @@ -231,9 +220,11 @@ public abstract class KotlinCompileMojoBase e A arguments, List sourceRoots ) throws MojoExecutionException { + ArrayList freeArgs = new ArrayList<>(arguments.getFreeArgs()); for (File sourceRoot : sourceRoots) { - arguments.getFreeArgs().add(sourceRoot.getPath()); + freeArgs.add(sourceRoot.getPath()); } + arguments.setFreeArgs(freeArgs); return compiler.exec(messageCollector, Services.EMPTY, arguments); }