-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jooby-apt: kotlin: should generates a code with !! null operator for …
…nullable types - fix #3507
- Loading branch information
Showing
5 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Jooby https://jooby.io | ||
* Apache License Version 2.0 https://jooby.io/LICENSE.txt | ||
* Copyright 2014 Edgar Espina | ||
*/ | ||
package tests.i3507; | ||
|
||
import edu.umd.cs.findbugs.annotations.Nullable; | ||
import io.jooby.annotation.GET; | ||
import io.jooby.annotation.QueryParam; | ||
|
||
public class C3507 { | ||
@GET("/3507") | ||
@Nullable public String get(@QueryParam String query) { | ||
return null; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
modules/jooby-apt/src/test/java/tests/i3507/Issue3507.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Jooby https://jooby.io | ||
* Apache License Version 2.0 https://jooby.io/LICENSE.txt | ||
* Copyright 2014 Edgar Espina | ||
*/ | ||
package tests.i3507; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.io.IOException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.jooby.apt.ProcessorRunner; | ||
|
||
public class Issue3507 { | ||
|
||
@Test | ||
public void shouldGenerateNullSafeKtReturnType() throws IOException { | ||
new ProcessorRunner(new C3507()) | ||
.withSource( | ||
true, | ||
source -> { | ||
assertTrue(source.contains("return c.get(ctx.query(\"query\").value())!!")); | ||
}); | ||
} | ||
} |