diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 35eb1ddfbbc029bcab630581847471d7f238ec53..07406da3fc8891cf8955a2a6cee716b4fdc60799 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ <project version="4"> <component name="VcsDirectoryMappings"> <mapping directory="" vcs="Git" /> + <mapping directory="$PROJECT_DIR$/gson" vcs="Git" /> </component> </project> \ No newline at end of file diff --git a/gson/gson/src/main/java/com/google/gson/internal/bind/JsonTreeReader.java b/gson/gson/src/main/java/com/google/gson/internal/bind/JsonTreeReader.java index fc23c2d53df1bb29ff71a10df076782aeb675d9d..4b734f709afc88567e438a67df18cc70776c7d3c 100644 --- a/gson/gson/src/main/java/com/google/gson/internal/bind/JsonTreeReader.java +++ b/gson/gson/src/main/java/com/google/gson/internal/bind/JsonTreeReader.java @@ -380,7 +380,8 @@ public final class JsonTreeReader extends JsonReader { return getPath(true); } - private String locationString() { + @Override + protected String locationString() { return " at path " + getPath(); } } diff --git a/gson/gson/src/main/java/com/google/gson/internal/reflect/ReflectionHelper.java b/gson/gson/src/main/java/com/google/gson/internal/reflect/ReflectionHelper.java index 7ee75bde92a4d63f83b5ffbb002daa3170228630..5dd127d4bb96ff71d3db2e64547685465361827d 100644 --- a/gson/gson/src/main/java/com/google/gson/internal/reflect/ReflectionHelper.java +++ b/gson/gson/src/main/java/com/google/gson/internal/reflect/ReflectionHelper.java @@ -1,3 +1,4 @@ + /* * Copyright (C) 2021 Google Inc. * @@ -48,9 +49,9 @@ public class ReflectionHelper { if (e.getClass().getName().equals("java.lang.reflect.InaccessibleObjectException")) { String message = e.getMessage(); String troubleshootingId = - message != null && message.contains("to module com.google.gson") - ? "reflection-inaccessible-to-module-gson" - : "reflection-inaccessible"; + message != null && message.contains("to module com.google.gson") + ? "reflection-inaccessible-to-module-gson" + : "reflection-inaccessible"; return "\nSee " + TroubleshootingGuide.createUrl(troubleshootingId); } return ""; @@ -69,12 +70,12 @@ public class ReflectionHelper { } catch (Exception exception) { String description = getAccessibleObjectDescription(object, false); throw new JsonIOException( - "Failed making " - + description - + " accessible; either increase its visibility" - + " or write a custom TypeAdapter for its declaring type." - + getInaccessibleTroubleshootingSuffix(exception), - exception); + "Failed making " + + description + + " accessible; either increase its visibility" + + " or write a custom TypeAdapter for its declaring type." + + getInaccessibleTroubleshootingSuffix(exception), + exception); } } @@ -87,7 +88,7 @@ public class ReflectionHelper { * @param uppercaseFirstLetter whether the first letter of the description should be uppercased */ public static String getAccessibleObjectDescription( - AccessibleObject object, boolean uppercaseFirstLetter) { + AccessibleObject object, boolean uppercaseFirstLetter) { String description; if (object instanceof Field) { @@ -130,13 +131,13 @@ public class ReflectionHelper { // Ideally parameter type would be java.lang.reflect.Executable, but that was added in Java 8 private static void appendExecutableParameters( - AccessibleObject executable, StringBuilder stringBuilder) { + AccessibleObject executable, StringBuilder stringBuilder) { stringBuilder.append('('); Class<?>[] parameters = - (executable instanceof Method) - ? ((Method) executable).getParameterTypes() - : ((Constructor<?>) executable).getParameterTypes(); + (executable instanceof Method) + ? ((Method) executable).getParameterTypes() + : ((Constructor<?>) executable).getParameterTypes(); for (int i = 0; i < parameters.length; i++) { if (i > 0) { stringBuilder.append(", "); @@ -168,12 +169,12 @@ public class ReflectionHelper { return null; } catch (Exception exception) { return "Failed making constructor '" - + constructorToString(constructor) - + "' accessible; either increase its visibility or write a custom InstanceCreator or" - + " TypeAdapter for its declaring type: " - // Include the message since it might contain more detailed information - + exception.getMessage() - + getInaccessibleTroubleshootingSuffix(exception); + + constructorToString(constructor) + + "' accessible; either increase its visibility or write a custom InstanceCreator or" + + " TypeAdapter for its declaring type: " + // Include the message since it might contain more detailed information + + exception.getMessage() + + getInaccessibleTroubleshootingSuffix(exception); } } @@ -196,26 +197,26 @@ public class ReflectionHelper { } public static RuntimeException createExceptionForUnexpectedIllegalAccess( - IllegalAccessException exception) { + IllegalAccessException exception) { throw new RuntimeException( - "Unexpected IllegalAccessException occurred (Gson " - + GsonBuildConfig.VERSION - + "). Certain ReflectionAccessFilter features require Java >= 9 to work correctly. If" - + " you are not using ReflectionAccessFilter, report this to the Gson maintainers.", - exception); + "Unexpected IllegalAccessException occurred (Gson " + + GsonBuildConfig.VERSION + + "). Certain ReflectionAccessFilter features require Java >= 9 to work correctly. If" + + " you are not using ReflectionAccessFilter, report this to the Gson maintainers.", + exception); } private static RuntimeException createExceptionForRecordReflectionException( - ReflectiveOperationException exception) { + ReflectiveOperationException exception) { throw new RuntimeException( - "Unexpected ReflectiveOperationException occurred" - + " (Gson " - + GsonBuildConfig.VERSION - + ")." - + " To support Java records, reflection is utilized to read out information" - + " about records. All these invocations happens after it is established" - + " that records exist in the JVM. This exception is unexpected behavior.", - exception); + "Unexpected ReflectiveOperationException occurred" + + " (Gson " + + GsonBuildConfig.VERSION + + ")." + + " To support Java records, reflection is utilized to read out information" + + " about records. All these invocations happens after it is established" + + " that records exist in the JVM. This exception is unexpected behavior.", + exception); } /** Internal abstraction over reflection when Records are supported. */ @@ -306,19 +307,19 @@ public class ReflectionHelper { @Override String[] getRecordComponentNames(Class<?> clazz) { throw new UnsupportedOperationException( - "Records are not supported on this JVM, this method should not be called"); + "Records are not supported on this JVM, this method should not be called"); } @Override <T> Constructor<T> getCanonicalRecordConstructor(Class<T> raw) { throw new UnsupportedOperationException( - "Records are not supported on this JVM, this method should not be called"); + "Records are not supported on this JVM, this method should not be called"); } @Override public Method getAccessor(Class<?> raw, Field field) { throw new UnsupportedOperationException( - "Records are not supported on this JVM, this method should not be called"); + "Records are not supported on this JVM, this method should not be called"); } } } diff --git a/gson/gson/src/main/java/com/google/gson/stream/JsonReader.java b/gson/gson/src/main/java/com/google/gson/stream/JsonReader.java index 2dc4e654024493d19e1b19e261021b604d68c4b1..b623c19ac753ef637641bfe259c3b93c9763beb0 100644 --- a/gson/gson/src/main/java/com/google/gson/stream/JsonReader.java +++ b/gson/gson/src/main/java/com/google/gson/stream/JsonReader.java @@ -1582,7 +1582,7 @@ public class JsonReader implements Closeable { return getClass().getSimpleName() + locationString(); } - String locationString() { + protected String locationString() { int line = lineNumber + 1; int column = pos - lineStart + 1; return " at line " + line + " column " + column + " path " + getPath(); diff --git a/gson/metrics/src/main/java/com/google/gson/metrics/UtilDeserialisationJson.java b/gson/metrics/src/main/java/com/google/gson/metrics/UtilDeserialisationJson.java index f8a4cdf1551166991435dc246f22c4abd83852bd..5c5502438e872b3908db5a5fec807381301abdd5 100644 --- a/gson/metrics/src/main/java/com/google/gson/metrics/UtilDeserialisationJson.java +++ b/gson/metrics/src/main/java/com/google/gson/metrics/UtilDeserialisationJson.java @@ -65,4 +65,4 @@ public class UtilDeserialisationJson { throw new RuntimeException("Type inattendu: " + typeChamp + ", nom: " + champ.getName()); } } -} +} \ No newline at end of file