Skip to content

Commit b1a10a5

Browse files
committed
Update error messages for custom function calls to include class name
1 parent 51430c8 commit b1a10a5

File tree

6 files changed

+10
-4
lines changed

6 files changed

+10
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,6 @@ ex) doma.compile.config
105105
```properties
106106
doma.expr.functions=example.expression.MyExpressionFunctions
107107
```
108+
109+
The contents of `doma.compile.config` are cached.
110+
The cache is updated based on the file's last modified timestamp, so please make sure to save the file after making any changes.

src/main/kotlin/org/domaframework/doma/intellij/common/sql/validator/result/ValidationInvalidFunctionCallResult.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import org.domaframework.doma.intellij.common.psi.PsiParentClass
2626
*/
2727
open class ValidationInvalidFunctionCallResult(
2828
override val identify: PsiElement,
29+
private val expressionClassName: String,
2930
override val shortName: String,
3031
) : ValidationResult(identify, null, shortName) {
3132
override fun setHighlight(
@@ -40,6 +41,7 @@ open class ValidationInvalidFunctionCallResult(
4041
MessageBundle.message(
4142
"inspection.invalid.sql.notFound.customFunction",
4243
identify.text ?: "",
44+
expressionClassName,
4345
),
4446
problemHighlightType(project, shortName),
4547
highlightRange,

src/main/kotlin/org/domaframework/doma/intellij/inspection/sql/processor/InspectionFunctionCallVisitorProcessor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class InspectionFunctionCallVisitorProcessor(
4646
var result: ValidationResult =
4747
ValidationInvalidFunctionCallResult(
4848
functionName,
49+
customFunctionClassName ?: "",
4950
shortName,
5051
)
5152
var methods: Array<out PsiMethod?> = emptyArray()

src/main/resources/messages/DomaToolsBundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ inspection.invalid.sql.testdata=Bind variables must be followed by test data
1212
inspection.invalid.sql.classpath=A non-existent package or class name was specified [{0}]
1313
inspection.invalid.sql.iterable=The type that can be used in the loop directive is an Iterable type
1414
inspection.invalid.dao.duplicate=An element name that is a duplicate of an element name defined in SQL is used
15-
inspection.invalid.sql.notFound.customFunction=An undefined built-in or custom function [{0}] is being called
15+
inspection.invalid.sql.notFound.customFunction=An undefined built-in or custom function [{0}] is being called in class [{1}]
1616
inspection.invalid.sql.notFound.expressionClass=An invalid ExpressionFunctions implementation class is configured in doma.compile.config

src/main/resources/messages/DomaToolsBundle_ja.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ inspection.invalid.sql.testdata=\u30D0\u30A4\u30F3\u30C9\u5909\u6570\u306E\u5F8C
1212
inspection.invalid.sql.classpath=\u5B58\u5728\u3057\u306A\u3044\u30D1\u30C3\u30B1\u30FC\u30B8\u307E\u305F\u306F\u30AF\u30E9\u30B9\u540D\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F\u3002:[{0}]
1313
inspection.invalid.sql.iterable=\u30EB\u30FC\u30D7\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6\u306B\u4F7F\u7528\u3067\u304D\u308B\u578B\u306F\u0049\u0074\u0065\u0072\u0061\u0062\u006C\u0065\u578B\u3067\u3059
1414
inspection.invalid.dao.duplicate=\u0053\u0051\u004C\u5185\u3067\u5B9A\u7FA9\u3055\u308C\u305F\u8981\u7D20\u540D\u3068\u91CD\u8907\u3057\u305F\u8981\u7D20\u540D\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059
15-
inspection.invalid.sql.notFound.customFunction=\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u306A\u3044\u7D44\u307F\u8FBC\u307F\u95A2\u6570\u307E\u305F\u306F\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u304C\u547C\u3073\u51FA\u3055\u308C\u3066\u3044\u307E\u3059:[{0}]
15+
inspection.invalid.sql.notFound.customFunction=\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u306A\u3044\u7D44\u307F\u8FBC\u307F\u95A2\u6570\u307E\u305F\u306F\u30AB\u30B9\u30BF\u30E0\u95A2\u6570\u304C\u547C\u3073\u51FA\u3055\u308C\u3066\u3044\u307E\u3059:[{0}] in class [{1}]
1616
inspection.invalid.sql.notFound.expressionClass=\u0064\u006F\u006D\u0061\u002E\u0063\u006F\u006D\u0070\u0069\u006C\u0065\u002E\u0063\u006F\u006E\u0066\u0069\u0067\u0020\u306B\u7121\u52B9\u306A\u0020\u0045\u0078\u0070\u0072\u0065\u0073\u0073\u0069\u006F\u006E\u0046\u0075\u006E\u0063\u0074\u0069\u006F\u006E\u0073\u0020\u5B9F\u88C5\u30AF\u30E9\u30B9\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059

src/test/testData/src/main/resources/META-INF/doma/example/dao/EmployeeSummaryDao/implementCustomFunctions.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ SELECT
66
WHERE p.employee_id = /* employee.employeeId */0
77
AND p.user_id = /* employee.userId */0
88
OR is_gest = /* @isGest() */false
9-
OR flag = /* @<error descr="An undefined built-in or custom function [authUser] is being called">authUser</error>() */false
10-
AND lang = /* @<error descr="An undefined built-in or custom function [getLangCode] is being called">getLangCode</error>() */'en'
9+
OR flag = /* @<error descr="An undefined built-in or custom function [authUser] is being called in class [doma.example.expression.TestExpressionFunctions]">authUser</error>() */false
10+
AND lang = /* @<error descr="An undefined built-in or custom function [getLangCode] is being called in class [doma.example.expression.TestExpressionFunctions]">getLangCode</error>() */'en'

0 commit comments

Comments
 (0)