fix(tooling-api): FileTypeAdapter is incorrectly implemented

This commit is contained in:
Akash Yadav
2023-01-28 22:39:36 +05:30
parent e06aa1cb5f
commit 1cc1f21ea7
3 changed files with 10 additions and 19 deletions
Binary file not shown.
@@ -37,29 +37,21 @@ public class FileTypeAdapter extends TypeAdapter<File> {
@Override
public void write(final JsonWriter out, final File value) throws IOException {
out.name("path");
if (value == null) {
out.nullValue();
return;
}
out.value(value.getPath());
}
@Override
public File read(final JsonReader in) throws IOException {
final var next = in.peek();
if (next == JsonToken.NULL) {
return null;
}
in.beginObject();
final String name = in.nextName();
if (!"path".equals(name)) {
throw new JsonParseException("Expected 'path' but was '" + name + "'");
}
final var path = in.nextString();
if (path == null) {
if (in.peek() == JsonToken.NULL) {
in.nextNull();
return null;
}
in.endObject();
return new File(path);
return new File(in.nextString());
}
}
@@ -18,7 +18,6 @@
package com.itsaky.androidide.inflater.internal
import com.itsaky.androidide.inflater.IAttribute
import com.itsaky.androidide.inflater.IViewGroup
/**
* [IView][com.itsaky.androidide.inflater.IView] implementation for `<include>` tags.
@@ -37,10 +36,10 @@ class IncludeView(private val embedded: ViewImpl) :
override fun applyAttribute(attribute: IAttribute) =
// The attributes must be applied to the embedded view
embedded.applyAttribute(attribute)
override fun onHighlightStateUpdated(highlight: Boolean) =
embedded.onHighlightStateUpdated(highlight)
override fun removeFromParent() = embedded.removeFromParent()
override fun printHierarchy() = embedded.printHierarchy()