Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated checkstyle plugin to latest 3.1.0 #4364

Merged
merged 2 commits into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -35,7 +35,7 @@
*
* @author Stepan Kopriva
*/
public class HttpHeadersTest extends JerseyTest{
public class HttpHeadersTest extends JerseyTest {
@Path("/test")
public static class HttpMethodResource {
@POST
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018 Ian Kirk. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -52,4 +53,4 @@ public Principal getUserPrincipal() {
public String getAuthenticationScheme() {
return null;
}
};
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -67,7 +67,11 @@ public void testPreThrowsPostFixes() {
final Invocation.Builder builder = ClientBuilder.newBuilder()
.register(new CounterPreInvocationInterceptor(a -> { throw new IllegalStateException(); }))
.register(new CounterPostInvocationInterceptor(
(a, b) -> false, (a, b) -> { b.resolve(Response.accepted().build()); return true; }))
(a, b) -> false,
(a, b) -> {
b.resolve(Response.accepted().build());
return true;
}))
.build().target(URL).request();
try (Response response = builder.get()) {
Assert.assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatus());
Expand All @@ -80,7 +84,11 @@ public void testPreThrowsPostFixesAsync() throws ExecutionException, Interrupted
final Invocation.Builder builder = ClientBuilder.newBuilder()
.register(new CounterPreInvocationInterceptor(a -> { throw new IllegalStateException(); }))
.register(new CounterPostInvocationInterceptor(
(a, b) -> false, (a, b) -> { b.resolve(Response.accepted().build()); return true; }))
(a, b) -> false,
(a, b) -> {
b.resolve(Response.accepted().build());
return true;
}))
.build().target(URL).request();
try (Response response = builder.async().get().get()) {
Assert.assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatus());
Expand All @@ -94,7 +102,11 @@ public void testFilterThrowsPostFixesAsync() throws ExecutionException, Interrup
final Invocation.Builder builder = ClientBuilder.newBuilder()
.register(filter)
.register(new CounterPostInvocationInterceptor(
(a, b) -> false, (a, b) -> { b.resolve(Response.accepted().build()); return true; }))
(a, b) -> false,
(a, b) -> {
b.resolve(Response.accepted().build());
return true;
}))
.build().target(URL).request();
try (Response response = builder.async()
.get(new TestInvocationCallback(a -> a.getStatus() == Response.Status.ACCEPTED.getStatusCode(), a -> false))
Expand Down Expand Up @@ -150,7 +162,11 @@ public void testMultipleResolvesThrows() {
100)
.register(new CounterPostInvocationInterceptor(
(a, b) -> false,
(a, b) -> { b.resolve(Response.ok().build()); b.resolve(Response.ok().build()); return true; }) {},
(a, b) -> {
b.resolve(Response.ok().build());
b.resolve(Response.ok().build());
return true;
}) {},
200)
.build().target(URL).request();
try (Response response = builder.get()) {
Expand All @@ -165,8 +181,11 @@ public void testPostChangesStatusAndEntity() {
final Invocation.Builder builder = ClientBuilder.newBuilder()
.register(AbortRequestFilter.class)
.register(new CounterPostInvocationInterceptor(
(a, b) -> { b.setStatus(Response.Status.CONFLICT.getStatusCode());
b.setEntityStream(new ByteArrayInputStream("HELLO".getBytes())); return true; },
(a, b) -> {
b.setStatus(Response.Status.CONFLICT.getStatusCode());
b.setEntityStream(new ByteArrayInputStream("HELLO".getBytes()));
return true;
},
(a, b) -> false))
.build().target(URL).request();
try (Response response = builder.get()) {
Expand All @@ -181,11 +200,19 @@ public void testPostOnExceptionWhenNoThrowableAndNoResponseContext() {
final Invocation.Builder builder = ClientBuilder.newBuilder()
.register(new CounterPostInvocationInterceptor(
(a, b) -> false,
(a, b) -> { b.getThrowables().clear(); return true; }) {},
(a, b) -> {
b.getThrowables().clear();
return true;
}) {
},
200)
.register(new CounterPostInvocationInterceptor(
(a, b) -> false,
(a, b) -> { b.resolve(Response.accepted().build()); return true; }) {},
(a, b) -> {
b.resolve(Response.accepted().build());
return true;
}) {
},
300)
.build().target(URL).request();
try (Response response = builder.get()) {
Expand All @@ -212,10 +239,13 @@ public void testAsyncNoConnectionPostInvocationInterceptor() throws InterruptedE
public void testPreThrowsPostResolves() {
final Invocation.Builder builder = ClientBuilder.newBuilder()
.register(new CounterPreInvocationInterceptor(a -> { throw new IllegalArgumentException(); }) {})
.register(new CounterPreInvocationInterceptor(a -> {throw new IllegalStateException(); }) {})
.register(new CounterPostInvocationInterceptor((a, b) -> false, (a, b) -> {
b.resolve(Response.accepted().build()); return b.getThrowables().size() == 2;
}))
.register(new CounterPreInvocationInterceptor(a -> { throw new IllegalStateException(); }) {})
.register(new CounterPostInvocationInterceptor(
(a, b) -> false,
(a, b) -> {
b.resolve(Response.accepted().build());
return b.getThrowables().size() == 2;
}))
.build().target(URL).request();
try (Response response = builder.get()) {
Assert.assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatus());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -122,7 +122,10 @@ public void testPreInvocationInterceptorInTheSameThreadInJerseyRx() throws Execu
public void testPreInvocationInterceptorAbortWith() {
final Invocation.Builder builder = ClientBuilder.newBuilder()
.executorService(new CustomClientExecutorProvider().getExecutorService())
.register(new PropertyPreInvocationInterceptor(a -> {a.abortWith(Response.noContent().build()); return true; }))
.register(new PropertyPreInvocationInterceptor(a -> {
a.abortWith(Response.noContent().build());
return true;
}))
.register(new PropertyRequestFilter(a -> {throw new IllegalStateException(); }))
.register(AbortRequestFilter.class).build().target(URL).request();
try (Response response = builder.get()) {
Expand All @@ -135,11 +138,17 @@ public void testPreInvocationInterceptorAbortWithThrowsInMultiple() {
final Invocation.Builder builder = ClientBuilder.newBuilder()
.executorService(new CustomClientExecutorProvider().getExecutorService())
.register(
new PropertyPreInvocationInterceptor(a -> {a.abortWith(Response.noContent().build()); return true; }){},
new PropertyPreInvocationInterceptor(a -> {
a.abortWith(Response.noContent().build());
return true;
}) {},
200
)
.register(
new PropertyPreInvocationInterceptor(a -> {a.abortWith(Response.accepted().build()); return true; }){},
new PropertyPreInvocationInterceptor(a -> {
a.abortWith(Response.accepted().build());
return true;
}) {},
100
)
.register(new PropertyRequestFilter(a -> {throw new IllegalStateException(); }))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -51,7 +51,7 @@ public class JaxrsProviders implements Providers {
* <li>{@link Providers}</li>
* </ul>
*/
public static class ProvidersConfigurator implements BootstrapConfigurator{
public static class ProvidersConfigurator implements BootstrapConfigurator {

@Override
public void init(InjectionManager injectionManager, BootstrapBag bootstrapBag) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -417,7 +417,7 @@ public Flow.Subscription getSubscription() {
}
}

public enum PublisherStrategy{
public enum PublisherStrategy {
/**
* Blocking publisher strategy - tries to deliver to all subscribers regardless the cost.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -154,11 +154,11 @@ public Set<HeaderDelegateProvider> getHeaderDelegateProviders() {

private static final class EnabledProvidersBinder {
private enum Provider {
DOMSOURCE ("javax.xml.transform.dom.DOMSource"),
RENDEREDIMAGE ("java.awt.image.RenderedImage"),
SAXSOURCE ("javax.xml.transform.sax.SAXSource"),
SOURCE ("javax.xml.transform.Source"),
STREAMSOURCE ("javax.xml.transform.stream.StreamSource");
DOMSOURCE("javax.xml.transform.dom.DOMSource"),
RENDEREDIMAGE("java.awt.image.RenderedImage"),
SAXSOURCE("javax.xml.transform.sax.SAXSource"),
SOURCE("javax.xml.transform.Source"),
STREAMSOURCE("javax.xml.transform.stream.StreamSource");
Provider(String className) {
this.className = className;
}
Expand Down
24 changes: 15 additions & 9 deletions etc/config/checkstyle-verify.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -28,16 +28,17 @@
<property name="eachLine" value="true"/>
</module>

<module name="LineLength">
<property name="max" value="130"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://|@see| \* |@link|TODO|@todo|@version"/>
<property name="fileExtensions" value="java"/>
</module>

<module name="TreeWalker">
<property name="tabWidth" value="4"/>

<module name="OuterTypeFilename"/>

<module name="LineLength">
<property name="max" value="130"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://|@see| \* |@link|TODO|@todo|@version"/>
</module>

<module name="AvoidStarImport"/>
<!--<module name="UnusedImports"/>-->

Expand All @@ -60,13 +61,18 @@
<property name="allowSingleLineStatement" value="true"/>
</module>
<module name="LeftCurly">
<property name="maxLineLength" value="130"/>
<!-- without literal LAMBDA -->
<property name="tokens" value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
INTERFACE_DEF, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE,
METHOD_DEF, OBJBLOCK, STATIC_INIT" />
Verdent marked this conversation as resolved.
Show resolved Hide resolved
</module>
<module name="RightCurly"/>
<module name="RightCurly">
<property name="option" value="alone"/>
<!-- without literal LITERAL_TRY, LITERAL_CATCH, LITERAL_IF -->
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
value="LITERAL_FOR, LITERAL_WHILE, LITERAL_FINALLY, LITERAL_ELSE"/>
</module>

<module name="WhitespaceAround">
Expand Down
6 changes: 3 additions & 3 deletions etc/config/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -52,6 +52,7 @@
<property name="basedir" value="${basedir}"/>
-->
<property name="charset" value="UTF-8"/>
<property name="cacheFile" value="${checkstyle.cache.file}"/>

<!-- Checks that each Java package has a Javadoc file used for commenting. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
Expand Down Expand Up @@ -82,14 +83,13 @@
</module>-->

<module name="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<property name="tabWidth" value="4"/>

<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocMethod">
<property name="scope" value="protected"/>
<property name="allowUndeclaredRTE" value="true"/>
<!-- <property name="allowUndeclaredRTE" value="true"/>-->
</module>
<module name="JavadocType">
<property name="scope" value="protected"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -354,7 +354,7 @@ private boolean isManagedBean(final Class<?> component) {
}

private static AnnotatedConstructor<?> enrichedConstructor(final AnnotatedConstructor<?> ctor) {
return new AnnotatedConstructor(){
return new AnnotatedConstructor() {

@Override
public Constructor getJavaMember() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -54,8 +54,11 @@ public void getBeanManagerCustom(@Mocked final TestBeanManagerProvider custom,
CdiUtil.getBeanManager();

new Verifications() {{
custom.getBeanManager(); times = 1;
fallback.getBeanManager(); times = 0;
custom.getBeanManager();
times = 1;

fallback.getBeanManager();
times = 0;
}};
}

Expand All @@ -72,7 +75,8 @@ <T> T lookupService(final Class<T> clazz) {
CdiUtil.getBeanManager();

new Verifications() {{
fallback.getBeanManager(); times = 1;
fallback.getBeanManager();
times = 1;
}};
}

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2077,8 +2077,8 @@
<cdi.api.version>1.1</cdi.api.version>
<commons-lang3.version>3.3.2</commons-lang3.version>
<config.version>1.2.1</config.version>
<checkstyle.mvn.plugin.version>2.16</checkstyle.mvn.plugin.version>
<checkstyle.version>6.8.1</checkstyle.version>
<checkstyle.mvn.plugin.version>3.1.0</checkstyle.mvn.plugin.version>
<checkstyle.version>8.28</checkstyle.version>
<easymock.version>3.3</easymock.version>
<ejb.version>3.2.5</ejb.version>
<gf.impl.version>5.1.0-RC2</gf.impl.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -31,7 +31,7 @@
*
* @author Petr Bouda
*/
public class EventsTest extends JerseyTest{
public class EventsTest extends JerseyTest {

@Override
protected Application configure() {
Expand Down
Loading