-
Notifications
You must be signed in to change notification settings - Fork 66
/
jdt_whatsnew.html
291 lines (268 loc) · 15.2 KB
/
jdt_whatsnew.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="copyright" content="Copyright (c) Eclipse contributors and others 2020. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page."/>
<meta http-equiv="Content-Language" content="en-us"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="STYLESHEET" href="../book.css" type="text/css"/>
<style type="text/css">
body {max-width: 900px;}
table.news col.title {width: 30%;}
/*img {max-width: 520px;}*/
table.news {table-layout: fixed; border-collapse: collapse; width: 100%;}
table.news td {border-top: solid thin black; padding: 10px; overflow: visible;}
table.news tr {vertical-align: top;}
table.news tr td.section {font-size: 20px; font-weight: bold;}
table.news tr td.title {vertical-align: top; font-weight: bold;}
table.news tr td.content {vertical-align: top;}
ul {padding-left: 13px;}
</style>
<title>What's New in Eclipse 4.21 (JDT)</title>
</head>
<body>
<h2>What's New in Eclipse 4.21 (JDT)</h2>
<p>Here are descriptions of some of the more interesting or significant changes made to the Java development tools (JDT)
for the 4.21 release of Eclipse.
They are grouped into:</p>
<ul> <!-- NOTE: Sync ../topics_WhatsNew.xml with this! -->
<!--<li><a href="#Java16">Java™ 16 Support</a></li>-->
<li><a href="#JUnit">JUnit</a></li>
<li><a href="#JavaEditor">Java Editor</a></li>
<li><a href="#JavaCompiler">Java Compiler</a></li>
<!--<li><a href="#JavaViewsAndDialogs">Java Views and Dialogs</a></li>-->
<!--li><a href="#JavaFormatter">Java Formatter</a></li-->
<li><a href="#Debug">Debug</a></li>
<!--li><a href="#JDTDev">JDT Developers</a></li-->
</ul>
<p>See also the <b><a href="../../org.eclipse.platform.doc.user/whatsNew/platform_whatsnew.html">Eclipse Platform What's New</a></b>
document for changes in the Platform.</p>
<p>We also recommend to read the <a href="../tips/jdt_tips.html">Tips and Tricks</a>.</p>
<br/>
<!-- ****************** START OF N&N TABLE ****************** -->
<table class="news">
<colgroup>
<col class="title" />
<col />
</colgroup>
<tbody>
<!-- ******************* Java XX Support ************************************* -->
<!--
<tr>
<td id="JavaXX" class="section" colspan="2">
<h2>Java™ XX Support </h2>
</td>
</tr>
-->
<!-- ******************* End of Java XX Support ************************************* -->
<!-- ******************* JUnit ************************************* -->
<tr>
<td id="JUnit" class="section" colspan="2">
<h2>JUnit</h2>
</td>
</tr>
<tr id="mockitomatchers"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=575246 -->
<td class="title"><a href="#mockitomatchers">mockito ArgumentMatchers.* added to favorites in Java tooling</a></td>
<td class="content">
Mockito based tests frequently use <code>org.mockito.ArgumentMatchers.*</code>.
This has been added to the Java favorites in the preferences under <b>Java > Editor > Content Assist > Favorites</b>.
This way the organize imports action in the IDE will automatically add static imports for these classes if you use them in your tests.
</td>
</tr>
<!-- ******************* End of JUnit ************************************* -->
<!-- ******************* Java Editor ************************************* -->
<tr>
<td id="JavaEditor" class="section" colspan="2">
<h2>Java Editor </h2>
</td>
</tr>
<tr id="stringbuffer-to-stringbuilder"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=569835 -->
<td class="title"><a href="#stringbuffer-to-stringbuilder">Use StringBuilder instead of StringBuffer clean up</a></td>
<td class="content">
A new clean up has been added that converts code to use <code>StringBuilder</code> (added in Java 1.5) rather than <code>StringBuffer</code> which has synchronized methods and is slower than using <code>StringBuilder</code>.
<p>
There is a sub-option where changes will only occur to local variables which is on by default. When this sub-option is on, changes will only occur to <code>StringBuffer</code> variables that are local to a method. When a method calls other methods with such variables or assigns to/from fields/parameters, the method contents will not be converted. It is permitted to append <code>StringBuffer</code> fields or parameters to local <code>StringBuffer</code> variables which can then still be converted to <code>StringBuilder</code>.
</p>
<p>
When the option is selected and the sub-option for local variables is off,all usage of <code>StringBuffer</code> in the selected files are changed to <code>StringBuilder</code> regardless of usage. It should be noted that in this case, the clean up will not track down non-selected classes and methods that are referenced and might require changes to compile successfully.
</p>
<p>
To apply the clean up, select the <b>Use StringBuilder instead of StringBuffer</b> check box on the <b>Performance</b> tab in your clean up profile. To specify just for local variables, select the <b>Only for local variables</b> check box found just below.
</p>
<p><img src="images/stringbuffer-to-stringbuilder-prefs.png" alt="Preferences" width="800"/></p>
<p>
For the given code:
</p>
<p><img src="images/stringbuffer-to-stringbuilder-before.png" alt="Before"/></p>
<p>
One gets:
</p>
<p><img src="images/stringbuffer-to-stringbuilder-after.png" alt="After"/></p>
</td>
</tr>
<tr id="while-to-do-while"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=572574 -->
<td class="title"><a href="#while-to-do-while">Convert while to do/while</a></td>
<td class="content">
A new quick-assist has been added to convert appropriate <b>while</b> loops into <b>do/while</b> loops. Appropriate <b>while</b> loops require the first evaluation of the while expression is guaranteed to be true and that the evaluation is passive.
<p>
For the following loop:
</p>
<p><img src="images/while-to-do-while-before.png" alt="Before"/></p>
<p>
One is offered:
</p>
<p><img src="images/while-to-do-while-after.png" alt="After"/></p>
</td>
</tr>
<tr id="extract-superclass-enhancement"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=573884 -->
<td class="title"><a href="#extract-superclass-enhancement">Extract Superclass Enhancement</a></td>
<td class="content">
The <b>Extract Superclass</b> refactoring has been enhanced to support movement of uninitialized non-static final fields. In the past, a warning was issued for extracting uninitialized non-static final fields as the resultant code would be in error. The refactoring has been enhanced to add additional parameters to the moved constructors and to pass initialization values from the original class constructors.
<p>
For the following class:
</p>
<p><img src="images/extract-superclass-original-before.png" alt="Before"/></p>
<p>
Extracting to Superclass and choosing all fields, one gets:
</p>
<p><img src="images/extract-superclass-original-after.png" alt="After"/></p>
<p>
and
</p>
<p><img src="images/extract-superclass-superclass-after.png" alt="After"/></p>
</td>
</tr>
<tr id="raw-paste"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=5222184 -->
<td class="title"><a href="#raw-paste">Raw Paste</a></td>
<td class="content">
A new menu item has been added for doing a raw paste when editing Java files. The menu item <b>Raw Paste</b> can be found in the <b>Edit</b> pull-down menu and by right-clicking in the edit window to bring up the context-menu. The menu item performs a paste action but toggles off the smart insert feature, if required, and restores it, if necessary, after the paste. For end-users in smart insert mode, this is the same as doing a <b>Shift+Ctrl+Insert</b> followed by <b>Ctrl+V</b>, followed by <b>Shift+Ctrl+Insert</b> to retoggle into smart insert mode again.
</td>
</tr>
<tr id="default-type-filters"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=571758 -->
<td class="title"><a href="#default-type-filters">Default Type Filters</a></td>
<td class="content">
Default values have been added to the <b>Java > Appearance > Type Filters</b> preferences. Types matching these filters will be excluded
from appearing in the Open Type dialog, content assist, quick fix, and organize imports. These filter patterns do not affect the Package Explorer and Type Hierarchy views.
<p><img src="images/default-type-filters.png" alt=""/></p>
<p>
</p>
</td>
</tr>
<tr id="change-compliance-jre-multi-constant-labels"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=574707 -->
<td class="title"><a href="#change-compliance-jre-multi-constant-labels">Change project compliance and JRE on using multi-constant case labels</a></td>
<td class="content">
A new quick fix (<b>Ctrl+1</b>) has been added to change the project compliance and JRE when multi-constant case labels
are used in a project below Java 14:
<p><img src="images/change-compliance-jre-multi-constant-labels.png" alt=""/></p>
<p>
</p>
</td>
</tr>
<tr id="declare-as-super-interface"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=573980 -->
<td class="title"><a href="#declare-sealed-interface-as-super-interface">Quick fix to declare sealed interface as super interface</a></td>
<td class="content">
You can use the following quick fix (<b>Ctrl+1</b>) to declare a sealed interface as super interface of its permitted types:
<p><img src="images/declare-sealed-interface-as-super-interface.png" alt=""/></p>
<p>
</p>
</td>
</tr>
<tr id="declare-as-super-class"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=574860 -->
<td class="title"><a href="#declare-sealed-class-as-super-class">Quick fix to declare sealed class as super class</a></td>
<td class="content">
You can use the following quick fix (<b>Ctrl+1</b>) to declare a sealed class as super class of its permitted classes:
<p><img src="images/declare-sealed-class-as-super-class.png" alt=""/></p>
<p>
</p>
</td>
</tr>
<tr id="add-to-permitted-types"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=574526 -->
<td class="title"><a href="#add-sub -type-as-permitted -type-of-sealed-type">Quick fix to add the sub type to permitted types of sealed super type</a></td>
<td class="content">
You can use the following quick fix (<b>Ctrl+1</b>) to add a sub type to permitted types of a sealed super type:
<p><img src="images/add-subtype-to-permitted-types-of-supertype.png" alt=""/></p>
<p>
</p>
</td>
</tr>
<!--******************* End of Java Editor ************************************* -->
<!-- ******************* Java Views and Dialogs ************************************* -->
<!-- <tr>
<td id="JavaViewsAndDialogs" class="section" colspan="2">
<h2>Java Views and Dialogs</h2>
</td>
</tr>-->
<!-- ******************* End of Java Views and Dialogs ************************************* -->
<!-- ******************* Java Compiler ************************************* -->
<tr>
<td id="JavaCompiler" class="section" colspan="2">
<h2>Java Compiler</h2>
</td>
</tr>
<tr id="external_annotations_all_locations"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=574603 -->
<td class="title"><a href="#external_annotations_all_locations">Find external annotations anywhere</a></td>
<td class="content">
External annotations, which are used for annotation based null analysis, can now be associated
to unannotated classes more freely.
<p>Previously, all external annotations where declared per build path entry. I.e., whenever a project of yours
uses a library for which external annotations exist, you would need to explicitly declare where
the corresponding external annotations for this particular library can be found.</p>
<p>A new compiler preference has been added by which you can instruct the compiler to search
for external annotations in all build path locations of the current project.</p>
<p><img src="images/external_annotations_all_locations.png" alt=""/></p>
<p>
When enabled, this strategy will be applied to all class files encountered during compilation.</p>
<p>Some examples, where this option is useful:</p>
<ul><li>A project A contains generated sources (in a separate source folder), which are decorated using
external annotations in the same project. When project A ships a jar containing also the external annotations,
any client of A will immediately see the generated classes with their external annotations applied.</li>
<li>When dedicated jars have been created, each containing external annotations for a set of libraries,
you only have to add these annotation jars to your build path and enable the new option, without worrying
which annotation jar corresponds to which individual dependency (dependencies).
The compiler will match external annotations to class files with no further help.
</li>
</ul>
<p>For batch compilation a corresponding option already exists. To match the above strategy in CI-builds,
just add the following to the compiler command line (verbatim):
<br/>
<code>-annotationpath CLASSPATH</code>
</p>
</td>
</tr>
<!-- ******************* End of Java Compiler ************************************* -->
<!-- ******************* Java Formatter ************************************* -->
<!-- <tr>
<td id="JavaFormatter" class="section" colspan="2">
<h2>Java Formatter </h2>
</td>
</tr> -->
<!-- ******************* End of Java Formatter ************************************* -->
<!-- *********************** Debug ******************************** -->
<tr>
<td id="Debug" class="section" colspan="2">
<h2>Debug</h2>
</td>
</tr>
<tr id="debug-intrim-eval"> <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=574395 -->
<td class="title"><a href="#debug-intrim-eval">Evaluate variables in current execution stack</a></td>
<td class="content">
In debug mode, regardless of the selected stack frame now you can evaluate variables which are
in the scope of the current execution stack frame and stack frames below it which are defined in
the current focused java class.
<p>
<img src="images/debug_eval_intrim_stack.png" alt="screenshot showing evaluation result" />
</p>
</td>
</tr>
<!--************************ End of Debug ******************************** -->
<!-- *********************** JDT Developers ******************************** -->
<!-- <tr>
<td id="JDTDev" class="section" colspan="2">
<h2>JDT Developers</h2>
</td>
</tr> -->
<!-- *********************** End of JDT Developers ******************************** -->
</tbody>
</table>
<!-- ****************** END OF N&N TABLE ****************** -->
</body>
</html>