Skip to content

Commit

Permalink
bugfixes for v5.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Prunoideae committed Jan 9, 2024
1 parent 786b7b2 commit 7e32dd8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
5 changes: 4 additions & 1 deletion common/src/main/java/com/probejs/docs/EventCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ public static void compileEvents(Map<String, DocumentClass> globalClasses) throw

elements.add("%s(extra: %s, handler: (event: %s) => void):void,".formatted(
eventName,
Serde.getTypeFormatter(type).formatFirst(), Util.formatMaybeParameterized(event)
Serde.getTypeFormatter(type)
.underscored()
.formatFirst(),
Util.formatMaybeParameterized(event)
));
}
if (handler.extra == null || !handler.extra.required) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ private boolean isReturningThis() {

@Override
public List<String> formatDocument(Integer indent, Integer stepIndent) {
return List.of(Util.indent(indent) + "%s%s%s%s;".formatted(
return List.of(Util.indent(indent) + "%s%s%s%s%s;".formatted(
document.isStatic() ? "static " : "",
document.isAbstract() ? "abstract " : "",
Util.getSafeName(document.getName()),
document.getVariables().isEmpty() ? "" : "<%s>".formatted(document.getVariables().stream().map(Serde::getTypeFormatter).map(IFormatter::formatMethodVariable).collect(Collectors.joining(", "))),
formatMethodParts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public boolean isStatic() {
}

public boolean isAbstract() {
return isAbstract;
return isAbstract && !isStatic;
}

public void setName(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.apache.commons.lang3.tuple.Pair;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public class ComponentConverter {
Expand Down Expand Up @@ -67,7 +69,19 @@ public static PropertyType<?> fromDescription(TypeDescJS description) {
if (name.equals("null")) // return any here because we don't know what to do with null
return new PropertyType.Clazz(Object.class);
if (name.startsWith("$probejs$")) {
return new PropertyType.Clazz(name.substring(9));
String clazzName = name.substring(9);
try {
Class<?> clazz = Class.forName(clazzName);
int variables = clazz.getTypeParameters().length;
if (variables > 0) {
return new PropertyType.Parameterized(
new PropertyType.Clazz(clazzName),
Collections.nCopies(variables, new PropertyType.Clazz(Object.class))
);
}
} catch (ClassNotFoundException ignored) {
}
return new PropertyType.Clazz(clazzName);
} else {
return new PropertyType.Native(name);
}
Expand Down
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ remapJar {
injectAccessWidener = true
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
classifier "fabric"
}

jar {
Expand Down
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ shadowJar {
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
classifier "forge"
}

jar {
Expand Down

0 comments on commit 7e32dd8

Please sign in to comment.