Search Java Code Snippets

  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.

#Java - Code Snippets for '#Org.apache.bcel.generic.InstructionHandle' - 1 code snippet(s) found

 Sample 1. Code Sample / Example / Snippet of org.apache.bcel.generic.InstructionHandle

    public void testRemoveLocalVariable() throws Exception {

final MethodGen mg = getMethod(Foo.class, "bar");

final LocalVariableGen lv = mg.getLocalVariables()[1];

assertEquals("variable name", "a", lv.getName());

final InstructionHandle start = lv.getStart();

final InstructionHandle end = lv.getEnd();

assertNotNull("scope start", start);

assertNotNull("scope end", end);

assertTrue("scope start not targeted by the local variable", Arrays.asList(start.getTargeters()).contains(lv));

assertTrue("scope end not targeted by the local variable", Arrays.asList(end.getTargeters()).contains(lv));


assertFalse("scope start still targeted by the removed variable", Arrays.asList(start.getTargeters()).contains(lv));

assertFalse("scope end still targeted by the removed variable", Arrays.asList(end.getTargeters()).contains(lv));

assertNull("scope start", lv.getStart());

assertNull("scope end", lv.getEnd());


   Like      Feedback      org.apache.bcel.generic.InstructionHandle

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner