Break OO privacy: Difference between revisions

m
Line 436:
Ecstasy security is accomplished by the use of <i>software containers</i>. Code running in a container is always allowed reveal any legal type on any object created within that container, including any object created within sub-containers. However, the runtime will reject any reveal request on any object that was <i>not</i> created within that container.
<syntaxhighlight lang="java">
module BreakOO {
{
/**
* This is a class with public, protected, and private properties.
*/
class Exposed {
{
public String pub = "public";
protected String pro = "protected";
Line 448 ⟶ 446:
 
@Override
String toString() {
{
return $"pub={pub.quoted()}, pro={pro.quoted()}, pri={pri.quoted()}";
}
}
{}
 
void run() {
{
@Inject Console console;
 
Line 483 ⟶ 479:
 
console.print($"after: {expo}");
}
}
}
</syntaxhighlight>
 
162

edits