Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Evgeny Mandrikov
asm
Commits
bb8eb912
Commit
bb8eb912
authored
Apr 03, 2022
by
Eric Bruneton
Browse files
Merge branch 'justinblank/asm-provide_descriptor_in_type_exception'
parents
7f3b2d0e
4a30c739
Changes
2
Hide whitespace changes
Inline
Side-by-side
asm/src/main/java/org/objectweb/asm/Type.java
View file @
bb8eb912
...
...
@@ -440,7 +440,7 @@ public final class Type {
case
'('
:
return
new
Type
(
METHOD
,
descriptorBuffer
,
descriptorBegin
,
descriptorEnd
);
default
:
throw
new
IllegalArgumentException
();
throw
new
IllegalArgumentException
(
"Invalid descriptor: "
+
descriptorBuffer
);
}
}
...
...
asm/src/test/java/org/objectweb/asm/TypeTest.java
View file @
bb8eb912
...
...
@@ -126,7 +126,8 @@ class TypeTest implements Opcodes {
void
testGetTypeFromDescriptor_invalid
()
{
Executable
getType
=
()
->
Type
.
getType
(
"-"
);
assertThrows
(
IllegalArgumentException
.
class
,
getType
);
IllegalArgumentException
exception
=
assertThrows
(
IllegalArgumentException
.
class
,
getType
);
assertEquals
(
"Invalid descriptor: -"
,
exception
.
getMessage
());
}
@ParameterizedTest
...
...
@@ -187,6 +188,15 @@ class TypeTest implements Opcodes {
Duration
.
ofMillis
(
100
),
()
->
assertThrows
(
RuntimeException
.
class
,
getArgumentTypes
));
}
@Test
void
testGetArgumentTypesInvalidArgumentDescriptor
()
{
Executable
getArgumentTypes
=
()
->
Type
.
getArgumentTypes
(
"(Ljava/lang/String;-)V"
);
IllegalArgumentException
exception
=
assertThrows
(
IllegalArgumentException
.
class
,
getArgumentTypes
);
assertEquals
(
"Invalid descriptor: (Ljava/lang/String;-)V"
,
exception
.
getMessage
());
}
@Test
void
testGetReturnTypeFromDescriptor
()
{
assertEquals
(
Type
.
INT_TYPE
,
Type
.
getReturnType
(
"()I"
));
...
...
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