Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jun 25, 2016
2 parents e9c69c5 + 0b13791 commit 53687b3
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 10 deletions.
19 changes: 9 additions & 10 deletions qulice-findbugs/src/main/java/com/qulice/findbugs/Wrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
package com.qulice.findbugs;

import com.google.common.base.Function;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.jcabi.aspects.Tv;
import com.mebigfatguy.fbcontrib.utils.BugType;
Expand Down Expand Up @@ -76,6 +75,13 @@ public static void main(final String... args) {
/**
* Run it.
* @param args Arguments
* @todo #706:30min After fix issue mentioned in comment
* https://github.com/teamed/qulice/issues/706#issuecomment-225943946
* rollback the changes done in #706 then remove @Ignore above
* FindBugsValidatorTest.reportsIncorrectlyAddedThrows test
* and fix test findbugs-bed-bogus-exception-declaration.
* For the moment third item is done from comment
* https://github.com/teamed/qulice/issues/706#issuecomment-184611854
*/
public static void run(final String... args) {
final Project project =
Expand All @@ -87,9 +93,8 @@ public static void run(final String... args) {
}
final FindBugs2 findbugs = new FindBugs2();
findbugs.setProject(project);
final Collection<String> ignored = Collections2.filter(
Collections2.transform(
Arrays.asList(BugType.values()),
final Collection<String> ignored = Collections2.transform(
Arrays.asList(BugType.values()),
new Function<BugType, String>() {
@Override
public String apply(final BugType bug) {
Expand All @@ -102,12 +107,6 @@ public String apply(final BugType bug) {
return name;
}
}
),
Predicates.not(
Predicates.equalTo(
BugType.BED_BOGUS_EXCEPTION_DECLARATION.name()
)
)
);
final BugReporter reporter = new PrintingBugReporter() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.google.common.base.Joiner;
import com.qulice.spi.Environment;
import com.qulice.spi.ValidationException;
import org.junit.Ignore;
import org.junit.Test;

/**
Expand Down Expand Up @@ -59,6 +60,7 @@ public void passesCorrectFilesWithNoExceptions() throws Exception {
* FindbugsValidator can report incorrectly added throws.
* @throws Exception If something wrong happens inside
*/
@Ignore
@Test(expected = ValidationException.class)
public void reportsIncorrectlyAddedThrows() throws Exception {
final byte[] bytecode = new BytecodeMocker()
Expand Down
1 change: 1 addition & 0 deletions qulice-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
<pomInclude>hibernate-validator-check/pom.xml</pomInclude>
<pomInclude>pmd-duplicate-string-literals-violations/pom.xml</pomInclude>
<pomInclude>dependency-not-matches-exclude/pom.xml</pomInclude>
<pomInclude>findbugs-bed-bogus-exception-declaration/pom.xml</pomInclude>
</pomIncludes>
<extraArtifacts>
<extraArtifact>${project.groupId}:qulice-checkstyle:${project.version}:jar</extraArtifact>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2011-2016, Qulice.com
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met: 1) Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer. 2) Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution. 3) Neither the name of the Qulice.com nor
the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals = clean verify
invoker.buildResult = success
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0"?>
<!--
*
* Copyright (c) 2011-2016, Qulice.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met: 1) Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer. 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution. 3) Neither the name of the Qulice.com nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.qulice.plugin</groupId>
<artifactId>findbugs-bed-bogus-exception-declaration</artifactId>
<version>1.0-SNAPSHOT</version>
<name>findbugs-bed-bogus-exception-declaration</name>
<dependencies>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-aspects</artifactId>
<version>0.22.5</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<license>file:${basedir}/LICENSE.txt</license>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-maven-plugin</artifactId>
<version>0.14</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>ajc</goal>
</goals>
<configuration>
<unwovenClassesDir>target/customUnwoven</unwovenClassesDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* Copyright (c) 2011-2016, Qulice.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met: 1) Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer. 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution. 3) Neither the name of the Qulice.com nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.qulice.foo;

import com.jcabi.aspects.RetryOnFailure;
import java.io.IOException;
import java.net.Socket;

/**
* Test class with using jcabi-aspects annotation.
* @author Denys Skalenko (d.skalenko@gmail.com)
* @version $Id$
* @since 0.17
*/
public final class TestSocket {

/**
* Socket.
*/
private final Socket socket;

/**
* Constructor.
* @param socket Socket
*/
public TestSocket(final Socket socket) {
this.socket = socket;
}

/**
* Close method.
* @throws IOException If something wrong happens inside
*/
@RetryOnFailure
public void close() throws IOException {
this.socket.close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2011-2016, Qulice.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met: 1) Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer. 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution. 3) Neither the name of the Qulice.com nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**
* Test reproduces case when FindBugs can't find out if the exception
* is thrown, because AspectJ does some magic with bytecode
* when annotation from jcabi-aspects is used,
* even on a method that throws correct exception.
*
* @author Denys Skalenko (d.skalenko@gmail.com)
* @version $Id$
* @since 0.17
*/
package com.qulice.foo;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright (c) 2011, Qulice.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met: 1) Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer. 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution. 3) Neither the name of the Qulice.com nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* Validate that the build doesn't fail with M C BED when
* we use annotation from jcabi-aspects and jcabi-maven-plugin plugin.
* @version $Id$
* @since 0.17
*/
def log = new File(basedir, 'build.log')
assert !log.text.contains('M C BED: Non derivable method')
assert !log.text.contains('declares throwing an exception that isn\'t thrown')
assert log.text.contains('Finishing FindBugs validator')

0 comments on commit 53687b3

Please sign in to comment.