Permalink
Browse files

remove warnings

  • Loading branch information...
vladdu committed Aug 9, 2017
1 parent 8fcf1cc commit 604d16d6fb2fd46df453d3f63fb59d45021646c4
@@ -1,4 +1,4 @@
class org/eclipse/core/runtime/IAdaptable
getAdapter
<T:Ljava/lang/Object;>(Ljava/lang/Class<TT;>;)TT;
<T:Ljava/lang/Object;>(Ljava/lang/Class<TT;>;)T0T;
<T:Ljava/lang/Object;>(Ljava/lang/Class<T0T;>;)T0T;
@@ -22,7 +22,7 @@
Set<IBackend> getExecutionBackends(@NonNull final IProject project);
Collection<IBackend> getAllBackends();
Collection<@NonNull IBackend> getAllBackends();
void addBackendListener(final IBackendListener listener);
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="src" path="xtend-gen/"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<attributes>
<attribute name="annotationpath" value="/erlide_eclipse/.annotations"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
@@ -7,47 +7,48 @@
import com.ericsson.otp.erlang.OtpErlangTuple;
public class FunctionRef {
public final String module;
public final String function;
public final int arity;
public FunctionRef(final String module, final String function, final int arity) {
this.module = module;
this.function = function;
this.arity = arity;
}
@SuppressWarnings("boxing")
public FunctionRef(final OtpErlangObject e) {
if (e instanceof OtpErlangTuple) {
final OtpErlangTuple t = (OtpErlangTuple) e;
try {
final OtpBindings bb = OtpErlang.match("{M:a, F:a, A:i}", t);
final String m = bb.getAs("M", String.class);
final String f = bb.getAs("F", String.class);
final int a = bb.getAs("A", Integer.class);
module = m;
function = f;
arity = a;
} catch (final Exception e2) {
throw new IllegalArgumentException();
}
} else {
throw new IllegalArgumentException();
}
}
public FunctionRef(final IErlFunction parent) {
module = parent.getModuleName();
function = parent.getName();
arity = parent.getArity();
}
@Override
public String toString() {
return module + ":" + function + "/" + arity;
}
public final String module;
public final String function;
public final int arity;
public FunctionRef(final String module, final String function, final int arity) {
this.module = module;
this.function = function;
this.arity = arity;
}
@SuppressWarnings("boxing")
public FunctionRef(final OtpErlangObject e) {
if (e instanceof OtpErlangTuple) {
final OtpErlangTuple t = (OtpErlangTuple) e;
try {
final OtpBindings bb = OtpErlang.match("{M:a, F:a, A:i}", t);
final String m = bb.getAs("M", String.class);
final String f = bb.getAs("F", String.class);
Integer ai = bb.getAs("A", Integer.class);
final int a = (ai == null ? 0 : ai.intValue());
module = m;
function = f;
arity = a;
} catch (final Exception e2) {
throw new IllegalArgumentException();
}
} else {
throw new IllegalArgumentException();
}
}
public FunctionRef(final IErlFunction parent) {
module = parent.getModuleName();
function = parent.getName();
arity = parent.getArity();
}
@Override
public String toString() {
return module + ":" + function + "/" + arity;
}
}
@@ -29,6 +29,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.annotation.Nullable;
import org.erlide.engine.ErlangEngine;
import org.erlide.engine.ModelPlugin;
import org.erlide.engine.model.IErlElement;
@@ -46,7 +47,7 @@
// TODO replace ResourceDeltaStub with a mock object
public static class ResourceDeltaStub implements IResourceDelta {
@Override
public <T> T getAdapter(final Class<T> adapter) {
public <@Nullable T> T getAdapter(final Class<T> adapter) {
return null;
}
@@ -65,7 +66,7 @@ public void accept(final IResourceDeltaVisitor visitor, final int memberFlags)
}
@Override
public IResourceDelta findMember(final IPath path) {
public IResourceDelta findMember(final IPath path) {
return null;
}
@@ -6,6 +6,7 @@
import java.util.List;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
import org.erlide.backend.BackendCore;
import org.erlide.backend.api.IBackend;
import org.erlide.backend.api.IBackendManager;
@@ -49,12 +50,12 @@ public static boolean isExternal(final String nodeName) {
* if nodes should be omitted
* @return list of backends
*/
public static Collection<? extends IBackend> getBackends(final boolean ignore) {
public static Collection<? extends @NonNull IBackend> getBackends(final boolean ignore) {
if (!ignore) {
return BackendCore.getBackendManager().getAllBackends();
}
final List<IBackend> backends = new ArrayList<>();
final List<@NonNull IBackend> backends = new ArrayList<>();
final IBackendManager backendManager = BackendCore.getBackendManager();
final Set<IBackend> ignored = new HashSet<>();
IBackend backend;
@@ -33,6 +33,8 @@ public void toggleLineBreakpoints(final IWorkbenchPart part,
if (textEditor != null) {
final IResource resource = textEditor.getEditorInput()
.getAdapter(IResource.class);
if(resource==null)
return;
final ITextSelection textSelection = (ITextSelection) selection;
final int lineNumber = textSelection.getStartLine();
final IBreakpoint[] breakpoints = DebugPlugin.getDefault()
@@ -67,6 +67,8 @@ public static boolean matchesKeybinding(final KeyEvent event,
final String commandId) {
final IBindingService bindingSvc = PlatformUI.getWorkbench()
.getAdapter(IBindingService.class);
if(bindingSvc==null)
return false;
final TriggerSequence[] activeBindingsFor = bindingSvc
.getActiveBindingsFor(commandId);
@@ -97,6 +99,8 @@ public static boolean matchesKeybinding(final KeyEvent event,
public static KeySequence getCommandKeyBinding(final String commandId) {
final IBindingService bindingSvc = PlatformUI.getWorkbench()
.getAdapter(IBindingService.class);
if(bindingSvc==null)
return null;
final TriggerSequence binding = bindingSvc.getBestActiveBindingFor(commandId);
if (binding instanceof KeySequence) {
return (KeySequence) binding;
@@ -13,6 +13,7 @@
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.viewers.ColumnLayoutData;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -770,7 +771,7 @@ public void refresh() {
private List<Element> moveUp(final List<Element> elements, final List<Element> move) {
final int nElements = elements.size();
final List<Element> res = new ArrayList<>(nElements);
Element floating = null;
@Nullable Element floating = null;
for (int i = 0; i < nElements; i++) {
final Element curr = elements.get(i);
if (move.contains(curr)) {
@@ -81,7 +81,8 @@ protected CallHierarchyView prepare() {
final CallHierarchyView cvh = p
.getAdapter(CallHierarchyView.class);
cvh.setMessage("<searching... project " + ErlangEngine.getInstance()
if(cvh!=null)
cvh.setMessage("<searching... project " + ErlangEngine.getInstance()
.getModelUtilService().getProject(module).getName() + ">");
return cvh;
} catch (final PartInitException e) {
@@ -38,8 +38,8 @@ public Object execute(final ExecutionEvent event) throws ExecutionException {
.getAdapter(ErlangOutlinePage.class);
shell = outline.getSite().getShell();
targetId = "org.eclipse.ui.views.ContentOutline";
patternFilter = erlangOutlinePage.getPatternFilter();
viewer = erlangOutlinePage.getTreeViewer();
patternFilter = (erlangOutlinePage==null?null:erlangOutlinePage.getPatternFilter());
viewer = (erlangOutlinePage==null?null:erlangOutlinePage.getTreeViewer());
} else if (activePart instanceof CommonNavigator) {
final CommonNavigator commonNavigator = (CommonNavigator) activePart;
targetId = "commonNavigator";
@@ -118,6 +118,8 @@ public static void addFilter(final String filterId, final boolean value,
erlangOutlinePage = outline
.getAdapter(ErlangOutlinePage.class);
}
if(erlangOutlinePage==null)
return;
final TreeViewer viewer = erlangOutlinePage.getTreeViewer();
if (viewer == null) {
return;
@@ -148,6 +150,8 @@ public static void setFilters(final Collection<FilterDescriptor> filterDescs,
erlangOutlinePage = outline
.getAdapter(ErlangOutlinePage.class);
}
if(erlangOutlinePage==null)
return;
final TreeViewer viewer = erlangOutlinePage.getTreeViewer();
if (viewer == null) {
return;
@@ -15,7 +15,6 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelection;
@@ -11,6 +11,8 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNull;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
@@ -28,7 +30,7 @@
public class Memoizer implements InvocationHandler {
@SuppressWarnings("unchecked")
public static <T> T memoize(final T object) {
public static <@NonNull T> T memoize(final T object) {
return (T) Proxy.newProxyInstance(object.getClass().getClassLoader(),
object.getClass().getInterfaces(), new Memoizer(object));
}
@@ -16,6 +16,7 @@
import java.util.Map;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import com.ericsson.otp.erlang.OtpErlangAtom;
@@ -112,7 +113,7 @@ public OtpErlangPid getPid(final String name) throws OtpErlangException {
}
@SuppressWarnings("unchecked")
public <@Nullable T> T getAs(final String name, final Class<T> cls) throws SignatureException {
public <@Nullable T> T getAs(final String name, final Class<@NonNull T> cls) throws SignatureException {
final OtpErlangObject v = get(name);
return (T) TypeConverter.erlang2java(v, cls);
}
@@ -3,7 +3,6 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.xtext.xbase.lib.Pair;
public class ServiceLocator {

0 comments on commit 604d16d

Please sign in to comment.