Community
Participate
Working Groups
Restricted (i.e. private, protected or package visible) nested types can be referred/used by ITDs in privileged aspects. Unfortunately, the imports section at the top of the .aj file is not considered part of the aspect, so while we are able to use/refer to them from the aspect by using fully qualified names, we can not import them into the aspect's compilation unit. Technically, I guess this is an enhancement, not a bug, since the imports are not actually inside the aspect, so not "privileged". Nevertheless, it seems somewhat illogical to prohibit importing of types that can legitimately be used in the compilation unit. Example: ---- paspect/TestAspect.aj --- package paspect; import pclass.Klass; import pclass.Klass.Default; // <-- Error (because of visibility) import pclass.Klass.Protected; // <-- Error (because of visibility) import pclass.Klass.Secret; // <-- Error (because of visibility) public privileged aspect TestAspect { public void Klass.pullMe() { Secret s = null; // <- Error (because import failed) Protected p = null; // <- Error (because import failed) Default d = null; // <- Error (because import failed) System.out.println(""+s+p+d+prot+deflt+priv); } } ---- pclass/Klass.java --- package pclass; public class Klass { private class Secret {} protected class Protected {} class Default {} private int priv; protected int prot; int deflt; }