You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.
I expect IntelliJ not to flag the code as incorrect
Current Behavior
The IntelliJ editor flags the code as incorrect (see below for details)
Context
I was translating the "working with files" example of the gradle user guide when I noticed this. No clear idea if it's a DSL or an IntelliJ bug, but Eric Wendelin asked me to submit an issue here, so here it goes.
Feel free to open an issue for IntelliJ if necessary.
Steps to Reproduce (for bugs)
Install Gradle 4.10-rc-3 (using the wrapper)
Create a gradle build script in Kotlin with the following task:
tasks.create<Copy>("bizarreIdeaBug") {
from("a")
into("b")
filter { line: String ->
if (line.startsWith("-")) null else line
}
}
Open it in IntelliJ. Here's my version:
IntelliJ IDEA 2018.2.2 (Ultimate Edition)
Build #IU-182.4129.33, built on August 21, 2018
JRE: 1.8.0_152-release-1248-b8 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
executing the task works fine. Importing the project in IntelliJ works fine, but the editor complains, with a red squiggly line under null, with a message saying "Null can not be a value of a non-null type String"
Your Environment
------------------------------------------------------------
Gradle 4.10-rc-3
------------------------------------------------------------
Build time: 2018-08-23 12:07:56 UTC
Revision: 1b827f2119c11123e178e731421ae79d52a8991a
Kotlin DSL: 1.0-rc-3
Kotlin: 1.2.60
Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_152 (Oracle Corporation 25.152-b16)
OS: Mac OS X 10.13.6 x86_64
The text was updated successfully, but these errors were encountered:
Using IntelliJ IDEA 2018.2.3 with the Kotlin plugin v1.2.70 I get:
Which is different from what you got with 2018.2.2 (and what version of the Kotlin plugin?). Other behavior is the same: compiles and runs fine from the command line.
Intellij can be made happy by casting lying:
But it doesn't make sense.
It is as if IntelliJ interprets CopySpec filter(Transformer<String, String> transformer); with JSR-305 strict mode differently than the Kotlin compiler.
Given the return type is a type parameter it should be String!, allowing null.
Expected Behavior
I expect IntelliJ not to flag the code as incorrect
Current Behavior
The IntelliJ editor flags the code as incorrect (see below for details)
Context
I was translating the "working with files" example of the gradle user guide when I noticed this. No clear idea if it's a DSL or an IntelliJ bug, but Eric Wendelin asked me to submit an issue here, so here it goes.
Feel free to open an issue for IntelliJ if necessary.
Steps to Reproduce (for bugs)
Open it in IntelliJ. Here's my version:
IntelliJ IDEA 2018.2.2 (Ultimate Edition)
Build #IU-182.4129.33, built on August 21, 2018
JRE: 1.8.0_152-release-1248-b8 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
executing the task works fine. Importing the project in IntelliJ works fine, but the editor complains, with a red squiggly line under
null
, with a message saying "Null can not be a value of a non-null type String"Your Environment
The text was updated successfully, but these errors were encountered: