Skip to content

Commit

Permalink
Support new Java 8 GAE platform (close #51)
Browse files Browse the repository at this point in the history
  • Loading branch information
henri-tremblay committed May 26, 2017
1 parent d3424ae commit b4273d9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions gae/README.md
Expand Up @@ -10,3 +10,5 @@ Deployment
----------

`mvn appengine:update`

Open [objenesis.appspot.com](https://objenesis.appspot.com).
3 changes: 2 additions & 1 deletion gae/src/main/webapp/WEB-INF/appengine-web.xml
Expand Up @@ -20,7 +20,8 @@
<application>${app.id}</application>
<version>${app.version}</version>
<threadsafe>true</threadsafe>

<runtime>java8</runtime>

<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
Expand Down
4 changes: 2 additions & 2 deletions gae/src/main/webapp/index.jsp
Expand Up @@ -16,8 +16,8 @@
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="main.java.org.objenesis.gae.JspReporter" %>
<%@ page import="main.java.org.objenesis.gae.JspWriterListener" %>
<%@ page import="org.objenesis.gae.JspReporter" %>
<%@ page import="org.objenesis.gae.JspWriterListener" %>
<%@ page import="org.objenesis.strategy.PlatformDescription" %>
<%@ page import="org.objenesis.tck.Main" %>
<%@ page import="org.objenesis.tck.candidates.SerializableNoConstructor" %>
Expand Down
Expand Up @@ -58,7 +58,8 @@ public <T> ObjectInstantiator<T> newInstantiatorOf(Class<T> type) {
throw new ObjenesisException(new NotSerializableException(type+" not serializable"));
}
if(JVM_NAME.startsWith(HOTSPOT) || PlatformDescription.isThisJVM(OPENJDK)) {
if(isGoogleAppEngine()) {
// Java 7 GAE was under a security manager so we use a degraded system
if(isGoogleAppEngine() && PlatformDescription.SPECIFICATION_VERSION.equals("1.7")) {
return new ObjectInputStreamInstantiator<T>(type);
}
// ObjectStreamClassInstantiator uses setAccessible which isn't supported on JDK9
Expand Down
Expand Up @@ -56,7 +56,8 @@ public class StdInstantiatorStrategy extends BaseInstantiatorStrategy {
public <T> ObjectInstantiator<T> newInstantiatorOf(Class<T> type) {

if(PlatformDescription.isThisJVM(HOTSPOT) || PlatformDescription.isThisJVM(OPENJDK)) {
if(PlatformDescription.isGoogleAppEngine()) {
// Java 7 GAE was under a security manager so we use a degraded system
if(PlatformDescription.isGoogleAppEngine() && PlatformDescription.SPECIFICATION_VERSION.equals("1.7")) {
if(Serializable.class.isAssignableFrom(type)) {
return new ObjectInputStreamInstantiator<T>(type);
}
Expand Down

0 comments on commit b4273d9

Please sign in to comment.