[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-09-14 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1325782731


##
maven-model/src/test/java/org/apache/maven/model/v4/Xpp3DomPerfTest.java:
##
@@ -18,22 +18,6 @@
  */
 package org.apache.maven.model.v4;
 
-/*

Review Comment:
   Possibly you can ask at 
https://issues.apache.org/jira/projects/LEGAL/issues/LEGAL-654?filter=allopenissues
   
   I'm fine with whatever they say is fine. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-09-14 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1325779523


##
maven-model/src/test/java/org/apache/maven/model/v4/Xpp3DomPerfTest.java:
##
@@ -18,22 +18,6 @@
  */
 package org.apache.maven.model.v4;
 
-/*

Review Comment:
   We need a lawyer, or at least official approval. This is complicated and 
Apache is rigorous about crossing the t's and dotting the I's. IANAL and cannot 
decide on who owns what or what rules apply where outside the common cases, and 
this one is getting increasingly wonky.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-09-13 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1324435432


##
maven-core/src/main/java/org/apache/maven/plugin/ReflectionValueExtractor.java:
##
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.plugin;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * Extract values from an Object instance using simple dotted expressions
+ * such as project.build.sourceDirectory
+ * 
+ * The implementation supports indexed, nested and mapped properties similar 
to the JSP way.
+ *
+ * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html

Review Comment:
   404



##
maven-model/src/test/java/org/apache/maven/model/v4/Xpp3DomPerfTest.java:
##
@@ -18,22 +18,6 @@
  */
 package org.apache.maven.model.v4;
 
-/*

Review Comment:
   I checked. This is hard violation of Apache policy. From 
https://www.apache.org/legal/src-headers.html
   
   Do not modify or remove any copyright notices or licenses within third-party 
works.
   Make sure that every third-party work includes its associated license, even 
if that requires adding a copy of the license from the third-party download 
site into the distribution.
   Do not add the standard Apache License header to the top of third-party 
source files.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-09-12 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1322972137


##
maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java:
##
@@ -86,9 +86,9 @@ public ToolchainPrivate createToolchain(ToolchainModel model) 
throws Misconfigur
 throw new MisconfiguredToolchainException(
 "Java toolchain without the " + 
JavaToolchainImpl.KEY_JAVAHOME + " configuration element.");
 }
-File normal = new File(FileUtils.normalize(javahome.getValue()));
+File normal = Paths.get(javahome.getValue()).normalize().toFile();

Review Comment:
   No need to convert to a File; just use Files.exists(path) below



##
maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java:
##
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.introspection;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * 
+ * Using simple dotted expressions to extract the values from an Object 
instance, For example we might want to extract a

Review Comment:
   run on sentence



##
maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java:
##
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.introspection;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * 
+ * Using simple dotted expressions to extract the values from an Object 
instance, For example we might want to extract a
+ * value like: project.build.sourceDirectory
+ * 
+ * 
+ * The implementation supports indexed, nested and mapped properties similar 
to the JSP way.
+ * 
+ *
+ * @author mailto:ja...@maven.org";>Jason van Zyl 
+ * @author mailto:vincent.sive...@gmail.com";>Vincent Siveton
+ *
+ * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html
+ */
+public class ReflectionValueExtractor {
+private static final Class[] CLASS_ARGS = new Class[0];
+
+private static final Object[] OBJECT_ARGS = new Object[0];
+
+/**
+ * Use a WeakHashMap here, so the keys (Class objects) can be garbage 
collected. This approach prevents permgen
+ * space overflows due to retention of discarded classloaders.
+ */
+private static final Map, WeakReference> CLASS_MAPS = 
new WeakHashMap<>();
+
+static final int EOF = -1;
+
+static final char PROPERTY_START = '.';
+
+static final char INDEXED_START = '[';
+
+static final char INDEXED_END = ']';
+
+static final char MAPPED_START = '(';
+
+static final char MAPPED_END = ')';
+
+static class Tokenizer {
+final String expression;
+
+int idx;
+
+Tokenizer(String expression) {
+this.expression = expression;
+}
+
+public int peekChar() {
+return idx < expression.length() ? expression.charAt(idx) : EOF;
+}
+
+public int skipCha

[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-09-11 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1321373092


##
maven-core/src/main/java/org/apache/maven/utils/dag/Dag.java:
##
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.dag;
+
+/*
+ * Copyright The Codehaus Foundation.

Review Comment:
   ditto. Possibly start here: 
https://incubator.apache.org/ip-clearance/ip-clearance-template.html



##
maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetector.java:
##
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.dag;
+
+/*
+ * Copyright The Codehaus Foundation.

Review Comment:
   as above



##
maven-model-builder/src/main/java/org/apache/maven/utils/Os.java:
##
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils;
+
+import java.util.Locale;
+import java.util.stream.Stream;
+
+/**
+ * OS support
+ */
+public class Os {
+
+/**
+ * The OS Name.
+ */
+public static final String OS_NAME = 
System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
+
+/**
+ * The OA architecture.
+ */
+public static final String OS_ARCH = 
System.getProperty("os.arch").toLowerCase(Locale.ENGLISH);
+
+/**
+ * The OS version.
+ */
+public static final String OS_VERSION = 
System.getProperty("os.version").toLowerCase(Locale.ENGLISH);
+
+/**
+ * OS Family
+ */
+public static final String OS_FAMILY;
+
+public static final boolean IS_WINDOWS;
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_WINDOWS = "windows";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_WIN9X = "win9x";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_NT = "winnt";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_OS2 = "os/2";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_NETWARE = "netware";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_DOS = "dos";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_MAC = "mac";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_TANDEM = "tandem";
+
+/**
+ * OS family that can be teste

[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-09-05 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1316362150


##
maven-model-builder/src/main/java/org/apache/maven/utils/Os.java:
##
@@ -0,0 +1,383 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+/*
+ * This class is copied from maven-shared-utils.
+ *
+ * This class was copied over from Apache ANT.
+ * Even the version from plexus-utils was
+ * only an ANT fork!
+ * The last time it got copied was on 2011-08-12
+ * When merging changes please take care of the special
+ * OS_FAMILY handling in this version of Os.java!
+ */
+
+/**
+ * Condition that tests the OS type.
+ *
+ * @author Stefan Bodewig
+ * @author Magesh Umasankar
+ * @author Brian Fox
+ * @author Mark Struberg
+ */
+public class Os {
+/**
+ * The OS Name.
+ */
+public static final String OS_NAME = 
System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
+
+/**
+ * The OA architecture.
+ */
+public static final String OS_ARCH = 
System.getProperty("os.arch").toLowerCase(Locale.ENGLISH);
+
+/**
+ * The OS version.
+ */
+public static final String OS_VERSION = 
System.getProperty("os.version").toLowerCase(Locale.ENGLISH);
+
+/**
+ * The path separator.
+ */
+public static final String PATH_SEP = System.getProperty("path.separator");
+
+/**
+ * system line separator , e.g. "\n" on unixoid systems and 
"\r\n" on Windows
+ */
+public static final String LINE_SEP = System.getProperty("line.separator");
+
+/**
+ * OS Family
+ */
+public static final String OS_FAMILY = getOsFamily();
+
+// store the valid families
+private static final Set VALID_FAMILIES = getValidFamilies();
+
+/**
+ * OS family to look for
+ */
+private String family;
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_WINDOWS = "windows";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_WIN9X = "win9x";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_NT = "winnt";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_OS2 = "os/2";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_NETWARE = "netware";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_DOS = "dos";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_MAC = "mac";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_TANDEM = "tandem";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_UNIX = "unix";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_OPENVMS = "openvms";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_ZOS = "z/os";
+
+/**
+ * OS family that can be tested for. {@value}
+ */
+public static final String FAMILY_OS400 = "os/400";
+
+/**
+ * OpenJDK is reported to call MacOS X "Darwin"
+ *
+ * @see https://issues.apache.org/bugzilla/show_bug.cgi?id=44889";>bugzilla 
issue
+ * @see https://issues.apache.org/jira/browse/HADOOP-3318";>HADOOP-3318
+ */
+private static final String DARWIN = "darwin";
+
+/**
+ * The set of valid families. This methods initializes the set until
+ * VALID_FAMILIES constant is set.
+ * @return The set of families.
+ */
+public static Set getValidFamilies() {
+if (VALID_FAMILIES != null) {
+return VALID_FAMILIES;
+}
+
+Set valid = new HashSet<>();
+valid.add(FAMILY_DOS);
+valid.add(FAMILY_MAC);
+valid.add(FAMILY_NETWARE);
+ 

[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-31 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1311520008


##
maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java:
##
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.dag;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * DAG = Directed Acyclic Graph
+ *
+ * @author Michal Maczka
+ *
+ * TODO this class should be renamed from DAG to Dag

Review Comment:
   Now is the time to do this



##
maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java:
##
@@ -103,6 +102,10 @@ public class DefaultProjectBuilder implements 
ProjectBuilder {
 
 private final RootLocator rootLocator;
 
+public static final String OS_NAME = 
System.getProperty("os.name").toLowerCase(Locale.US);

Review Comment:
   private



##
maven-model-builder/src/main/java/org/apache/maven/utils/Os.java:
##
@@ -0,0 +1,383 @@
+/*

Review Comment:
   This can't be copied over as is. It needs to be cleaned up and rethought. 
It's horribly out of date.



##
maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetectedException.java:
##
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.dag;

Review Comment:
   This DAG stuff should probably be a separate PR from random StringUtils and 
IO fixes. 



##
maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3ReaderEx.java:
##
@@ -112,13 +119,13 @@ public Model read(InputStream in, InputSource source) 
throws IOException, XmlPul
  *
  * @param parser a parser object.
  * @param strict a strict object.
- * @throws IOException IOException if any.
- * @throws XmlPullParserException XmlPullParserException if
- * any.
  * @return Model
+ * @throws IOExceptionIOException if any.

Review Comment:
   no period, and in general "if any" is not sufficient description. Something 
like "if an I/O error occurs while reading from the underlying source"



##
maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java:
##
@@ -103,6 +102,10 @@ public class DefaultProjectBuilder implements 
ProjectBuilder {
 
 private final RootLocator rootLocator;
 
+public static final String OS_NAME = 
System.getProperty("os.name").toLowerCase(Locale.US);
+
+public static final String FAMILY_WINDOWS = "windows";

Review Comment:
   private
   
   In general, avoid introducing new public API



##
maven-core/src/main/java/org/apache/maven/properties/internal/EnvironmentUtils.java:
##
@@ -36,6 +34,10 @@ public class EnvironmentUtils {
 
 private static Properties envVars;
 
+public static final String OS_NAME = 
System.getProperty("os.name").toLowerCase(Locale.US);

Review Comment:
   private



##
maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java:
##
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache Licens

[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-30 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1310423407


##
maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java:
##
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.dag;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * DAG = Directed Acyclic Graph
+ *
+ * @author Michal Maczka
+ *
+ * TODO this class should be renamed from DAG to Dag
+ */
+public class DAG implements Cloneable, Serializable {
+// 
+// Fields
+// 
+/**
+ * Nodes will be kept in two data structures at the same time for faster 
processing
+ */
+/**
+ * Maps vertex's label to vertex
+ */
+private Map vertexMap = new HashMap<>();
+
+/**
+ * Conatin list of all vertices
+ */
+private List vertexList = new ArrayList<>();
+
+// 
+// Constructors
+// 
+
+/**
+ *
+ */
+public DAG() {
+super();
+}
+
+// 
+// Accessors
+// 
+
+/**
+ * @return the vertices
+ */
+public List getVertices() {
+return vertexList;
+}
+
+/**
+ * @deprecated instead use {@link #getVertices()}
+ * @return the vertices
+ */
+@Deprecated
+public List getVerticies() {
+return getVertices();
+}
+
+public Set getLabels() {
+return vertexMap.keySet();
+}
+
+// 
+// Implementation
+// 
+
+/**
+ * Adds vertex to DAG. If vertex of given label already exist in DAG no 
vertex is added
+ *
+ * @param label The label of the Vertex
+ * @return New vertex if vertex of given label was not present in the DAG 
or existing vertex if vertex of given
+ * label was already added to DAG
+ */
+public Vertex addVertex(final String label) {
+Vertex retValue = null;
+
+// check if vertex is already in DAG
+if (vertexMap.containsKey(label)) {
+retValue = vertexMap.get(label);
+} else {
+retValue = new Vertex(label);
+
+vertexMap.put(label, retValue);
+
+vertexList.add(retValue);
+}
+
+return retValue;
+}
+
+public void addEdge(final String from, final String to) throws 
CycleDetectedException {
+final Vertex v1 = addVertex(from);
+
+final Vertex v2 = addVertex(to);
+
+addEdge(v1, v2);
+}
+
+public void addEdge(final Vertex from, final Vertex to) throws 
CycleDetectedException {
+
+from.addEdgeTo(to);
+
+to.addEdgeFrom(from);
+
+final List cycle = CycleDetector.introducesCycle(to);
+
+if (cycle != null) {
+// remove edge which introduced cycle
+
+removeEdge(from, to);
+
+final String msg = "Edge between '" + from + "' and '" + to + "' 
introduces to cycle in the graph";
+
+throw new CycleDetectedException(msg, cycle);
+}
+}
+
+public void removeEdge(final String from, final String to) {
+final Vertex v1 = addVertex(from);
+
+final Vertex v2 = addVertex(to);
+
+removeEdge(v1, v2);
+}
+
+public void removeEdge(final Vertex from, final Vertex to) {
+from.removeEdgeTo(to);
+
+to.removeEdgeFrom(from);
+}
+
+public Vertex getVertex(final String label) {
+final Vertex retValue = vertexMap.get(label);
+
+return retValue;
+}
+
+public boolean hasEdge(final String label1, final String label2) {
+final Vertex v1 = getVertex(label1);
+
+final Vertex v2 = getVertex(label2);
+
+  

[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-30 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1310422373


##
maven-core/src/main/java/org/apache/maven/utils/dag/Vertex.java:
##
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.dag;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Michal Maczka
+ *
+ */
+public class Vertex implements Cloneable, Serializable {
+// 
+// Fields
+// 
+private String label = null;
+
+List children = new ArrayList<>();
+
+List parents = new ArrayList<>();
+
+// 
+// Constructors
+// 
+
+public Vertex(final String label) {
+this.label = label;
+}
+
+// 
+// Accessors
+// 
+
+public String getLabel() {
+return label;
+}
+
+public void addEdgeTo(final Vertex vertex) {
+children.add(vertex);
+}
+
+public void removeEdgeTo(final Vertex vertex) {
+children.remove(vertex);
+}
+
+public void addEdgeFrom(final Vertex vertex) {
+parents.add(vertex);
+}
+
+public void removeEdgeFrom(final Vertex vertex) {
+parents.remove(vertex);
+}
+
+public List getChildren() {
+return children;
+}
+
+/**
+ * Get the labels used by the most direct children.
+ *
+ * @return the labels used by the most direct children.

Review Comment:
   no period, per Oracle guidelines



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-30 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1310379975


##
maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java:
##
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.dag;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * DAG = Directed Acyclic Graph
+ *
+ * @author Michal Maczka
+ *
+ * TODO this class should be renamed from DAG to Dag
+ */
+public class DAG implements Cloneable, Serializable {
+// 
+// Fields
+// 
+/**
+ * Nodes will be kept in two data structures at the same time for faster 
processing
+ */
+/**
+ * Maps vertex's label to vertex
+ */
+private Map vertexMap = new HashMap<>();
+
+/**
+ * Conatin list of all vertices
+ */
+private List vertexList = new ArrayList<>();
+
+// 
+// Constructors
+// 
+
+/**
+ *
+ */
+public DAG() {
+super();
+}
+
+// 
+// Accessors
+// 
+
+/**
+ * @return the vertices
+ */
+public List getVertices() {
+return vertexList;
+}
+
+/**
+ * @deprecated instead use {@link #getVertices()}
+ * @return the vertices
+ */
+@Deprecated
+public List getVerticies() {
+return getVertices();
+}
+
+public Set getLabels() {
+return vertexMap.keySet();
+}
+
+// 
+// Implementation
+// 
+
+/**
+ * Adds vertex to DAG. If vertex of given label already exist in DAG no 
vertex is added
+ *
+ * @param label The label of the Vertex
+ * @return New vertex if vertex of given label was not present in the DAG 
or existing vertex if vertex of given
+ * label was already added to DAG
+ */
+public Vertex addVertex(final String label) {
+Vertex retValue = null;
+
+// check if vertex is already in DAG
+if (vertexMap.containsKey(label)) {
+retValue = vertexMap.get(label);
+} else {
+retValue = new Vertex(label);
+
+vertexMap.put(label, retValue);
+
+vertexList.add(retValue);
+}
+
+return retValue;
+}
+
+public void addEdge(final String from, final String to) throws 
CycleDetectedException {
+final Vertex v1 = addVertex(from);
+
+final Vertex v2 = addVertex(to);
+
+addEdge(v1, v2);
+}
+
+public void addEdge(final Vertex from, final Vertex to) throws 
CycleDetectedException {
+
+from.addEdgeTo(to);
+
+to.addEdgeFrom(from);
+
+final List cycle = CycleDetector.introducesCycle(to);
+
+if (cycle != null) {
+// remove edge which introduced cycle
+
+removeEdge(from, to);
+
+final String msg = "Edge between '" + from + "' and '" + to + "' 
introduces to cycle in the graph";
+
+throw new CycleDetectedException(msg, cycle);
+}
+}
+
+public void removeEdge(final String from, final String to) {
+final Vertex v1 = addVertex(from);
+
+final Vertex v2 = addVertex(to);
+
+removeEdge(v1, v2);
+}
+
+public void removeEdge(final Vertex from, final Vertex to) {
+from.removeEdgeTo(to);
+
+to.removeEdgeFrom(from);
+}
+
+public Vertex getVertex(final String label) {
+final Vertex retValue = vertexMap.get(label);
+
+return retValue;
+}
+
+public boolean hasEdge(final String label1, final String label2) {
+final Vertex v1 = getVertex(label1);
+
+final Vertex v2 = getVertex(label2);
+
+  

[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-28 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1307372298


##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {
+String message;
+if (!source.exists()) {
+message = "File " + source + " does not exist";
+throw new IOException(message);
+} else if 
(!source.getCanonicalPath().equals(destination.getCanonicalPath())) {
+File parentFile = destination.getParentFile();
+if (parentFile != null && !parentFile.exists()) {
+parentFile.mkdirs();

Review Comment:
   The existing code is buggy and can fail. There is no guarantee mkdirs 
succeeds here. 



##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {
+String message;
+if (!source.exists()) {
+message = "File " + source + " does not exist";
+throw new IOException(message);
+} else if 
(!source.getCanonicalPath().equals(destination.getCanonicalPath())) {
+File parentFile = destination.getParentFile();
+if (parentFile != null && !parentFile.exists()) {
+parentFile.mkdirs();
+}
+Files.copy(
+source.toPath(),
+destination.toPath(),
+StandardCopyOption.REPLACE_EXISTING,
+StandardCopyOption.COPY_ATTRIBUTES);
+if (source.length() != destination.length()) {

Review Comment:
   There's some shared history between all of these, and they have the same 
failure modes and issues. That's why we need to move away from all of them and 
use the JDK methods that are available in Java 7+ that did not exist 20 years 
ago when this buggy code was first written.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-25 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1305624838


##
maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java:
##
@@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) {
 test = test.substring(1);
 }
 
-boolean result = Os.isFamily(test);
+boolean result = isFamily(test);
 
 if (reverse) {
 return !result;
 } else {
 return result;
 }
 }
+
+private boolean isFamily(String family) {

Review Comment:
   Just moving code from plexus is not kosher, either technically or legally. 
plexus-utils has iffy ownership and license status due to the Codehaus mess. 
Nor has it had good maintenance or updates over the years. It should be 
replaced de novo. Copy paste of the existing code into this project is not OK. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-25 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1305624838


##
maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java:
##
@@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) {
 test = test.substring(1);
 }
 
-boolean result = Os.isFamily(test);
+boolean result = isFamily(test);
 
 if (reverse) {
 return !result;
 } else {
 return result;
 }
 }
+
+private boolean isFamily(String family) {

Review Comment:
   Just moving code from plexus is not kosher, either technically or legally. 
plexus-utils has iffy ownership and license status due to the Codehaus mess. 
Nor has it had good maintenance or updates over the years. It should be 
replaced de novo. Copy paste of the existing code is not OK. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-25 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1305598002


##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {
+String message;
+if (!source.exists()) {
+message = "File " + source + " does not exist";
+throw new IOException(message);
+} else if 
(!source.getCanonicalPath().equals(destination.getCanonicalPath())) {
+File parentFile = destination.getParentFile();
+if (parentFile != null && !parentFile.exists()) {
+parentFile.mkdirs();
+}
+Files.copy(
+source.toPath(),
+destination.toPath(),
+StandardCopyOption.REPLACE_EXISTING,
+StandardCopyOption.COPY_ATTRIBUTES);
+if (source.length() != destination.length()) {

Review Comment:
   Even with this check it's not safe against concurrent modifications outside 
this thread or process. I'm willing to assume the JDK method behaves as 
documented until proven otherwise. And inlining questionable code is no better 
than writing it from scratch. This block should go. 



##
maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java:
##
@@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) {
 test = test.substring(1);
 }
 
-boolean result = Os.isFamily(test);
+boolean result = isFamily(test);
 
 if (reverse) {
 return !result;
 } else {
 return result;
 }
 }
+
+private boolean isFamily(String family) {

Review Comment:
   This can likely be made static, though I wonder if there's more work to be 
done here. Netware? Windows 98? It amazes me that in one thread I'm trying to 
convince folks not to drop support for the widely used Java 8 while over here 
in this PR I'm seeing support for OSs that were defunct circa Java 1.4. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-24 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1304233854


##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {
+String message;
+if (!source.exists()) {
+message = "File " + source + " does not exist";
+throw new IOException(message);
+} else if 
(!source.getCanonicalPath().equals(destination.getCanonicalPath())) {
+File parentFile = destination.getParentFile();
+if (parentFile != null && !parentFile.exists()) {
+parentFile.mkdirs();
+}
+Files.copy(
+source.toPath(),
+destination.toPath(),
+StandardCopyOption.REPLACE_EXISTING,
+StandardCopyOption.COPY_ATTRIBUTES);
+if (source.length() != destination.length()) {

Review Comment:
   This if block isn't needed. If Files.copy doesn't copy everything, an 
IOException will be thrown above.



##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {
+String message;
+if (!source.exists()) {
+message = "File " + source + " does not exist";
+throw new IOException(message);
+} else if 
(!source.getCanonicalPath().equals(destination.getCanonicalPath())) {
+File parentFile = destination.getParentFile();
+if (parentFile != null && !parentFile.exists()) {
+parentFile.mkdirs();

Review Comment:
   The return value isn't checked here. Use Files.createDirectories instead and 
drop the exists check.



##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {

Review Comment:
   I think this can be static



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-24 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1274774380


##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {
+String message;

Review Comment:
   declare where used, and don't reuse for two different messages, or just 
inline the two uses of this variable



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-08-24 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1304137698


##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {

Review Comment:
   I wouldn't assume the existing method is correct. Please use the JDK 
Files.copy method instead



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [maven] elharo commented on a diff in pull request #1208: [MNG-7820] Remove dependency on plexus-utils

2023-07-26 Thread via GitHub


elharo commented on code in PR #1208:
URL: https://github.com/apache/maven/pull/1208#discussion_r1274768736


##
maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java:
##
@@ -18,17 +18,48 @@
  */
 package org.apache.maven.profiles.activation;
 
+import java.util.Locale;
+
 import org.apache.maven.model.Activation;
 import org.apache.maven.model.ActivationOS;
 import org.apache.maven.model.Profile;
-import org.codehaus.plexus.util.Os;
 
 /**
  * OperatingSystemProfileActivator
  */
 @Deprecated
 public class OperatingSystemProfileActivator implements ProfileActivator {
 
+public static final String FAMILY_DOS = "dos";

Review Comment:
   why are these public? especially in a deprecated class?



##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {

Review Comment:
   These sorts of methods are very tricky with lots of inobvious, platform 
dependent edge cases that are hard to get right. I'd be much more comfortable 
if we could use a single method from commons-io  like FileUtils.copyFile



##
maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java:
##
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.introspection;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * 
+ * Using simple dotted expressions to extract the values from an Object 
instance, For example we might want to extract a
+ * value like: project.build.sourceDirectory
+ * 
+ * 
+ * The implementation supports indexed, nested and mapped properties similar 
to the JSP way.
+ * 
+ *
+ * @author mailto:ja...@maven.org";>Jason van Zyl 
+ * @author mailto:vincent.sive...@gmail.com";>Vincent Siveton
+ *
+ * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html
+ */
+public class ReflectionValueExtractor {

Review Comment:
   non-public if possible



##
maven-core/src/main/java/org/apache/maven/utils/dag/Vertex.java:
##
@@ -0,0 +1,151 @@
+/*

Review Comment:
   These classes seem to have simply been copied over from plexus. I'm no sure 
you can simply remove copyright like that but IANAL



##
maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:
##
@@ -465,6 +469,28 @@ public void getRemoteFile(
 }
 }
 
+private void copyFile(File source, File destination) throws IOException {
+String message;

Review Comment:
   declare whrere used, and don't reuse for two different messages



##
maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetector.java:
##
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.maven.utils.dag;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Michal Maczka
+ *
+ */
+public class CycleDetector {
+
+private static fin