Where from "has private access in " is logged? I'd like to suppress it

Gabriele Kahlout gabriele at mysimpatico.com
Thu Feb 24 09:14:54 PST 2011


Hello,

Consider a class that accesses an inaccessible private method:

class T {
    private static void p(int i, Double d, String... s){}
}

public class Test{


    @com.dp4j.InjectReflection
    public void t() {
	T.p(1,new Double(2),"hello", "reflection");
    }
}

When parsing, I try to get the TreePath of  T.p(1,new
Double(2),"hello", "reflection"), and then from it the Scope. When I
compile it it'll print the following, once per treepath/scope
retrieval.

null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10
null:0: p(int,java.lang.Double,java.lang.String...) has private access in T10

Who logs this, javac or tools.jar? I've tried to figure out but all I
came up to is a test file for this called T5003235c.java, also
referred to here[1].

I'd like to supress this log because in my case the compilation is
successful, since dp4j[2] injects the reflection code in lieu of the
private access but in order to do that I resolve the symbols, and get
the 'faulty' scope too.
A workaround would be to use the scope up to the annotated element
(method) which contains everything but the symbols declared in the
method body, and for those create my own scope, so I never call the
logic that prints those. But would it not be much easier/cleaner to
just comment this line? Unfortunately, beside the ugly prints,
NetBeans pays attention to it.



[1] http://mail.openjdk.java.net/pipermail/compiler-dev/2009-May/001153.htmldev
[2] http://code.google.com/p/dp4j/downloads/detail?name=dp4j-1.0-jar-with-dependencies.jar
in langtools/javac/Scope/TreePath?
http://code.google.com/p/dp4j/downloads/detail?name=dp4j-1.0-jar-with-dependencies.jar&can=2&q=#makechanges

--
Regards,
K. Gabriele

--- unchanged since 20/9/10 ---
P.S. If the subject contains "[LON]" or the addressee acknowledges the
receipt within 48 hours then I don't resend the email.
subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧
time(x) < Now + 48h) ⇒ ¬resend(I, this).

If an email is sent by a sender that is not a trusted contact or the
email does not contain a valid code then the email is not received. A
valid code starts with a hyphen and ends with "X".
∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y
∈ L(-[a-z]+[0-9]X)).



More information about the compiler-dev mailing list