apache / apache/grails-intellij-plugin

Incompatible type assignments inspection incorrectly flagging Grails data source properties

Open
#168 0 comments 0 reactions 0 assignees View on GitHub
bug imported-from-youtrack
Dominant language
Java
Stars
17
Forks
4
Avg merge
5d 15h
Merged PRs (30d)
4

Description

Per [http://grails.org/doc/latest/guide/conf.html#dataSource](http://grails.org/doc/latest/guide/conf.html#dataSource), defining properties for a Grails data source inside DataSource.groovy is valid and syntactically correct. However, the incompatible type assignments inspection is incorrectly flagging properties in the code sample below as 'properties' cannot be applied to '(groovy.lang.Closure<java.lang.Integer>)'
```
production {
dataSource {
dbCreate = "update"
url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
properties {
// See [http://grails.org/doc/latest/guide/conf.html#dataSource](http://grails.org/doc/latest/guide/conf.html#dataSource) for documentation
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}
}
```
The attached screen shot from IntelliJ IDEA 13.1.4 shows what I am seeing.

---

*Imported from [IDEA-128826](https://youtrack.jetbrains.com/issue/IDEA-128826) · Type: Bug · Votes: 2*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the warning in DataSource.groovy using the production data source example, then trace the incompatible type assignments inspection handling of the nested properties closure. Compare the inspection result with the Grails data source documentation; done means valid properties assignments no longer receive the reported false positive.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.