## What's New in 3.7 (JDT)

Here are descriptions of some of the more interesting or significant changes made to the Java development tools for the 3.7 release of Eclipse. They are grouped into:

- Java Editor
- Java Formatter
- Java Compiler
- Java Views and Dialogs
- Properties File Editor
- JUnit

See also the Eclipse Platform What's New document for changes in the Platform.

## Java Editor

Open Java element from clipboard

The new Navigate > Open from Clipboard command tries to open the matching Java element in the editor if the clipboard contains a single line. Otherwise it opens the contents in the Java Stack Trace Console.
Examples:

- java.lang.String
- String
- String#getBytes
- String.getBytes
- java.lang.String.getBytes(String)
- String.java:123
- at java.lang.String.matches(String.java:1550)
- java.lang.String.valueOf(char) line: 1456
- currentTimeMillis()

Note: If the action is not enabled in a certain perspective, then you can enable the Java Debug action group in Window > Customize Perspective > Command Groups Availability.

Hyperlinks

Three new hyperlinks have been added to the Java editor:

- Open Super Implementation: The action from the Navigate menu is now also available as a hyperlink. It is enabled for overridden methods and opens the super implementation of the selected method.

- Open Declared Type: This link is enabled for local variables and fields. When invoked, it opens the declared type of the variable in an editor:

- Open Return Type: This link is enabled for methods. When invoked, it opens the return type of the method in an editor:

By default, the hyperlink appears when you hold down the Ctrl key while hovering over an appropriate element, or when you use the Navigate > Open Hyperlink command. You can configure the modifier for the hyperlinks on the The hyperlink style navigation can be configured on the General > Editors > Text Editors > Hyperlinking preference page.

"Introduce new local with cast type" quick assist | The Introduce new local with cast type quick assist (Ctrl+1) is now not only available on the `instanceof` keyword, but also in the body of the conditional statement (before the first body statement).
"Join variable declaration" quick assist for variables initialized to null | The Join variable declaration quick assist is now also available for variables initialized to `null`.
"Exchange Operands" quick assist for comparison operators | The Exchange left and right operands for infix expression quick assist is now also available for the `!=`, `<`, `<=`, `>`, and `>=` operators.
New 'Put expression in parentheses' quick assist | The Java editor now offers a new quick assist Put expression in parentheses. Also the Add paranoiac parentheses quick assist has been renamed to Put expressions in parentheses.
'Add missing case statements' quick assist | The Add missing case statements quick assist is now available in the body of the switch statement:
Semantic coloring for abstract classes | Abstract classes can now be highlighted separately in the source code: The rendering can be configured on the Java > Editor > Syntax Coloring preference page.
Quick Outline shows inherited members for nested type | The Quick Outline shows inherited members of top-level types when Ctrl+O is pressed twice. Now, it also shows inherited members of the type that contains the current editor selection: The focus types that can show inherited members are marked with a triangle ( ).
Ctrl+drag to add to Call Hierarchy | Ctrl+drag now adds the selected methods to the existing elements in the Call Hierarchy view. Plain drag and drop continues to replace the view input with the selected methods.
Navigate to {@inheritDoc} target | To quickly navigate to the target of an {@inheritDoc} tag in a Javadoc comment, you can now Ctrl+click the tag or use Navigate > Open Declaration to jump to the method that defines the inherited doc. In this example, the target of the `@inheritDoc` inline tag on X2.foo() is X1.foo().

Navigate to 'break' and 'continue' target

To quickly navigate to the target of a `break` or `continue` statement, you can now Ctrl+click or use Open Declaration (F3) on `break` or `continue` keywords or their labels.

Navigation on...

- `break`: jumps to the end of the target statement
- `continue`: jumps to the beginning of the target statement
- a label: jumps to the label declaration

Format Java elements via Outline view | You can now format one or more selected elements in the Java Outline view by invoking Source > Format Element from the main menu.
Disable smart indentation on 'Enter' | A new preference has been added to the Java > Editor > Typing preference page that allows to disable smart indentation after the Enter key has been pressed:

## Java Formatter

New line after annotations | The Insert new line after annotations on members option on the 'New Lines' tab of the formatter preferences has been split up to support packages, types, fields and methods: For example, with this preference activated as shown above, the formatted code looks like this: Formatter profiles can be configured on the Java > Code Style > Formatter preference page.
Preserve whitespace before line comment | A code formatter option has been added to preserve white space between code and line comments: This preference can be enabled on the Java > Code Style > Formatter preference page on the Comments tab:

## Java Compiler

New option to include 'assert' in null analysis

JDT now gives the flexibility to enable or disable null-related errors/warnings on variables that got marked as potentially or definitely null inside an assert statement. If you have runtime asserts enabled, you can also enable the new warning to see the null-related problems being reported because of null-related checks inside the assert statement. If the option is disabled, null checks in asserts are not considered.

The new option Include 'assert' in null analysis is disabled by default and can be enabled on the Java > Compiler > Errors/Warnings preference page.

Missing Javadoc tags for method type parameters no longer reported by default | JDT now provides an option to enable or disable the missing Javadoc tag error or warning for a method type parameter without a corresponding `@param` tag. The new Ignore method type parameters option is enabled by default and can be disabled on the Java > Compiler > Errors/Warnings preference page.

Improved detection of unused local variables, parameters and fields

JDT now reports local variables, parameters, and fields of a primitive type as unused in the following scenarios:

- compound assignment
- prefix/postfix increment/decrement expression

In case the above expressions involve an unboxing operation, the variable is not reported as unused.

We also changed the wording from "X has never been read" to "The value of X is not used."

Filter preferences on Java > Compiler > Errors/Warnings page

You can now filter preferences on the Java > Compiler > Errors/Warnings page by preference label text or by preference value. A word in the filter string preceded by '~' is used to filter on preference values. Examples:

- param
- ~off
- ~ignore
- param ~enabled
- ~ignore param

Unavoidable generic type problems

A new compiler option has been added that suppresses unavoidable generic type problems.

Those problems only show up because a type refers to an old API that uses raw types.

When the old API is eventually generified, then these problems either go away, or you will see a compile error because the type arguments you used are not correct.

This option is disabled by default but can be enabled on the Java > Compiler > Errors/Warnings preference page.

Compiler detects methods that can be static

Two new compiler options have been added that mark methods which can be made static because they only refer to static members.

The first option marks private and final methods than can always be made static.
The second option also marks other methods. Note that methods can be overridden in a subclass, so if you make a "potentially static" method static, this may break existing clients.

These options are disabled by default.

On-disk JRE change detection | In the past, if a system update or another event changed a JRE used in Eclipse, those changes would not be reflected in Eclipse: In some cases, this caused the JRE to stop functioning. Now, these changes are accounted for, and any JRE that changed on-disk (external to Eclipse) will be updated accordingly when Eclipse restarts.
New "javadoc" token for `@SuppressWarnings` annotation | The `@SuppressWarnings` annotation can now also be used to suppress compiler warnings/errors related to Javadoc issues:

## Java Views and Dialogs

Open Type Hierarchy on multiple type containers | The Open Type Hierarchy action now also works on multiple type containers: You can select multiple packages, source folders, or projects, and then open a hierarchy that contains all types in the selected containers.
Pin the Call Hierarchy view | The Call Hierarchy view now allows to pin the current view, which allows you to open multiple Call Hierarchy views at the same time:
Configure 'Search In...' in Call Hierarchy | A new Search In... action has been added to the Call Hierarchy view menu. The action shows the Search In dialog with the same options that are already available in the Search dialog.
History for breakpoint conditions | There is now a history for recently used breakpoint conditions:

Prompt before deleting conditional breakpoints

In the Java editor, if you delete a breakpoint that has a condition set on it, you will now be prompted before the breakpoint gets deleted:

You can specify that you would not like to be notified again when trying to remove a conditional breakpoint. This can later be changed again via Prompt for confirmation when deleting a conditional breakpoint from editor on the Java > Debug preference page.

Step filtering for bean-style getters and setters

When single stepping, you can now automatically step over simple getters and setters during Step Into:

Consider single stepping into statements like:

    computeEffect(meters.getCurrent(), meters.getVoltage());

Normally, this means first stepping into `getCurrent`, then into `getVoltage`, and finally into `computeEffect`. You can now skip the first two steps (provided they are simple bean-style getters), and jump directly into the `computeEffect` method, by selecting the Filter simple getters check box on the Java > Debug > Step Filtering preference page.

Similarly, selecting Filter simple setters avoids stopping inside simple bean-style setters when using Step Into.

## Properties File Editor

New "Escape backslashes" and "Unescape backslashes" quick assists in properties file editor | The properties file editor now offers two new quick assists (Ctrl+1) to escape or unescape backslashes. The Escape backslashes quick assist is also offered automatically on paste if the pasted text contains backslashes that should be escaped.
Auto-escaped characters and editor hovers | The properties file editor now auto-escapes typed and pasted non-ISO-8859-1 characters and shows a hover containing the real text if the underlying text contains special characters like \uHHHH, \t, or \n.

## JUnit

New JUnit Test Suite wizard supports JUnit 4

The New > JUnit Test Suite wizard can now also create JUnit 4 test suites:

Result:

    @RunWith(Suite.class)
    @SuiteClasses({ ListTest.class, SimpleTest.class })
    public class AllTests {
    }

Show latest JUnit test in all windows | By default, a new JUnit test run only shows up in the window where the test was started. If you prefer to see the latest test in all open JUnit views, select Preferences > Java > JUnit > Show newly launched test in all JUnit views:
Paste URL into JUnit view | Apart from drag-and-drop or Test Run History > Import from URL..., you can now also paste a URL into the JUnit view to load test results from the web. Supported test run formats are XML files exported from the JUnit view or generated by the Ant JUnit task.