wu-sheng opened a new pull request, #13737:
URL: https://github.com/apache/skywalking/pull/13737
### Add `def` local variable support in LAL DSL
- [x] Update the documentation to include this new feature.
- [x] Tests(including UT, IT, E2E) are added to verify the new feature.
**Grammar**: `def varName = expression` with optional `as TypeName` cast
(built-in types or FQCN).
**Built-in functions**: `toJson()` converts String/Map/protobuf `Struct` to
Gson `JsonObject`; `toJsonArray()` converts to `JsonArray`.
**Type inference**: Variable type inferred at compile time from initializer
expression. Supports null-safe navigation (`?.`) and method chaining on the
inferred type. Optional `as` cast narrows type when the inferred type is too
general (e.g., `Object` from generic API).
**Runtime helpers**: `LalRuntimeHelper.toJsonObject()` overloads for String,
Map, and protobuf Struct (recursive field conversion).
**Test reorganization**: Split monolithic `LALClassGeneratorTest` (641
lines) into 5 scoped test classes:
- `LALClassGeneratorBasicTest` (10 tests)
- `LALClassGeneratorConditionTest` (10 tests)
- `LALClassGeneratorExtractorTest` (10 tests)
- `LALClassGeneratorDefTest` (10 tests)
- `LALClassGeneratorSinkTest` (5 tests)
Plus shared `LALClassGeneratorTestBase` with `.class` file output to
`target/lal-generated-classes/` and `{TestClass}_{testMethod}` naming.
**ALS-specific tests**: `EnvoyAlsLalTest` in envoy receiver module — 3 tests
for JWT extraction from proto `filter_metadata` via chained `def` variables.
- [x] Update the [`CHANGES`
log](https://github.com/apache/skywalking/blob/master/docs/en/changes/changes.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]