Skip to content

Commit

Permalink
fix: use @nullable instead of Optional in constructor parameter (#410)
Browse files Browse the repository at this point in the history
Co-authored-by: Álvaro Sánchez-Mariscal <[email protected]>
  • Loading branch information
sdelamo and alvarosanchez authored Dec 20, 2022
1 parent caf9129 commit 41d9626
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
version: ${{ matrix.graalvm }}
java-version: ${{ matrix.java }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Gradle
uses: gradle/[email protected]
- name: Build with Gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ tasks.withType(JavaCompile).configureEach {
])
}

micronautBuild {
checkstyleVersion = "10.5.0"
}

// configurations.all {
// resolutionStrategy.dependencySubstitution {
// substitute(module('commons-logging:commons-logging'))
Expand Down
8 changes: 4 additions & 4 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--
Expand Down Expand Up @@ -171,8 +171,8 @@
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<!--<module name="MagicNumber">-->
<!--<property name="ignoreFieldDeclaration" value="true"/>-->
<!--<property name="ignoreHashCodeMethod" value="true"/>-->
<!--<property name="ignoreFieldDeclaration" value="true"/>-->
<!--<property name="ignoreHashCodeMethod" value="true"/>-->
<!--</module>-->
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
Expand Down
11 changes: 11 additions & 0 deletions config/checkstyle/custom-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<suppress checks="DesignForExtension" files=".*docs-examples.*" />
<suppress checks="[a-zA-Z0-9]*" files="io[\\/]micronaut[\\/]oraclecloud[\\/]atp[\\/]wallet" />
<suppress checks="MissingJavadocType" files=".*doc-examples.*" />
</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
import io.micronaut.context.annotation.Property;
import io.micronaut.context.event.ApplicationEventListener;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.oraclecloud.core.OracleCloudCoreFactory;
import io.micronaut.runtime.ApplicationConfiguration;
import io.micronaut.runtime.server.event.ServerStartupEvent;
import jakarta.annotation.PreDestroy;
import jakarta.inject.Singleton;

import java.util.Optional;

/**
* OracleCloudLoggingClient is a {@link Logging} client that is required for {@link OracleCloudAppender}.
*
Expand All @@ -53,11 +52,10 @@ final class OracleCloudLoggingClient implements ApplicationEventListener<ServerS

public OracleCloudLoggingClient(
Logging logging, ApplicationConfiguration applicationConfiguration,
@Property(name = PREFIX + ".logId")
Optional<String> internalLogId) {
@Nullable @Property(name = PREFIX + ".logId") String internalLogId) {
this.internalLogging = logging;
this.internalAppName = applicationConfiguration.getName().orElse("");
this.internalLogId = internalLogId.orElse(null);
this.internalLogId = internalLogId;
}

static synchronized boolean isReady() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class OracleCloudLoggingAppenderSpec extends Specification {

oracleCloudLogsClient = new OracleCloudLoggingSpec.MockLogging()

new OracleCloudLoggingClient(oracleCloudLogsClient, config, Optional.empty()).onApplicationEvent(serverStartupEvent)
new OracleCloudLoggingClient(oracleCloudLogsClient, config, null).onApplicationEvent(serverStartupEvent)

}

Expand Down

0 comments on commit 41d9626

Please sign in to comment.