diff -Nru objenesis-2.6/benchmark/launch.sh objenesis-3.0.1/benchmark/launch.sh
--- objenesis-2.6/benchmark/launch.sh 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/benchmark/launch.sh 2018-10-19 00:44:52.000000000 +0000
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
-# Copyright 2006-2017 the original author or authors.
+# Copyright 2006-2018 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/benchmark/pom.xml objenesis-3.0.1/benchmark/pom.xml
--- objenesis-2.6/benchmark/pom.xml 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/benchmark/pom.xml 2018-10-19 00:44:52.000000000 +0000
@@ -1,10 +1,27 @@
+
4.0.0org.objenesisobjenesis-parent
- 2.6
+ 3.0.1objenesis-benchmark
@@ -15,7 +32,7 @@
1.8
- 1.19
+ 1.21benchmarks
@@ -41,7 +58,7 @@
cglibcglib-nodep
- 3.2.5
+ 3.2.8
@@ -60,8 +77,8 @@
maven-timestamp-plugin
- com.mycila.maven-license-plugin
- maven-license-plugin
+ com.mycila
+ license-maven-pluginmaven-remote-resources-plugin
@@ -74,7 +91,6 @@
maven-shade-plugin
- 2.4.3package
diff -Nru objenesis-2.6/benchmark/src/main/java/org/objenesis/benchmark/ConcurrentGetInstantiator.java objenesis-3.0.1/benchmark/src/main/java/org/objenesis/benchmark/ConcurrentGetInstantiator.java
--- objenesis-2.6/benchmark/src/main/java/org/objenesis/benchmark/ConcurrentGetInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/benchmark/src/main/java/org/objenesis/benchmark/ConcurrentGetInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@
public static class SunInstantiatorStrategy extends BaseInstantiatorStrategy {
@Override
public ObjectInstantiator newInstantiatorOf(Class type) {
- return new SunReflectionFactoryInstantiator(type);
+ return new SunReflectionFactoryInstantiator<>(type);
}
}
diff -Nru objenesis-2.6/benchmark/src/main/java/org/objenesis/benchmark/CreateObject.java objenesis-3.0.1/benchmark/src/main/java/org/objenesis/benchmark/CreateObject.java
--- objenesis-2.6/benchmark/src/main/java/org/objenesis/benchmark/CreateObject.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/benchmark/src/main/java/org/objenesis/benchmark/CreateObject.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,8 +79,8 @@
@Setup
public void prepare() {
- sunInstantiator = new SunReflectionFactoryInstantiator
");
summary.println("");
- List exceptions = new ArrayList();
+ List exceptions = new ArrayList<>();
// Candidates
for(Map.Entry> entry : results.entrySet()) {
diff -Nru objenesis-2.6/gae/src/main/java/org/objenesis/gae/JspWriterListener.java objenesis-3.0.1/gae/src/main/java/org/objenesis/gae/JspWriterListener.java
--- objenesis-2.6/gae/src/main/java/org/objenesis/gae/JspWriterListener.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/gae/src/main/java/org/objenesis/gae/JspWriterListener.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +54,17 @@
} catch (IOException e) {
throw new RuntimeException(e);
}
+ }
+
+ @Override
+ public void instantiatorNotFound(String className, Throwable t) {
+ ByteArrayOutputStream b = new ByteArrayOutputStream();
+ t.printStackTrace(new PrintStream(b));
+ try {
+ writer.println(String.format(PATTERN, className + " not found", "KO - " + t));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
private Typology getTypology(Class> c) {
diff -Nru objenesis-2.6/gae/src/main/webapp/index.jsp objenesis-3.0.1/gae/src/main/webapp/index.jsp
--- objenesis-2.6/gae/src/main/webapp/index.jsp 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/gae/src/main/webapp/index.jsp 2018-10-19 00:44:52.000000000 +0000
@@ -1,6 +1,6 @@
<%--
- Copyright 2006-2017 the original author or authors.
+ Copyright 2006-2018 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@
Value
<%
- for(Map.Entry property : new TreeMap(System.getProperties()).entrySet()) {
+ for(Map.Entry property : new TreeMap<>(System.getProperties()).entrySet()) {
%>
<%= "
" + property.getKey() + "
" + property.getValue() + "
" %>
<%
diff -Nru objenesis-2.6/gae/src/main/webapp/WEB-INF/appengine-web.xml objenesis-3.0.1/gae/src/main/webapp/WEB-INF/appengine-web.xml
--- objenesis-2.6/gae/src/main/webapp/WEB-INF/appengine-web.xml 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/gae/src/main/webapp/WEB-INF/appengine-web.xml 2018-10-19 00:44:52.000000000 +0000
@@ -1,7 +1,7 @@
4.0.0org.objenesisobjenesis-parent
- 2.6
+ 3.0.1objenesis
@@ -19,6 +36,9 @@
${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+ org.objenesis
+
@@ -27,8 +47,8 @@
maven-timestamp-plugin
- com.mycila.maven-license-plugin
- maven-license-plugin
+ com.mycila
+ license-maven-pluginmaven-remote-resources-plugin
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android10Instantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/android/Android10Instantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android10Instantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/android/Android10Instantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,10 +56,7 @@
newStaticMethod.setAccessible(true);
return newStaticMethod;
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
+ catch(RuntimeException | NoSuchMethodException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android17Instantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/android/Android17Instantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android17Instantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/android/Android17Instantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,10 +58,7 @@
newInstanceMethod.setAccessible(true);
return newInstanceMethod;
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
+ catch(RuntimeException | NoSuchMethodException e) {
throw new ObjenesisException(e);
}
}
@@ -74,16 +71,7 @@
return (Integer) newInstanceMethod.invoke(null, Object.class);
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
- throw new ObjenesisException(e);
- }
- catch(IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
- catch(InvocationTargetException e) {
+ catch(RuntimeException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android18Instantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/android/Android18Instantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/Android18Instantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/android/Android18Instantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
import org.objenesis.instantiator.annotations.Typology;
/**
- * Instantiator for Android API leve 18 and higher. Same as the version 17 but the
+ * Instantiator for Android API level 18 and higher. Same as the version 17 but the
* newInstance now takes a long in parameter
*
* @author Henri Tremblay
@@ -58,10 +58,7 @@
newInstanceMethod.setAccessible(true);
return newInstanceMethod;
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
+ catch(RuntimeException | NoSuchMethodException e) {
throw new ObjenesisException(e);
}
}
@@ -74,16 +71,7 @@
return (Long) newInstanceMethod.invoke(null, Object.class);
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
- throw new ObjenesisException(e);
- }
- catch(IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
- catch(InvocationTargetException e) {
+ catch(RuntimeException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/AndroidSerializationInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/android/AndroidSerializationInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/android/AndroidSerializationInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/android/AndroidSerializationInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@
public AndroidSerializationInstantiator(Class type) {
this.type = type;
newInstanceMethod = getNewInstanceMethod();
- Method m = null;
+ Method m;
try {
m = ObjectStreamClass.class.getMethod("lookupAny", Class.class);
} catch (NoSuchMethodException e) {
@@ -48,9 +48,7 @@
}
try {
objectStreamClass = (ObjectStreamClass) m.invoke(null, type);
- } catch (IllegalAccessException e) {
- throw new ObjenesisException(e);
- } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException | InvocationTargetException e) {
throw new ObjenesisException(e);
}
}
@@ -59,13 +57,7 @@
try {
return type.cast(newInstanceMethod.invoke(objectStreamClass, type));
}
- catch(IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
- catch(IllegalArgumentException e) {
- throw new ObjenesisException(e);
- }
- catch(InvocationTargetException e) {
+ catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new ObjenesisException(e);
}
}
@@ -77,10 +69,7 @@
newInstanceMethod.setAccessible(true);
return newInstanceMethod;
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
+ catch(RuntimeException | NoSuchMethodException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/annotations/Instantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/annotations/Instantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/annotations/Instantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/annotations/Instantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/annotations/Typology.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/annotations/Typology.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/annotations/Typology.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/annotations/Typology.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/AccessibleInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/AccessibleInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/AccessibleInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/AccessibleInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ConstructorInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/ConstructorInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ConstructorInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/ConstructorInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/FailingInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/FailingInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/FailingInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/FailingInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/NewInstanceInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/NewInstanceInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/NewInstanceInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/NewInstanceInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,10 +15,10 @@
*/
package org.objenesis.instantiator.basic;
-import org.objenesis.ObjenesisException;
import org.objenesis.instantiator.ObjectInstantiator;
import org.objenesis.instantiator.annotations.Instantiator;
import org.objenesis.instantiator.annotations.Typology;
+import org.objenesis.instantiator.util.ClassUtils;
/**
* The simplest instantiator - simply calls Class.newInstance(). This can deal with default public
@@ -37,12 +37,7 @@
}
public T newInstance() {
- try {
- return type.newInstance();
- }
- catch(Exception e) {
- throw new ObjenesisException(e);
- }
+ return ClassUtils.newInstance(type);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/NullInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/NullInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/NullInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/NullInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/ObjectInputStreamInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,7 +120,7 @@
}
@Override
- public int read() throws IOException {
+ public int read() {
int result = data[pointer++];
if(pointer >= data.length) {
advanceBuffer();
@@ -130,12 +130,12 @@
}
@Override
- public int available() throws IOException {
+ public int available() {
return Integer.MAX_VALUE;
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(byte[] b, int off, int len) {
int left = len;
int remaining = data.length - pointer;
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/ObjectStreamClassInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,10 +44,7 @@
newInstanceMethod = ObjectStreamClass.class.getDeclaredMethod("newInstance");
newInstanceMethod.setAccessible(true);
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
+ catch(RuntimeException | NoSuchMethodException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ProxyingInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/ProxyingInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/basic/ProxyingInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/basic/ProxyingInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
import org.objenesis.instantiator.annotations.Instantiator;
import org.objenesis.instantiator.annotations.Typology;
import org.objenesis.instantiator.util.ClassDefinitionUtils;
+import org.objenesis.instantiator.util.ClassUtils;
import static org.objenesis.instantiator.util.ClassDefinitionUtils.*;
@@ -46,7 +47,7 @@
private static final int INDEX_UTF8_CLASS = 7;
private static final int INDEX_UTF8_SUPERCLASS = 8;
- private static int CONSTANT_POOL_COUNT = 9;
+ private static final int CONSTANT_POOL_COUNT = 9;
private static final byte[] CODE = { OPS_aload_0, OPS_return};
private static final int CODE_ATTRIBUTE_LENGTH = 12 + CODE.length;
@@ -56,28 +57,21 @@
private static final String CONSTRUCTOR_NAME = "";
private static final String CONSTRUCTOR_DESC = "()V";
- private final Class> newType;
+ private final Class extends T> newType;
public ProxyingInstantiator(Class type) {
- byte[] classBytes = writeExtendingClass(type, SUFFIX);
+ byte[] classBytes = writeExtendingClass(type);
try {
- newType = ClassDefinitionUtils.defineClass(type.getName() + SUFFIX, classBytes, type.getClassLoader());
+ newType = ClassDefinitionUtils.defineClass(type.getName() + SUFFIX, classBytes, type, type.getClassLoader());
} catch (Exception e) {
throw new ObjenesisException(e);
}
}
- @SuppressWarnings("unchecked")
public T newInstance() {
- try {
- return (T) newType.newInstance();
- } catch (InstantiationException e) {
- throw new ObjenesisException(e);
- } catch (IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
+ return ClassUtils.newInstance(newType);
}
/**
@@ -85,18 +79,15 @@
* only have an empty default constructor
*
* @param type type to extend
- * @param suffix the suffix appended to the class name to create the next extending class name
* @return the byte for the class
* @throws ObjenesisException is something goes wrong
*/
- private static byte[] writeExtendingClass(Class> type, String suffix) {
- String parentClazz = classNameToInternalClassName(type.getName());
- String clazz = parentClazz + suffix;
+ private static byte[] writeExtendingClass(Class> type) {
+ String parentClazz = ClassUtils.classNameToInternalClassName(type.getName());
+ String clazz = parentClazz + SUFFIX;
- DataOutputStream in = null;
ByteArrayOutputStream bIn = new ByteArrayOutputStream(1000); // 1000 should be large enough to fit the entire class
- try {
- in = new DataOutputStream(bIn);
+ try(DataOutputStream in = new DataOutputStream(bIn)) {
in.write(MAGIC);
in.write(VERSION);
@@ -178,14 +169,6 @@
} catch (IOException e) {
throw new ObjenesisException(e);
- } finally {
- if(in != null) {
- try {
- in.close();
- } catch (IOException e) {
- throw new ObjenesisException(e);
- }
- }
}
return bIn.toByteArray();
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiatorBase.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,18 +41,11 @@
private static void initialize() {
if(newObjectMethod == null) {
try {
- newObjectMethod = ObjectInputStream.class.getDeclaredMethod("newObject", new Class[] {
- Class.class, Class.class});
+ newObjectMethod = ObjectInputStream.class.getDeclaredMethod("newObject", Class.class, Class.class);
newObjectMethod.setAccessible(true);
dummyStream = new DummyStream();
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
- throw new ObjenesisException(e);
- }
- catch(IOException e) {
+ catch(RuntimeException | NoSuchMethodException | IOException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/gcj/GCJInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,13 +39,7 @@
try {
return type.cast(newObjectMethod.invoke(dummyStream, type, Object.class));
}
- catch(RuntimeException e) {
- throw new ObjenesisException(e);
- }
- catch(IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
- catch(InvocationTargetException e) {
+ catch(RuntimeException | IllegalAccessException | InvocationTargetException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/gcj/GCJSerializationInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
*/
@Instantiator(Typology.SERIALIZATION)
public class GCJSerializationInstantiator extends GCJInstantiatorBase {
- private Class super T> superType;
+ private final Class super T> superType;
public GCJSerializationInstantiator(Class type) {
super(type);
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/ObjectInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/ObjectInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/ObjectInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/ObjectInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/perc/PercInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/perc/PercInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/perc/PercInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/perc/PercInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,13 +47,10 @@
Boolean.TYPE);
newInstanceMethod.setAccessible(true);
}
- catch(RuntimeException e) {
+ catch(RuntimeException | NoSuchMethodException e) {
throw new ObjenesisException(e);
}
- catch(NoSuchMethodException e) {
- throw new ObjenesisException(e);
- }
- }
+ }
@SuppressWarnings("unchecked")
public T newInstance() {
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/perc/PercSerializationInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/perc/PercSerializationInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/perc/PercSerializationInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/perc/PercSerializationInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@
Class> percMethodClass = Class.forName("COM.newmonics.PercClassLoader.Method");
newInstanceMethod = ObjectInputStream.class.getDeclaredMethod("noArgConstruct",
- new Class[] {Class.class, Object.class, percMethodClass});
+ Class.class, Object.class, percMethodClass);
newInstanceMethod.setAccessible(true);
// Create invoke params
@@ -64,22 +64,13 @@
Method getPercClassMethod = percClassClass.getDeclaredMethod("getPercClass", Class.class);
Object someObject = getPercClassMethod.invoke(null, unserializableType);
Method findMethodMethod = someObject.getClass().getDeclaredMethod("findMethod",
- new Class[] {String.class});
+ String.class);
Object percMethod = findMethodMethod.invoke(someObject, "()V");
typeArgs = new Object[] {unserializableType, type, percMethod};
}
- catch(ClassNotFoundException e) {
- throw new ObjenesisException(e);
- }
- catch(NoSuchMethodException e) {
- throw new ObjenesisException(e);
- }
- catch(InvocationTargetException e) {
- throw new ObjenesisException(e);
- }
- catch(IllegalAccessException e) {
+ catch(ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw new ObjenesisException(e);
}
}
@@ -89,10 +80,7 @@
try {
return (T) newInstanceMethod.invoke(null, typeArgs);
}
- catch(IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
- catch(InvocationTargetException e) {
+ catch(IllegalAccessException | InvocationTargetException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/MagicInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/MagicInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/MagicInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/MagicInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
import org.objenesis.instantiator.annotations.Instantiator;
import org.objenesis.instantiator.annotations.Typology;
import org.objenesis.instantiator.util.ClassDefinitionUtils;
+import org.objenesis.instantiator.util.ClassUtils;
import static org.objenesis.instantiator.util.ClassDefinitionUtils.*;
@@ -57,7 +58,7 @@
private static final int INDEX_CLASS_TYPE = 17;
private static final int INDEX_UTF8_TYPE = 18;
- private static int CONSTANT_POOL_COUNT = 19;
+ private static final int CONSTANT_POOL_COUNT = 19;
private static final byte[] CONSTRUCTOR_CODE = { OPS_aload_0, OPS_invokespecial, 0, INDEX_METHODREF_OBJECT_CONSTRUCTOR, OPS_return};
private static final int CONSTRUCTOR_CODE_ATTRIBUTE_LENGTH = 12 + CONSTRUCTOR_CODE.length;
@@ -68,7 +69,7 @@
private static final String CONSTRUCTOR_NAME = "";
private static final String CONSTRUCTOR_DESC = "()V";
- private ObjectInstantiator instantiator;
+ private final ObjectInstantiator instantiator;
public MagicInstantiator(Class type) {
instantiator = newInstantiatorOf(type);
@@ -87,29 +88,23 @@
return instantiator;
}
- private ObjectInstantiator newInstantiatorOf(Class type) {
+ private ObjectInstantiator newInstantiatorOf(Class type) {
String suffix = type.getSimpleName();
String className = getClass().getName() + "$$$" + suffix;
- Class> clazz = getExistingClass(getClass().getClassLoader(), className);
+ Class> clazz = ClassUtils.getExistingClass(getClass().getClassLoader(), className);
if(clazz == null) {
byte[] classBytes = writeExtendingClass(type, className);
try {
- clazz = ClassDefinitionUtils.defineClass(className, classBytes, getClass().getClassLoader());
+ clazz = ClassDefinitionUtils.defineClass(className, classBytes, type, getClass().getClassLoader());
} catch (Exception e) {
throw new ObjenesisException(e);
}
}
- try {
- return clazz.newInstance();
- } catch (InstantiationException e) {
- throw new ObjenesisException(e);
- } catch (IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
+ return ClassUtils.newInstance(clazz);
}
/**
@@ -122,13 +117,10 @@
* @throws ObjenesisException is something goes wrong
*/
private byte[] writeExtendingClass(Class> type, String className) {
- String clazz = classNameToInternalClassName(className);
-
- DataOutputStream in = null;
- ByteArrayOutputStream bIn = new ByteArrayOutputStream(1000); // 1000 should be large enough to fit the entire class
- try {
- in = new DataOutputStream(bIn);
+ String clazz = ClassUtils.classNameToInternalClassName(className);
+ ByteArrayOutputStream bIn = new ByteArrayOutputStream(1000); // 1000 should be large enough to fit the entire class
+ try(DataOutputStream in = new DataOutputStream(bIn)) {
in.write(MAGIC);
in.write(VERSION);
in.writeShort(CONSTANT_POOL_COUNT);
@@ -208,7 +200,7 @@
// 18. Type to instantiate name
in.writeByte(CONSTANT_Utf8);
- in.writeUTF(classNameToInternalClassName(type.getName()));
+ in.writeUTF(ClassUtils.classNameToInternalClassName(type.getName()));
// end of constant pool
@@ -268,14 +260,6 @@
} catch (IOException e) {
throw new ObjenesisException(e);
- } finally {
- if(in != null) {
- try {
- in.close();
- } catch (IOException e) {
- throw new ObjenesisException(e);
- }
- }
}
return bIn.toByteArray();
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryHelper.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryHelper.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryHelper.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryHelper.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,13 +44,7 @@
return (Constructor) newConstructorForSerializationMethod.invoke(
reflectionFactory, type, constructor);
}
- catch(IllegalArgumentException e) {
- throw new ObjenesisException(e);
- }
- catch(IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
- catch(InvocationTargetException e) {
+ catch(IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
throw new ObjenesisException(e);
}
}
@@ -70,16 +64,7 @@
"getReflectionFactory");
return method.invoke(null);
}
- catch(NoSuchMethodException e) {
- throw new ObjenesisException(e);
- }
- catch(IllegalAccessException e) {
- throw new ObjenesisException(e);
- }
- catch(IllegalArgumentException e) {
- throw new ObjenesisException(e);
- }
- catch(InvocationTargetException e) {
+ catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException | IllegalArgumentException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactoryInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/SunReflectionFactorySerializationInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/UnsafeFactoryInstantiator.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/UnsafeFactoryInstantiator.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/sun/UnsafeFactoryInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/sun/UnsafeFactoryInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,8 +22,6 @@
import org.objenesis.instantiator.annotations.Typology;
import org.objenesis.instantiator.util.UnsafeUtils;
-import java.lang.reflect.Field;
-
/**
* Instantiates an object, WITHOUT calling it's constructor, using
* {@code sun.misc.Unsafe.allocateInstance()}. Unsafe and its methods are implemented by most
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,19 +15,14 @@
*/
package org.objenesis.instantiator.util;
-import org.objenesis.ObjenesisException;
-
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.lang.reflect.Field;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
-import sun.misc.Unsafe;
-
/**
* Helper class for ProxyObjectInstantiator. We can see the details of a class specification
* here
@@ -72,15 +67,10 @@
private ClassDefinitionUtils() { }
-// private static Method DEFINE_CLASS;
private static final ProtectionDomain PROTECTION_DOMAIN;
static {
- PROTECTION_DOMAIN = AccessController.doPrivileged(new PrivilegedAction() {
- public ProtectionDomain run() {
- return ClassDefinitionUtils.class.getProtectionDomain();
- }
- });
+ PROTECTION_DOMAIN = AccessController.doPrivileged((PrivilegedAction) ClassDefinitionUtils.class::getProtectionDomain);
}
/**
@@ -90,14 +80,15 @@
* @param type of the class returned
* @param className class name in the format org.objenesis.MyClass
* @param b bytes representing the class
+ * @param neighbor a class in the same package as the loaded class
* @param loader the class loader where the class will be loaded
* @return the newly loaded class
* @throws Exception whenever something goes wrong
*/
@SuppressWarnings("unchecked")
- public static Class defineClass(String className, byte[] b, ClassLoader loader)
+ public static Class defineClass(String className, byte[] b, Class> neighbor, ClassLoader loader)
throws Exception {
- Class c = (Class) UnsafeUtils.getUnsafe().defineClass(className, b, 0, b.length, loader, PROTECTION_DOMAIN);
+ Class c = (Class) DefineClassHelper.defineClass(className, b, 0, b.length, neighbor, loader, PROTECTION_DOMAIN);
// Force static initializers to run.
Class.forName(className, true, loader);
return c;
@@ -113,19 +104,15 @@
*/
public static byte[] readClass(String className) throws IOException {
// convert to a resource
- className = classNameToResource(className);
+ className = ClassUtils.classNameToResource(className);
byte[] b = new byte[2500]; // I'm assuming that I'm reading class that are not too big
int length;
- InputStream in = ClassDefinitionUtils.class.getClassLoader().getResourceAsStream(className);
- try {
+ try (InputStream in = ClassDefinitionUtils.class.getClassLoader().getResourceAsStream(className)) {
length = in.read(b);
}
- finally {
- in.close();
- }
if(length >= 2500) {
throw new IllegalArgumentException("The class is longer that 2500 bytes which is currently unsupported");
@@ -144,52 +131,8 @@
* @throws IOException if we fail to write the class
*/
public static void writeClass(String fileName, byte[] bytes) throws IOException {
- BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName));
- try {
+ try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
out.write(bytes);
}
- finally {
- out.close();
- }
- }
-
- /**
- * Will convert a class name to its name in the class definition format (e.g {@code org.objenesis.EmptyClass}
- * becomes {@code org/objenesis/EmptyClass})
- *
- * @param className full class name including the package
- * @return the internal name
- */
- public static String classNameToInternalClassName(String className) {
- return className.replace('.', '/');
- }
-
- /**
- * Will convert a class name to its class loader resource name (e.g {@code org.objenesis.EmptyClass}
- * becomes {@code org/objenesis/EmptyClass.class})
- *
- * @param className full class name including the package
- * @return the resource name
- */
- public static String classNameToResource(String className) {
- return classNameToInternalClassName(className) + ".class";
- }
-
- /**
- * Check if this class already exists in the class loader and return it if it does
- *
- * @param type of the class returned
- * @param classLoader Class loader where to search the class
- * @param className Class name with full path
- * @return the class if it already exists or null
- */
- @SuppressWarnings("unchecked")
- public static Class getExistingClass(ClassLoader classLoader, String className) {
- try {
- return (Class) Class.forName(className, true, classLoader);
- }
- catch (ClassNotFoundException e) {
- return null;
- }
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java 1970-01-01 00:00:00.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java 2018-10-19 00:44:52.000000000 +0000
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.objenesis.instantiator.util;
+
+import org.objenesis.ObjenesisException;
+
+/**
+ * Helper class for to play with classes. It contains everything needed to play with a class
+ * except the dodgy (Java 8) code you will find in {@link ClassDefinitionUtils}.
+ *
+ * @author Henri Tremblay
+ */
+public final class ClassUtils {
+
+ private ClassUtils() { }
+
+ /**
+ * Will convert a class name to its name in the class definition format (e.g {@code org.objenesis.EmptyClass}
+ * becomes {@code org/objenesis/EmptyClass})
+ *
+ * @param className full class name including the package
+ * @return the internal name
+ */
+ public static String classNameToInternalClassName(String className) {
+ return className.replace('.', '/');
+ }
+
+ /**
+ * Will convert a class name to its class loader resource name (e.g {@code org.objenesis.EmptyClass}
+ * becomes {@code org/objenesis/EmptyClass.class})
+ *
+ * @param className full class name including the package
+ * @return the resource name
+ */
+ public static String classNameToResource(String className) {
+ return classNameToInternalClassName(className) + ".class";
+ }
+
+ /**
+ * Check if this class already exists in the class loader and return it if it does
+ *
+ * @param type of the class returned
+ * @param classLoader Class loader where to search the class
+ * @param className Class name with full path
+ * @return the class if it already exists or null
+ */
+ @SuppressWarnings("unchecked")
+ public static Class getExistingClass(ClassLoader classLoader, String className) {
+ try {
+ return (Class) Class.forName(className, true, classLoader);
+ }
+ catch (ClassNotFoundException e) {
+ return null;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public static T newInstance(Class clazz) {
+ try {
+ return clazz.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new ObjenesisException(e);
+ }
+ }
+}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/DefineClassHelper.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/util/DefineClassHelper.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/DefineClassHelper.java 1970-01-01 00:00:00.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/util/DefineClassHelper.java 2018-10-19 00:44:52.000000000 +0000
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2006-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.objenesis.instantiator.util;
+
+import sun.misc.Unsafe;
+import org.objenesis.ObjenesisException;
+import org.objenesis.strategy.PlatformDescription;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.security.ProtectionDomain;
+
+/**
+ * Java 11+ removed sun.misc.Unsafe.defineClass. This class bridges the gap to work from Java 1.8 up to 11.
+ *
+ * It was inspired from javassist.
+ *
+ * @author Henri Tremblay
+ */
+public final class DefineClassHelper {
+
+ private static abstract class Helper {
+ abstract Class> defineClass(String name, byte[] b, int off, int len, Class> neighbor,
+ ClassLoader loader, ProtectionDomain protectionDomain);
+ }
+
+ private static class Java8 extends Helper {
+
+ private final MethodHandle defineClass = defineClass();
+
+ private MethodHandle defineClass() {
+ MethodType mt = MethodType.methodType(Class.class, String.class, byte[].class, int.class, int.class, ClassLoader.class, ProtectionDomain.class);
+ MethodHandle m;
+ try {
+ m = MethodHandles.publicLookup().findVirtual(Unsafe.class, "defineClass", mt);
+ } catch(NoSuchMethodException | IllegalAccessException e) {
+ throw new ObjenesisException(e);
+ }
+ Unsafe unsafe = UnsafeUtils.getUnsafe();
+ return m.bindTo(unsafe);
+ }
+
+ @Override
+ Class> defineClass(String className, byte[] b, int off, int len, Class> neighbor, ClassLoader loader, ProtectionDomain protectionDomain) {
+ try {
+ return (Class>) defineClass.invokeExact(className, b, off, len, loader, protectionDomain);
+ } catch (Throwable e) {
+ if(e instanceof Error) {
+ throw (Error) e;
+ }
+ if(e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ }
+ throw new ObjenesisException(e);
+ }
+ }
+ }
+
+ private static class Java11 extends Helper {
+
+ private final Class> module = module();
+ private final MethodHandles.Lookup lookup = MethodHandles.lookup();
+ private final MethodHandle getModule = getModule();
+ private final MethodHandle addReads = addReads();
+ private final MethodHandle privateLookupIn = privateLookupIn();
+ private final MethodHandle defineClass = defineClass();
+
+ private Class> module() {
+ try {
+ return Class.forName("java.lang.Module");
+ } catch (ClassNotFoundException e) {
+ throw new ObjenesisException(e);
+ }
+ }
+
+ private MethodHandle getModule() {
+ try {
+ return lookup.findVirtual(Class.class, "getModule", MethodType.methodType(module));
+ } catch (NoSuchMethodException | IllegalAccessException e) {
+ throw new ObjenesisException(e);
+ }
+ }
+
+ private MethodHandle addReads() {
+ try {
+ return lookup.findVirtual(module, "addReads", MethodType.methodType(module, module));
+ } catch (NoSuchMethodException | IllegalAccessException e) {
+ throw new ObjenesisException(e);
+ }
+ }
+
+ private MethodHandle privateLookupIn() {
+ try {
+ return lookup.findStatic(MethodHandles.class, "privateLookupIn", MethodType.methodType(MethodHandles.Lookup.class, Class.class, MethodHandles.Lookup.class));
+ } catch (NoSuchMethodException | IllegalAccessException e) {
+ throw new ObjenesisException(e);
+ }
+ }
+
+ private MethodHandle defineClass() {
+ try {
+ return lookup.findVirtual(MethodHandles.Lookup.class, "defineClass", MethodType.methodType(Class.class, byte[].class));
+ } catch (NoSuchMethodException | IllegalAccessException e) {
+ throw new ObjenesisException(e);
+ }
+ }
+
+ @Override
+ Class> defineClass(String className, byte[] b, int off, int len, Class> neighbor, ClassLoader loader, ProtectionDomain protectionDomain) {
+ try {
+ Object module = getModule.invokeWithArguments(DefineClassHelper.class);
+ Object neighborModule = getModule.invokeWithArguments(neighbor);
+ addReads.invokeWithArguments(module, neighborModule);
+ MethodHandles.Lookup prvlookup = (MethodHandles.Lookup) privateLookupIn.invokeExact(neighbor, lookup);
+ return (Class>) defineClass.invokeExact(prvlookup, b);
+ } catch (Throwable e) {
+ throw new ObjenesisException(neighbor.getName() + " has no permission to define the class", e);
+ }
+ }
+ }
+
+ // Java 11+ removed sun.misc.Unsafe.defineClass, so we fallback to invoking defineClass on
+ // ClassLoader until we have an implementation that uses MethodHandles.Lookup.defineClass
+ private static final Helper privileged = PlatformDescription.isAfterJava11() ?
+ new Java11() : new Java8();
+
+ public static Class> defineClass(String name, byte[] b, int off, int len, Class> neighbor,
+ ClassLoader loader, ProtectionDomain protectionDomain) {
+ return privileged.defineClass(name, b, off, len, neighbor, loader, protectionDomain);
+ }
+
+ private DefineClassHelper() {}
+}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/UnsafeUtils.java objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/util/UnsafeUtils.java
--- objenesis-2.6/main/src/main/java/org/objenesis/instantiator/util/UnsafeUtils.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/instantiator/util/UnsafeUtils.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisBase.java objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisBase.java
--- objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisBase.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisBase.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
*/
public class ObjenesisBase implements Objenesis {
- /** Strategy used by this Objenesi implementation to create classes */
+ /** Strategy used by this Objenesis implementation to create classes */
protected final InstantiatorStrategy strategy;
/** Strategy cache. Key = Class, Value = InstantiatorStrategy */
@@ -54,7 +54,7 @@
throw new IllegalArgumentException("A strategy can't be null");
}
this.strategy = strategy;
- this.cache = useCache ? new ConcurrentHashMap>() : null;
+ this.cache = useCache ? new ConcurrentHashMap<>() : null;
}
@Override
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisException.java objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisException.java
--- objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisException.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisException.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisHelper.java objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisHelper.java
--- objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisHelper.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisHelper.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@
* @return New instance of clazz
*/
public static T newSerializableInstance(Class clazz) {
- return (T) OBJENESIS_SERIALIZER.newInstance(clazz);
+ return OBJENESIS_SERIALIZER.newInstance(clazz);
}
/**
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/Objenesis.java objenesis-3.0.1/main/src/main/java/org/objenesis/Objenesis.java
--- objenesis-2.6/main/src/main/java/org/objenesis/Objenesis.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/Objenesis.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisSerializer.java objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisSerializer.java
--- objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisSerializer.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisSerializer.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisStd.java objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisStd.java
--- objenesis-2.6/main/src/main/java/org/objenesis/ObjenesisStd.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/ObjenesisStd.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/strategy/BaseInstantiatorStrategy.java objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/BaseInstantiatorStrategy.java
--- objenesis-2.6/main/src/main/java/org/objenesis/strategy/BaseInstantiatorStrategy.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/BaseInstantiatorStrategy.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/strategy/InstantiatorStrategy.java objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/InstantiatorStrategy.java
--- objenesis-2.6/main/src/main/java/org/objenesis/strategy/InstantiatorStrategy.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/InstantiatorStrategy.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/strategy/PlatformDescription.java objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/PlatformDescription.java
--- objenesis-2.6/main/src/main/java/org/objenesis/strategy/PlatformDescription.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/PlatformDescription.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,10 +15,10 @@
*/
package org.objenesis.strategy;
-import org.objenesis.ObjenesisException;
-
import java.lang.reflect.Field;
+import org.objenesis.ObjenesisException;
+
/**
* List of constants describing the currently used platform.
*
@@ -26,9 +26,6 @@
*/
public final class PlatformDescription {
- /** JVM_NAME prefix for JRockit */
- public static final String JROCKIT = "BEA";
-
/** JVM_NAME prefix for GCJ */
public static final String GNU = "GNU libgcj";
@@ -93,9 +90,8 @@
+ "JVM version=" + VM_VERSION + ", "
+ "JVM info=" + VM_INFO;
- // Add the API level is it's an Android platform
- int androidVersion = ANDROID_VERSION;
- if(androidVersion != 0) {
+ // Add the API level if it's an Android platform
+ if(ANDROID_VERSION != 0) {
desc += ", API level=" + ANDROID_VERSION;
}
desc += ")";
@@ -134,6 +130,29 @@
return bootClasspath != null && bootClasspath.toLowerCase().contains("core-oj.jar");
}
+ /**
+ * Tells if the current JVM is running Java 9 or above
+ *
+ * @return if the current JVM is Java 9 or above
+ */
+ public static boolean isAfterJigsaw() {
+ String version = PlatformDescription.SPECIFICATION_VERSION;
+ return version.indexOf('.') < 0; // No dot means the version is 9, 10, 11, ... not 1.6, 1.7, 1.8
+ }
+
+ /**
+ * Tells if the current JVM is running Java 11 or above
+ *
+ * @return if the current JVM is Java 11 or above
+ */
+ public static boolean isAfterJava11() {
+ if(!isAfterJigsaw()) {
+ return false;
+ }
+ int version = Integer.parseInt(PlatformDescription.SPECIFICATION_VERSION);
+ return version >= 11;
+ }
+
public static boolean isGoogleAppEngine() {
return GAE_VERSION != null;
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/strategy/SerializingInstantiatorStrategy.java objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/SerializingInstantiatorStrategy.java
--- objenesis-2.6/main/src/main/java/org/objenesis/strategy/SerializingInstantiatorStrategy.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/SerializingInstantiatorStrategy.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,24 +60,24 @@
if(JVM_NAME.startsWith(HOTSPOT) || PlatformDescription.isThisJVM(OPENJDK)) {
// 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(type);
+ return new ObjectInputStreamInstantiator<>(type);
}
- return new SunReflectionFactorySerializationInstantiator(type);
+ return new SunReflectionFactorySerializationInstantiator<>(type);
}
else if(JVM_NAME.startsWith(DALVIK)) {
if(PlatformDescription.isAndroidOpenJDK()) {
- return new ObjectStreamClassInstantiator(type);
+ return new ObjectStreamClassInstantiator<>(type);
}
- return new AndroidSerializationInstantiator(type);
+ return new AndroidSerializationInstantiator<>(type);
}
else if(JVM_NAME.startsWith(GNU)) {
- return new GCJSerializationInstantiator(type);
+ return new GCJSerializationInstantiator<>(type);
}
else if(JVM_NAME.startsWith(PERC)) {
- return new PercSerializationInstantiator(type);
+ return new PercSerializationInstantiator<>(type);
}
- return new SunReflectionFactorySerializationInstantiator(type);
+ return new SunReflectionFactorySerializationInstantiator<>(type);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java
--- objenesis-2.6/main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,11 +59,7 @@
public ObjectInstantiator newInstantiatorOf(Class type) {
try {
return (ObjectInstantiator) constructor.newInstance(type);
- } catch (InstantiationException e) {
- throw new ObjenesisException(e);
- } catch (IllegalAccessException e) {
- throw new ObjenesisException(e);
- } catch (InvocationTargetException e) {
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new ObjenesisException(e);
}
}
diff -Nru objenesis-2.6/main/src/main/java/org/objenesis/strategy/StdInstantiatorStrategy.java objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/StdInstantiatorStrategy.java
--- objenesis-2.6/main/src/main/java/org/objenesis/strategy/StdInstantiatorStrategy.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/main/java/org/objenesis/strategy/StdInstantiatorStrategy.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,43 +59,39 @@
// 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(type);
+ return new ObjectInputStreamInstantiator<>(type);
}
- return new AccessibleInstantiator(type);
+ return new AccessibleInstantiator<>(type);
}
// The UnsafeFactoryInstantiator would also work. But according to benchmarks, it is 2.5
// times slower. So I prefer to use this one
- return new SunReflectionFactoryInstantiator(type);
+ return new SunReflectionFactoryInstantiator<>(type);
}
else if(PlatformDescription.isThisJVM(DALVIK)) {
if(PlatformDescription.isAndroidOpenJDK()) {
// Starting at Android N which is based on OpenJDK
- return new UnsafeFactoryInstantiator(type);
+ return new UnsafeFactoryInstantiator<>(type);
}
if(ANDROID_VERSION <= 10) {
// Android 2.3 Gingerbread and lower
- return new Android10Instantiator(type);
+ return new Android10Instantiator<>(type);
}
if(ANDROID_VERSION <= 17) {
// Android 3.0 Honeycomb to 4.2 Jelly Bean
- return new Android17Instantiator(type);
+ return new Android17Instantiator<>(type);
}
// Android 4.3 until Android N
- return new Android18Instantiator(type);
- }
- else if(PlatformDescription.isThisJVM(JROCKIT)) {
- // JRockit is compliant with HotSpot
- return new SunReflectionFactoryInstantiator(type);
+ return new Android18Instantiator<>(type);
}
else if(PlatformDescription.isThisJVM(GNU)) {
- return new GCJInstantiator(type);
+ return new GCJInstantiator<>(type);
}
else if(PlatformDescription.isThisJVM(PERC)) {
- return new PercInstantiator(type);
+ return new PercInstantiator<>(type);
}
// Fallback instantiator, should work with most modern JVM
- return new UnsafeFactoryInstantiator(type);
+ return new UnsafeFactoryInstantiator<>(type);
}
}
diff -Nru objenesis-2.6/main/src/test/java/android/os/Build.java objenesis-3.0.1/main/src/test/java/android/os/Build.java
--- objenesis-2.6/main/src/test/java/android/os/Build.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/android/os/Build.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/ClassReader.java objenesis-3.0.1/main/src/test/java/org/objenesis/ClassReader.java
--- objenesis-2.6/main/src/test/java/org/objenesis/ClassReader.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/ClassReader.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
*/
package org.objenesis;
+import org.objenesis.instantiator.util.ClassUtils;
+
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
@@ -29,8 +31,8 @@
*/
public class ClassReader {
- byte[] buffer = new byte[256];
- Object[] constant_pool;
+ private final byte[] buffer = new byte[256];
+ private Object[] constant_pool;
public static void main(String[] args) throws IOException {
if(args.length != 1) {
@@ -239,7 +241,7 @@
InputStream iin;
if(classPath.startsWith("classpath:")) {
String className = classPath.substring("classpath:".length());
- String resourceName = classNameToResource(className);
+ String resourceName = ClassUtils.classNameToResource(className);
iin = getClass().getClassLoader().getResourceAsStream(resourceName);
}
else {
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/EmptyClassBis.java objenesis-3.0.1/main/src/test/java/org/objenesis/EmptyClassBis.java
--- objenesis-2.6/main/src/test/java/org/objenesis/EmptyClassBis.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/EmptyClassBis.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/EmptyClass.java objenesis-3.0.1/main/src/test/java/org/objenesis/EmptyClass.java
--- objenesis-2.6/main/src/test/java/org/objenesis/EmptyClass.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/EmptyClass.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/ExternalizableTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/ExternalizableTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/ExternalizableTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/ExternalizableTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.objenesis;
import java.io.Externalizable;
-import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
@@ -51,11 +50,11 @@
fail("A constructor shouldn't be called");
}
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
}
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
}
}
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/instantiator/basic/ProxyingInstantiatorTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/instantiator/basic/ProxyingInstantiatorTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/instantiator/basic/ProxyingInstantiatorTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/instantiator/basic/ProxyingInstantiatorTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,8 +29,8 @@
public class ProxyingInstantiatorTest {
@Test
- public void testNewInstance() throws Exception {
- ObjectInstantiator inst = new ProxyingInstantiator(EmptyClass.class);
+ public void testNewInstance() {
+ ObjectInstantiator inst = new ProxyingInstantiator<>(EmptyClass.class);
EmptyClass c = inst.newInstance();
assertEquals("EmptyClass$$$Objenesis", c.getClass().getSimpleName());
}
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/instantiator/sun/MagicInstantiatorTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/instantiator/sun/MagicInstantiatorTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/instantiator/sun/MagicInstantiatorTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/instantiator/sun/MagicInstantiatorTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,22 +33,22 @@
public void before() {
// I know it works on Hotspot and OpenJDK. Before JDK 9. Not sure on others
assumeTrue((PlatformDescription.isThisJVM(PlatformDescription.HOTSPOT) || PlatformDescription.isThisJVM(PlatformDescription.OPENJDK))
- && !PlatformDescription.SPECIFICATION_VERSION.equals("9")
+ && !PlatformDescription.isAfterJigsaw()
);
}
@Test
- public void testNewInstance() throws Exception {
- ObjectInstantiator o1 = new MagicInstantiator(EmptyClass.class);
+ public void testNewInstance() {
+ ObjectInstantiator o1 = new MagicInstantiator<>(EmptyClass.class);
assertEquals(EmptyClass.class, o1.newInstance().getClass());
- ObjectInstantiator o2 = new MagicInstantiator(EmptyClass.class);
+ ObjectInstantiator o2 = new MagicInstantiator<>(EmptyClass.class);
assertEquals(EmptyClass.class, o2.newInstance().getClass());
}
@Test
public void testInternalInstantiator() {
- ObjectInstantiator o1 = new MagicInstantiator(EmptyClass.class).getInstantiator();
+ ObjectInstantiator o1 = new MagicInstantiator<>(EmptyClass.class).getInstantiator();
assertEquals(EmptyClass.class, o1.newInstance().getClass());
}
}
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/instantiator/util/ClassDefinitionUtilsTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/instantiator/util/ClassDefinitionUtilsTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/instantiator/util/ClassDefinitionUtilsTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/instantiator/util/ClassDefinitionUtilsTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.objenesis.instantiator.util;
import org.junit.Test;
-import org.objenesis.instantiator.util.ClassDefinitionUtils;
+import org.objenesis.Objenesis;
import static org.junit.Assert.*;
@@ -25,37 +25,13 @@
*/
public class ClassDefinitionUtilsTest {
- String className = "org.objenesis.EmptyClassBis";
+ private final String className = "org.objenesis.EmptyClassBis";
@Test
public void testDefineClass() throws Exception {
byte[] b = ClassDefinitionUtils.readClass(className);
- Class> c = ClassDefinitionUtils.defineClass(className, b, getClass().getClassLoader());
+ Class> c = ClassDefinitionUtils.defineClass(className, b, Objenesis.class, getClass().getClassLoader());
assertEquals(c.getName(), className);
}
- @Test
- public void testClassNameToInternalClassName() {
- String actual = ClassDefinitionUtils.classNameToInternalClassName(className);
- assertEquals("org/objenesis/EmptyClassBis", actual);
- }
-
- @Test
- public void testClassNameToResource() {
- String actual = ClassDefinitionUtils.classNameToResource(className);
- assertEquals("org/objenesis/EmptyClassBis.class", actual);
- }
-
- @Test
- public void testGetExistingClass_existing() {
- Class> actual = ClassDefinitionUtils.getExistingClass(getClass().getClassLoader(),
- getClass().getName());
- assertSame(actual, getClass());
- }
-
- @Test
- public void testGetExistingClass_notExisting() {
- Class> actual = ClassDefinitionUtils.getExistingClass(getClass().getClassLoader(), getClass().getName() + "$$$1");
- assertNull(actual);
- }
}
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/instantiator/util/ClassUtilsTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/instantiator/util/ClassUtilsTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/instantiator/util/ClassUtilsTest.java 1970-01-01 00:00:00.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/instantiator/util/ClassUtilsTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.objenesis.instantiator.util;
+
+import org.junit.Test;
+import org.objenesis.ObjenesisException;
+
+import java.util.ArrayList;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Henri Tremblay
+ */
+public class ClassUtilsTest {
+
+ private final String className = "org.objenesis.EmptyClassBis";
+
+ @Test
+ public void testClassNameToInternalClassName() {
+ String actual = ClassUtils.classNameToInternalClassName(className);
+ assertEquals("org/objenesis/EmptyClassBis", actual);
+ }
+
+ @Test
+ public void testClassNameToResource() {
+ String actual = ClassUtils.classNameToResource(className);
+ assertEquals("org/objenesis/EmptyClassBis.class", actual);
+ }
+
+ @Test
+ public void testGetExistingClass_existing() {
+ Class> actual = ClassUtils.getExistingClass(getClass().getClassLoader(),
+ getClass().getName());
+ assertSame(actual, getClass());
+ }
+
+ @Test
+ public void testGetExistingClass_notExisting() {
+ Class> actual = ClassUtils.getExistingClass(getClass().getClassLoader(), getClass().getName() + "$$$1");
+ assertNull(actual);
+ }
+
+ @Test
+ public void testNewInstance_noArgsConstructorPresent() {
+ ArrayList> i = ClassUtils.newInstance(ArrayList.class);
+ assertTrue(i.isEmpty());
+ }
+
+ @Test
+ public void testNewInstance_noArgsConstructorAbsent() {
+ try {
+ ClassUtils.newInstance(Integer.class);
+ fail("No arg constructor. It should fail");
+ }
+ catch(ObjenesisException e) {
+ assertEquals(InstantiationException.class, e.getCause().getClass());
+ }
+ }
+}
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/ObjenesisExceptionTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/ObjenesisExceptionTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/ObjenesisExceptionTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/ObjenesisExceptionTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@
// Check null case
e = new ObjenesisException((Throwable) null);
assertNull(e.getCause());
- assertEquals(null, e.getMessage());
+ assertNull(e.getMessage());
}
@Test
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/ObjenesisTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/ObjenesisTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/ObjenesisTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/ObjenesisTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/SerializingInstantiatorTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/SerializingInstantiatorTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/SerializingInstantiatorTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/SerializingInstantiatorTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/main/src/test/java/org/objenesis/strategy/PlatformDescriptionTest.java objenesis-3.0.1/main/src/test/java/org/objenesis/strategy/PlatformDescriptionTest.java
--- objenesis-2.6/main/src/test/java/org/objenesis/strategy/PlatformDescriptionTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/main/src/test/java/org/objenesis/strategy/PlatformDescriptionTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,16 +15,16 @@
*/
package org.objenesis.strategy;
-import org.junit.Test;
-
import java.lang.reflect.Method;
+import org.junit.Test;
+
import static org.junit.Assert.*;
/**
* Currently the test just check nothing is crashing. A more complex test should play with class
* loading an properties
- *
+ *
* @author Henri Tremblay
*/
public class PlatformDescriptionTest {
@@ -48,4 +48,14 @@
int actual = (Integer) m.invoke(null);
assertEquals(42, actual);
}
+
+ @Test
+ public void isAfterJigsaw() {
+ PlatformDescription.isAfterJigsaw(); // just make sure it doesn't crash
+ }
+
+ @Test
+ public void isAfterJava11() {
+ PlatformDescription.isAfterJava11(); // just make sure it doesn't crash
+ }
}
diff -Nru objenesis-2.6/mvnw objenesis-3.0.1/mvnw
--- objenesis-2.6/mvnw 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/mvnw 1970-01-01 00:00:00.000000000 +0000
@@ -1,225 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Maven2 Start Up Batch script
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-# M2_HOME - location of maven2's installed home dir
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "`uname`" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- export JAVA_HOME="`/usr/libexec/java_home`"
- else
- export JAVA_HOME="/Library/Java/Home"
- fi
- fi
- ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=`java-config --jre-home`
- fi
-fi
-
-if [ -z "$M2_HOME" ] ; then
- ## resolve links - $0 may be a link to maven's home
- PRG="$0"
-
- # need this for relative symlinks
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG="`dirname "$PRG"`/$link"
- fi
- done
-
- saveddir=`pwd`
-
- M2_HOME=`dirname "$PRG"`/..
-
- # make it fully qualified
- M2_HOME=`cd "$M2_HOME" && pwd`
-
- cd "$saveddir"
- # echo Using m2 at $M2_HOME
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --unix "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
-fi
-
-# For Migwn, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME="`(cd "$M2_HOME"; pwd)`"
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
- # TODO classpath?
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="`which javac`"
- if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
- if $darwin ; then
- javaHome="`dirname \"$javaExecutable\"`"
- javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
- else
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- fi
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD="`which java`"
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
-
- if [ -z "$1" ]
- then
- echo "Path not specified to find_maven_basedir"
- return 1
- fi
-
- basedir="$1"
- wdir="$1"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- # workaround for JBEAP-8937 (on Solaris 10/Sparc)
- if [ -d "${wdir}" ]; then
- wdir=`cd "$wdir/.."; pwd`
- fi
- # end of workaround
- done
- echo "${basedir}"
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- echo "$(tr -s '\n' ' ' < "$1")"
- fi
-}
-
-BASE_DIR=`find_maven_basedir "$(pwd)"`
-if [ -z "$BASE_DIR" ]; then
- exit 1;
-fi
-
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
-echo $MAVEN_PROJECTBASEDIR
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --path --windows "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
-fi
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff -Nru objenesis-2.6/mvnw.cmd objenesis-3.0.1/mvnw.cmd
--- objenesis-2.6/mvnw.cmd 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/mvnw.cmd 1970-01-01 00:00:00.000000000 +0000
@@ -1,143 +0,0 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven2 Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%
diff -Nru objenesis-2.6/pom.xml objenesis-3.0.1/pom.xml
--- objenesis-2.6/pom.xml 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/pom.xml 2018-10-19 00:44:52.000000000 +0000
@@ -1,9 +1,26 @@
+
4.0.0org.objenesisobjenesis-parent
- 2.6
+ 3.0.1pomObjenesis parent project
@@ -37,7 +54,7 @@
https://github.com/easymock/objenesisscm:git:git@github.com:easymock/objenesis.gitscm:git:https://github.com/easymock/objenesis.git
- 2.6
+ 3.0.1
@@ -59,7 +76,9 @@
+ 1.8UTF-8
+ 3.1.6
@@ -85,8 +104,8 @@
maven-compiler-plugin
-
- 1.6
+
+ ${java.version}
@@ -127,8 +146,8 @@
- com.mycila.maven-license-plugin
- maven-license-plugin
+ com.mycila
+ license-maven-pluginfalse
@@ -147,27 +166,27 @@
maven-assembly-plugin
- 3.0.0
+ 3.1.0maven-compiler-plugin
- 3.6.1
+ 3.8.0maven-jar-plugin
- 3.0.2
+ 3.1.0maven-surefire-plugin
- 2.19.1
+ 2.22.0maven-clean-plugin
- 3.0.0
+ 3.1.0maven-deploy-plugin
- 2.8.2
+ 3.0.0-M1maven-gpg-plugin
@@ -184,7 +203,7 @@
maven-install-plugin
- 2.5.2
+ 3.0.0-M1maven-release-plugin
@@ -192,15 +211,15 @@
maven-resources-plugin
- 3.0.1
+ 3.1.0maven-shade-plugin
- 2.4.3
+ 3.2.0maven-site-plugin
- 3.5.1
+ 3.7.1maven-source-plugin
@@ -208,12 +227,18 @@
maven-javadoc-plugin
- 2.10.4
+ 3.0.1
+
+
+ maven-war-plugin
+ 3.2.2
+
+ org.apache.felixmaven-bundle-plugin
- 3.2.0
+ 4.0.0com.keyboardsamurais.maven
@@ -233,12 +258,15 @@
- com.mycila.maven-license-plugin
- maven-license-plugin
- 1.10.b1
+ com.mycila
+ license-maven-plugin
+ 3.0${project.basedir}/../header.txttrue
+
+ SLASHSTAR_STYLE
+ .gitignore
@@ -263,6 +291,9 @@
**/*.launch**/*.md
+
+ website/site/resources/CNAME
+ website/site/resources/.nojekyll${project.inceptionYear}
@@ -289,17 +320,17 @@
org.codehaus.mojoexec-maven-plugin
- 1.5.0
+ 1.6.0org.codehaus.mojoversions-maven-plugin
- 2.4
+ 2.7
- org.codehaus.mojo
- findbugs-maven-plugin
- 3.0.4
+ com.github.spotbugs
+ spotbugs-maven-plugin
+ ${spotbugs-maven-plugin.version}trueNaming
@@ -340,11 +371,11 @@
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-plugin[2.5.5,)
- findbugs
+ spotbugs
@@ -362,18 +393,18 @@
maven-project-info-reports-plugin
- 2.9
+ 3.0.0
- org.codehaus.mojo
- findbugs-maven-plugin
- 3.0.4
+ com.github.spotbugs
+ spotbugs-maven-plugin
+ ${spotbugs-maven-plugin.version}maven-pmd-plugin
- 3.7
+ 3.10.0
- 1.5
+ 1.6
@@ -389,7 +420,7 @@
-
+
full
@@ -416,20 +447,20 @@
- org.codehaus.mojo
- findbugs-maven-plugin
+ com.github.spotbugs
+ spotbugs-maven-plugin
- findbugs
+ spotbugs
- findbugs
+ spotbugs
- com.mycila.maven-license-plugin
- maven-license-plugin
+ com.mycila
+ license-maven-plugincheck
@@ -443,29 +474,6 @@
-
- license
-
-
-
-
- com.mycila.maven-license-plugin
- maven-license-plugin
-
-
- format
- generate-sources
-
- format
-
-
-
-
-
-
-
-
- website
@@ -487,6 +495,13 @@
+
+ gae
+
+ gae
+
+
+ release
diff -Nru objenesis-2.6/README.md objenesis-3.0.1/README.md
--- objenesis-2.6/README.md 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/README.md 2018-10-19 00:44:52.000000000 +0000
@@ -14,8 +14,8 @@
## Environment setup
I'm using:
-- Maven 3.5.0
-- IntelliJ Ultimate 2017.1.3 (thanks to JetBrains for the license) (it should also work with Eclipse)
+- Maven 3.5.3
+- IntelliJ Ultimate 2018.2 (thanks to JetBrains for the license) (it should also work with Eclipse)
To configure your local workspace:
- Import the Maven parent project to Eclipse or IntelliJ
@@ -33,7 +33,7 @@
### Full build
-This build will create the source and javadoc jars and run findbugs.
+This build will create the source and javadoc jars and run spotbugs.
`mvn install -Pfull`
@@ -41,10 +41,10 @@
### Run the Android TCK
-- Install the Android SDK
-- Configure a device (real or simulated)
-- Add an `ANDROID_HOME` to target the Android SDK
-- Add `$ANDROID_HOME/platform-tools` to your path
+- Install the Android SDK (`brew cask install android-sdk`)
+- Install `platform-tools` and `build-tools` using the sdkmanager (`sdkmanager "platform-tools" "build-tools"`)
+- Add an `ANDROID_HOME` to target the Android SDK (`export ANDROID_HOME=$(realpath $(echo "$(dirname $(readlink $(which sdkmanager)))/../.."))`)
+- Configure a device (real or simulated) and launch it
- Activate the debug mode if it's a real device
- `mvn package -Pandroid`
@@ -96,7 +96,18 @@
## To release
-* Add the release notes in `website/site/content/notes.html`
+* Add the release notes in `website/site/content/notes.html` You use this code to generate it
+
+```bash
+# Get the milestone matching the version
+milestone=$(curl -s "https://api.github.com/repos/easymock/objenesis/milestones" | jq ".[] | select(.title==\"$version\") | .number")
+echo "
"
+```
+
* Add these servers to your `settings.xml`
```xml
@@ -128,4 +139,4 @@
## Deploy the website
* Make sure the pom is at the version you want to release
-* Launch `./deploy_website.sh`
+* Launch `./deploy-website.sh`
diff -Nru objenesis-2.6/SupportedJVMs.md objenesis-3.0.1/SupportedJVMs.md
--- objenesis-2.6/SupportedJVMs.md 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/SupportedJVMs.md 2018-10-19 00:44:52.000000000 +0000
@@ -1,7 +1,7 @@
# List of currently supported JVMs
-* Sun Hotspot VM, versions 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9
-* OpenJDK 6, 7, 8, 9
+* Sun Hotspot VM, versions 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9, 10, 11
+* OpenJDK 6, 7, 8, 9, 10, 11
* Android API level 8 to 26 (Serialization support starting from Honeycomb)
* Azul Zulu (tested on 1.8.0_45-b14)
* Azul Zing JDK 1.8 (tested on 1.8.0-zing_16.10.1.0-b2)
@@ -10,6 +10,12 @@
* GCJ version 3.4.4 (tested on Windows/Cygwin)
* Aonix PERC (no serialization support), tested on version 5.0.0667
+Support per Objenesis versions:
+
+* 1.x supports Java 1.3 to 1.7
+* 2.x supports Java 1.5 to 10
+* 3.x supports Java 1.8 to 11
+
## Google App Engine
GAE is only really partially supported due to the constraints of the platform.
diff -Nru objenesis-2.6/tck/pom.xml objenesis-3.0.1/tck/pom.xml
--- objenesis-2.6/tck/pom.xml 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/pom.xml 2018-10-19 00:44:52.000000000 +0000
@@ -1,10 +1,27 @@
+
4.0.0org.objenesisobjenesis-parent
- 2.6
+ 3.0.1objenesis-tck
@@ -13,7 +30,7 @@
http://objenesis.org
- 4.11.0
+ 4.12.0
@@ -55,7 +72,7 @@
org.apache.felixorg.apache.felix.framework
- 5.6.4
+ 6.0.1test
@@ -76,8 +93,8 @@
maven-timestamp-plugin
- com.mycila.maven-license-plugin
- maven-license-plugin
+ com.mycila
+ license-maven-pluginmaven-remote-resources-plugin
@@ -89,6 +106,9 @@
org.objenesis.tck.Main
+
+ org.objenesis.tck
+
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/AbstractLoader.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/AbstractLoader.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/AbstractLoader.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/AbstractLoader.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/Candidate.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/Candidate.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/Candidate.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/Candidate.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/CandidateLoader.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/CandidateLoader.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/CandidateLoader.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/CandidateLoader.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorThrowingException.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/ConstructorThrowingException.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorThrowingException.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/ConstructorThrowingException.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithArguments.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithArguments.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithArguments.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithArguments.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithMandatoryArguments.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithMandatoryArguments.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithMandatoryArguments.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/ConstructorWithMandatoryArguments.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPackageConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/DefaultPackageConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPackageConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/DefaultPackageConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPrivateConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/DefaultPrivateConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPrivateConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/DefaultPrivateConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultProtectedConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/DefaultProtectedConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultProtectedConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/DefaultProtectedConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPublicConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/DefaultPublicConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/DefaultPublicConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/DefaultPublicConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/NoConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/NoConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/NoConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/NoConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorThrowingException.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorThrowingException.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorThrowingException.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorThrowingException.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithArguments.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithArguments.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithArguments.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithArguments.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithMandatoryArguments.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithMandatoryArguments.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithMandatoryArguments.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableConstructorWithMandatoryArguments.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPackageConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPackageConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPackageConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPackageConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPrivateConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPrivateConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPrivateConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPrivateConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultProtectedConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultProtectedConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultProtectedConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultProtectedConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPublicConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPublicConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPublicConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableDefaultPublicConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableNoConstructor.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableNoConstructor.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableNoConstructor.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableNoConstructor.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableReplacer.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableReplacer.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableReplacer.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableReplacer.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableResolver.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableResolver.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableResolver.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableResolver.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableWithAncestorThrowingException.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableWithAncestorThrowingException.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/candidates/SerializableWithAncestorThrowingException.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/candidates/SerializableWithAncestorThrowingException.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/AbstractFeature.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/AbstractFeature.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/AbstractFeature.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/AbstractFeature.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
*/
public abstract class AbstractFeature implements Feature {
- protected static final List called = new ArrayList();
+ protected static final List called = new ArrayList<>();
public AbstractFeature() {
called.clear();
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ExtendsNotSerializableParentClass.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/ExtendsNotSerializableParentClass.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ExtendsNotSerializableParentClass.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/ExtendsNotSerializableParentClass.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ExtendsSerializableClass.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/ExtendsSerializableClass.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ExtendsSerializableClass.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/ExtendsSerializableClass.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/Feature.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/Feature.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/Feature.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/Feature.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/NotSerializableClass.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/NotSerializableClass.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/NotSerializableClass.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/NotSerializableClass.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ReadExternalNotCalled.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/ReadExternalNotCalled.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ReadExternalNotCalled.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/ReadExternalNotCalled.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.objenesis.tck.features;
import java.io.Externalizable;
-import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
@@ -32,12 +31,12 @@
public static class ReadExternalAndAll implements Serializable, Externalizable {
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
called.add("writeExternal");
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
called.add("readExternal");
}
}
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ReadObjectNotCalled.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/ReadObjectNotCalled.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/ReadObjectNotCalled.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/ReadObjectNotCalled.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
*/
package org.objenesis.tck.features;
-import java.io.IOException;
-import java.io.ObjectStreamException;
import java.io.Serializable;
import org.objenesis.Objenesis;
@@ -29,16 +27,16 @@
public class ReadObjectNotCalled extends AbstractFeature {
public static class ReadObjectAndAll implements Serializable {
- private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(java.io.ObjectInputStream in) {
called.add("readObject");
}
- private Object readResolve() throws ObjectStreamException {
+ private Object readResolve() {
called.add("readResolve");
return this;
}
- private void readObjectNoData() throws ObjectStreamException {
+ private void readObjectNoData() {
called.add("readObjectNoData");
}
}
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/SerializableClass.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/SerializableClass.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/features/SerializableClass.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/features/SerializableClass.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/Main.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/Main.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/Main.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/Main.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
*/
package org.objenesis.tck;
-import java.io.IOException;
-
import org.objenesis.ObjenesisSerializer;
import org.objenesis.ObjenesisStd;
@@ -33,9 +31,8 @@
* Main class of the TCK. Can also be called as a normal method from an application server.
*
* @param args No parameters are required
- * @throws IOException When the TCK fails to read properties' files.
*/
- public static void main(String[] args) throws IOException {
+ public static void main(String[] args) {
TextReporter reporter = new TextReporter(System.out, System.err);
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/Reporter.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/Reporter.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/Reporter.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/Reporter.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/ClassEnumerator.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/search/ClassEnumerator.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/ClassEnumerator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/search/ClassEnumerator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,21 +34,20 @@
// Get the list of the files contained in the package
String[] files = directory.list();
- for (int i = 0; i < files.length; i++) {
- String fileName = files[i];
- // we are only interested in .class files
- if (fileName.endsWith(".class")) {
- // removes the .class extension
- String className = pkgname + '.' + fileName.substring(0, fileName.length() - 6);
- classes.add(className);
- continue;
- }
-
- File subdir = new File(directory, fileName);
- if (subdir.isDirectory()) {
- processDirectory(subdir, pkgname + '.' + fileName, classes);
- }
- }
+ for (String fileName : files) {
+ // we are only interested in .class files
+ if (fileName.endsWith(".class")) {
+ // removes the .class extension
+ String className = pkgname + '.' + fileName.substring(0, fileName.length() - 6);
+ classes.add(className);
+ continue;
+ }
+
+ File subdir = new File(directory, fileName);
+ if (subdir.isDirectory()) {
+ processDirectory(subdir, pkgname + '.' + fileName, classes);
+ }
+ }
}
private static void processJarfile(URL resource, String pkgname, SortedSet classes) {
@@ -96,7 +95,7 @@
* @return list of full class names
*/
public static SortedSet getClassesForPackage(Package pkg, ClassLoader classLoader) {
- SortedSet classes = new TreeSet(new Comparator() {
+ SortedSet classes = new TreeSet<>(new Comparator() {
public int compare(String o1, String o2) {
String simpleName1 = getSimpleName(o1);
String simpleName2 = getSimpleName(o2);
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiator.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiator.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiator.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiator.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
import java.util.SortedSet;
/**
@@ -32,9 +31,9 @@
*/
public class SearchWorkingInstantiator implements Serializable { // implements Serializable just for the test
- private SearchWorkingInstantiatorListener listener;
+ private final SearchWorkingInstantiatorListener listener;
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) {
System.out.println();
System.out.println(PlatformDescription.describePlatform());
System.out.println();
@@ -50,44 +49,40 @@
public void searchForInstantiator(Class> toInstantiate) {
SortedSet classes = ClassEnumerator.getClassesForPackage(ObjectInstantiator.class.getPackage());
- for (Iterator it = classes.iterator(); it.hasNext();) {
- String className = it.next();
-
- // Skip if inner class or isn't named like a instantiator
- if(className.contains("$") || !className.endsWith("Instantiator")) {
- continue;
- }
-
- Class> c = null;
- try {
- c = Class.forName(className);
- }
- catch(Exception e) {
- listener.instantiatorUnsupported(c, e);
- continue;
- }
-
- if(c.isInterface() || !ObjectInstantiator.class.isAssignableFrom(c)) {
- continue;
- }
-
- Constructor> constructor;
- try {
- constructor = c.getConstructor(Class.class);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
-
- try {
- ObjectInstantiator> instantiator =
- (ObjectInstantiator>) constructor.newInstance(toInstantiate);
- instantiator.newInstance();
- listener.instantiatorSupported(c);
- }
- catch(Exception e) {
- Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e;
- listener.instantiatorUnsupported(c, t);
- }
- }
+ for (String className : classes) {
+ // Skip if inner class or isn't named like a instantiator
+ if (className.contains("$") || !className.endsWith("Instantiator")) {
+ continue;
+ }
+
+ Class> c;
+ try {
+ c = Class.forName(className);
+ } catch (Exception e) {
+ listener.instantiatorNotFound(className, e);
+ continue;
+ }
+
+ if (c.isInterface() || !ObjectInstantiator.class.isAssignableFrom(c)) {
+ continue;
+ }
+
+ Constructor> constructor;
+ try {
+ constructor = c.getConstructor(Class.class);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+
+ try {
+ ObjectInstantiator> instantiator =
+ (ObjectInstantiator>) constructor.newInstance(toInstantiate);
+ instantiator.newInstance();
+ listener.instantiatorSupported(c);
+ } catch (Exception e) {
+ Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e;
+ listener.instantiatorUnsupported(c, t);
+ }
+ }
}
}
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiatorListener.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiatorListener.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiatorListener.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/search/SearchWorkingInstantiatorListener.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,4 +23,6 @@
void instantiatorSupported(Class> c);
void instantiatorUnsupported(Class> c, Throwable t);
+
+ void instantiatorNotFound(String className, Throwable t);
}
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SystemOutListener.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/search/SystemOutListener.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/search/SystemOutListener.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/search/SystemOutListener.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,12 @@
System.out.printf(PATTERN, c.getSimpleName() + "(" + getTypology(c) + ")", "KO - " + t);
}
- private Typology getTypology(Class> c) {
+ @Override
+ public void instantiatorNotFound(String className, Throwable t) {
+ System.out.printf(PATTERN, className + " not found", "KO - " + t);
+ }
+
+ private Typology getTypology(Class> c) {
Instantiator instantiatorAnn = c.getAnnotation(Instantiator.class);
return instantiatorAnn == null ? Typology.UNKNOWN : instantiatorAnn.value();
}
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/TCK.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/TCK.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/TCK.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/TCK.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@
private final Objenesis objenesisSerializer;
private final Reporter reporter;
- private final List candidates = new ArrayList();
+ private final List candidates = new ArrayList<>();
/**
* @param objenesisStandard Objenesis instance used to instantiate classes the standard way (no constructor called)
diff -Nru objenesis-2.6/tck/src/main/java/org/objenesis/tck/TextReporter.java objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/TextReporter.java
--- objenesis-2.6/tck/src/main/java/org/objenesis/tck/TextReporter.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/java/org/objenesis/tck/TextReporter.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,13 +38,13 @@
private static class Result {
- Candidate candidate;
+ private final Candidate candidate;
- Candidate.CandidateType type;
+ private final Candidate.CandidateType type;
- boolean result;
+ private final boolean result;
- Exception exception;
+ private final Exception exception;
/**
* @param candidate Candidate tested
@@ -74,7 +74,7 @@
private Candidate currentCandidate;
- private final Map> results = new TreeMap>();
+ private final Map> results = new TreeMap<>();
private String platformDescription;
@@ -117,10 +117,7 @@
if(!success) {
errorCount++;
}
- Map result = results.get(currentCandidate);
- if(result == null) {
- results.put(currentCandidate, result = new HashMap());
- }
+ Map result = results.computeIfAbsent(currentCandidate, k -> new HashMap<>());
result.put(type, new Result(currentCandidate, type, success, exception));
}
@@ -146,7 +143,7 @@
summary.println(" Objenesis serializer: " + objenesisSerializer.getInstantiatorOf(String.class).getClass().getName());
summary.println();
- Collection candidateNames = new ArrayList();
+ Collection candidateNames = new ArrayList<>();
for(Map.Entry> entry : results.entrySet()) {
candidateNames.add(entry.getKey().getDescription());
}
@@ -160,7 +157,7 @@
summary.print(pad("Objenesis serializer", maxObjenesisWidth));
summary.println();
- List exceptions = new ArrayList();
+ List exceptions = new ArrayList<>();
// Candidates
for(Map.Entry> entry : results.entrySet()) {
diff -Nru objenesis-2.6/tck/src/main/resources/org/objenesis/tck/candidates/serializable-candidates.properties objenesis-3.0.1/tck/src/main/resources/org/objenesis/tck/candidates/serializable-candidates.properties
--- objenesis-2.6/tck/src/main/resources/org/objenesis/tck/candidates/serializable-candidates.properties 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/resources/org/objenesis/tck/candidates/serializable-candidates.properties 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
#
-# Copyright 2006-2017 the original author or authors.
+# Copyright 2006-2018 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/main/resources/org/objenesis/tck/candidates/standard-candidates.properties objenesis-3.0.1/tck/src/main/resources/org/objenesis/tck/candidates/standard-candidates.properties
--- objenesis-2.6/tck/src/main/resources/org/objenesis/tck/candidates/standard-candidates.properties 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/main/resources/org/objenesis/tck/candidates/standard-candidates.properties 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
#
-# Copyright 2006-2017 the original author or authors.
+# Copyright 2006-2018 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff -Nru objenesis-2.6/tck/src/test/java/org/objenesis/tck/AbstractLoaderTest.java objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/AbstractLoaderTest.java
--- objenesis-2.6/tck/src/test/java/org/objenesis/tck/AbstractLoaderTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/AbstractLoaderTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,16 +31,12 @@
private StringBuilder recordedEvents;
private AbstractLoader loader;
- private AbstractLoader.ErrorHandler errorHandler;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
recordedEvents = new StringBuilder();
- AbstractLoader.ErrorHandler errorHandler = new CandidateLoader.ErrorHandler() {
- public void classNotFound(String name) {
- recordedEvents.append("classNotFound('").append(name).append("')\n");
- }
- };
+ AbstractLoader.ErrorHandler errorHandler = name ->
+ recordedEvents.append("classNotFound('").append(name).append("')\n");
loader = new AbstractLoader(getClass().getClassLoader(), errorHandler) {
@Override
protected void handlePropertyEntry(Class> clazz, String description,
@@ -69,14 +65,14 @@
@Test
public void testReportsMissingClassesToErrorHandler() throws IOException {
String input = "" + "org.objenesis.tck.AbstractLoaderTest$A = A candidate\n"
- + "org.objenesis.tck.AbstractLoaderTest$NonExistant = Dodgy candidate\n"
+ + "org.objenesis.tck.AbstractLoaderTest$NonExistent = Dodgy candidate\n"
+ "org.objenesis.tck.AbstractLoaderTest$C = C candidate\n";
loader.loadFrom(new ByteArrayInputStream(input.getBytes()), Candidate.CandidateType.STANDARD);
assertEquals(""
+ "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$A', 'A candidate')\n"
- + "classNotFound('org.objenesis.tck.AbstractLoaderTest$NonExistant')\n"
+ + "classNotFound('org.objenesis.tck.AbstractLoaderTest$NonExistent')\n"
+ "registerCandidate('class org.objenesis.tck.AbstractLoaderTest$C', 'C candidate')\n",
recordedEvents.toString());
}
@@ -94,9 +90,9 @@
}
@Test
- public void testThrowsIOExceptionIfResourceNotInClassPath() throws IOException {
+ public void testThrowsIOExceptionIfResourceNotInClassPath() {
try {
- loader.loadFromResource( "Blatently-Bogus.properties", Candidate.CandidateType.STANDARD);
+ loader.loadFromResource( "Blatantly-Bogus.properties", Candidate.CandidateType.STANDARD);
fail("Expected exception");
}
catch(IOException expectedException) {
diff -Nru objenesis-2.6/tck/src/test/java/org/objenesis/tck/ObjenesisTest.java objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/ObjenesisTest.java
--- objenesis-2.6/tck/src/test/java/org/objenesis/tck/ObjenesisTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/ObjenesisTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,15 +54,11 @@
@Override
public void exception(Candidate.CandidateType type, Exception exception) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- PrintStream out = new PrintStream(buffer);
- try {
+ try (PrintStream out = new PrintStream(buffer)) {
out.println("Exception when instantiating " + currentCandidate + " for " + type + ": ");
exception.printStackTrace(out);
fail(buffer.toString());
}
- finally {
- out.close();
- }
}
@Override
@@ -72,7 +68,7 @@
}
@Test
- public void test() throws Exception {
+ public void test() {
TCK tck = new TCK(new ObjenesisStd(), new ObjenesisSerializer(), new JUnitReporter());
tck.runTests();
}
diff -Nru objenesis-2.6/tck/src/test/java/org/objenesis/tck/OsgiTest.java objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/OsgiTest.java
--- objenesis-2.6/tck/src/test/java/org/objenesis/tck/OsgiTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/OsgiTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.objenesis.tck;
import java.io.File;
-import java.io.IOException;
import java.io.Serializable;
import org.junit.Test;
@@ -59,12 +58,12 @@
}
@Test
- public void testCanInstantiate() throws IOException {
+ public void testCanInstantiate() {
assertSame(OsgiTest.class, ObjenesisHelper.newInstance(getClass()).getClass());
}
@Test
- public void testCanInstantiateSerialize() throws IOException {
+ public void testCanInstantiateSerialize() {
assertSame(OsgiTest.class, ObjenesisHelper.newSerializableInstance(getClass()).getClass());
}
diff -Nru objenesis-2.6/tck/src/test/java/org/objenesis/tck/SerializableTest.java objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/SerializableTest.java
--- objenesis-2.6/tck/src/test/java/org/objenesis/tck/SerializableTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/SerializableTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
-import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@@ -62,7 +61,7 @@
public static class ExtendsNotSerializableButIs extends NotSerializable implements Serializable {
public ExtendsNotSerializableButIs() {
- called.add("ExtendsNotSeriazableButIs.constructor");
+ called.add("ExtendsNotSerializableButIs.constructor");
}
}
@@ -73,21 +72,21 @@
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
called.add("IsExternalizable.write");
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
called.add("IsExternalizable.read");
}
- private Object writeReplace() throws ObjectStreamException {
+ private Object writeReplace() {
called.add("IsExternalizable.writeReplace");
return this;
}
- private Object readResolve() throws ObjectStreamException {
+ private Object readResolve() {
called.add("IsExternalizable.readResolve");
return this;
}
@@ -100,12 +99,12 @@
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
called.add("IsExternalizableAndSerializable.write");
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
called.add("IsExternalizableAndSerializable.read");
}
}
@@ -116,12 +115,12 @@
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
called.add("IsExternalizableButExtends.write");
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
called.add("IsExternalizableButExtends.read");
}
}
@@ -132,12 +131,12 @@
}
// Write the object to the stream
- private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ private void writeObject(java.io.ObjectOutputStream out) {
called.add("ReadWriteObject.write");
}
// Read the object from the stream
- private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(java.io.ObjectInputStream in) {
called.add("ReadWriteObject.read");
}
}
@@ -147,18 +146,18 @@
called.add("ReadWriteReplace.constructor");
}
- private Object writeReplace() throws ObjectStreamException {
+ private Object writeReplace() {
called.add("ReadWriteReplace.write");
return this;
}
- private Object readResolve() throws ObjectStreamException {
+ private Object readResolve() {
called.add("ReadWriteReplace.read");
return this;
}
}
- private static Set called = new HashSet();
+ private static final Set called = new HashSet<>();
@After
public void verify() {
@@ -195,7 +194,7 @@
public void extendsNotSerializable() throws Exception {
writeRead(new ExtendsNotSerializableButIs());
assertCalled("NotSerializable.constructor");
- assertNotCalled("ExtendsNotSeriazableButIs.constructor");
+ assertNotCalled("ExtendsNotSerializableButIs.constructor");
}
@Test
@@ -220,7 +219,7 @@
public void isExternalizableButExtends() throws Exception {
writeRead(new IsExternalizableButExtends());
assertCalled("NotSerializable.constructor");
- assertCalled("ExtendsNotSeriazableButIs.constructor");
+ assertCalled("ExtendsNotSerializableButIs.constructor");
assertCalled("IsExternalizableButExtends.constructor");
assertCalled("IsExternalizableButExtends.read");
assertCalled("IsExternalizableButExtends.write");
diff -Nru objenesis-2.6/tck/src/test/java/org/objenesis/tck/TCKTest.java objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/TCKTest.java
--- objenesis-2.6/tck/src/test/java/org/objenesis/tck/TCKTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/TCKTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
*/
package org.objenesis.tck;
-import java.io.IOException;
-
import org.junit.Test;
import org.objenesis.Objenesis;
import org.objenesis.instantiator.ObjectInstantiator;
@@ -47,7 +45,7 @@
// Given... a TCK with some candidate classes: A, B and C.
TCK tck = new TCK(new StubbedInstantiator(), new StubbedInstantiator(), reporter) {
@Override
- protected void loadCandidates() throws IOException {
+ protected void loadCandidates() {
registerCandidate(CandidateA.class, "Candidate A", Candidate.CandidateType.STANDARD);
registerCandidate(CandidateB.class, "Candidate B", Candidate.CandidateType.STANDARD);
registerCandidate(CandidateB.class, "Candidate B", Candidate.CandidateType.SERIALIZATION);
@@ -76,7 +74,7 @@
// Given... a TCK with some candidate classes: A, B and C.
TCK tck = new TCK(new SelectiveInstantiator(), new SelectiveInstantiator(), reporter) {
@Override
- protected void loadCandidates() throws IOException {
+ protected void loadCandidates() {
registerCandidate(CandidateA.class, "Candidate A", Candidate.CandidateType.STANDARD);
registerCandidate(CandidateA.class, "Candidate A", Candidate.CandidateType.SERIALIZATION);
registerCandidate(CandidateB.class, "Candidate B", Candidate.CandidateType.STANDARD);
diff -Nru objenesis-2.6/tck/src/test/java/org/objenesis/tck/TextReporterTest.java objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/TextReporterTest.java
--- objenesis-2.6/tck/src/test/java/org/objenesis/tck/TextReporterTest.java 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/test/java/org/objenesis/tck/TextReporterTest.java 2018-10-19 00:44:52.000000000 +0000
@@ -1,5 +1,5 @@
-/**
- * Copyright 2006-2017 the original author or authors.
+/*
+ * Copyright 2006-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@
private ByteArrayOutputStream summaryBuffer;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
summaryBuffer = new ByteArrayOutputStream();
ByteArrayOutputStream logBuffer = new ByteArrayOutputStream();
textReporter = new TextReporter(new PrintStream(summaryBuffer), new PrintStream(logBuffer));
diff -Nru objenesis-2.6/tck/src/test/resources/logback-test.xml objenesis-3.0.1/tck/src/test/resources/logback-test.xml
--- objenesis-2.6/tck/src/test/resources/logback-test.xml 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck/src/test/resources/logback-test.xml 2018-10-19 00:44:52.000000000 +0000
@@ -1,6 +1,6 @@
4.0.0org.objenesisobjenesis-parent
- 2.6
+ 3.0.1objenesis-tck-androidObjenesis Android TCK
@@ -56,7 +73,7 @@
com.simpligility.maven.pluginsandroid-maven-plugin
- 4.4.3
+ 4.5.0truefalse
@@ -75,8 +92,8 @@
maven-timestamp-plugin
- com.mycila.maven-license-plugin
- maven-license-plugin
+ com.mycila
+ license-maven-pluginmaven-remote-resources-plugin
@@ -87,8 +104,9 @@
android-maven-plugin
- 25
+ 27
+ --min-sdk-version=26true
diff -Nru objenesis-2.6/tck-android/project.properties objenesis-3.0.1/tck-android/project.properties
--- objenesis-2.6/tck-android/project.properties 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck-android/project.properties 2018-10-19 00:44:52.000000000 +0000
@@ -1,2 +1,2 @@
# Project target.
-target=android-8
+target=android-26
diff -Nru objenesis-2.6/tck-android/src/main/AndroidManifest.xml objenesis-3.0.1/tck-android/src/main/AndroidManifest.xml
--- objenesis-2.6/tck-android/src/main/AndroidManifest.xml 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/tck-android/src/main/AndroidManifest.xml 2018-10-19 00:44:52.000000000 +0000
@@ -1,7 +1,7 @@
4.0.0org.objenesisobjenesis-parent
- 2.6
+ 3.0.1objenesis-websiteObjenesis websitepom
- 2.6
+ 3.0.1apidocs
@@ -22,7 +39,7 @@
org.objenesisobjenesis
- 2.6
+ 3.0.1
diff -Nru objenesis-2.6/website/site/content/acknowledgements.html objenesis-3.0.1/website/site/content/acknowledgements.html
--- objenesis-2.6/website/site/content/acknowledgements.html 2017-06-20 15:18:32.000000000 +0000
+++ objenesis-3.0.1/website/site/content/acknowledgements.html 2018-10-19 00:44:52.000000000 +0000
@@ -1,6 +1,6 @@