Welcome to JDT Extension

The motivation is to make Eclipse JDT more powerful and easy-to-use.

Guava-based hashCode(), equals() and toString()

Eclipse provides utilities to generate hashCode(), equals() and toString(). But it’s the old-style. The generated functions are usually very long, which makes the code hard to read.

Google Guava provides a better solution for it. See here for more details.

JDT Extension can generate Guava-styled functions, which are shorter, tidy and easy to read.

Usage

screen1

screen2

import com.google.common.base.Objects;

public class A {

	private int a;
	
	private double b;
	
	private String c;

	@Override
	public int hashCode() {
	  return Objects.hashCode(a, b, c);
	}

	@Override
	public boolean equals(Object obj) {
	  if (obj == this) {
	    return true;
	  }
	  
	  if (!(obj instanceof A)) {
	      return false;
	  }
	  
	  A anotherInstance = (A) obj;
	  return Objects.equal(anotherInstance.a, this.a)
	      && Objects.equal(anotherInstance.b, this.b)
	      && Objects.equal(anotherInstance.c, this.c);
	}
	
}

Search by Google, StackOverflow

Another utility is to put Google/StackOverflow search in context menu in editors/consoles/terminals.

Usage

screen3

Installation

The simplest way is to Eclipse Marketplace.

Open Eclipse Marketplace, search “JDT Extension” and click install.

marketplace

You can also use update site URL: https://bloodlee.github.io/jdt_extension_update/