Skip to content

Clean up STDLIB_FQCNS: remove redundant @OnchainLibrary entries, keep only Builtins #22

Description

@satran004

Summary

JulcCompiler.STDLIB_FQCNS (line 62) hardcodes 12 stdlib FQCNs for import resolution. All @onchainlibrary entries are redundant — they're already dynamically discovered via LibrarySourceResolver.scanClasspathSources() and added to knownFqcns at lines 211-217.

Only Builtins needs to remain hardcoded since it is not an @onchainlibrary (no Java source compiled to PIR — methods map directly to UPLC builtins via StdlibRegistry).

Why it's safe

User-defined @onchainlibrary classes already work without any hardcoded entry — they're resolved through the same libraryCus loop. The stdlib @onchainlibrary classes (ListsLib, MapLib, BlsLib, NativeValueLib, etc.) use the identical discovery path.

Change

In julc-compiler/src/main/java/com/bloxbean/cardano/julc/compiler/JulcCompiler.java:

// Before (line 62-75)
private static final Set STDLIB_FQCNS = Set.of(
"com.bloxbean.cardano.julc.stdlib.Builtins",
"com.bloxbean.cardano.julc.stdlib.lib.ContextsLib",
"com.bloxbean.cardano.julc.stdlib.lib.ListsLib",
... // 10 more entries
);

// After
private static final Set STDLIB_FQCNS = Set.of(
"com.bloxbean.cardano.julc.stdlib.Builtins"
);

Same change applies at line 624 (the compileMethod path).

Verification

  • ./gradlew test — full suite passes
  • Compile a validator importing every stdlib library (ContextsLib, ListsLib, BlsLib, NativeValueLib, etc.)
  • Compile a validator using a user-defined @onchainlibrary

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions