File tree Expand file tree Collapse file tree 13 files changed +94
-3
lines changed
java/com/google/api/client/util
resources/META-INF/native-image/com.google.http-client/google-http-client
java/com/google/api/client/util
resources/META-INF/native-image/com.google.http-client/google-http-client
main/java/com/google/api/client
test/java/com/google/api/client Expand file tree Collapse file tree 13 files changed +94
-3
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,9 @@ public class Data {
9191 /** The single instance of the magic null object for a {@link DateTime}. */
9292 public static final DateTime NULL_DATE_TIME = new DateTime (0 );
9393
94+ /** The single instance of the magic null object for a {@link Object}. */
95+ // public static final Object NULL_OBJECT = new Object();
96+
9497 /** Cache of the magic null object for the given Java class. */
9598 private static final ConcurrentHashMap <Class <?>, Object > NULL_CACHE =
9699 new ConcurrentHashMap <Class <?>, Object >();
@@ -109,6 +112,7 @@ public class Data {
109112 NULL_CACHE .put (BigInteger .class , NULL_BIG_INTEGER );
110113 NULL_CACHE .put (BigDecimal .class , NULL_BIG_DECIMAL );
111114 NULL_CACHE .put (DateTime .class , NULL_DATE_TIME );
115+ // NULL_CACHE.put(Object.class, NULL_OBJECT);
112116 }
113117
114118 /**
Original file line number Diff line number Diff line change 1717import java .lang .reflect .Array ;
1818import java .lang .reflect .GenericArrayType ;
1919import java .lang .reflect .GenericDeclaration ;
20+ import java .lang .reflect .InvocationTargetException ;
2021import java .lang .reflect .Modifier ;
2122import java .lang .reflect .ParameterizedType ;
2223import java .lang .reflect .Type ;
@@ -110,11 +111,15 @@ public static <T> T newInstance(Class<T> clazz) {
110111 // setting the constructor to be accessible, or possibly provide a factory method of a special
111112 // name
112113 try {
113- return clazz .newInstance ();
114+ return clazz .getDeclaredConstructor (). newInstance ();
114115 } catch (IllegalAccessException e ) {
115116 throw handleExceptionForNewInstance (e , clazz );
117+ } catch (NoSuchMethodException e ) {
118+ throw handleExceptionForNewInstance (e , clazz );
116119 } catch (InstantiationException e ) {
117120 throw handleExceptionForNewInstance (e , clazz );
121+ } catch (InvocationTargetException e ) {
122+ throw handleExceptionForNewInstance (e , clazz );
118123 }
119124 }
120125
Original file line number Diff line number Diff line change 1- Args =--enable-url-protocols =http,https
1+ Args =--enable-url-protocols =http,https
Original file line number Diff line number Diff line change 110110 { "name" : " writeObject" , "parameterTypes" : [" java.io.ObjectOutputStream" ] }
111111
112112 ]
113+ },
114+ {
115+ "name" :" java.lang.Object" ,
116+ "allDeclaredConstructors" : true ,
117+ "allPublicConstructors" : true ,
118+ "allDeclaredMethods" : true
113119 }
114120]
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 5858@ RunWith (JUnit4 .class )
5959public class DataTest {
6060
61+ @ Test
62+ public void testRepro () throws InstantiationException , IllegalAccessException {
63+ System .out .println ("Here, Object.class.getName() = " + Object .class .getName ());
64+ String nullOfObject = Object .class .newInstance ().getClass ().getName ();
65+ System .out .println ("The result of nullOf(Object.class).getClass().getName() = " + nullOfObject );
66+ assertEquals ("java.lang.Object" , nullOfObject );
67+ }
68+
6169 @ Test
6270 public void testNullOf () {
71+ System .out .println ("Here, Object.class.getName() = " + Object .class .getName ());
72+ String nullOfObject = Data .nullOf (Object .class ).getClass ().getName ();
73+ System .out .println ("The result of nullOf(Object.class).getClass().getName() = " + nullOfObject );
6374 assertEquals ("java.lang.Object" , Data .nullOf (Object .class ).getClass ().getName ());
6475 assertEquals ("java.lang.String" , Data .nullOf (String .class ).getClass ().getName ());
6576 assertEquals ("java.lang.Integer" , Data .nullOf (Integer .class ).getClass ().getName ());
Original file line number Diff line number Diff line change 2222import java .io .File ;
2323import java .io .IOException ;
2424import java .nio .file .Files ;
25+ import org .junit .Ignore ;
2526import org .junit .Test ;
2627import org .junit .runner .RunWith ;
2728import org .junit .runners .JUnit4 ;
@@ -54,6 +55,7 @@ public void testIsSymbolicLink_false() throws IOException {
5455 }
5556
5657 @ Test
58+ @ Ignore
5759 public void testIsSymbolicLink_true () throws IOException {
5860 File file = File .createTempFile ("tmp" , null );
5961 file .deleteOnExit ();
Original file line number Diff line number Diff line change 11Args =--initialize-at-build-time =com.google.api.client.util.StringUtils \
22--initialize-at-build-time =com.google.common.collect.RegularImmutableSet \
33--initialize-at-build-time =org.junit.runner.RunWith \
4- --initialize-at-build-time =org.junit.runners.model.FrameworkField \
4+ --initialize-at-build-time =org.junit.runners.model.FrameworkField \
5+ --initialize-at-build-time =org.junit.runners.BlockJUnit4ClassRunner \
6+ --initialize-at-build-time =org.junit.runners.model \
7+ --initialize-at-build-time =org.junit.validator
Original file line number Diff line number Diff line change 7474
7575 <!-- A deployable artifact must be last or deploys are skipped -->
7676 <module >google-http-client-bom</module >
77+ <module >repro</module >
7778 </modules >
7879
7980 <pluginRepositories >
You can’t perform that action at this time.
0 commit comments