-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
7
-
None
-
x86
-
linux
Specification of PermissionCollection class tells following:
"The PermissionCollection returned by the Permission.newPermissionCollection method is a homogeneous collection, which stores only Permission objects for a given Permission type. "
There is still chance for newPermissionCollection method to return null however if non-null is returned then it should be permission collection allowing just instances of corespondign class to be added.
Yet it is specified that "The default behavior (from the Permission class) is to simply return null."
All these together implicitly means that:
1. direct subclasses of Permission class may just inherit method newPermissionCollection from
parent.
2. statement #1 is appllicable to direct subclasses of classes satisfied with it recursively.
3. *Important*. If some class redefines newPermissionCollection method to return non-null value then all it's direct subclasses should redefine this method too - otherwise inherited method will return instalce of PermissionCollection capable to store instances of classes which are parent's or siblings of this one. This rule is applicable recursively too.
4. If some direct class defines newPermissionCollection returning null while it's super class returns non-null then statement #1 then above rules are applied in assumption that Permission is replacedd by such class.
However there are several classes which violate these implicit requirements (they are subclasses of BasicPermission that do not override newPermissionCollection method) which means that permission collections returned by 'newPermissionCollection' invoked for their instances are not homogenous:
javax.sound.sampled.AudioPermission
javax.security.auth.AuthPermission
java.awt.AWTPermission
java.util.logging.LoggingPermission
java.lang.management.ManagementPermission
javax.management.MBeanTrustPermission
java.net.NetPermission
java.lang.reflect.ReflectPermission
java.lang.RuntimePermission
java.security.SecurityPermission
java.io.SerializablePermission
java.sql.SQLPermission
javax.net.ssl.SSLPermission
javax.management.remote.SubjectDelegationPermission
javax.xml.ws.WebServicePermission
Good example of BasicPermission subclass is java.util.PropertyPermission.
"The PermissionCollection returned by the Permission.newPermissionCollection method is a homogeneous collection, which stores only Permission objects for a given Permission type. "
There is still chance for newPermissionCollection method to return null however if non-null is returned then it should be permission collection allowing just instances of corespondign class to be added.
Yet it is specified that "The default behavior (from the Permission class) is to simply return null."
All these together implicitly means that:
1. direct subclasses of Permission class may just inherit method newPermissionCollection from
parent.
2. statement #1 is appllicable to direct subclasses of classes satisfied with it recursively.
3. *Important*. If some class redefines newPermissionCollection method to return non-null value then all it's direct subclasses should redefine this method too - otherwise inherited method will return instalce of PermissionCollection capable to store instances of classes which are parent's or siblings of this one. This rule is applicable recursively too.
4. If some direct class defines newPermissionCollection returning null while it's super class returns non-null then statement #1 then above rules are applied in assumption that Permission is replacedd by such class.
However there are several classes which violate these implicit requirements (they are subclasses of BasicPermission that do not override newPermissionCollection method) which means that permission collections returned by 'newPermissionCollection' invoked for their instances are not homogenous:
javax.sound.sampled.AudioPermission
javax.security.auth.AuthPermission
java.awt.AWTPermission
java.util.logging.LoggingPermission
java.lang.management.ManagementPermission
javax.management.MBeanTrustPermission
java.net.NetPermission
java.lang.reflect.ReflectPermission
java.lang.RuntimePermission
java.security.SecurityPermission
java.io.SerializablePermission
java.sql.SQLPermission
javax.net.ssl.SSLPermission
javax.management.remote.SubjectDelegationPermission
javax.xml.ws.WebServicePermission
Good example of BasicPermission subclass is java.util.PropertyPermission.
- duplicates
-
JDK-6568872 BasicPermission.newPermissionCollection() violates general contract specified in Permission class
-
- Closed
-
- relates to
-
JDK-6551490 Behavior of PermissionCollection.add() method is not clear
-
- Closed
-
-
JDK-6551493 Non-clear requirements for PermissionCollection.implies method implementation
-
- Closed
-