You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I generate the code by Janino and copy the code to a file MyTest.java,and step into the test function,I can't look the variable this and value in Intellij IDEA.
Then I debug the Janino 3.0.0,and find the logical in UnitCompiler#compile(FunctionDeclarator, ClassFile) is change the private non-static method to package static method, and add the "this" to the method's first argument.
"This" in IDEA is this object, but in Janino is the first augument, this cause the problem.
Can U support this debug function :)
The text was updated successfully, but these errors were encountered:
modeling non-static private methods with static default-accessible methods is a trick of JANINO:
if (fd.getAccess() == Access.PRIVATE) {
if (fd instanceof MethodDeclarator && !((MethodDeclarator) fd).isStatic()) {
// To make the non-static private method invocable for enclosing types, enclosed types and types
// enclosed by the same type, it is modified as follows:
// + Access is changed from PRIVATE to PACKAGE
// + The name is appended with "$"
// + It is made static
// + A parameter of type "declaring class" is prepended to the signature
short accessFlags = UnitCompiler.changeAccessibility(this.accessFlags(fd.getModifiers()), Mod.PACKAGE);
accessFlags |= Mod.STATIC;
mi = classFile.addMethodInfo(
accessFlags, // accessFlags
fd.name + '$', // methodName
( // methodMd
this.toIMethod((MethodDeclarator) fd)
.getDescriptor()
.prependParameter(this.resolve(fd.getDeclaringType()).getDescriptor())
)
);
It is not enough to change accessibility from PRIVATE to PACKAGE, because PRIVATE-accessible methods are non-virtual, and PACKAGE-accessible methods are not.
Sorry it breaks IDEA!
The idea behind this is to avoid those ridiculous "access$000()" methods that Java generates to make private methods accessible for enclosing and enclosed classes. A very questionable concept anyway, because it pollutes the generated classes, the call stacks, and also adds security vulnerabilities.
But I see your point and will think of a way to get around this problem. Stay tuned.
the code is
When I generate the code by Janino and copy the code to a file
MyTest.java
,and step into thetest
function,I can't look the variablethis
andvalue
in Intellij IDEA.Then I debug the Janino 3.0.0,and find the logical in
UnitCompiler#compile(FunctionDeclarator, ClassFile)
is change the private non-static method to package static method, and add the "this" to the method's first argument."This" in IDEA is this object, but in Janino is the first augument, this cause the problem.
Can U support this debug function :)
The text was updated successfully, but these errors were encountered: