diff options
author | Andrey Loskutov | 2015-03-09 19:23:20 +0000 |
---|---|---|
committer | Andrey Loskutov | 2015-04-05 17:51:01 +0000 |
commit | a3e42cdeb580b83d3169e438c16b6b35f53c5ad6 (patch) | |
tree | 00692d04b4f063e05873ae299335f35f9d8f8922 | |
parent | a3be75937963bec7bc94b74a4a065259548961ec (diff) | |
download | eclipse.platform.runtime-a3e42cdeb580b83d3169e438c16b6b35f53c5ad6.tar.gz eclipse.platform.runtime-a3e42cdeb580b83d3169e438c16b6b35f53c5ad6.tar.xz eclipse.platform.runtime-a3e42cdeb580b83d3169e438c16b6b35f53c5ad6.zip |
Bug 460048 - Move platform runtime plugins to Java 1.7 BREE -
org.eclipse.e4.core.di.extensions part 2
Fixed all new compiler warnings (override).
Change-Id: I4628e824efb848d569b799cec6841a269cff0d87
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
10 files changed, 70 insertions, 11 deletions
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java index 3dfecec74..fc782c6f3 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,6 +39,7 @@ public abstract class ContextFunction implements IContextFunction { /** * {@inheritDoc} */ + @Override public Object compute(IEclipseContext context, String contextKey) { // call into now-deprecated method to maintain backwards compatibility return compute(context); diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/Computation.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/Computation.java index 4a8d9b6b2..80a09d512 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/Computation.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/Computation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,6 +17,7 @@ abstract public class Computation { abstract protected int calcHashCode(); + @Override abstract public boolean equals(Object obj); /* final */protected int hashCode; diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextChangeEvent.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextChangeEvent.java index 387f1003a..4d7fae3a7 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextChangeEvent.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextChangeEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -138,6 +138,7 @@ public final class ContextChangeEvent { return oldValue; } + @Override public int hashCode() { final int prime = 31; int result = 1; @@ -148,6 +149,7 @@ public final class ContextChangeEvent { return result; } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -175,4 +177,4 @@ public final class ContextChangeEvent { return true; } -}
\ No newline at end of file +} diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextObjectSupplier.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextObjectSupplier.java index 0734f2334..a11eec9d6 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextObjectSupplier.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ContextObjectSupplier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2014 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -46,12 +46,14 @@ public class ContextObjectSupplier extends PrimaryObjectSupplier { this.context = context; } + @Override public Reference<Object> getReference() { if (requestor instanceof Requestor) return ((Requestor<?>) requestor).getReference(); return super.getReference(); } + @Override public boolean update(IEclipseContext eventsContext, int eventType, Object[] extraArguments) { if (eventType == ContextChangeEvent.INITIAL) { // needs to be done inside runnable to establish dependencies @@ -90,6 +92,7 @@ public class ContextObjectSupplier extends PrimaryObjectSupplier { return true; } + @Override public boolean changed(IEclipseContext eventsContext) { return true; } @@ -213,11 +216,13 @@ public class ContextObjectSupplier extends PrimaryObjectSupplier { return null; } + @Override synchronized public void pauseRecording() { Stack<Computation> current = EclipseContext.getCalculatedComputations(); current.push(null); } + @Override synchronized public void resumeRecording() { Stack<Computation> current = EclipseContext.getCalculatedComputations(); Computation plug = current.pop(); @@ -237,6 +242,7 @@ public class ContextObjectSupplier extends PrimaryObjectSupplier { return objectSupplier; } + @Override public WeakReference<Object> makeReference(Object object) { if (context instanceof EclipseContext) { return ((EclipseContext) context).trackedWeakReference(object); diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java index 34a5619c5..b49debb7f 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -56,10 +56,12 @@ public class EclipseContext implements IEclipseContext { this.event = event; } + @Override public int hashCode() { return 31 * (31 + event.hashCode()) + runnable.hashCode(); } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -133,6 +135,7 @@ public class EclipseContext implements IEclipseContext { return result; } + @Override public boolean containsKey(String name) { trackAccess(name); return containsKey(name, false); @@ -149,6 +152,7 @@ public class EclipseContext implements IEclipseContext { return false; } + @Override public void dispose() { // dispose of child contexts first for (EclipseContext childContext : getChildren()) { @@ -203,11 +207,13 @@ public class EclipseContext implements IEclipseContext { debugAddOn.notify(this, IEclipseContextDebugger.EventType.DISPOSED, null); } + @Override public Object get(String name) { trackAccess(name); return internalGet(this, name, false); } + @Override public Object getLocal(String name) { trackAccess(name); return internalGet(this, name, true); @@ -299,6 +305,7 @@ public class EclipseContext implements IEclipseContext { return localValues.containsKey(name); } + @Override public void remove(String name) { if (isSetLocally(name)) { Object oldValue = localValues.remove(name); @@ -308,6 +315,7 @@ public class EclipseContext implements IEclipseContext { } } + @Override public void runAndTrack(final RunAndTrack runnable) { TrackableComputationExt computation = new TrackableComputationExt(runnable, this); ContextChangeEvent event = new ContextChangeEvent(this, ContextChangeEvent.INITIAL, null, null, null); @@ -334,6 +342,7 @@ public class EclipseContext implements IEclipseContext { } } + @Override public void set(String name, Object value) { if (PARENT.equals(name)) { setParent((IEclipseContext) value); @@ -360,6 +369,7 @@ public class EclipseContext implements IEclipseContext { } } + @Override public void modify(String name, Object value) { Set<Scheduled> scheduled = new LinkedHashSet<Scheduled>(); if (!internalModify(name, value, scheduled)) @@ -386,10 +396,12 @@ public class EclipseContext implements IEclipseContext { return false; } + @Override public EclipseContext getParent() { return (EclipseContext) localValues.get(PARENT); } + @Override public void setParent(IEclipseContext parent) { EclipseContext parentContext = (EclipseContext) localValues.get(PARENT); if (parent == parentContext) @@ -408,6 +420,7 @@ public class EclipseContext implements IEclipseContext { /** * Returns a string representation of this context for debugging purposes only. */ + @Override public String toString() { Object debugString = localValues.get(DEBUG_STRING); return debugString instanceof String ? ((String) debugString) : "Anonymous Context"; //$NON-NLS-1$ @@ -427,6 +440,7 @@ public class EclipseContext implements IEclipseContext { weakListeners.add(name, computation); } + @Override public void declareModifiable(String name) { if (name == null) return; @@ -499,6 +513,7 @@ public class EclipseContext implements IEclipseContext { } } + @Override public void processWaiting() { // traverse to the root node EclipseContext parent = getParent(); @@ -562,38 +577,47 @@ public class EclipseContext implements IEclipseContext { } } + @Override public <T> T get(Class<T> clazz) { return clazz.cast(get(clazz.getName())); } + @Override public boolean containsKey(Class<?> clazz) { return containsKey(clazz.getName()); } + @Override public <T> void set(Class<T> clazz, T value) { set(clazz.getName(), value); } + @Override public void remove(Class<?> clazz) { remove(clazz.getName()); } + @Override public <T> T getLocal(Class<T> clazz) { return clazz.cast(getLocal(clazz.getName())); } + @Override public <T> void modify(Class<T> clazz, T value) { modify(clazz.getName(), value); } + @Override public void declareModifiable(Class<?> clazz) { declareModifiable(clazz.getName()); } + @Override public IEclipseContext createChild() { return new EclipseContext(this); // strategies are not inherited } + @Override public IEclipseContext createChild(String name) { IEclipseContext result = createChild(); result.set(DEBUG_STRING, name); @@ -606,11 +630,13 @@ public class EclipseContext implements IEclipseContext { } } + @Override public IEclipseContext getActiveChild() { trackAccess(ACTIVE_CHILD); return (EclipseContext) internalGet(this, ACTIVE_CHILD, true); } + @Override public IEclipseContext getActiveLeaf() { IEclipseContext activeContext = this; IEclipseContext child = getActiveChild(); @@ -621,6 +647,7 @@ public class EclipseContext implements IEclipseContext { return activeContext; } + @Override public void activate() { EclipseContext parent = getParent(); if (parent == null) @@ -630,12 +657,14 @@ public class EclipseContext implements IEclipseContext { parent.set(ACTIVE_CHILD, this); } + @Override public void activateBranch() { for (IEclipseContext i = this; i != null; i = i.getParent()) { i.activate(); } } + @Override public void deactivate() { EclipseContext parent = getParent(); if (parent == null) @@ -722,10 +751,12 @@ public class EclipseContext implements IEclipseContext { return null; } + @Override public <T> T getActive(Class<T> clazz) { return clazz.cast(getActive(clazz.getName())); } + @Override public Object getActive(final String name) { return getActiveLeaf().get(name); } diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/TrackableComputationExt.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/TrackableComputationExt.java index 38278d77e..e7349f70e 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/TrackableComputationExt.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/TrackableComputationExt.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,10 +29,12 @@ public class TrackableComputationExt extends Computation { init(); } + @Override public int hashCode() { return hashCode; } + @Override protected int calcHashCode() { final int prime = 31; int result = 1; @@ -41,6 +43,7 @@ public class TrackableComputationExt extends Computation { return result; } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -62,6 +65,7 @@ public class TrackableComputationExt extends Computation { return true; } + @Override public void handleInvalid(ContextChangeEvent event, Set<Scheduled> scheduledList) { // don't call super - we keep the link unless uninjected / disposed int eventType = event.getEventType(); @@ -127,6 +131,7 @@ public class TrackableComputationExt extends Computation { return result; } + @Override public String toString() { return runnable.toString(); } diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java index 010293ea1..1c04bbad8 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,6 +35,7 @@ public class ValueComputation extends Computation { init(); } + @Override public void handleInvalid(ContextChangeEvent event, Set<Scheduled> scheduled) { if (cachedValue == NotAValue) // already invalidated return; @@ -66,12 +67,14 @@ public class ValueComputation extends Computation { return cachedValue; } + @Override public String toString() { if (function == null) return super.toString(); return function.toString(); } + @Override protected int calcHashCode() { final int prime = 31; int result = 1; @@ -108,6 +111,7 @@ public class ValueComputation extends Computation { return true; } + @Override public boolean isValid() { return valid; } diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/WeakGroupedListenerList.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/WeakGroupedListenerList.java index cd654acc3..f9bd0718a 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/WeakGroupedListenerList.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/WeakGroupedListenerList.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2012 IBM Corporation and others.
+ * Copyright (c) 2012, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,10 +35,12 @@ public class WeakGroupedListenerList { hashCode = computation.hashCode();
}
+ @Override
public int hashCode() {
return hashCode;
}
+ @Override
public boolean equals(Object obj) {
if (obj == null)
return false;
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/osgi/ContextsActivator.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/osgi/ContextsActivator.java index 55d4f0b53..76d18214d 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/osgi/ContextsActivator.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/osgi/ContextsActivator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. + * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,10 +29,12 @@ public class ContextsActivator implements BundleActivator { return defaultInstance; } + @Override public void start(BundleContext context) throws Exception { bundleContext = context; } + @Override public void stop(BundleContext context) throws Exception { if (debugTracker != null) { debugTracker.close(); diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/osgi/EclipseContextOSGi.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/osgi/EclipseContextOSGi.java index a676f8a58..b8d3a4c9c 100644 --- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/osgi/EclipseContextOSGi.java +++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/osgi/EclipseContextOSGi.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -54,6 +54,7 @@ public class EclipseContextOSGi extends EclipseContext implements ServiceListene this.bundleContext.addBundleListener(this);
}
+ @Override
public boolean containsKey(String name, boolean localOnly) {
if (super.containsKey(name, localOnly))
return true;
@@ -61,6 +62,7 @@ public class EclipseContextOSGi extends EclipseContext implements ServiceListene return (result != null);
}
+ @Override
public Object lookup(String name, EclipseContext originatingContext) {
if (name == null)
return null;
@@ -92,6 +94,7 @@ public class EclipseContextOSGi extends EclipseContext implements ServiceListene return ((String[]) reference.getProperty(Constants.OBJECTCLASS))[0];
}
+ @Override
public void dispose() {
for (ServiceReference<?> ref : refs.values()) {
if (ref != null)
@@ -103,6 +106,7 @@ public class EclipseContextOSGi extends EclipseContext implements ServiceListene super.dispose();
}
+ @Override
public void serviceChanged(ServiceEvent event) {
ServiceReference<?> ref = event.getServiceReference();
String name = serviceName(ref);
@@ -124,6 +128,7 @@ public class EclipseContextOSGi extends EclipseContext implements ServiceListene }
}
+ @Override
public void bundleChanged(BundleEvent event) {
// In case OSGi context has not being properly disposed by the application,
// OSGi framework shutdown will trigged uninjection of all consumed OSGi
|