Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Neo4jsource
Commits
3a5ff5a7
Commit
3a5ff5a7
authored
4 years ago
by
Gustav Hedengran
Committed by
Gustav Hedengran
4 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Catch and validate parameters that are not Primitive or Declared
parent
f57f6933
4.0
4.0.12
4.0.11
4.0.10
4.0.9
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
community/procedure-compiler/processor/src/main/java/org/neo4j/tooling/procedure/visitors/ParameterTypeVisitor.java
+2
-10
...eo4j/tooling/procedure/visitors/ParameterTypeVisitor.java
community/procedure-compiler/processor/src/test/java/org/neo4j/tooling/procedure/ProcedureProcessorTest.java
+5
-1
...a/org/neo4j/tooling/procedure/ProcedureProcessorTest.java
community/procedure-compiler/processor/src/test/java/org/neo4j/tooling/procedure/UserFunctionProcessorTest.java
+5
-1
...rg/neo4j/tooling/procedure/UserFunctionProcessorTest.java
community/procedure-compiler/processor/src/test/java/org/neo4j/tooling/procedure/procedures/invalid/bad_proc_input_type/BadGenericInputSproc.java
+6
-0
...res/invalid/bad_proc_input_type/BadGenericInputSproc.java
community/procedure-compiler/processor/src/test/java/org/neo4j/tooling/procedure/procedures/invalid/bad_proc_input_type/BadGenericInputUserFunction.java
+6
-0
...alid/bad_proc_input_type/BadGenericInputUserFunction.java
with
24 additions
and
12 deletions
+24
-12
community/procedure-compiler/processor/src/main/java/org/neo4j/tooling/procedure/visitors/ParameterTypeVisitor.java
+
2
-
10
View file @
3a5ff5a7
...
...
@@ -20,8 +20,6 @@
package
org.neo4j.tooling.procedure.visitors
;
import
java.util.function.Predicate
;
import
javax.lang.model.type.DeclaredType
;
import
javax.lang.model.type.PrimitiveType
;
import
javax.lang.model.type.TypeMirror
;
import
javax.lang.model.util.SimpleTypeVisitor8
;
import
javax.lang.model.util.Types
;
...
...
@@ -40,15 +38,9 @@ class ParameterTypeVisitor extends SimpleTypeVisitor8<Boolean,Void>
}
@Override
p
ublic
Boolean
visitDeclared
(
DeclaredType
parameterT
ype
,
Void
ignored
)
p
rotected
Boolean
defaultAction
(
TypeMirror
t
ype
,
Void
ignored
)
{
return
validate
(
parameterType
);
}
@Override
public
Boolean
visitPrimitive
(
PrimitiveType
primitive
,
Void
ignored
)
{
return
validate
(
primitive
);
return
validate
(
type
);
}
private
Boolean
validate
(
TypeMirror
typeMirror
)
...
...
This diff is collapsed.
Click to expand it.
community/procedure-compiler/processor/src/test/java/org/neo4j/tooling/procedure/ProcedureProcessorTest.java
+
5
-
1
View file @
3a5ff5a7
...
...
@@ -107,7 +107,7 @@ public class ProcedureProcessorTest extends ExtensionTestBase
UnsuccessfulCompilationClause
compilation
=
assert_
().
about
(
javaSource
()
).
that
(
sproc
).
processedWith
(
processor
()
).
failsToCompile
()
.
withErrorCount
(
3
);
.
withErrorCount
(
4
);
compilation
.
withErrorContaining
(
"Unsupported parameter type "
+
"<java.util.List<java.util.List<java.util.Map<java.lang.String,java.lang.Thread>>>>"
+
...
...
@@ -120,6 +120,10 @@ public class ProcedureProcessorTest extends ExtensionTestBase
compilation
.
withErrorContaining
(
"Unsupported parameter type <java.util.Map> of procedure|function BadGenericInputSproc#doSomething3"
)
.
in
(
sproc
).
onLine
(
48
);
compilation
.
withErrorContaining
(
"Unsupported parameter type <java.lang.String[]> of procedure|function BadGenericInputSproc#doSomething4"
)
.
in
(
sproc
).
onLine
(
54
);
}
@Test
...
...
This diff is collapsed.
Click to expand it.
community/procedure-compiler/processor/src/test/java/org/neo4j/tooling/procedure/UserFunctionProcessorTest.java
+
5
-
1
View file @
3a5ff5a7
...
...
@@ -92,7 +92,7 @@ public class UserFunctionProcessorTest extends ExtensionTestBase
UnsuccessfulCompilationClause
compilation
=
assert_
().
about
(
javaSource
()
).
that
(
function
).
processedWith
(
processor
()
).
failsToCompile
()
.
withErrorCount
(
3
);
.
withErrorCount
(
4
);
compilation
.
withErrorContaining
(
"Unsupported parameter type "
+
"<java.util.List<java.util.List<java.util.Map<java.lang.String,java.lang.Thread>>>>"
+
...
...
@@ -105,6 +105,10 @@ public class UserFunctionProcessorTest extends ExtensionTestBase
compilation
.
withErrorContaining
(
"Unsupported parameter type <java.util.Map> of procedure|function BadGenericInputUserFunction#doSomething3"
)
.
in
(
function
).
onLine
(
48
);
compilation
.
withErrorContaining
(
"Unsupported parameter type <java.lang.String[]> of procedure|function BadGenericInputUserFunction#doSomething4"
)
.
in
(
function
).
onLine
(
54
);
}
@Test
...
...
This diff is collapsed.
Click to expand it.
community/procedure-compiler/processor/src/test/java/org/neo4j/tooling/procedure/procedures/invalid/bad_proc_input_type/BadGenericInputSproc.java
+
6
-
0
View file @
3a5ff5a7
...
...
@@ -50,6 +50,12 @@ public class BadGenericInputSproc
}
@Procedure
public
void
doSomething4
(
@Name
(
"test"
)
String
[]
unsupportedType
)
{
}
@Procedure
public
void
works1
(
@Name
(
"test"
)
List
<
String
>
supported
)
{
...
...
This diff is collapsed.
Click to expand it.
community/procedure-compiler/processor/src/test/java/org/neo4j/tooling/procedure/procedures/invalid/bad_proc_input_type/BadGenericInputUserFunction.java
+
6
-
0
View file @
3a5ff5a7
...
...
@@ -50,6 +50,12 @@ public class BadGenericInputUserFunction
return
"42"
;
}
@UserFunction
public
String
doSomething4
(
@Name
(
"test"
)
String
[]
unsupportedType
)
{
return
"42"
;
}
@UserFunction
public
String
works1
(
@Name
(
"test"
)
List
<
String
>
supported
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help