Schlagwort-Archive: Eclipse

Was Eclipse bisher bei Java 9 unterstützt


Feature / Steps
Expected Result

The Pre-requisite: Java 9 JRE Support

Add Java 9 JRE
Use Eclipse Preferences -> Java -> Installed JREs -> Add


Java 9 JRE recognized as a valid JRE

Project JRE
In Package Explorer Use Project Context Menu and add Java 9 JRE
JRE specific (eg Object) gets resolved in the project.

Package Explorer
Go to Package Explorer and expand the Java 9 JRE
Modules (eg java.base etc) are listed in the package explorer view

The First Step: Module Creation

Context Menu of src -> New -> File – give the as name
no compiler errors

Context Menu of Project -> Cofigure -> Create module-info.


A default with all packages exported should be created

Basic Necessity : Compilation, Module Dependency & Error Reporting

Unspecified Dependency
create projects "first" and "second" and create files in each of giving the module names "first" and "second" respectively.

In the first module add the directive requires second; . This initial configuration would look something similar to the one shown in the figure.

Compiler gives error "second cannot be resolved to a module"

Define Dependency
In the above scenario, add Project second as a dependent project for project first
Compiler error goes away

Duplicate Dependency
Continuing from the above scenario, add a duplicate requires second; directive in the file of the first
Compiler gives error "Duplicate requires entry: second"

Circular Dependency
add a circular dependency ie

add second project dependent on first
add requires first; directive in the file of the second project ie replace // empty by design comment by this directive

Two compiler errors " Cycle exists in module dependencies, Module second requires itself via first"

Editing with Ease: Completion in file

Keyword Completion (1)
In the file of say second project, after module first {, press completion key (for eg, ctrl+space in windows)


keywords exports, opens, requires, provides and uses shown

Keyword Completion (2)
after exports packagename, or opens packagename press completion key
keyword to is shown as an option

Package Completion
after exports, opens, provides or uses, press completion key
package completion shown.

Type Reference Completion
after exports, opens, provides or uses, or optionally after a dot after a package, ie exports packagename. press completion key
Type completion shown.

Implementation TypeRef Completion
after provides typename with press completion key
Type completion shown and these typereferences are implementations of the type given before with.

The Essential Utilities: Code Select, Hover, Navigate, Search and Rename

Module Select & Hover

In the file of the first project, select second in the requires second; directive

Hover appears

Module Select, Hover & Navigate
In the above scenario, after hover appears, click on the navigate file of second opened

Module Select, & Search

In the file of the second project, select second in module declaration module second { and search for references

In the search view, the reference in directive requires second; in file first -> is shown.

Package Search

create package pack1 to the project first.
add exports pack1; directive in file of first.
search for references of pack1

In the search view, the reference of pack1 in directive exports pack1; in file first -> is shown, similar to other pack1references if any

Type Search
create Type X in the project first, add directive uses X; in file of first, and search for references of X
In the search view, the reference of Xin directiveuses X; in file first -> is shown, similar to other Xreferences if any

Code Select & Rename
in file of first, select X in directive uses X; and rename to X11
rename exhibits usual behavior – renames definition and references of Xto X11

The Outlier: Milling Project Coin Enhancements

@SafeVarargs is now allowed on private instance methods. There is even a support of quick assist for that. Use the following code which has warnings, and use the quick assist at the point mentioned in the comment

package packsafe;
import java.util.ArrayList;
import java.util.List;   public class SafeVar {
	private int getLen(List<String>...list) {
		List<String>[] l = list;
		return l.length;
	}   public static void main(String[] args) {
		SafeVar x = new SafeVar();
		List<String> l = new ArrayList<>();
		int len = x.getLen(l); // Use Quick Assist of SafeVarargs here<br>
		System.out.println("Length:" + len);

@SafeVarargsinserted before getLen() and the warnings go away

Effectively Final Autoloseables

Effectively-final variables are allowed to be used as resources in the try-with-resources statement. The code below has an error. Try removing the line t1 = null; // Remove this code .

package packtry;
import;   class Two implements Closeable {
	public void close() throws IOException {
		// nothing
public class TryStmtTwo {   public void foo() throws IOException {
		Two t1 = new Two();
		try (t1; final Two t2 = new Two()) {
		// Empty by design
	t1 = null; // Remove this code
	public static void main(String[] args) {

Code without errors. For the more inquisitive, check the generated code to see that the close is generated for t1 as well which is not a final variable but an effectively final variable.

Anonymous Diamond

In the following code, there is a warning about Y being a raw type and need to be parameterized. with Java 9 support, just add a diamond operator after Y.

public class Dia {
	public static void main(String[] args) {
		Y<?> y1 = new Y(){}; // Change this to new Y<>(){}
class Y<T> {}

Diamond operator <>accepted and code compiles without warning

Illegal Underscore

Underscore is an illegal identifier from Java 9 onwards. Uncomment the commented line in the following example

public class UnderScore {
	//Integer _ ;

error: "’_‘ should not be used as an identifier, since it is a reserved keyword from source level 1.8 on"

Private Methods

private interface methods are allowed. Change the default of worker to private

public interface I {
	default void worker() {}<   default void foo() {
	}   default void bar() {

Code compiles with privateas well. Note that this is a useful feature if two default methods wants to share the worker code and does not want the worker to be an public interface method.

Eclipse 4.6 (Neon) News

Alle News unter

Interessant sind:

Commands and shortcuts to zoom in text editors In text editors, you can now use Zoom In (Ctrl++ or Ctrl+=) and Zoom Out (Ctrl+-) commands to increase and decrease the font size.Like a change in the General > Appearance > Colors and Fonts preference page, the commands persistently change the font size in all editors of the same type. If the editor type’s font is configured to use a default font, then that default font will be zoomed.
Full Screen The Full Screen feature is now also available on Windows and Linux. You can toggle the mode via shortcut (Alt+F11) or menu (Window > Appearance > Toggle Full Screen).When Full Screen is activated, you’ll see a dialog which tells you how to turn it off again.

On the Mac, Window > Toggle Full Screen (Control+Command+F) still works as before.

Substring code completion Content Assist now supports substring patterns. Enter any part of the desired proposal’s text, and Content Assist will find it! For example, completing on selection proposes all results containing selection as a substring.Popup with proposals like addSelectionListener(..), getSelection(), etc.

This feature can be disabled using the Show substring matches option on the Java > Editor > Content Assist preference page.

Clean Up to remove redundant type arguments A new option to remove redundant type arguments has been added under the „Unnecessary Code“ group of the Clean Up profile.
Create new fields from method parameters You can now assign all parameters of a method or constructor to new fields at once using a newQuick Assist (Ctrl+1):Assign all parameters to new fields
Quick Fix to configure problem severity You can now configure the severity of a compiler problem by invoking the new Quick Fix (Ctrl+1) which opens the Java > Compiler > Errors/Warnings preference page and highlights the configurable problem.

The Quick Fix icon may look familiar to you. In older Eclipse versions, this was a toolbar button in enriched hovers (i.e., you had to press F2 or move the mouse into the hover to see it).




Eclipse Project 4.5 (Mars) M4

Je länger ich Eclipse benutze, desto seltener beschäftige ich mich mit Release-Dates oder den Features — es sei denn, ich warte auf die Unterstützung von neuen Sprache-Features.

So gingen auch die bisherigen Milestones von 4.5 an mir spurlos vorbei, auch der letzte Milestone M4 vom 12.12. Zusammenfassend Neuerungen, die (für mich) interessanter sind:

Assigning stdin to a file
Stdin can now be assigned to a file in the „Common“ tab of launch configuration dialogs.

Automatic scroll lock in Console view
Scrolling up in the Console view using keys, mouse wheel, or scroll bar now automatically enables the Scroll Lock mode.

When you scroll down to the end of the console, the scroll lock is automatically released again.

Improved flow analysis for loops
Flow analysis has been improved to more precisely capture the flow of null values in loops. This mainly achieves a reduction of false positive reports from null analysis.

Previously, example method „test1“ would raise a potential null pointer warning at point (3). To correct this issue the merging of information leading towards point (3) has been improved to correctly see that the null value from point (1) can never reach point (3).

In example method „test2“ JDT previously reported a redundant null check at (3), because analysis didn’t see that the assignment directly above could indeed assign a non-null value.

In example method „test3“ it was reported that „o can only be null“ at (3), because the information from the two null-assignments wrongly overruled the one assignment from non-null. With improved analysis this is now softened to saying „o may be null“.

The graph on the right hand side illustrates the new composition of flow information: for each relevant point (3) inside a loop, the analysis first merges the flows that lead into (1). This result is concatenated with the partial flow (b.c), which leads from the loop start to point (3). Improved precision has thus been achieved within the design limits of a single AST traversal in order to minimize impact on compiler performance.

‚Terminate/Disconnect All‘ in Console view
You can invoke the Terminate/Disconnect All action from the Console view’s context menu:

Add inferred lambda parameter types
You can explicitly add the inferred types of the parameters in a lambda expression by invoking the Quick Assist (Ctrl+1) – Add inferred lambda parameter types:

Convert method reference to lambda and back
New Quick Assists (Ctrl+1) have been added to convert…

  • from method reference to lambda expression:Integer::toHexString
  • from lambda expression to method reference:t -> Integer.toHexString(t)

Compiler schneller.

Word wrap in the Console
A new formatting option has been contributed to the Console view for all I/O consoles: Word Wrap.

The new option is available on the Console view toolbar and in the content popup menu within the Console view.

The new word wrap toolbar and popup menu command

Der gibt uns noch einen Milestone vor, dann beginnt die Feinarbeit:

  • M5 2015-01-30 4.5M5
  •     2015-02-13 CQ Submission Deadline
  • M6 2015-03-20 .5M6 (API Freeze)
  • M7 2015-05-01 4.5M7 (Feature Freeze)

Eclipse 4.4 M7 (Luna)

Für mich ist wichtig:

Java 8: Java™ 8 is here, and JDT fully supports it:

  • The Eclipse compiler for Java (ECJ) implements all the new Java 8 language enhancements
  • Updated significant features to support Java 8, such as Search and Refactoring
  • New formatter options for lambdas
  • Quick Assist and Clean Up to migrate anonymous class creations to lambda expressions and back:


    anonymous class with a 1-line method body

    After the Quick Assist (Ctrl+1), the 6 lines are condensed into 1:

    lambda expression -- everything on 1 line

Heute kommt auch der erste Release Candidate (RC) raus.

Official Eclipse Support for Java 8

So ist zu lesen unter

The Eclipse top-level project is very proud to announce official support for Java 8. Starting with I20140318-0830 all Luna (4.4) builds contain the Eclipse support for Java™ 8. For Kepler SR2 (4.3.2) a feature patch is available. For future builds visit our downloads page.
The Java™ 8 support contains the following:
– Eclipse compiler implements all the new Java™ 8 language enhancements.
– Significant features, like Search and Refactoring, have been updated to support Java™ 8.
– Quick Assist and Clean Up to migrate anonymous class creations to lambda expressions and back.
– New formatter options for lambdas.
Note that PDE API Tools has not yet adopted the new language constructs. This will be completed in the final Luna release.
Big thanks to everyone who worked on this effort!

GUI-Builder für JavaFX und Swing

Mit einem GUI-Builder lassen sich grafische Oberflächen über ein grafisches Werkzeug einfach aufbauen. In der Regel bietet ein GUI-Bilder eine Zeichenfläche und eine Symbolleiste mit Komponenten, die per Drag and Drop angeordnet werden. Zentral bei dem Ansatz ist das WYSIWYG-Prinzip (What You See Is What You Get), dass nämlich im Designschritt schon abzulesen ist, wie die fertige Oberfläche aussieht.

Ein GUI-Builder erzeugt eine Repräsentation der grafischen Oberfläche, die im Prinzip auch von Hand zu erstellen wäre – allerdings ist der Aufwand sehr groß und für jeden nachvollziehbar, der schon einmal in HMTL eine neue Tabellenspalte hinzugeführt hat. Es gibt immer wieder Diskussion über das Für und Wider doch ist es wie mit allen Tools: richtig eingesetzt kann ein GUI-Builder viel Arbeit sparen.

GUI-Builder für JavaFX

Der JavaFX Scene Builder ist ein Werkzeug von Oracle und nennt sich selbst „A Visual Layout Tool for JavaFX Applications“. Er ist kein Teil vom JDK, sondern muss unter bezogen und installiert werden. Danach stehen komfortable Werkzeuge zum Entwurf von Oberflächen und deren Verschönerung mit CSS nichts im Wege.

NetBeans bietet von Haus aus Unterstützung im Entwurf grafischer Oberflächen, denn ein GUI-Bilder ist integriert, und eine Zusatzinstallation ist nicht nötig. Das gibt uns direkte Möglichkeiten, Swing und auch JavaFX spielerisch zu erfahren.[1]

Für Eclipse gibt es keinen speziellen GUI-Builder, das ist auch eigentlich gar nicht nötig, denn der Scene Builder kann in Eclipse integriert werden.[2] Zwar kein direkter WYSIWYG-Editor, aber immerhin ein Werkzeug im Umgang mit XML ist das quelloffenes Eclipse-Plugin e(fx)clipse unter

GUI-Builder für Swing

Während NetBeans für Swing gute Unterstützung mitbringt, ist bei Eclipse standardmäßig kein GUI-Builder integriert. Es gilt also, ein Plugin nachzuinstallieren. In den letzten Jahren kamen und gingen verschiedene GUI-Builder, aber letztendlich hat sich der WindowsBuilder ( von Google als De-facto-Standard etabliert. Über den Update-Mechanismus von Eclipse wird er installiert. Eine Installationsanleitung findet sich auf der Webseite. Neben Swing nimmt der WindowsBuilder gleich noch GWT, SWT und XWT (Eclipse XML Window Toolkit) mit.

[1] Didaktiker nennen das »exploratives Lernen«.


Refactoring mit Alt + Shift + R geht nicht mehr? RadioSure kann Schuld sein

Seit einiger Zeit gab es einen merkwürden Effekt: Zeitweilig ging das Refactoring über den Shortcut Alt + Shift + R nicht mehr. Ich dachte erst an ein komisches Eclipse-Plugin, aber selbst Eclipse wollte zu dem Shortcut gar keine Operation anzeigen, es ging bis Alt + Shift und das R schluckte das System schon. Damit war klar, dass die Tastenkombination erst gar nicht bei Eclipse ankam – es musste ein anderes Windows-Programm sein. Ich schaute auf die Liste und dann fiel mir sofort RadioSure auf, und dann jetzt verstand ich auch, warum ich immer wieder unbeabsichtigte Aufnahmen hatte: Die Recording-Funktionalität wird exakt mit Alt + Shift + R getoggelt.


Nach dem Deaktivieren war dann auch mit dem Refactoring alles wieder in Ordnung.

Eclipse-Plugin: Shell-Script-Editor (ShellEd) und Remote System Explorer (RSE)

ShellEd (Bild) ist ein Shell-Script-Editor für Unix-Skripte (also ash, bsh, bash, csh, ksh, sh, zsh). Mit Manual und Vervollständigung. Interessant dazu ist das relativ unbekannte Target Management Project, wo man remote, etwa über SSH oder FTP auf einem Server arbeiten und zum Beispiel Dokumente editieren kann.

Mehr Eclipse-Plugins gibt’s unter