This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch MCOMPILER-445 in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
commit f85bf8e8666ac30b7e844ca81a381180140c77f7 Author: Benjamin Marwell <[email protected]> AuthorDate: Sun Dec 13 17:35:55 2020 +0100 [MCOMPILER-445] add IT --- src/it/MCOMPILER-445/invoker.properties | 19 ++++++ src/it/MCOMPILER-445/pom.xml | 59 ++++++++++++++++++ .../src/main/java/example/FinalExample.java | 69 ++++++++++++++++++++++ 3 files changed, 147 insertions(+) diff --git a/src/it/MCOMPILER-445/invoker.properties b/src/it/MCOMPILER-445/invoker.properties new file mode 100644 index 0000000..5e11a16 --- /dev/null +++ b/src/it/MCOMPILER-445/invoker.properties @@ -0,0 +1,19 @@ +# 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. + +# https://bugs.openjdk.java.net/browse/JDK-8051958 +invoker.java.version = 16+ diff --git a/src/it/MCOMPILER-445/pom.xml b/src/it/MCOMPILER-445/pom.xml new file mode 100644 index 0000000..0caf4df --- /dev/null +++ b/src/it/MCOMPILER-445/pom.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.compiler.its</groupId> + <artifactId>mcompiler445</artifactId> + <version>1.0.0-SNAPSHOT</version> + + <url>https://issues.apache.org/jira/browse/MCOMPILER-445</url> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <!-- makes sure JDK16 is being used --> + <release>16</release> + <!-- default, but explicitly must not fail --> + <fork>false</fork> + <!-- from zookeper --> + <showWarnings>true</showWarnings> + <compilerArgs> + <compilerArg>-Werror</compilerArg> + <compilerArg>-Xlint:deprecation</compilerArg> + <compilerArg>-Xlint:unchecked</compilerArg> + <compilerArg>-Xlint:-options</compilerArg> + <compilerArg>-Xdoclint:-missing</compilerArg> + <!-- https://issues.apache.org/jira/browse/MCOMPILER-205 --> + <compilerArg>-Xpkginfo:always</compilerArg> + </compilerArgs> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/src/it/MCOMPILER-445/src/main/java/example/FinalExample.java b/src/it/MCOMPILER-445/src/main/java/example/FinalExample.java new file mode 100644 index 0000000..f68d812 --- /dev/null +++ b/src/it/MCOMPILER-445/src/main/java/example/FinalExample.java @@ -0,0 +1,69 @@ +package example; + +/* + * 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. + */ + +import java.util.Comparator; + +/** + * Example doclint comment. + * + * @since 3.8.2 + */ +public class FinalExample +{ + /** + * Example field description. + * + * @return a comparator comparing two strings. + */ + public static final Comparator<String> comparator = FinalExample::nullSafeStringComparator; + + /** + * Example method description. + * @param desc1 String to compare with desc2. + * @param desc2 String to be compared agains desc1. + * @return + * {@code -1} if desc1 is {@code null}, + * {@code +1} if desc2 is {@code null} and desc1 is not, + * the comparison result if it is {!= 0}, + * {@code 3} if the comparison result would have been {@code 0}. + */ + public static int nullSafeStringComparator( String desc1, String desc2 ) + { + final int compareTo; + if ( desc1 == null ) + { + compareTo = -1; + } + else if ( desc2 == null ) + { + compareTo = 1; + } + else + { + compareTo = desc1.compareTo( desc2 ); + } + if ( compareTo == 0 ) + { + return 3; + } + return compareTo; + } +}
