You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2018/01/17 08:20:01 UTC
[jira] [Commented] (GROOVY-8420) @TypeChecked in 2.4.13 produces
incorrect compiler error
[ https://issues.apache.org/jira/browse/GROOVY-8420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16328452#comment-16328452 ]
Paul King commented on GROOVY-8420:
-----------------------------------
I think this might be an Intellij bug. For me it compiles and executes fine in the Groovy console and in fact does so in Intellij IDEA even though it has a red line underneath return with the warning you describe if I hover over it. You might be using a different @Nullable though. The one I tried worked and even so when I deleted that annotation all together.
> @TypeChecked in 2.4.13 produces incorrect compiler error
> --------------------------------------------------------
>
> Key: GROOVY-8420
> URL: https://issues.apache.org/jira/browse/GROOVY-8420
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.4.13
> Environment: Windows 10, Java 8 Update 152, IntelliJ IDEA Build #IC-173.4127.2
> Reporter: Steven Dick
> Priority: Major
>
> After upgrading to Groovy 2.4.13, the following code no longer compiles in Intellij:
> {code:java}
> @TypeChecked
> public class EnhancedDerivedNonUnitisedPrice {
> ...
> public @Nullable BigDecimal getReturnPerc() {
> return null;
> }
> ...
> {code}
> The error is, "Cannot return 'null' from method returning BigDecimal".
> Either removing the {{@TypeChecked}} or adding a cast to {{BigDecimal}} resolves the problem.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)