New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception thrown when "insertBefore" a return expression #241
Comments
The type parameter T is java.lang.Object at the byte code level. |
But when I changed the code to:
It throws the following exception, doesn't $r work?
|
The exception says the type of $r was not found. |
I think this is because "$r" doesn't have the effect of escaping, because even if I add Class.forName($type.getName()) before this, it doesn't help. According to the documentation, $r doesn't work. It should have the effect of escaping. |
It makes $r available in the code given to CtBehavior#insertBefore().
OK, you're right. $r was not available in the code passed to |
I have tried it, this bug no longer exists, thanks. |
3.25 fixes: - jboss-javassist/javassist#72 - jboss-javassist/javassist#241 - jboss-javassist/javassist#242 - jboss-javassist/javassist#246 - jboss-javassist/javassist#252 3.26 fixes: - jboss-javassist/javassist#265 - jboss-javassist/javassist#270 - jboss-javassist/javassist#271 - jboss-javassist/javassist#275 Of these #270 is most important, as it fixes an issue we've seen with powermock downstream. Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3.25 fixes: - jboss-javassist/javassist#72 - jboss-javassist/javassist#241 - jboss-javassist/javassist#242 - jboss-javassist/javassist#246 - jboss-javassist/javassist#252 3.26 fixes: - jboss-javassist/javassist#265 - jboss-javassist/javassist#270 - jboss-javassist/javassist#271 - jboss-javassist/javassist#275 Of these #270 is most important, as it fixes an issue we've seen with powermock downstream. Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2 Signed-off-by: Robert Varga <robert.varga@pantheon.tech> (cherry picked from commit 6a404f1)
3.25 fixes: - jboss-javassist/javassist#72 - jboss-javassist/javassist#241 - jboss-javassist/javassist#242 - jboss-javassist/javassist#246 - jboss-javassist/javassist#252 3.26 fixes: - jboss-javassist/javassist#265 - jboss-javassist/javassist#270 - jboss-javassist/javassist#271 - jboss-javassist/javassist#275 Of these #270 is most important, as it fixes an issue we've seen with powermock downstream. Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2 Signed-off-by: Robert Varga <robert.varga@pantheon.tech> (cherry picked from commit 6a404f1)
Recently, I am doing a mock function on methods, one of which is to modify the bytecode before the method starts. I inserted the following code with the insertBefore method:
Among them, the definition of the getMockData method is:
But when it started, it throws the following exceptions:
When I delete the "insertBefore" expression, it was normal again. So I believe there are some problems with this statement("insertBefore" with return expression).
Thanks.
The text was updated successfully, but these errors were encountered: