Author: mfriedenhagen Date: Sun Oct 19 19:38:55 2014 New Revision: 1632982 URL: http://svn.apache.org/r1632982 Log: Fixes MCHECKSTYLE-253: Upgrade to checkstyle 5.9 for Java 8 compatability
Including IT checks for the existence of a typical error message with older checkstyle messages (expecting EOF, found 'return'). This dismisses all other messages of checkstyle for the class. Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/invoker.properties maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/pom.xml maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/main/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/main/java/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/main/java/org/ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/main/java/org/MyClass.java maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/verify.groovy Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/pom.xml?rev=1632982&r1=1632981&r2=1632982&view=diff ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-checkstyle-plugin/pom.xml Sun Oct 19 19:38:55 2014 @@ -59,7 +59,7 @@ under the License. <properties> <mavenVersion>2.2.1</mavenVersion> - <checkstyleVersion>5.7</checkstyleVersion> + <checkstyleVersion>5.9</checkstyleVersion> <doxiaVersion>1.4</doxiaVersion> <sitePluginVersion>3.4</sitePluginVersion> </properties> Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/invoker.properties?rev=1632982&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/invoker.properties (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/invoker.properties Sun Oct 19 19:38:55 2014 @@ -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. + +invoker.goals = clean checkstyle:checkstyle +invoker.java.version = 1.8+ Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/pom.xml?rev=1632982&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/pom.xml (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/pom.xml Sun Oct 19 19:38:55 2014 @@ -0,0 +1,48 @@ +<?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.checkstyle.its</groupId> + <artifactId>MCHECKSTYLE-253-jdk8</artifactId> + <version>1.0-SNAPSHOT</version> + + <description> + Check JDK 8 expressions are parsed by checkstyle. + </description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>@project.version@</version> + </plugin> + </plugins> + </build> +</project> Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/main/java/org/MyClass.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/main/java/org/MyClass.java?rev=1632982&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/main/java/org/MyClass.java (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/src/main/java/org/MyClass.java Sun Oct 19 19:38:55 2014 @@ -0,0 +1,33 @@ +package org; + +/* + * 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.lang.String; +import java.util.ArrayList; +import java.util.stream.Stream; + +public class MyClass +{ + public List<String> collection () { + final ArrayList<String> result = new ArrayList<>(); + Stream.of( "a", "b", "c" ).forEach( s -> result.add( s ) ); + return result; + } +} Added: maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/verify.groovy?rev=1632982&view=auto ============================================================================== --- maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/verify.groovy (added) +++ maven/plugins/trunk/maven-checkstyle-plugin/src/it/MCHECKSTYLE-253-jdk8/verify.groovy Sun Oct 19 19:38:55 2014 @@ -0,0 +1,24 @@ +/* + * 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. + */ + +File checkstyleResult = new File( basedir, 'target/checkstyle-result.xml' ) +assert checkstyleResult.exists() + +// This warning should not appear in the log +assert 0 == checkstyleResult.getText().count('expecting EOF, found 'return'')