Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jamie Mansfield
asm
Commits
c2d59677
Commit
c2d59677
authored
Jun 13, 2018
by
Eric Bruneton
Browse files
Merge branch 'retronymm/asm-inslist-add'
parents
c4a9e49c
dc8acb48
Changes
2
Hide whitespace changes
Inline
Side-by-side
asm-tree/src/main/java/org/objectweb/asm/tree/InsnList.java
View file @
c2d59677
...
...
@@ -230,6 +230,7 @@ public class InsnList {
lastInsn
.
nextInsn
=
insnNode
;
insnNode
.
previousInsn
=
lastInsn
;
}
insnNode
.
nextInsn
=
null
;
lastInsn
=
insnNode
;
cache
=
null
;
insnNode
.
index
=
0
;
// insnNode now belongs to an InsnList.
...
...
asm-tree/src/test/java/org/objectweb/asm/tree/InsnListTest.java
View file @
c2d59677
...
...
@@ -54,6 +54,8 @@ public class InsnListTest {
private
InsnList
list2
;
private
InsnList
list3Unchecked
;
private
InsnNode
insn1
;
private
InsnNode
insn2
;
...
...
@@ -62,6 +64,7 @@ public class InsnListTest {
public
void
setUp
()
throws
Exception
{
list1
=
new
CheckedInsnList
();
list2
=
new
CheckedInsnList
();
list3Unchecked
=
new
InsnList
();
insn1
=
new
InsnNode
(
0
);
insn2
=
new
InsnNode
(
0
);
list2
.
add
(
insn1
);
...
...
@@ -322,6 +325,16 @@ public class InsnListTest {
assertEquals
(
insn
,
list1
.
get
(
1
));
}
@Test
public
void
testSetNodeAssociatedWithAnotherList
()
{
InsnNode
insnNode
=
new
InsnNode
(
0
);
list3Unchecked
.
add
(
insnNode
);
list3Unchecked
.
set
(
insnNode
,
insn1
);
ListIterator
<
AbstractInsnNode
>
iterator
=
list3Unchecked
.
iterator
();
iterator
.
next
();
assertFalse
(
iterator
.
hasNext
());
}
@Test
public
void
testInvalidAdd
()
{
assertThrows
(
IllegalArgumentException
.
class
,
()
->
list1
.
add
(
insn1
));
...
...
@@ -354,6 +367,14 @@ public class InsnListTest {
assertEquals
(
true
,
list1
.
contains
(
insn
));
}
@Test
public
void
testAddNodeAssociatedWithAnotherList
()
{
list3Unchecked
.
add
(
insn1
);
ListIterator
<
AbstractInsnNode
>
iterator
=
list3Unchecked
.
iterator
();
iterator
.
next
();
assertFalse
(
iterator
.
hasNext
());
}
@Test
public
void
testAddEmptyList
()
{
list1
.
add
(
new
InsnList
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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