-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeveloperTools.html
193 lines (171 loc) · 14.3 KB
/
DeveloperTools.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE HTML>
<html>
<head>
<title>Developers Tools</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="/js/jquery.min.js"></script>
<script src="/js/skel.min.js"></script>
<script src="/js/skel-layers.min.js"></script>
<script src="/js/init.js"></script>
<script src="/js/highlight.pack.js"></script>
<link rel="stylesheet" href="/css/highlight/github.css" />
<noscript>
<link rel="stylesheet" href="/css/skel.css" />
<link rel="stylesheet" href="/css/style.css" />
<link rel="stylesheet" href="/css/style-xlarge.css" />
</noscript>
</head>
<body id="top">
<header id="header" class="skel-layers-fixed">
<h2><a href="/"><img src="/OPALLogo.png" width="25" height="25"> OPAL Project</a></h2>
<nav id="nav">
<ul>
<li><a href="/Publications.html">Publications</a></li>
<li><a href="/library/api/SNAPSHOT/org/opalj/index.html">ScalaDoc</a></li>
<li><a href="https://github.com/opalj/OPAL">Repository</a></li>
<li><a href="https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22de.opal-project%22">Maven Central</a></li>
</ul>
</nav>
</header>
<section id="one" class="wrapper style1">
<div class="container">
<div class="row">
<div class="3u">
<nav>
<a href="/UsingOPAL.html">Using OPAL</a><br>
<br><b>Getting Started</b><br>
<a href="/tutorial/FixedPointAnalyses.html">Writing Fixed-Point Analyses</a><br>
<a href="/tutorial/CollaborativeAnalyses.html">Collaborative Analyses</a><br>
<a href="/tutorial/Lattices.html">Lattices</a><br>
<a href="/tutorial/Results.html">Results</a><br>
<a href="/tutorial/Schedulers.html">Schedulers</a><br>
<br><b>Further Tutorials</b><br>
<a href="/examples/ReadingClassFiles.html">Reading Class Files</a><br>
<a href="/examples/Projects.html">Loading Java Projects</a><br>
<a href="/examples/ClassHierarchy.html">Using the Class Hierarchy</a><br>
<a href="/examples/BytecodeEngineering.html">Engineering Java Bytecode</a><br>
<a href="/examples/TAC.html">3-Address Code/SSA Code</a><br>
<a href="/examples/WritingAnalyses.html">Writing Analyses</a><br>
<br><b>Tools</b><br>
<a href="/DeveloperTools.html">Developers Tools</a><br>
<a href="/Hermes.html">Hermes</a><br>
<a href="/Opium.html">OPIUM</a><br>
<br><b>Showcases</b><br>
<a href="/UselessBoxing.html">Detecting Useless Boxings</a><br>
<a href="/JDK8Dependencies.html">Package Dependencies in JDK8</a><br>
<a href="/JDK8Complexity.html">Complexity of the JDK8</a><br>
<br><b>Artifacts</b><br>
<a href="/Artifacts.html">Research Artifacts</a><br>
</nav>
<hr/>
<div class="hide-at-medium">
Please, report issues or problems in the documentation using <a href="https://github.com/opalj/OPAL/issues">OPAL's issue tracker</a>, by going to the <a href="https://gitter.im/OPAL-Project/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link">OPAL gitter chat room</a> or by writing an email to <a href="mailto:opal_at_st.informatik.tu-darmstadt.de">opal(at)st.informatik.tu-darmstadt.de</a>.
</div>
</div>
<div class="9u">
<h1 id="facilitating-the-development-of-static-analyses">Facilitating the Development of Static Analyses</h1>
<p>OPAL comes with a large number of tools to analyze and visualize various aspects related to <em>Java Bytecode</em> projects. These tools can be used as is or can be embedded into other tools. Some of the tools require Graphviz to visualize graphs which depict control- and data-flow information.</p>
<h2 id="running-tools-which-are-part-of-the-opal-suite">Running Tools which are part of the OPAL Suite</h2>
<p>To use the tools, start <code>sbt</code>, change to the <code>project OPAL-DeveloperTools</code> project and call <code>run</code>. Afterwards, you'll see the list of tools which can be run.</p>
<h2 id="java-bytecode-disassembler--java-class-file-finder">Java Bytecode Disassembler / Java Class File Finder</h2>
<p>OPAL has a built-in Java Bytecode Disassembler which is also made available as a <a href="/artifacts/OPALDisassembler.jar">standalone tool</a> and also as plugins for the <a href="https://atom.io/">ATOM</a> text editor and the <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a> and <a href="https://code.visualstudio.com/">VisualStudioCode</a> IDEs.</p>
<p>In contrast to most existing Java disassemblers, OPAL generates an HTML document to provide better syntax highlighting and advanced interaction.</p>
<p><em>To use the OPAL Java Bytecode Disassembler Java 8 is required.</em></p>
<h3 id="command-line-tool">Command Line Tool</h3>
<pre>
Usage: java org.opalj.da.Disassembler
[-help <tt>will print the help and terminate</tt>]
[-o <File> <tt>the name of the file to which the generated html page should be written</tt>]
[-open <tt>the generated html page will be opened in a browser</tt>]
[-source <File> <tt>a class or jar file or a directory containing jar or class files;
if no source files/folders are specified the current folder will be
searched for class files</tt>]* (<tt><b>can be specified multiple times</b></tt>)
[-sourceJDK <tt>the current JDK/JRE is added as a source folder</tt>]
[-noDefaultCSS <tt>the generated html page will have no CSS styling</tt>]
[-noMethodsFilter <tt>the generated html page will have no embedded means to filter methods
(as a whole, the file will not contain any JavaScript code)</tt>]
[-noHeader <tt>the generated output will have no header;
the top level element will be <div class="class_file">...</div>
(automatically activates "-noMethodsFilter" and "-noDefaultCSS")</tt>]
[-css <Source> <tt>the path (URL) of a CSS file (".csss")
which will be referenced from the generated HTML page</tt>]
[-js <Source> <tt>the path (URL) of a JavaScript file (".js")
which will be referenced from the generated HTML page</tt>]
[-showProgress <tt>shows the progress when searching for the class file</tt>]
[<ClassName> <tt>name of the class for which we want to create the HTML page; if not
specified the first class that is found on the given path is taken; this
is particularly useful if the source identifies a particular ".class" file</tt>]
</pre>
<p>Note, that the OPAL Disassembler is fast and can scan thousands of class files per second; this makes it also possible to use it to locate a certain class file. For example, if you want to find the jar which defines a specific class, e.g., <code>java.util.HashMap$Entry</code>, it is sufficient to specify the root folder of the JDK and let it automatically find the class for you. The generated HTML file will contain precise information where the class file was found. This also works if you specify the root of your <code>.ivy</code> or <code>.m2</code> folders.</p>
<h3 id="integrated">Integrated</h3>
<p>The bytecode Disassembler can be run programmatically as shown next:</p>
<pre><code class="language-scala">val classFile : org.opalj.da.ClassFile = ...;
val html = classFile.toXHTML()
// println(html)
// org.opalj.io.writeAndOpen(classFile.toXHTML().toString, "ClassFile", ".html")
</code></pre>
<h2 id="ide-plugins">IDE Plugins</h2>
<h3 id="atom">ATOM</h3>
<p>Using the <a href="https://atom.io/packages/java-bytecode-disassembler">Java Bytecode Disassembler</a> plugin, it is in particular possible to click on a type in a disassembled file to also disassemble the target type. This enables you to quickly navigate between ".class" files.</p>
<p>Screenshot of the OPAL Java Bytecode Disassembler in action:
<img src="images/ATOM-OPAL-Disassembler-2017-07-13.png" alt="ATOM - OPAL Disassembler" /></p>
<h3 id="intellij-idea">IntelliJ Idea</h3>
<p>The <a href="https://plugins.jetbrains.com/plugin/11566-bytecode-disassembler">Bytecode Disassembler</a> plugin provides you with both Bytecode and Three-Address-Code views for both source and ".class files". It also includes structural views to enable you to quickly navigate these views.</p>
<p>The Bytecode Disassembler plugin in action:
<img src="images/IntelliJPluginExample.gif" alt="IntelliJ IDEA - Bytecode Disassembler" /></p>
<h3 id="visual-studio-code">Visual Studio Code</h3>
<p>The <a href="https://marketplace.visualstudio.com/items?itemName=STG.java-bytecode-workbench">Java Bytecode Workbench</a> allows you to view Bytecode or Three-Address Code of your classes directly in Visual Studio Code.</p>
<h2 id="invokedynamic-rectifier--project-serializer">Invokedynamic Rectifier / Project Serializer</h2>
<p>If you are a developer of static analyses and suffered from the pain of having to support Invokedynamic (Java 7+) - in other words, Java lambda expressions and method references - then this is the tool for you! OPAL's project serializer rewrites Invokedynamic calls using plain-old standard Java bytecode instructions to facilitate the writing of static analyses! <em><strong>You no longer have to worry about Invokedynamics created by Java compilers.</strong></em></p>
<p>Currently, we can rewrite Invokedynamics created by standard Java compilers and we are adding support to completely support Scala. Basically, OPAL replaces the Invokedynamic calls using Java's LambdaMetaFactory by a standard Invokestatic call which will create an instance of a newly created class (similar to what LambdaMetaFactory does). The object will encapsulate the relevant state used by the Lambda and implement the Lambda's functional interface. Later on, when the Lambda is evaluated the generated class will forward the call to the implementation method of the Lambda. The tool is currently in a beta version, but we already successfully rewrote JUnit 5 and were able to execute its entire test suite afterwards (originally over 3000 Invokedynamics).</p>
<p>OPAL's project serializer can be downloaded <a href="/artifacts/OPALInvokedynamicRectifier.jar">here</a>.</p>
<p>If you want to see it in action, just use OPAL's Invokedynamic rectifier to rewrite your project and study the code afterwards using our Bytecode Disassembler (see below).</p>
</div>
</div>
</div>
</section>
<footer id="footer">
<div class="container">
<div class="row double">
<div class="6u">
<h3>Stay connected and get help!</h3>
<ul class="icons">
<li><a href="https://twitter.com/intent/follow?original_referer=http%3A%2F%2Fwww.opal-project.de%2F&ref_src=twsrc%5Etfw®ion=follow_link&screen_name=TheOpalProject&tw_p=followbutton" class="icon fa-twitter"><span class="label">Twitter</span></a></li>
<li><a href="https://gitter.im/OPAL-Project/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link" class="icon fa-users"><span class="label">Gitter</span></a></li>
<li><a href="https://trello.com/theopalproject" class="icon fa-trello"><span class="label">Trello</span></a></li>
<li><a href="https://stackoverflow.com/questions/tagged/opal-framework" class="icon fa-stack-overflow"><span class="label">Stackoverflow</span></a></li>
<li><a href="https://hub.docker.com/r/opalj/sbt_scala_opal" class="icon fa-cloud"><span class="label">Docker</span></a></li>
</ul>
<h3>Related</h3>
<ul class="alt">
<li><a href="https://www.openhub.net/p/OPAL-Project">OPAL on OpenHub</a></li>
</ul>
</div>
<div class="6u">
<h3>Supported By</h3>
<ul class="alt">
<li><a href="https://www.yourkit.com/"><img src="/images/yklogo.png" width="139", height="33"></a><br>
YourKit supports open source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>
an innovative and intelligent tool for profiling Java applications.
</li>
</ul>
</div>
</div>
<ul class="copyright">
<li>© The OPAL Project. All rights reserved.</li>
<li><a href="https://raw.githubusercontent.com/stg-tud/opal/master/LICENSE">License (BSD 2 Clause)</a></li>
<li><img src="/Athene.png" height="27" style="vertical-align:middle"></li>
<li>Design: <a href="https://templated.co">TEMPLATED</a></li>
</ul>
</div>
</footer>
</body>
<script>
hljs.configure({
tabReplace: ' ', // 4 spaces
languages: ["scala","java"]
})
hljs.highlightAll()
</script>
</html>