Skip to content

Commit aa6831e

Browse files
committed
Fix CI failures: javadoc + LAL setLayer codegen for non-enum Layer
- LayerExtension.java: javadoc inside `<pre>{@code ... @OverRide ...}</pre>` blew up because `{@code}` parses `@Override` as a nested unknown tag. Drop the `{@code}` wrapper and use HTML-escaped `&#64;Override` inside plain `<pre>`. - LALBlockCodegen.generateFieldToOutput: previously detected enum-typed setters via `paramType.isEnum()` and emitted `Type.valueOf(string)` to cast LAL extractor `layer "MYSQL"` (a String literal) into the typed setter argument. With Layer no longer an enum, the `isEnum()` branch was missed and codegen tried to pass `String` to `setLayer(Layer)`, failing at compile-time. Add `paramType == Layer.class` to the same branch — Layer's registry-backed `valueOf(String)` keeps the call shape identical.
1 parent 67de4e9 commit aa6831e

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

  • oap-server
    • analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler
    • server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis

oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler/LALBlockCodegen.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.HashMap;
2424
import java.util.List;
2525
import java.util.Map;
26+
import org.apache.skywalking.oap.server.core.analysis.Layer;
2627

2728
/**
2829
* Code generation for LAL block-level structures: {@code extractor},
@@ -265,7 +266,11 @@ private static void generateFieldToOutput(
265266
sb.append(", \"")
266267
.append(LALCodegenHelper.escapeJava(field.getFormatPattern()))
267268
.append("\")");
268-
} else if (paramType.isEnum()) {
269+
} else if (paramType.isEnum() || paramType == Layer.class) {
270+
// `Layer` was historically an enum and is now a registry-backed value type with a
271+
// matching `valueOf(String)`; both flow through the same `Type.valueOf(string)`
272+
// codegen so LAL extractors written as `layer "MYSQL"` still resolve to the typed
273+
// setter argument.
269274
sb.append(paramType.getName()).append(".valueOf(");
270275
LALValueCodegen.generateCastedValueAccess(sb, field.getValue(), "String", genCtx);
271276
sb.append(")");

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/LayerExtension.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
* {@code META-INF/services/org.apache.skywalking.oap.server.core.analysis.LayerExtension}.
3434
*
3535
* <p>Example:
36-
* <pre>{@code
36+
* <pre>
3737
* public final class IotFleetLayers implements LayerExtension {
38-
* @Override
38+
* &#64;Override
3939
* public void contribute() {
4040
* Layer.register("IOT_FLEET", 1000, true);
4141
* Layer.register("IOT_GATEWAY", 1001, true);
4242
* }
4343
* }
44-
* }</pre>
44+
* </pre>
4545
*
4646
* <p>SPI is preferred over registering from a downstream module's {@code prepare()} because
4747
* Core's {@code prepare()} runs before every other module's {@code prepare()} — there is no

0 commit comments

Comments
 (0)