Community
Participate
Working Groups
When I try organize imports with the following code it tries to import some weird sun packages (com.sun.rsasign.c and sun.security.krb5.internal.crypto.c) package com.rgdsft.wadgef.editpart; import org.eclipse.gef.commands.Command; import org.eclipse.gef.requests.GroupRequest; import java.util.ArrayList; public class FuncConnectionEditPolicy extends org.eclipse.gef.editpolicies.ConnectionEditPolicy { public FuncConnectionEditPolicy() { super(); } protected Command getDeleteCommand(GroupRequest request) { List c = new ArrayList(); c.add(null); return c; } } It seems to think the 'c', on the line including c.setCircuitModel, is a type for some reason. If I rename the variable this does not happen. Also any type works, it does not have to be this ConnectionCommand. As long as the variable is named c.
steps1: 1. disable 'Do not create import for types starting with a lowercase letter' 2. paste this code into a Java project: ----------- %< ------------ class FuncConnectionEditPolicy { protected void getDeleteCommand() { List c = new ArrayList(); c.add(null); } } ----------- %< ------------ 3. Ctrl+Shift+O
It does not like 'l' either, responding with similar Sun classes.
If possible, turn on the option 'Do not create import for types starting with a lowercase letter' on the Organize import order. The problem is that 'c' didn't get a variable binding as its return type couldn't be evaluated. We have to either talk to jdt.core to allow incomplete variable bindings (bug 149567), or add code in organize impot that finds more information about the reference to 'v'.
The problem is, it is attempting to import a type based on something located in a place that could not possibly contain a type. Thats a variable location. Hmm, then again c.add(null); 'c' certainly could be a type there with 'add' being a static call. So it would appear that once 'c' is determined to be a variable in the previous line, it should no longer be considered able to be a type in other lines within the same block.
This is fixed in M7.