Java Doc for JSRInlinerAdapterUnitTest.java in  » Byte-Code » asm » org » objectweb » asm » commons » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Byte Code » asm » org.objectweb.asm.commons 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.objectweb.asm.commons.JSRInlinerAdapterUnitTest

JSRInlinerAdapterUnitTest
public class JSRInlinerAdapterUnitTest extends TestCase (Code)
JsrInlinerTest
author:
   Eugene Kuleshov, Niko Matsakis, Eric Bruneton

Inner Class :static class TestClassLoader extends ClassLoader



Method Summary
public  voidassertEquals(MethodNode exp, MethodNode actual)
    
protected  voidsetUp()
    
public  voidtestBasic()
    
public  voidtestBasicLineNumberAndLocalVars()
     Tests a method which has line numbers and local variable declarations.
public  voidtestCommonCodeWhichMustBeDuplicated()
     This tests two subroutines, neither of which exit.
public  voidtestIfElseInFinally()
    
public  voidtestImplicitExit()
     This tests a subroutine which has no ret statement, but instead exits implicitely by branching to code which is not part of the subroutine.
public  voidtestImplicitExitInTryCatch()
     Tests a nested try/finally with implicit exit from one subroutine to the other subroutine, and with a surrounding try/catch thrown in the mix.
public  voidtestImplicitExitToAnotherSubroutine()
     Tests a nested try/finally with implicit exit from one subroutine to the other subroutine.
public  voidtestInterleavedCode()
     This tests a simple subroutine where the control flow jumps back and forth between the subroutine and the caller.
public  voidtestSimpleNestedFinally()
    
public  voidtestSubroutineWithNoRet()
     This tests a subroutine which has no ret statement, but ends in a "return" instead. We structure this as a try/finally with a break in the finally.
public  voidtestSubroutineWithNoRet2()
     This tests a subroutine which has no ret statement, but ends in a "return" instead.



Method Detail
assertEquals
public void assertEquals(MethodNode exp, MethodNode actual)(Code)



setUp
protected void setUp() throws Exception(Code)



testBasic
public void testBasic()(Code)
Tests a method which has the most basic try{}finally form imaginable:
 public void a() {
 int a = 0;
 try {
 a++;
 } finally {
 a--;
 }
 }
 



testBasicLineNumberAndLocalVars
public void testBasicLineNumberAndLocalVars()(Code)
Tests a method which has line numbers and local variable declarations.
 public void a() {
 1    int a = 0;
 2    try {
 3      a++;
 4    } finally {
 5      a--;
 6    }
 }
 LV "a" from 1 to 6
 



testCommonCodeWhichMustBeDuplicated
public void testCommonCodeWhichMustBeDuplicated()(Code)
This tests two subroutines, neither of which exit. Instead, they both branch to a common set of code which returns from the method. This code is not reachable except through these subroutines, and since they do not invoke each other, it must be copied into both of them. I don't believe this can be represented in Java.



testIfElseInFinally
public void testIfElseInFinally()(Code)
Tests a method which has an if/else-if w/in the finally clause:
 public void a() {
 int a = 0;
 try {
 a++;
 } finally {
 if (a == 0)
 a+=2;
 else
 a+=3;
 }
 }
 



testImplicitExit
public void testImplicitExit()(Code)
This tests a subroutine which has no ret statement, but instead exits implicitely by branching to code which is not part of the subroutine. (Sadly, this is legal) We structure this as a try/finally in a loop with a break in the finally. The loop is not trivially infinite, so the RETURN statement is reachable both from the JSR subroutine and from the main entry point.
 public void a1() {
 int a = 0;
 while (null == null) {
 try {
 a += 1;
 } finally {
 a += 2;
 break;
 }
 }
 }
 



testImplicitExitInTryCatch
public void testImplicitExitInTryCatch()(Code)
Tests a nested try/finally with implicit exit from one subroutine to the other subroutine, and with a surrounding try/catch thrown in the mix. Equivalent to the following java code:
 void m(int b) {
 try {
 try {
 return;
 } finally {
 while (b) {
 try {
 return;
 } finally {
 // NOTE --- this break avoids the second return above (weird)
 if (b) break;
 }
 }
 } 
 } catch (Exception e) {
 b += 3;
 return;
 }
 }
 



testImplicitExitToAnotherSubroutine
public void testImplicitExitToAnotherSubroutine()(Code)
Tests a nested try/finally with implicit exit from one subroutine to the other subroutine. Equivalent to the following java code:
 void m(boolean b) {
 try {
 return;
 } finally {
 while (b) {
 try {
 return;
 } finally {
 // NOTE --- this break avoids the second return above (weird)
 if (b) break;
 }
 }
 }
 }
 
This example is from the paper, "Subroutine Inlining and Bytecode Abstraction to Simplify Static and Dynamic Analysis" by Cyrille Artho and Armin Biere.



testInterleavedCode
public void testInterleavedCode()(Code)
This tests a simple subroutine where the control flow jumps back and forth between the subroutine and the caller. This would not normally be produced by a java compiler.



testSimpleNestedFinally
public void testSimpleNestedFinally()(Code)
Tests a simple nested finally:
 public void a1() {
 int a = 0;
 try {
 a += 1;
 } finally {
 try {
 a += 2;
 } finally {
 a += 3;
 }
 }
 }
 



testSubroutineWithNoRet
public void testSubroutineWithNoRet()(Code)
This tests a subroutine which has no ret statement, but ends in a "return" instead. We structure this as a try/finally with a break in the finally. Because the while loop is infinite, it's clear from the byte code that the only path which reaches the RETURN instruction is through the subroutine.
 public void a1() {
 int a = 0;
 while (true) {
 try {
 a += 1;
 } finally {
 a += 2;
 break;
 }
 }
 }
 



testSubroutineWithNoRet2
public void testSubroutineWithNoRet2()(Code)
This tests a subroutine which has no ret statement, but ends in a "return" instead.
 JSR L0
 L0:
 ASTORE 0 
 RETURN 
 



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.