javaeclipse

Why do these boxes appear in the Eclipse Java editor?


I have a utility function defined as:

@FunctionalInterface
public interface DBSupplier<T, E extends SQLException> {
    T get() throws E;
}

public static <R>R onDupQuery(
  MutableConnection conn, 
  DBSupplier<R,SQLException> dbQuery, 
  DBSupplier<R,SQLException> dbInsert) throws SQLException {
...
}

When I write code to use this utility (reduced to minimum code here), the Eclipse Java editor draws a box around every line of the argument functions:

Code Editor Screenshot

Why is it doing that, and how to get rid of it?


Solution

  • Those boxes are provided for the content assist feature each time a method is typed. Content assist itself can be used on each box, when a box is complete the next one can be edited/filled jumping with TAB key to it.
    In OP's case, methods are defined in an interface so eclipse provides boilerplate code to write an anonymous implementation.

    enter image description here

    It could be disabled setting the java editor configuration but it's probably something too useful to be disabled.

    enter image description here

    Types or packages for content assist exclusion can be added on

    Preferences -> Java -> Appearance -> Type Filters