Permalink
Browse files

add nullable annotations

  • Loading branch information...
vladdu committed Aug 9, 2017
1 parent a7b736c commit 8fcf1cc434a0ee88dfb8f355c9a5180da5b49c0e
Showing with 66 additions and 35 deletions.
  1. +4 −0 .annotations/org/eclipse/core/runtime/IAdaptable.eea
  2. +4 −0 .annotations/org/eclipse/core/runtime/IAdapterFactory.eea
  3. +1 −1 libs/org.fishwife.jrugged/META-INF/MANIFEST.MF
  4. +1 −1 plugins/org.erlide.backend/META-INF/MANIFEST.MF
  5. +2 −1 plugins/org.erlide.backend/src/org/erlide/backend/internal/BackendManager.java
  6. +1 −1 plugins/org.erlide.core/META-INF/MANIFEST.MF
  7. +1 −1 plugins/org.erlide.model.api/META-INF/MANIFEST.MF
  8. +1 −1 plugins/org.erlide.model.api/src/org/erlide/engine/model/erlang/FunctionRef.java
  9. +2 −1 plugins/org.erlide.model.api/src/org/erlide/engine/util/ResourceUtil.java
  10. +3 −3 plugins/org.erlide.runtime/META-INF/MANIFEST.MF
  11. +1 −1 plugins/org.erlide.tracing.core/META-INF/MANIFEST.MF
  12. +7 −3 plugins/org.erlide.ui/.classpath
  13. +1 −1 plugins/org.erlide.ui/META-INF/MANIFEST.MF
  14. +2 −1 plugins/org.erlide.ui/src/org/erlide/debug/ui/model/ErlBreakpointAdapterFactory.java
  15. +2 −1 plugins/org.erlide.ui/src/org/erlide/debug/ui/tracing/DummyProcess.java
  16. +6 −5 plugins/org.erlide.ui/src/org/erlide/ui/console/ConsolePageParticipant.java
  17. +2 −1 plugins/org.erlide.ui/src/org/erlide/ui/console/ErlangConsolePage.java
  18. +4 −3 plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/outline/ErlangOutlinePage.java
  19. +1 −0 plugins/org.erlide.ui/src/org/erlide/ui/internal/search/SearchUtil.java
  20. +2 −1 plugins/org.erlide.ui/src/org/erlide/ui/internal/util/CommandRunnerSelectionAdapter.java
  21. +2 −1 plugins/org.erlide.ui/src/org/erlide/ui/navigator/ErlangFileContentProvider.java
  22. +2 −1 plugins/org.erlide.ui/src/org/erlide/ui/navigator/actions/ErlangFileActionProvider.java
  23. +2 −1 plugins/org.erlide.ui/src/org/erlide/ui/util/EditorInputToModuleAdapterFactory.java
  24. +2 −1 plugins/org.erlide.ui/src/org/erlide/ui/views/TraceLogView.java
  25. +1 −1 plugins/org.erlide.util/META-INF/MANIFEST.MF
  26. +3 −1 plugins/org.erlide.util/src/org/erlide/util/erlang/OtpBindings.java
  27. +2 −1 plugins/org.erlide.util/src/org/erlide/util/services/ExtensionUtils.java
  28. +1 −0 plugins/org.erlide.util/src/org/erlide/util/services/ServiceLocator.java
  29. +1 −0 releng/org.erlide.site/category.xml
  30. +2 −1 releng/org.erlide.target/org.erlide.target.target
@@ -0,0 +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;
@@ -0,0 +1,4 @@
class org/eclipse/core/runtime/IAdapterFactory
getAdapter
<T:Ljava/lang/Object;>(Ljava/lang/Object;Ljava/lang/Class<TT;>;)TT;
<T:Ljava/lang/Object;>(Ljava/lang/Object;Ljava/lang/Class<T0T;>;)T0T;
@@ -4,7 +4,7 @@ Bundle-Name: JRugged
Bundle-SymbolicName: org.fishwife.jrugged
Bundle-ActivationPolicy: lazy
Bundle-Version: 3.2.2
Bundle-Vendor: Erlide project
Bundle-Vendor: fishwife.org
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: jrugged-core-3.2.2.jar,
jrugged-aspects-3.2.2.jar
@@ -38,4 +38,4 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-ExtensibleAPI: true
Bundle-Activator: org.erlide.backend.internal.BackendActivator
Import-Package: org.eclipse.jdt.annotation
Import-Package: org.eclipse.jdt.annotation;version="[2.0.0,3.0.0)";resolution:=optional
@@ -26,6 +26,7 @@
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.xtext.xbase.lib.Pair;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.erlide.backend.BackendCore;
@@ -220,7 +221,7 @@ private void addCodeBundle(final IExtension extension) {
final String dir = el.getAttribute("path");
final String t = el.getAttribute("context").toUpperCase();
final CodeContext type = Enum.valueOf(CodeContext.class, t);
final @Nullable CodeContext type = Enum.valueOf(CodeContext.class, t);
paths.put(type, dir);
} else if ("init".equals(el.getName())) {
final String module = el.getAttribute("module");
@@ -37,5 +37,5 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .
Eclipse-ExtensibleAPI: true
Import-Package: org.eclipse.jdt.annotation
Import-Package: org.eclipse.jdt.annotation;version="[2.0.0,3.0.0)";resolution:=optional
@@ -37,4 +37,4 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
com.ericsson.otp.jinterface;bundle-version="1.8.0"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.erlide.engine.ModelApiActivator
Import-Package: org.eclipse.jdt.annotation
Import-Package: org.eclipse.jdt.annotation;version="[2.0.0,3.0.0)";resolution:=optional
@@ -24,7 +24,7 @@ public FunctionRef(final OtpErlangObject 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 String f = bb.getAs("F", String.class);
final int a = bb.getAs("A", Integer.class);
module = m;
@@ -21,6 +21,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jdt.annotation.Nullable;
/**
* <p>
@@ -63,7 +64,7 @@ public static IResource findResource(final Object element) {
if (element instanceof IResource) {
result = (IResource) element;
} else if (element instanceof IAdaptable) {
final Object adapter = ((IAdaptable) element).getAdapter(IResource.class);
final @Nullable Object adapter = ((IAdaptable) element).getAdapter(IResource.class);
if (adapter instanceof IResource) {
result = (IResource) adapter;
}
@@ -5,14 +5,15 @@ Bundle-SymbolicName: org.erlide.runtime;singleton:=true
Bundle-Version: 0.53.0.qualifier
Bundle-Vendor: erlide.org
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.fishwife.jrugged,
Require-Bundle: org.fishwife.jrugged,
org.erlide.util,
com.google.guava;bundle-version="[15.0.0,16.0.0)",
org.eclipse.xtend.lib;bundle-version="2.11.0",
org.eclipse.xtend.lib.macro;bundle-version="2.11.0",
org.eclipse.xtext.xbase.lib;bundle-version="2.11.0",
javax.inject;bundle-version="1.0.0",
com.ericsson.otp.jinterface;bundle-version="1.8.0"
com.ericsson.otp.jinterface;bundle-version="1.8.0",
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)"
Export-Package: org.erlide.runtime,
org.erlide.runtime.api,
org.erlide.runtime.epmd,
@@ -24,4 +25,3 @@ Export-Package: org.erlide.runtime,
org.erlide.runtime.service,
org.erlide.runtime.shell
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.jdt.annotation
@@ -40,4 +40,4 @@ Export-Package: org.erlide.tracing.core;x-internal:=true,
org.erlide.tracing.core.ui.menu;x-internal:=true,
org.erlide.tracing.core.utils;x-internal:=true,
org.erlide.tracing.core.views;x-internal:=true
Import-Package: org.eclipse.jdt.annotation
Import-Package: org.eclipse.jdt.annotation;version="[2.0.0,3.0.0)";resolution:=optional
@@ -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>
@@ -110,5 +110,5 @@ Require-Bundle: org.eclipse.compare;bundle-version="3.5.202",
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-ExtensibleAPI: true
Import-Package: org.eclipse.jdt.annotation
Import-Package: org.eclipse.jdt.annotation;version="[2.0.0,3.0.0)";resolution:=optional
@@ -6,6 +6,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.jdt.annotation.Nullable;
import org.erlide.ui.editors.erl.AbstractErlangEditor;
import org.erlide.ui.editors.erl.ErlangEditor;
@@ -16,7 +17,7 @@
public class ErlBreakpointAdapterFactory implements IAdapterFactory {
@Override
public <T> T getAdapter(final Object adaptableObject, final Class<T> adapterType) {
public <@Nullable T> @Nullable T getAdapter(final Object adaptableObject, final Class<@Nullable T> adapterType) {
if (adaptableObject instanceof ErlangEditor) {
final AbstractErlangEditor editorPart = (AbstractErlangEditor) adaptableObject;
final IResource resource = editorPart.getEditorInput()
@@ -12,6 +12,7 @@
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamsProxy;
import org.eclipse.jdt.annotation.Nullable;
import org.erlide.util.ErlLogger;
public class DummyProcess implements IProcess {
@@ -53,7 +54,7 @@ public int getExitValue() throws DebugException {
}
@Override
public <T> T getAdapter(final Class<T> adapter) {
public <T> @Nullable T getAdapter(final Class<T> adapter) {
ErlLogger.debug("--> adapt as " + adapter.getName());
return null;
}
@@ -25,6 +25,7 @@
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
@@ -157,7 +158,7 @@ protected void configureToolBar(final IToolBarManager mgr) {
}
@Override
public <T> T getAdapter(final Class<T> required) {
public <T> @Nullable T getAdapter(final Class<T> required) {
if (IShowInSource.class.equals(required)) {
return required.cast(this);
}
@@ -227,9 +228,9 @@ protected IProcess getProcess() {
public void activated() {
// add EOF submissions
final IPageSite site = fPage.getSite();
final IHandlerService handlerService = site
final @Nullable IHandlerService handlerService = site
.getService(IHandlerService.class);
final IContextService contextService = site
final @Nullable IContextService contextService = site
.getService(IContextService.class);
fActivatedContext = contextService.activateContext(fContextId);
fActivatedHandler = handlerService
@@ -240,9 +241,9 @@ public void activated() {
public void deactivated() {
// remove EOF submissions
final IPageSite site = fPage.getSite();
final IHandlerService handlerService = site
final @Nullable IHandlerService handlerService = site
.getService(IHandlerService.class);
final IContextService contextService = site
final @Nullable IContextService contextService = site
.getService(IContextService.class);
handlerService.deactivateHandler(fActivatedHandler);
contextService.deactivateContext(fActivatedContext);
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -414,7 +415,7 @@ public void setFocus() {
}
@Override
public <T> T getAdapter(final Class<T> adapter) {
public <T> @Nullable T getAdapter(final Class<T> adapter) {
if (IFindReplaceTarget.class.equals(adapter)) {
return adapter.cast(consoleOutputViewer.getFindReplaceTarget());
}
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -209,7 +210,7 @@ public void createControl(final Composite parent) {
fOpenAndLinkWithEditorHelper = new OpenAndLinkWithEditorHelper(fOutlineViewer,
fEditor, site.getPage());
final IContextService service = site
final @Nullable IContextService service = site
.getService(IContextService.class);
service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");
@@ -238,7 +239,7 @@ public void menuAboutToShow(final IMenuManager m) {
fEditor.getAction(ITextEditorActionConstants.REDO));
fActionGroups.fillActionBars(actionBars);
registerToolbarActions(actionBars);
final IHandlerService handlerService = site
final @Nullable IHandlerService handlerService = site
.getService(IHandlerService.class);
handlerService.activateHandler(
IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR,
@@ -293,7 +294,7 @@ public String toString() {
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
*/
@Override
public <T> T getAdapter(final Class<T> adapter) {
public <T> @Nullable T getAdapter(final Class<T> adapter) {
if (adapter == IWorkbenchAdapter.class) {
return adapter.cast(this);
}
@@ -15,6 +15,7 @@
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;
@@ -1,5 +1,6 @@
package org.erlide.ui.internal.util;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.ui.IWorkbench;
@@ -17,7 +18,7 @@ public CommandRunnerSelectionAdapter(final String commandId) {
@Override
public void widgetSelected(final SelectionEvent e) {
final IWorkbench workbench = PlatformUI.getWorkbench();
final IHandlerService handlerService = workbench
final @Nullable IHandlerService handlerService = workbench
.getService(IHandlerService.class);
try {
handlerService.executeCommand(commandId, null);
@@ -14,6 +14,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -195,7 +196,7 @@ public void elementChanged(final IErlElement element) {
}
@Override
public <T> T getAdapter(final Class<T> adapter) {
public <T> @Nullable T getAdapter(final Class<T> adapter) {
if (SaveablesProvider.class.equals(adapter)) {
// TODO return something useful
return null;
@@ -1,5 +1,6 @@
package org.erlide.ui.navigator.actions;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchPartSite;
@@ -30,7 +31,7 @@ public void init(final ICommonActionExtensionSite aSite) {
openAction = new OpenErlangAction(aSite,
workbenchSite.getSelectionProvider());
searchActionGroup = new ErlangSearchActionGroup(site);
final IContextService service = site
final @Nullable IContextService service = site
.getService(IContextService.class);
service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");
}
@@ -2,6 +2,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ui.IEditorInput;
import org.erlide.engine.model.IErlElement;
@@ -11,7 +12,7 @@
private static final Class[] ADAPTER_LIST = new Class[] { IErlElement.class };
@Override
public <T> T getAdapter(final Object adaptableObject, final Class<T> adapterType) {
public <T> @Nullable T getAdapter(final Object adaptableObject, final Class<@Nullable T> adapterType) {
if (adapterType == IErlElement.class && adaptableObject instanceof IEditorInput) {
try {
return adapterType.cast(ErlModelUtils.getModule((IEditorInput) adaptableObject));
@@ -4,6 +4,7 @@
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -68,7 +69,7 @@ public String toString() {
}
@Override
public <T> T getAdapter(final Class<T> adapter) {
public <T> @Nullable T getAdapter(final Class<T> adapter) {
return null;
}
}
@@ -19,4 +19,4 @@ Export-Package: org.erlide.util,
org.erlide.util.erlang,
org.erlide.util.event_tracer,
org.erlide.util.services
Import-Package: org.eclipse.jdt.annotation
Import-Package: org.eclipse.jdt.annotation;version="[2.0.0,3.0.0)";resolution:=optional
@@ -16,6 +16,8 @@
import java.util.Map;
import java.util.Set;
import org.eclipse.jdt.annotation.Nullable;
import com.ericsson.otp.erlang.OtpErlangAtom;
import com.ericsson.otp.erlang.OtpErlangBinary;
import com.ericsson.otp.erlang.OtpErlangException;
@@ -110,7 +112,7 @@ public OtpErlangPid getPid(final String name) throws OtpErlangException {
}
@SuppressWarnings("unchecked")
public <T> T getAs(final String name, final Class<T> cls) throws SignatureException {
public <@Nullable T> T getAs(final String name, final Class<T> cls) throws SignatureException {
final OtpErlangObject v = get(name);
return (T) TypeConverter.erlang2java(v, cls);
}
@@ -14,6 +14,7 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.jdt.annotation.Nullable;
import org.erlide.util.ErlLogger;
import com.google.common.collect.Lists;
@@ -24,7 +25,7 @@
* Get an executable extension that has only one implementor. We do no hard
* checks, but take the first one.
*/
public static <T> T getSingletonExtension(final String id,
public static <@Nullable T> T getSingletonExtension(final String id,
final Class<? extends T> clazz) {
final IExtensionRegistry reg = RegistryFactory.getRegistry();
final IConfigurationElement[] elements = reg.getConfigurationElementsFor(id);
@@ -3,6 +3,7 @@
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 {
Oops, something went wrong.

0 comments on commit 8fcf1cc

Please sign in to comment.