Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-04-19 08:33:13 +0000
committerAlexander Kurtakov2018-04-19 08:33:13 +0000
commit1758c0406515180cd91f57cc9c09117537c6d103 (patch)
tree12c5ffa7efac9e5a1040c3b6e338031435e30255
parentb2261b0dc9f7d491a636626fa892e99f064899ff (diff)
downloadrt.equinox.bundles-1758c0406515180cd91f57cc9c09117537c6d103.tar.gz
rt.equinox.bundles-1758c0406515180cd91f57cc9c09117537c6d103.tar.xz
rt.equinox.bundles-1758c0406515180cd91f57cc9c09117537c6d103.zip
Clean up and generify the code. The old code was making wild mid of ServiceReference and the service itself - passing them as parameters interchangeably. I can't imaging how this ever worked so I think the code is actually not used at all. Change-Id: Ib0b5d336dddafdd305e26804973838dbbb6e57a3 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.core.prefs64
-rw-r--r--bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.ui.prefs14
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java22
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/event/EventThread.java26
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashIntObjS.java7
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashLongObjS.java7
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjIntS.java7
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjLongS.java7
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/ServiceFactoryImpl.java14
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor.java7
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Job.java3
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolFactoryImpl.java13
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolManagerImpl.java16
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerFactory.java11
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java20
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerQueueNode.java5
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/pool/ObjectPool.java8
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java46
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedAction.java47
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedRunner.java12
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/SecurityUtil.java35
-rw-r--r--bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/timer/Timer.java4
22 files changed, 238 insertions, 157 deletions
diff --git a/bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.core.prefs
index c79ad8a4b..de29e4c47 100644
--- a/bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.core.prefs
@@ -6,7 +6,17 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
@@ -15,20 +25,27 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
@@ -36,40 +53,79 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
diff --git a/bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.ui.prefs
index 023a27a64..3948d685d 100644
--- a/bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.equinox.util/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,3 @@
-#Tue Aug 21 11:19:11 CDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_core
@@ -11,23 +10,29 @@ sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
@@ -35,6 +40,7 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
@@ -48,8 +54,10 @@ sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java
index b48c68834..a744d8cf1 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/UtilActivator.java
@@ -35,10 +35,10 @@ import org.osgi.framework.*;
public class UtilActivator implements BundleActivator {
public static ThreadPoolFactoryImpl thMan;
- private ServiceRegistration thManReg;
+ private ServiceRegistration<?> thManReg;
public static TimerFactory timer;
- private ServiceRegistration timerReg;
+ private ServiceRegistration<Timer> timerReg;
public static Log log;
public static int debugLevel = 1;
public static BundleContext bc;
@@ -60,7 +60,7 @@ public class UtilActivator implements BundleActivator {
* timer services. Also adds the framework and system pluggable commands to
* the parser service pluggable commands.
*
- * @param bc
+ * @param context
* The execution context of the bundle being started.
* @exception BundleException
* If this method throws an exception, the bundle is marked
@@ -68,8 +68,9 @@ public class UtilActivator implements BundleActivator {
* listeners, unregister all service's registered by the
* bundle, release all services used by the bundle.
*/
- public void start(BundleContext bc) throws BundleException {
- UtilActivator.bc = bc;
+ @Override
+ public void start(BundleContext context) throws BundleException {
+ UtilActivator.bc = context;
startup = getBoolean("equinox.measurements.bundles");
if (startup) {
long tmp = System.currentTimeMillis();
@@ -77,9 +78,9 @@ public class UtilActivator implements BundleActivator {
points = new long[3];
}
- UtilActivator.bc = bc;
+ UtilActivator.bc = context;
try {
- log = new Log(bc, false);
+ log = new Log(context, false);
LOG_DEBUG = getBoolean("equinox.putil.debug");
log.setDebug(LOG_DEBUG);
log.setPrintOnConsole(getBoolean("equinox.putil.console"));
@@ -104,12 +105,12 @@ public class UtilActivator implements BundleActivator {
log.debug(0, 2001, String.valueOf(time[0] - time[1]), null, false, true);
}
- String bundleName = ServiceFactoryImpl.getName(bc.getBundle());
+ String bundleName = ServiceFactoryImpl.getName(context.getBundle());
thMan = new ThreadPoolFactoryImpl(bundleName, log);
if (startup)
timeLog(3); /* 3 = "Creating Thread Pool service took " */
- thManReg = bc.registerService(new String[] {ThreadPoolManager.class.getName(), ThreadPoolFactory.class.getName()}, thMan, null);
+ thManReg = context.registerService(new String[] {ThreadPoolManager.class.getName(), ThreadPoolFactory.class.getName()}, thMan, null);
if (startup)
timeLog(4); /* 4 = "Registering Thread Pool service took " */
@@ -118,7 +119,7 @@ public class UtilActivator implements BundleActivator {
timeLog(33); /* 33 = "Creating Timer service took " */
int i = getInteger("equinox.util.threadpool.inactiveTime", 30);
- timerReg = bc.registerService(Timer.class.getName(), timer, null);
+ timerReg = context.registerService(Timer.class, timer, null);
timer.addNotifyListener(ThreadPoolFactoryImpl.threadPool, Thread.NORM_PRIORITY, Timer.PERIODICAL_TIMER, (i * 1000L), 0);
TimerRef.timer = timer;
@@ -156,6 +157,7 @@ public class UtilActivator implements BundleActivator {
* bundle's listeners, unregister all service's registered by
* the bundle, release all service's used by the bundle.
*/
+ @Override
public void stop(BundleContext bc) throws BundleException {
try {
thManReg.unregister();
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/event/EventThread.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/event/EventThread.java
index ffbd7cadb..fa8e18d05 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/event/EventThread.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/event/EventThread.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -162,6 +162,7 @@ public abstract class EventThread implements Runnable {
* Processes the event queue. Sets the event to be dispathed in the
* <code> element </code> field and calls <cope> processEvent </code>
*/
+ @Override
public void run() {
synchronized (queue) {
queue.notifyAll();
@@ -193,13 +194,13 @@ public abstract class EventThread implements Runnable {
}
}
- private void makeThread(ThreadGroup group, String name) {
+ private void makeThread(ThreadGroup threadGroup, String threadName) {
try {
if (privilegedAction == null) {
privilegedAction = new PrivilegedActionImpl();
}
- privilegedAction.set(group, this, name);
- thread = (Thread) AccessController.doPrivileged(privilegedAction);
+ privilegedAction.set(threadGroup, this, threadName);
+ thread = AccessController.doPrivileged(privilegedAction);
// thread = new Thread(group, this, name);
// thread.setDaemon(false);
// if (!disableContextClassLoader)
@@ -223,7 +224,7 @@ public abstract class EventThread implements Runnable {
* Returns the desired thread priority. Called in the constructors of the
* class in order to set the returned value to the thread.
*
- * @return
+ * @return priority of the thread
*/
public abstract int getThreadPriority();
@@ -261,7 +262,7 @@ public abstract class EventThread implements Runnable {
public abstract void print(Throwable t);
}
-class PrivilegedActionImpl implements PrivilegedAction {
+class PrivilegedActionImpl implements PrivilegedAction<Thread> {
private ThreadGroup group;
private Runnable runnable;
private String name;
@@ -276,13 +277,14 @@ class PrivilegedActionImpl implements PrivilegedAction {
this.name = name;
}
- public Object run() {
- ThreadGroup group = this.group;
- Runnable runnable = this.runnable;
- String name = this.name;
+ @Override
+ public Thread run() {
+ ThreadGroup group1 = this.group;
+ Runnable runnable1 = this.runnable;
+ String name1 = this.name;
unlock();
- Thread th = new Thread(group, runnable, name);
- if (!UtilActivator.getBoolean("equinox.disableContextClassLoader"))
+ Thread th = new Thread(group1, runnable1, name1);
+ if (!UtilActivator.getBoolean("equinox.disableContextClassLoader")) //$NON-NLS-1$
th.setContextClassLoader(null);
th.setDaemon(false);
return th;
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashIntObjS.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashIntObjS.java
index 2ac35ae12..a7ba64e5e 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashIntObjS.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashIntObjS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -32,22 +32,27 @@ public final class HashIntObjS extends HashIntObjNS {
super(capacity, lf);
}
+ @Override
public synchronized void put(int key, Object value) {
super.put(key, value);
}
+ @Override
public synchronized Object get(int key) {
return super.get(key);
}
+ @Override
public synchronized Object remove(int key) {
return super.remove(key);
}
+ @Override
public synchronized int size() {
return super.size();
}
+ @Override
public synchronized void removeAll() {
super.removeAll();
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashLongObjS.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashLongObjS.java
index dbc299a2a..ec1a859ac 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashLongObjS.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashLongObjS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -32,22 +32,27 @@ public final class HashLongObjS extends HashLongObjNS {
super(capacity, lf);
}
+ @Override
public synchronized void put(long key, Object value) {
super.put(key, value);
}
+ @Override
public synchronized Object get(long key) {
return super.get(key);
}
+ @Override
public synchronized Object remove(long key) {
return super.remove(key);
}
+ @Override
public synchronized int size() {
return super.size();
}
+ @Override
public synchronized void removeAll() {
super.removeAll();
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjIntS.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjIntS.java
index 529dbe4b7..c732f9bce 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjIntS.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjIntS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -32,22 +32,27 @@ public final class HashObjIntS extends HashObjIntNS {
super(capacity, lf);
}
+ @Override
public synchronized void put(Object key, int value) {
super.put(key, value);
}
+ @Override
public synchronized int get(Object key) {
return super.get(key);
}
+ @Override
public synchronized int remove(Object key) {
return super.remove(key);
}
+ @Override
public synchronized int size() {
return super.size();
}
+ @Override
public synchronized void removeAll() {
super.removeAll();
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjLongS.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjLongS.java
index 85c1f091e..530bc9b21 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjLongS.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/hash/HashObjLongS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -32,22 +32,27 @@ public final class HashObjLongS extends HashObjLongNS {
super(capacity, lf);
}
+ @Override
public synchronized void put(Object key, long value) {
super.put(key, value);
}
+ @Override
public synchronized long get(Object key) {
return super.get(key);
}
+ @Override
public synchronized long remove(Object key) {
return super.remove(key);
}
+ @Override
public synchronized int size() {
return super.size();
}
+ @Override
public synchronized void removeAll() {
super.removeAll();
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/ServiceFactoryImpl.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/ServiceFactoryImpl.java
index 9a705ead1..7051bb676 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/ServiceFactoryImpl.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/ServiceFactoryImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -21,7 +21,7 @@ import org.osgi.framework.*;
* @version 1.0
*/
-public abstract class ServiceFactoryImpl implements ServiceFactory {
+public abstract class ServiceFactoryImpl<T> implements ServiceFactory<T> {
public String bundleName;
public static Log log;
@@ -58,12 +58,13 @@ public abstract class ServiceFactoryImpl implements ServiceFactory {
this.bundleName = bundleName;
}
- public Object getService(Bundle caller, ServiceRegistration sReg) {
+ @Override
+ public T getService(Bundle caller, ServiceRegistration<T> sReg) {
return getInstance(useNames ? getName(caller) : null);
}
public static String getName(Bundle caller) {
- StringBuffer bf = new StringBuffer(13);
+ StringBuilder bf = new StringBuilder(13);
bf.append(" (Bundle ");
bf.append(caller.getBundleId());
bf.append(')');
@@ -79,8 +80,9 @@ public abstract class ServiceFactoryImpl implements ServiceFactory {
* @param service
* object that is released
*/
- public void ungetService(Bundle caller, ServiceRegistration sReg, Object service) {
+ @Override
+ public void ungetService(Bundle caller, ServiceRegistration<T> sReg, T service) {
}
- public abstract Object getInstance(String bundleName);
+ public abstract T getInstance(String bundleName);
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor.java
index 2f6cb2ed2..72c517e6d 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -53,6 +53,7 @@ public class Executor extends Thread implements ThreadContext {
notify();
}
+ @Override
public void run() {
while (!terminated) {
if (job != null) {
@@ -129,6 +130,7 @@ public class Executor extends Thread implements ThreadContext {
start();
}
+ @Override
public Runnable getRunnable() {
return job;
}
@@ -140,10 +142,11 @@ public class Executor extends Thread implements ThreadContext {
}
}
-class PEA implements PrivilegedAction {
+class PEA implements PrivilegedAction<Object> {
Runnable job;
+ @Override
public Object run() {
job.run();
return null;
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Job.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Job.java
index 7aea046c8..1b6280314 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Job.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/Job.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -41,6 +41,7 @@ class Job implements ObjectCreator {
this.acc = acc;
}
+ @Override
public Object getInstance() {
return new Job();
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolFactoryImpl.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolFactoryImpl.java
index a7c15a998..669e35553 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolFactoryImpl.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolFactoryImpl.java
@@ -25,7 +25,7 @@ import org.eclipse.equinox.internal.util.threadpool.ThreadPoolManager;
* @version 1.0
*/
-public class ThreadPoolFactoryImpl extends ServiceFactoryImpl implements ThreadPoolManager, ThreadPoolFactory {
+public class ThreadPoolFactoryImpl extends ServiceFactoryImpl<ThreadPoolFactory> implements ThreadPoolManager, ThreadPoolFactory {
public static ThreadPoolManagerImpl threadPool;
private int limit;
@@ -56,7 +56,8 @@ public class ThreadPoolFactoryImpl extends ServiceFactoryImpl implements ThreadP
this(bundleName, (ThreadPoolManagerImpl.tMaximum * defaultPercent) / 100);
}
- public Object getInstance(String bundleName) {
+ @Override
+ public ThreadPoolFactory getInstance(String bundleName) {
if (threadPool == null)
throw new RuntimeException("ServiceFactory is currently off!");
return new ThreadPoolFactoryImpl(bundleName);
@@ -68,6 +69,7 @@ public class ThreadPoolFactoryImpl extends ServiceFactoryImpl implements ThreadP
tmp.clear();
}
+ @Override
public ThreadPoolManager getThreadPool(int size, boolean sizeIsInPercents) {
if (threadPool == null)
throw new RuntimeException("[ThreadPool] ThreadPool is inaccessible");
@@ -81,6 +83,7 @@ public class ThreadPoolFactoryImpl extends ServiceFactoryImpl implements ThreadP
return new ThreadPoolFactoryImpl(bundleName, size);
}
+ @Override
public void execute(Runnable job, String name) {
execute(job, Thread.NORM_PRIORITY, name);
}
@@ -117,11 +120,10 @@ public class ThreadPoolFactoryImpl extends ServiceFactoryImpl implements ThreadP
}
public void execute(Runnable job, int priority, String name, AccessControlContext acc) {
- execute0(job, priority, name, acc
-
- );
+ execute0(job, priority, name, acc);
}
+ @Override
public void execute(Runnable job, int priority, String name) {
execute0(job, priority, name, (Log.security() ? AccessController.getContext() : null));
}
@@ -154,6 +156,7 @@ public class ThreadPoolFactoryImpl extends ServiceFactoryImpl implements ThreadP
}
}
+ @Override
public void reset() {
if (threadPool != null) {
threadPool.reset();
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolManagerImpl.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolManagerImpl.java
index 08d1eca84..0f89ba9e4 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolManagerImpl.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolManagerImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2009 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -23,7 +23,7 @@ import org.eclipse.equinox.internal.util.timer.TimerListener;
* @version 1.0
*/
-public class ThreadPoolManagerImpl extends ObjectPool implements TimerListener, PrivilegedAction {
+public class ThreadPoolManagerImpl extends ObjectPool implements TimerListener, PrivilegedAction<Executor> {
static ThreadPoolManagerImpl threadPool = null;
@@ -54,7 +54,7 @@ public class ThreadPoolManagerImpl extends ObjectPool implements TimerListener,
private static boolean autoMax;
private ThreadPoolManagerImpl(int i, int j, int m) {
- super((Class) null, i, j, m);
+ super((Class<?>) null, i, j, m);
tMaximum = i * j;
ignoreMax = UtilActivator.getBoolean(pIgnoreMax);
autoMax = UtilActivator.getBoolean(pAutoMaximum);
@@ -75,11 +75,13 @@ public class ThreadPoolManagerImpl extends ObjectPool implements TimerListener,
return threadPool;
}
+ @Override
public void clear() {
shrink(-1);
threadPool = null;
}
+ @Override
public Object getInstance() throws Exception {
if (ServiceFactoryImpl.privileged()) {
return AccessController.doPrivileged(this);
@@ -88,10 +90,12 @@ public class ThreadPoolManagerImpl extends ObjectPool implements TimerListener,
return new Executor();
}
- public Object run() {
+ @Override
+ public Executor run() {
return new Executor();
}
+ @Override
public Object getObject() {
try {
return super.getObject();
@@ -116,6 +120,7 @@ public class ThreadPoolManagerImpl extends ObjectPool implements TimerListener,
return null;
}
+ @Override
protected void shrink(int count) {
synchronized (getSyncMonitor()) {
dontExtend = true;
@@ -130,11 +135,13 @@ public class ThreadPoolManagerImpl extends ObjectPool implements TimerListener,
}
}
+ @Override
public void shrink() {
shrink(minimumFill - 1);
dontExtend = false;
}
+ @Override
public boolean releaseObject(Object obj) {
Job tmp = null;
Executor x = (Executor) obj;
@@ -164,6 +171,7 @@ public class ThreadPoolManagerImpl extends ObjectPool implements TimerListener,
return true;
}
+ @Override
public void timer(int event) {
int count = 0;
int all = 0;
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerFactory.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerFactory.java
index dcd710aa0..96ca4a397 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerFactory.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerFactory.java
@@ -23,7 +23,7 @@ import org.eclipse.equinox.internal.util.timer.TimerListener;
* @version 1.0
*/
-public class TimerFactory extends ServiceFactoryImpl implements Timer {
+public class TimerFactory extends ServiceFactoryImpl<Timer> implements Timer {
private static TimerImpl timer;
public TimerFactory(String bundleName, ThreadPoolFactoryImpl factory, Log log) {
@@ -36,32 +36,38 @@ public class TimerFactory extends ServiceFactoryImpl implements Timer {
super(bundleName);
}
- public Object getInstance(String bundleName) {
+ @Override
+ public Timer getInstance(String bundleName) {
if (timer == null)
throw new RuntimeException("ServiceFactory is currently off!");
return new TimerFactory(bundleName);
}
+ @Override
@Deprecated
public void notifyAfterMillis(TimerListener listener, long timePeriod, int event) throws IllegalArgumentException {
addNotifyListener(listener, Thread.NORM_PRIORITY, Timer.ONE_SHOT_TIMER, timePeriod, event);
}
+ @Override
@Deprecated
public void notifyAfterMillis(TimerListener listener, int priority, long timePeriod, int event) throws IllegalArgumentException {
addNotifyListener(listener, priority, Timer.ONE_SHOT_TIMER, timePeriod, event);
}
+ @Override
@Deprecated
public void notifyAfter(TimerListener listener, int timePeriod, int event) throws IllegalArgumentException {
addNotifyListener(listener, Thread.NORM_PRIORITY, Timer.ONE_SHOT_TIMER, timePeriod * 1000, event);
}
+ @Override
@Deprecated
public void notifyAfter(TimerListener listener, int priority, int timePeriod, int event) throws IllegalArgumentException {
addNotifyListener(listener, priority, Timer.ONE_SHOT_TIMER, timePeriod * 1000, event);
}
+ @Override
public void addNotifyListener(TimerListener listener, int priority, int timerType, long periodMilis, int event) {
TimerImpl tmp = timer;
if (tmp == null)
@@ -76,6 +82,7 @@ public class TimerFactory extends ServiceFactoryImpl implements Timer {
}
}
+ @Override
public void removeListener(TimerListener listener, int event) {
TimerImpl tmp = timer;
if (tmp == null)
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java
index 839912d4b..be2079e90 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -30,7 +30,7 @@ import org.eclipse.equinox.internal.util.timer.TimerListener;
public class TimerImpl implements Runnable {
- static Hashtable nodes;
+ static Hashtable<TimerQueueNode, TimerQueueNode> nodes;
static ObjectPool nodePool;
static ThreadPoolFactoryImpl threadPool;
@@ -43,7 +43,7 @@ public class TimerImpl implements Runnable {
public TimerImpl(ThreadPoolFactoryImpl threadPool) {
nodePool = new ObjectPool(new TimerQueueNode(), 2, 4, 2);
TimerImpl.threadPool = threadPool;
- nodes = new Hashtable(10);
+ nodes = new Hashtable<>(10);
queue = new TimerQueue();
try {
th = ((ServiceFactoryImpl.privileged()) ? getOne() : new Thread(this, "[Timer] - Main Queue Handler"));
@@ -59,6 +59,7 @@ public class TimerImpl implements Runnable {
}
}
+ @Override
public void run() {
TimerQueueNode n = null;
while (!terminated) {
@@ -153,7 +154,7 @@ public class TimerImpl implements Runnable {
continue;
}
}
- }// while (!terminated)
+ } // while (!terminated)
nodePool.clear();
nodePool = null;
nodes.clear();
@@ -179,7 +180,7 @@ public class TimerImpl implements Runnable {
TimerQueueNode n = (TimerQueueNode) nodePool.getObject();
n.setEvent(listener, priority, timerType, System.currentTimeMillis() + periodMilis, periodMilis, event, name, acc);
- TimerQueueNode tmp = (TimerQueueNode) nodes.remove(n);
+ TimerQueueNode tmp = nodes.remove(n);
if (tmp != null) {
synchronized (queue) {
queue.removeTimerNode(tmp);
@@ -222,7 +223,7 @@ public class TimerImpl implements Runnable {
public void removeListener(TimerListener listener, int event) {
TimerQueueNode rmTmp = (TimerQueueNode) nodePool.getObject();
rmTmp.setEvent(listener, 0, 0, 0, 0, event, null, null);
- TimerQueueNode old = (TimerQueueNode) nodes.remove(rmTmp);
+ TimerQueueNode old = nodes.remove(rmTmp);
if (old != null) {
synchronized (queue) {
queue.removeTimerNode(old);
@@ -232,7 +233,7 @@ public class TimerImpl implements Runnable {
rmTmp.returnInPool();
}
- private class PrivilegedActionImpl implements PrivilegedAction {
+ private class PrivilegedActionImpl implements PrivilegedAction<Thread> {
private Runnable runnable = null;
private boolean locked = false;
private boolean waiting = false;
@@ -253,7 +254,8 @@ public class TimerImpl implements Runnable {
this.runnable = runnable;
}
- public Object run() {
+ @Override
+ public Thread run() {
Runnable runnableLocal = null;
synchronized (this) {
runnableLocal = this.runnable;
@@ -270,7 +272,7 @@ public class TimerImpl implements Runnable {
if (action == null)
action = new PrivilegedActionImpl();
action.set(this);
- return (Thread) AccessController.doPrivileged(action);
+ return AccessController.doPrivileged(action);
}
PrivilegedActionImpl action = null;
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerQueueNode.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerQueueNode.java
index 00ba1f7b6..8638b871a 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerQueueNode.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/impl/tpt/timer/TimerQueueNode.java
@@ -115,6 +115,7 @@ class TimerQueueNode implements Runnable, ObjectCreator {
}
}
+ @Override
public void run() {
synchronized (this) {
running = true;
@@ -135,6 +136,7 @@ class TimerQueueNode implements Runnable, ObjectCreator {
running = false;
}
+ @Override
public Object getInstance() {
return new TimerQueueNode();
}
@@ -151,15 +153,18 @@ class TimerQueueNode implements Runnable, ObjectCreator {
}
+ @Override
public int hashCode() {
TimerListener lis = listener;
return (lis != null) ? (theHash = (lis.hashCode() + event)) : theHash;
}
+ @Override
public String toString() {
return "QueueNode: " + super.toString() + "\r\n" + "\t\tListener: " + listener + "\r\n" + "\t\tEvent: " + event + "\r\n" + "\t\tType: " + type + "\r\n" + "\t\trunafter: " + (runOn - System.currentTimeMillis()) + "\r\n" + "\t\tEnabled: " + enabled;
}
+ @Override
public boolean equals(Object a) {
if (a instanceof TimerQueueNode) {
TimerQueueNode b = (TimerQueueNode) a;
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/pool/ObjectPool.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/pool/ObjectPool.java
index 08f262684..e1dba1c0d 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/pool/ObjectPool.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/pool/ObjectPool.java
@@ -19,7 +19,7 @@ package org.eclipse.equinox.internal.util.pool;
public class ObjectPool {
- private Class template;
+ private Class<?> template;
protected Object[][] buff;
@@ -51,11 +51,11 @@ public class ObjectPool {
this(null, oc, size, factor, size * factor);
}
- public ObjectPool(Class template, int size, int factor) {
+ public ObjectPool(Class<?> template, int size, int factor) {
this(template, null, size, factor, size * factor);
}
- public ObjectPool(Class template, int size, int factor, int minimumFill) {
+ public ObjectPool(Class<?> template, int size, int factor, int minimumFill) {
this(template, null, size, factor, (minimumFill = (minimumFill > (size * factor)) ? (size * factor) : minimumFill));
}
@@ -63,7 +63,7 @@ public class ObjectPool {
this(null, oc, size, factor, (minimumFill = minimumFill > (size * factor) ? (size * factor) : minimumFill));
}
- protected ObjectPool(Class template, ObjectCreator oc, int size, int factor, int minimumFill) {
+ protected ObjectPool(Class<?> template, ObjectCreator oc, int size, int factor, int minimumFill) {
if (size <= 1 || factor < 1) {
throw new IllegalArgumentException(size + " is less or equal to 1");
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java
index c58f6687f..3d48fb322 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/ref/Log.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -32,13 +32,14 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
* @version 1.0
*/
-public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRunner.PrivilegedDispatcher {
+public class Log implements LogInterface, ServiceTrackerCustomizer<LogService, LogService>, PrivilegedRunner.PrivilegedDispatcher {
/**
* Flag, pointing if printingOnConsole is allowed
*
* @deprecated since osgilib verion 1.3.9 use set/get PrintOnConsole
*/
+ @Deprecated
public boolean printOnConsole = false;
/**
@@ -52,6 +53,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
*
* @deprecated since osgilib verion 1.3.9 use set/get Debug
*/
+ @Deprecated
public boolean debug = false;
/**
@@ -60,8 +62,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
*/
private boolean logErrorLevel = false;
- private ServiceTracker logTracker;
- private ServiceReference traceRef;
+ private ServiceTracker<LogService, LogService> logTracker;
protected static final SecurityUtil securityUtil = new SecurityUtil();
@@ -70,7 +71,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
private long bundleId;
/** BundleContext to get LogService and service owner of Log object BundleId */
protected BundleContext bc;
- private static Vector logs = new Vector();
+ private static Vector<Log> logs = new Vector<>();
private static Log listener;
public Log(BundleContext bc) {
@@ -134,7 +135,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
}
void initListenerNS() {
- logTracker = new ServiceTracker(bc, "org.osgi.service.log.LogService", this);
+ logTracker = new ServiceTracker<>(bc, org.osgi.service.log.LogService.class, this);
logTracker.open();
listener = this;
}
@@ -148,6 +149,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
* @param ex
* Throwable object, containing the stack trace; may be null.
*/
+ @Override
public void error(String str, Throwable ex) {
if (isClosed)
return;
@@ -194,6 +196,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
* @param ex
* Throwable object, containing the stack trace; may be null.
*/
+ @Override
public void warning(String str, Throwable ex) {
if (isClosed)
return;
@@ -238,6 +241,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
* @param str
* Message to be logged.
*/
+ @Override
public void info(String str) {
if (isClosed)
return;
@@ -282,6 +286,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
* @param ex
* Throwable object, containing the stack trace; may be null.
*/
+ @Override
public void debug(String str, Throwable ex) {
if (!debug || isClosed)
return;
@@ -408,10 +413,10 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
LogService getService0() throws IllegalArgumentException {
synchronized (logs) {
- ServiceReference logRef = (ServiceReference) listener.logTracker.getService();
+ ServiceReference<LogService> logRef = listener.logTracker.getServiceReference();
LogService ls = null;
if (logRef != null) {
- ls = (LogService) bc.getService(logRef);
+ ls = bc.getService(logRef);
}
return ls;
}
@@ -498,12 +503,9 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
* ServiceListener from the framework and nulls references. After invocation
* of this method, this Log object can be used no longer.
*/
+ @Override
public void close() {
if (bc != null) {
- if (traceRef != null) {
- bc.ungetService(traceRef);
- traceRef = null;
- }
synchronized (logs) {
close0();
}
@@ -521,7 +523,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
}
Log ls = null;
while (logs.size() > 0) {
- ls = (Log) logs.elementAt(0);
+ ls = logs.elementAt(0);
try {
ls.initListener();
break;
@@ -541,6 +543,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
* @param value
* boolean if true enables print on console else disables it
*/
+ @Override
public void setPrintOnConsole(boolean value) {
printOnConsole = value;
}
@@ -551,6 +554,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
* @param value
* boolean if true enables loging of debug info else disables it
*/
+ @Override
public void setDebug(boolean value) {
debug = value;
}
@@ -560,6 +564,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
*
* @return true if debugging is enabled
*/
+ @Override
public boolean getDebug() {
return debug;
}
@@ -569,18 +574,22 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
*
* @return true if printingon console is enabled
*/
+ @Override
public boolean getPrintOnConsole() {
return printOnConsole;
}
- public Object addingService(ServiceReference reference) {
- return reference;
+ @Override
+ public LogService addingService(ServiceReference<LogService> reference) {
+ return bc.getService(reference);
}
- public void modifiedService(ServiceReference reference, Object service) {
+ @Override
+ public void modifiedService(ServiceReference<LogService> reference, LogService service) {
}
- public void removedService(ServiceReference reference, Object service) {
+ @Override
+ public void removedService(ServiceReference<LogService> reference, LogService service) {
}
private HashIntObjNS map = null;
@@ -734,6 +743,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
}
}
+ @Override
public void finalize() {
if (fos != null)
try {
@@ -783,6 +793,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
* java.lang.Object, java.lang.Object, java.lang.Object,
* java.lang.Object)
*/
+ @Override
public Object dispatchPrivileged(int type, Object arg1, Object arg2, Object arg3, Object arg4) throws Exception {
switch (type) {
case OPEN_TYPE :
@@ -800,6 +811,7 @@ public class Log implements LogInterface, ServiceTrackerCustomizer, PrivilegedRu
class Saver implements Runnable {
+ @Override
public void run() {
byte[] bytes = null;
Log log = null;
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedAction.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedAction.java
deleted file mode 100644
index 8bcc46edc..000000000
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
- * http://www.prosyst.com
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * ProSyst Software GmbH - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.util.security;
-
-/**
- * <p>
- * This class is a wrapper of java.security.PrivilegedAction &&
- * java.security.PriviligedExceptionAction.
- *
- * <p>
- * Its purpose is to hide the dependency on java.security package, so that the
- * user of this class, could be used on JDK 1.1 compatible JVM-s and the others.
- * In the first case, no security mechanism is provided in the JVM, so there is
- * no need to execute doPrivileged blocks at all. In the second case the real
- * java.security.AccessController, java.security.PrivilegedAction and
- * java.security.PrivilegedExceptionAction are used to execute doPrivileged
- * blocks.
- *
- * @deprecated java.security package API should be used in order to execute
- * appropriately doPrivileged blocks. The provided implementation is
- * fake and is left only for backward compatibility.
- *
- * @author Svetozar Dimov
- * @author Pavlin Dobrev
- * @version 1.0
- *
- */
-public interface PrivilegedAction {
-
- /**
- * Substitute for PrivilegedAction.run() and PrivilegedExceptionAction.run()
- * in java.security package.
- *
- * @return
- * @throws Exception
- */
- public Object run0() throws Exception;
-}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedRunner.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedRunner.java
index db10c4326..352290757 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedRunner.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/PrivilegedRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997, 2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -114,9 +114,7 @@ public final class PrivilegedRunner implements ObjectCreator {
}
}
- /**
- * @see org.eclipse.equinox.internal.util.pool.ObjectCreator#getInstance()
- */
+ @Override
public Object getInstance() throws Exception {
return new PA();
}
@@ -150,7 +148,7 @@ public final class PrivilegedRunner implements ObjectCreator {
Object dispatchPrivileged(int type, Object arg1, Object arg2, Object arg3, Object arg4) throws Exception;
}
- static class PA implements PrivilegedExceptionAction {
+ static class PA implements PrivilegedExceptionAction<Object> {
int type;
Object arg1, arg2, arg3, arg4;
@@ -162,9 +160,7 @@ public final class PrivilegedRunner implements ObjectCreator {
arg1 = arg2 = arg3 = arg4 = null;
}
- /**
- * @see java.security.PrivilegedExceptionAction#run()
- */
+ @Override
public Object run() throws Exception {
return dispatcher.dispatchPrivileged(type, arg1, arg2, arg3, arg4);
}
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/SecurityUtil.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/SecurityUtil.java
index fe62f1cc8..962f625c4 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/SecurityUtil.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/security/SecurityUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 1997-2008 by ProSyst Software GmbH
+ * Copyright (c) 1997, 2018 by ProSyst Software GmbH
* http://www.prosyst.com
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -98,9 +98,9 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
* @return a Class
* @throws ClassNotFoundException
*/
- public Class forName(final String name) throws ClassNotFoundException {
+ public Class<?> forName(final String name) throws ClassNotFoundException {
try {
- return (Class) PrivilegedRunner.doPrivileged(controlContext, this, CLASS_FOR_NAME, name, null, null, null);
+ return (Class<?>) PrivilegedRunner.doPrivileged(controlContext, this, CLASS_FOR_NAME, name, null, null, null);
} catch (ClassNotFoundException t) {
throw t;
} catch (Exception t) {
@@ -364,7 +364,7 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
* the BundleContext
* @return a service object
*/
- public Object getService(final ServiceReference reference, final BundleContext context) {
+ public Object getService(final ServiceReference<?> reference, final BundleContext context) {
if (context == null) {
throw new NullPointerException("Context is null");
}
@@ -392,7 +392,7 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
* @throws InvalidSyntaxException
* if filter is not correct
*/
- public ServiceReference[] getServiceReferences(String clazz, String filter, BundleContext context) throws InvalidSyntaxException {
+ public ServiceReference<?>[] getServiceReferences(String clazz, String filter, BundleContext context) throws InvalidSyntaxException {
if (context == null) {
throw new NullPointerException("Context is null");
}
@@ -422,7 +422,7 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
* the bundle context
* @return a service registration
*/
- public ServiceRegistration registerService(String clazz, Object service, Dictionary properties, BundleContext context) {
+ public ServiceRegistration<?> registerService(String clazz, Object service, Dictionary<?, ?> properties, BundleContext context) {
if (context == null) {
throw new NullPointerException("Context is null");
}
@@ -433,7 +433,7 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
throw new NullPointerException("Class name is null");
}
try {
- return (ServiceRegistration) PrivilegedRunner.doPrivileged(controlContext, this, SERVICE_REG_CLASS, context, clazz, service, properties);
+ return (ServiceRegistration<?>) PrivilegedRunner.doPrivileged(controlContext, this, SERVICE_REG_CLASS, context, clazz, service, properties);
} catch (Exception t) {
throw new RuntimeException(t.getMessage());
}
@@ -453,7 +453,7 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
* the bundle context
* @return a service registration
*/
- public ServiceRegistration registerService(String[] classes, Object service, Dictionary properties, BundleContext context) {
+ public ServiceRegistration<?> registerService(String[] classes, Object service, Dictionary<?, ?> properties, BundleContext context) {
if (context == null) {
throw new NullPointerException("Context is null");
}
@@ -464,7 +464,7 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
throw new NullPointerException("Class names are null");
}
try {
- return (ServiceRegistration) PrivilegedRunner.doPrivileged(controlContext, this, SERVICE_REG_CLASSES, context, classes, service, properties);
+ return (ServiceRegistration<?>) PrivilegedRunner.doPrivileged(controlContext, this, SERVICE_REG_CLASSES, context, classes, service, properties);
} catch (Exception t) {
throw new RuntimeException(t.getMessage());
}
@@ -492,9 +492,9 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
* the bundle
* @return the bundle location
*/
- public Dictionary getHeaders(Bundle bundle) {
+ public Dictionary<?, ?> getHeaders(Bundle bundle) {
try {
- return (Dictionary) PrivilegedRunner.doPrivileged(controlContext, this, BUNDLE_GET_HEADERS, bundle, null, null, null);
+ return (Dictionary<?, ?>) PrivilegedRunner.doPrivileged(controlContext, this, BUNDLE_GET_HEADERS, bundle, null, null, null);
} catch (Exception t) {
throw new RuntimeException(t.getMessage());
}
@@ -687,11 +687,8 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
return PrivilegedRunner.doPrivileged(controlContext, dispatcher, type, arg1, null, null, null);
}
- /**
- * @see org.eclipse.equinox.internal.util.security.PrivilegedRunner.PrivilegedDispatcher#dispatchPrivileged(int,
- * java.lang.Object, java.lang.Object, java.lang.Object,
- * java.lang.Object)
- */
+ @SuppressWarnings("unchecked")
+ @Override
public Object dispatchPrivileged(int type, Object arg1, Object arg2, Object arg3, Object arg4) throws Exception {
switch (type) {
case SYSTEM_GET_PROPERTY :
@@ -725,11 +722,11 @@ public final class SecurityUtil implements PrivilegedRunner.PrivilegedDispatcher
case SERVICE_GET_REFERENCE :
return ((BundleContext) arg1).getServiceReferences((String) arg2, (String) arg3);
case SERVICE_GET_SERVICE :
- return ((BundleContext) arg1).getService((ServiceReference) arg2);
+ return ((BundleContext) arg1).getService((ServiceReference<?>) arg2);
case SERVICE_REG_CLASS :
- return ((BundleContext) arg1).registerService((String) arg2, arg3, (Dictionary) arg4);
+ return ((BundleContext) arg1).registerService((String) arg2, arg3, (Dictionary<String, ?>) arg4);
case SERVICE_REG_CLASSES :
- return ((BundleContext) arg1).registerService((String[]) arg2, arg3, (Dictionary) arg4);
+ return ((BundleContext) arg1).registerService((String[]) arg2, arg3, (Dictionary<String, ?>) arg4);
case BUNDLE_GET_LOCATION :
return ((Bundle) arg1).getLocation();
case BUNDLE_GET_HEADERS :
diff --git a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/timer/Timer.java b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/timer/Timer.java
index e18673dff..432bbc93d 100644
--- a/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/timer/Timer.java
+++ b/bundles/org.eclipse.equinox.util/src/org/eclipse/equinox/internal/util/timer/Timer.java
@@ -73,6 +73,7 @@ public interface Timer {
* if time period is not positive
* @deprecated
*/
+ @Deprecated
public void notifyAfterMillis(TimerListener listener, long timePeriod, int event) throws IllegalArgumentException;
/**
@@ -98,6 +99,7 @@ public interface Timer {
* Thread.MIN_PRIORITY and Thread.MAX_PRIORITY
* @deprecated
*/
+ @Deprecated
public void notifyAfterMillis(TimerListener listener, int priority, long timePeriod, int event) throws IllegalArgumentException;
/**
@@ -120,6 +122,7 @@ public interface Timer {
* if time period is not positive
* @deprecated
*/
+ @Deprecated
public void notifyAfter(TimerListener listener, int timePeriod, int event) throws IllegalArgumentException;
/**
@@ -145,6 +148,7 @@ public interface Timer {
* Thread.MIN_PRIORITY and Thread.MAX_PRIORITY
* @deprecated
*/
+ @Deprecated
public void notifyAfter(TimerListener listener, int priority, int timePeriod, int event) throws IllegalArgumentException;
/**

Back to the top