easymock/objenesis

App Engine Java 8 Runtime and Objenesis

Closed this issue · 12 comments

I'm part of Google Cloud engineering team, and I'm looking into making sure that libraries relying on SpringBoot and Objenesis could run seamlessly on Google App Engine Java 8 runtime - our new runtime which is in Alpha at the moment.

We noticed that the reason that GAE is only partially supported by Objenesis is due to security restrictions.
In Java8 runtime the security restrictions are lifted off. Thus, it should be possible for Objenesis do what needs to be done when running within this new runtime.

As an example, we recently noticed that Springboot relies on ability to create Proxy objects for classes with no default constructor via Objenesis. However, Objenesis will detect GAE environment, and will use an instantiator that expects a default constructor. In GAE Java8 the use of this instantiator should no longer be necessary.

Those are really good news. I need to tweak the strategy to be able to look for a working instantiator if the expected one fails. That would make Objenesis more robust on new platform.

How can I know that I'm on GAE 8? com.google.appengine.runtime.version == 8?

Also, I am willing to test it and officially validate the platform. But I will probably need Google Cloud Platform credits to do so.

You could simply check now if the SecurityManager is installed. I.e. check if "System.getSecurityManager()" returns null.

The other property you included will just contain the runtime version (e.g. 1.9.48), so it should not be used for this purpose.

Thank you for willing to test on the platform. Simply request to join the alpha program (as described here), and you should be able to deploy and test with this new runtime.

Make sense. Will do that as soon as I can. Will also read Guillaume wisdom to sign for alpha :-)

Salut Henri!
Yep, it is now an important bug for us (App Engine Standard Java8!) It's coming, and we now need to detect 2 different App Engine environments: the one you know targetting Java7 with restrictions, and the new Java8 without restrictions, so this new one should be treated as a normal standard JVM process...

Bien le bonjour. Cool. I just did my request for alpha.

Cool!
Whitelisted now.

Thanks!

Henri, you could also check for System.getProperty("java.specification.version"). For java8 runtime it should be "1.8" in production. My colleague pointed out that checking for SecurityManager may not be the best, since a java8 application could install its own SecurityManager now.
Thanks again.

No problem. By the way, if needed there is a sub-module named gae in the objenesis source code. It is a simple webapp that can be deployed on GAE and runs the TCK when accessing the home page.

thnx! what's the target release date for 2.6? and/or if there will be a 2.5.x minor release prior? (trying to figure out how to file an issue for Spring Framework to upgrade)

No. Next version is 2.6. Should be out in 2-3 weeks. I'm on something else right now and I want to fix #52 as well. BTW, if someone from Google can help ;-) (cc @ludoch @ifigotin)