summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-11-25 21:35:16 +0000
committerTom Tromey <tromey@redhat.com>2005-11-25 21:35:16 +0000
commit3d37afc21fd9c8ab18876a2aa8d91cc3b20d08ae (patch)
tree77330b4c8fc2efeda2a6ae60130d4db0f7f92ac1 /java
parentfcc6901097d22fcf4a9466d037f9229d9fae0923 (diff)
downloadclasspath-3d37afc21fd9c8ab18876a2aa8d91cc3b20d08ae.tar.gz
* java/security/Security.java (getAlgorithms): Genericized.
(getProviders): Likewise. * java/security/SecureClassLoader.java (defineClass): Genericized. (protectionDomainCache): Likewise. * java/security/PermissionCollection.java (elements): Genericized. (toString): Updated. * java/security/KeyStoreSpi.java (engineAliases): Genericized. * java/security/KeyStore.java (aliases): Genericized. * java/security/KeyFactorySpi.java (engineGetKeySpec): Genericized. (engineTranslateKey): Fixed javadoc. * java/security/KeyFactory.java (getKeySpec): Genericized. * java/security/IdentityScope.java (identities): Genericized. * java/security/AlgorithmParametersSpi.java (engineGetParameterSpec): Genericized. * java/security/AlgorithmParameters.java (getParameterSpec): Genericized. * java/security/AccessController.java (doPrivileged): Genericized. * java/security/PrivilegedExceptionAction.java: Genericized. * java/security/PrivilegedAction.java: Genericized.
Diffstat (limited to 'java')
-rw-r--r--java/security/AccessController.java12
-rw-r--r--java/security/AlgorithmParameters.java3
-rw-r--r--java/security/AlgorithmParametersSpi.java4
-rw-r--r--java/security/IdentityScope.java2
-rw-r--r--java/security/KeyFactory.java2
-rw-r--r--java/security/KeyFactorySpi.java7
-rw-r--r--java/security/KeyStore.java2
-rw-r--r--java/security/KeyStoreSpi.java2
-rw-r--r--java/security/PermissionCollection.java4
-rw-r--r--java/security/PrivilegedAction.java6
-rw-r--r--java/security/PrivilegedExceptionAction.java6
-rw-r--r--java/security/SecureClassLoader.java7
-rw-r--r--java/security/Security.java10
13 files changed, 36 insertions, 31 deletions
diff --git a/java/security/AccessController.java b/java/security/AccessController.java
index 93e34b87c..6f8b3ecbd 100644
--- a/java/security/AccessController.java
+++ b/java/security/AccessController.java
@@ -88,7 +88,7 @@ public final class AccessController
* should be be called.
* @return the result of the <code>action.run()</code> method.
*/
- public static Object doPrivileged(PrivilegedAction action)
+ public static <T> T doPrivileged(PrivilegedAction<T> action)
{
VMAccessController.pushContext(null);
try
@@ -115,8 +115,8 @@ public final class AccessController
* domains should be added to the protection domain of the calling class.
* @return the result of the <code>action.run()</code> method.
*/
- public static Object doPrivileged(PrivilegedAction action,
- AccessControlContext context)
+ public static <T> T doPrivileged(PrivilegedAction<T> action,
+ AccessControlContext context)
{
VMAccessController.pushContext(context);
try
@@ -145,7 +145,7 @@ public final class AccessController
* @exception PrivilegedActionException wrapped around any checked exception
* that is thrown in the <code>run()</code> method.
*/
- public static Object doPrivileged(PrivilegedExceptionAction action)
+ public static <T> T doPrivileged(PrivilegedExceptionAction<T> action)
throws PrivilegedActionException
{
VMAccessController.pushContext(null);
@@ -185,8 +185,8 @@ public final class AccessController
* @exception PrivilegedActionException wrapped around any checked exception
* that is thrown in the <code>run()</code> method.
*/
- public static Object doPrivileged(PrivilegedExceptionAction action,
- AccessControlContext context)
+ public static <T> T doPrivileged(PrivilegedExceptionAction<T> action,
+ AccessControlContext context)
throws PrivilegedActionException
{
VMAccessController.pushContext(context);
diff --git a/java/security/AlgorithmParameters.java b/java/security/AlgorithmParameters.java
index 038fbb4bd..385f15789 100644
--- a/java/security/AlgorithmParameters.java
+++ b/java/security/AlgorithmParameters.java
@@ -291,7 +291,8 @@ public class AlgorithmParameters
* specification is inappropriate for this parameter object, or if this
* parameter object has not been initialized.
*/
- public final AlgorithmParameterSpec getParameterSpec(Class paramSpec)
+ public final <T extends AlgorithmParameterSpec>
+ T getParameterSpec(Class<T> paramSpec)
throws InvalidParameterSpecException
{
return paramSpi.engineGetParameterSpec(paramSpec);
diff --git a/java/security/AlgorithmParametersSpi.java b/java/security/AlgorithmParametersSpi.java
index a9faa1543..bd61ce7df 100644
--- a/java/security/AlgorithmParametersSpi.java
+++ b/java/security/AlgorithmParametersSpi.java
@@ -113,8 +113,8 @@ public abstract class AlgorithmParametersSpi
* @throws InvalidParameterSpecException if the paramSpec is an
* invalid parameter class
*/
- protected abstract AlgorithmParameterSpec engineGetParameterSpec(Class
- paramSpec)
+ protected abstract <T extends AlgorithmParameterSpec>
+ T engineGetParameterSpec(Class<T> paramSpec)
throws InvalidParameterSpecException;
diff --git a/java/security/IdentityScope.java b/java/security/IdentityScope.java
index 34dd011e2..4b19d26e1 100644
--- a/java/security/IdentityScope.java
+++ b/java/security/IdentityScope.java
@@ -210,7 +210,7 @@ public abstract class IdentityScope extends Identity
*
* @return an enumeration of all identities in this identity scope.
*/
- public abstract Enumeration identities();
+ public abstract Enumeration<Identity> identities();
/**
* Returns a string representation of this identity scope, including its name,
diff --git a/java/security/KeyFactory.java b/java/security/KeyFactory.java
index 64ce841fa..3632b3e26 100644
--- a/java/security/KeyFactory.java
+++ b/java/security/KeyFactory.java
@@ -275,7 +275,7 @@ public class KeyFactory
* inappropriate for the given key, or the given key cannot be processed
* (e.g., the given key has an unrecognized algorithm or format).
*/
- public final KeySpec getKeySpec(Key key, Class keySpec)
+ public final <T extends KeySpec> T getKeySpec(Key key, Class<T> keySpec)
throws InvalidKeySpecException
{
return keyFacSpi.engineGetKeySpec(key, keySpec);
diff --git a/java/security/KeyFactorySpi.java b/java/security/KeyFactorySpi.java
index 1894fad08..fa5637812 100644
--- a/java/security/KeyFactorySpi.java
+++ b/java/security/KeyFactorySpi.java
@@ -113,7 +113,8 @@ public abstract class KeyFactorySpi
* is inappropriate for this key or the key is
* unrecognized.
*/
- protected abstract KeySpec engineGetKeySpec(Key key, Class keySpec)
+ protected abstract <T extends KeySpec> T engineGetKeySpec(Key key,
+ Class<T> keySpec)
throws InvalidKeySpecException;
@@ -121,11 +122,11 @@ public abstract class KeyFactorySpi
* Translates the key from an unknown or untrusted provider
* into a key for this key factory.
*
- * @param the key from an unknown or untrusted provider
+ * @param key key from an unknown or untrusted provider
*
* @return the translated key
*
- * @throws InvalidKeySpecException if the key cannot be
+ * @throws InvalidKeyException if the key cannot be
* processed by this key factory
*/
protected abstract Key engineTranslateKey(Key key)
diff --git a/java/security/KeyStore.java b/java/security/KeyStore.java
index 696448728..cb409f6bc 100644
--- a/java/security/KeyStore.java
+++ b/java/security/KeyStore.java
@@ -392,7 +392,7 @@ public class KeyStore
@return an Enumeration of the aliases
*/
- public final Enumeration aliases() throws KeyStoreException
+ public final Enumeration<String> aliases() throws KeyStoreException
{
return keyStoreSpi.engineAliases();
}
diff --git a/java/security/KeyStoreSpi.java b/java/security/KeyStoreSpi.java
index a16008f99..c8d231663 100644
--- a/java/security/KeyStoreSpi.java
+++ b/java/security/KeyStoreSpi.java
@@ -187,7 +187,7 @@ public abstract class KeyStoreSpi
*
* @return an Enumeration of the aliases
*/
- public abstract Enumeration engineAliases();
+ public abstract Enumeration<String> engineAliases();
/**
* Determines if the keystore contains the specified alias.
diff --git a/java/security/PermissionCollection.java b/java/security/PermissionCollection.java
index 4e8ffe579..c5849830a 100644
--- a/java/security/PermissionCollection.java
+++ b/java/security/PermissionCollection.java
@@ -120,7 +120,7 @@ public abstract class PermissionCollection implements Serializable
*
* @return an <code>Enumeration</code> of this collection's objects
*/
- public abstract Enumeration elements();
+ public abstract Enumeration<Permission> elements();
/**
* This method sets this <code>PermissionCollection</code> object to be
@@ -159,7 +159,7 @@ public abstract class PermissionCollection implements Serializable
StringBuffer sb = new StringBuffer(super.toString());
sb.append(" (\n");
- Enumeration e = elements();
+ Enumeration<Permission> e = elements();
while (e.hasMoreElements())
sb.append(' ').append(e.nextElement()).append('\n');
return sb.append(")\n").toString();
diff --git a/java/security/PrivilegedAction.java b/java/security/PrivilegedAction.java
index c3a41346f..1a51eaade 100644
--- a/java/security/PrivilegedAction.java
+++ b/java/security/PrivilegedAction.java
@@ -47,9 +47,9 @@ package java.security;
* @see AccessController
* @see PrivilegedExceptionAction
* @since 1.1
- * @status updated to 1.4
+ * @status updated to 1.5
*/
-public interface PrivilegedAction
+public interface PrivilegedAction<T>
{
/**
* This method performs an operation that requires higher privileges to
@@ -60,5 +60,5 @@ public interface PrivilegedAction
* @see AccessController#doPrivileged(PrivilegedAction)
* @see AccessController#doPrivileged(PrivilegedAction, AccessControlContext)
*/
- Object run();
+ T run();
} // interface PrivilegedAction
diff --git a/java/security/PrivilegedExceptionAction.java b/java/security/PrivilegedExceptionAction.java
index d3d0478fd..351438e0b 100644
--- a/java/security/PrivilegedExceptionAction.java
+++ b/java/security/PrivilegedExceptionAction.java
@@ -46,9 +46,9 @@ package java.security;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
- * @status updated to 1.4
+ * @status updated to 1.5
*/
-public interface PrivilegedExceptionAction
+public interface PrivilegedExceptionAction<T>
{
/**
* This method performs an operation that requires higher privileges to
@@ -61,5 +61,5 @@ public interface PrivilegedExceptionAction
* @see AccessController#doPrivileged(PrivilegedExceptionAction,
* AccessControlContext)
*/
- Object run() throws Exception;
+ T run() throws Exception;
} // interface PrivilegedExceptionAction
diff --git a/java/security/SecureClassLoader.java b/java/security/SecureClassLoader.java
index 9d1fac797..bcc3cab88 100644
--- a/java/security/SecureClassLoader.java
+++ b/java/security/SecureClassLoader.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package java.security;
+import java.util.WeakHashMap;
+
/**
* A Secure Class Loader for loading classes with additional
* support for specifying code source and permissions when
@@ -48,7 +50,8 @@ package java.security;
*/
public class SecureClassLoader extends ClassLoader
{
- java.util.WeakHashMap protectionDomainCache = new java.util.WeakHashMap();
+ WeakHashMap<CodeSource, ProtectionDomain> protectionDomainCache
+ = new WeakHashMap<CodeSource, ProtectionDomain>();
protected SecureClassLoader(ClassLoader parent)
{
@@ -79,7 +82,7 @@ public class SecureClassLoader extends ClassLoader
*
* @exception ClassFormatError if the byte array is not in proper classfile format.
*/
- protected final Class defineClass(String name, byte[] b, int off, int len,
+ protected final Class<?> defineClass(String name, byte[] b, int off, int len,
CodeSource cs)
{
if (cs != null)
diff --git a/java/security/Security.java b/java/security/Security.java
index fd51d0535..c5ef9f97c 100644
--- a/java/security/Security.java
+++ b/java/security/Security.java
@@ -431,9 +431,9 @@ public final class Security
* no provider supports the specified service.
* @since 1.4
*/
- public static Set getAlgorithms(String serviceName)
+ public static Set<String> getAlgorithms(String serviceName)
{
- HashSet result = new HashSet();
+ HashSet<String> result = new HashSet<String>();
if (serviceName == null || serviceName.length() == 0)
return result;
@@ -570,7 +570,7 @@ public final class Security
* format.
* @see #getProviders(String)
*/
- public static Provider[] getProviders(Map filter)
+ public static Provider[] getProviders(Map<String, String> filter)
{
if (providers == null || providers.isEmpty())
return null;
@@ -578,7 +578,7 @@ public final class Security
if (filter == null)
return getProviders();
- Set querries = filter.keySet();
+ Set<String> querries = filter.keySet();
if (querries == null || querries.isEmpty())
return getProviders();
@@ -601,7 +601,7 @@ public final class Security
throw new InvalidParameterException(
"missing dot in '" + String.valueOf(querry)+"'");
- value = (String) filter.get(querry);
+ value = filter.get(querry);
// deconstruct querry into [service, algorithm, attribute]
if (value == null || value.trim().length() == 0) // <service>.<algorithm>
{