Skip to content

Comments

fix: dual-mode test coverage and Long/Float literal compilation#543

Merged
lukaszlenart merged 2 commits intomainfrom
fix/issue-18-dual-mode-test-coverage
Feb 21, 2026
Merged

fix: dual-mode test coverage and Long/Float literal compilation#543
lukaszlenart merged 2 commits intomainfrom
fix/issue-18-dual-mode-test-coverage

Conversation

@lukaszlenart
Copy link
Collaborator

@lukaszlenart lukaszlenart commented Feb 21, 2026

Summary

  • Fix ASTConst.toGetSourceString() to append L suffix for Long literals and f suffix for Float literals in compiled source code generation
  • Add 66 dual-mode evaluation tests validating that interpreted and compiled execution paths produce identical results
  • Document 11 known compiler limitations with @Disabled tests

Details

The expression compiler generates Java source code via javassist. ASTConst was emitting 1234 for Long values (interpreted as int) and 12.34 for Float values (interpreted as double), causing type mismatches between interpreted and compiled modes.

Tests cover

  • Constants (int, long, double, float, boolean, null, string, char, hex, octal)
  • Integer, double, and float arithmetic
  • Bitwise operations
  • Logical expressions
  • Property access (simple, nested, array, static)
  • Method calls (no-arg, string-arg, static)
  • Null handling

Known compiler limitations (documented by @disabled tests)

  • BigDecimal/BigInteger arithmetic: Java operators (+, -, *, /) cannot be applied to these objects in generated source — requires architectural change to route through OgnlOps methods
  • BigInteger bitwise ops: Same fundamental issue
  • Float-to-double widening: Compiler widens float to double in arithmetic expressions
  • instanceof: Compiler generates invalid source ("missing member name")
  • Method on auto-boxed primitive: index.toString() generates invalid cast

Related

Once merged, #504 and #505 should be closed.

Test plan

  • All 792 tests pass (781 active + 11 skipped)
  • No regressions in existing test suite
  • CI passes

🤖 Generated with Claude Code

lukaszlenart and others added 2 commits February 21, 2026 19:20
ASTConst.toGetSourceString() was generating "1234" for Long values and
"12.34" for Float values. Java interprets these as int and double
respectively, causing type mismatches between interpreted and compiled
evaluation modes. Append "L" and "f" suffixes to preserve the correct
types.

Refs: #18

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add 66 tests validating that interpreted and compiled execution paths
produce identical results. Covers constants, integer/double/float
arithmetic, bitwise ops, logical expressions, property access, method
calls, and null handling.

11 tests are @disabled documenting known compiler limitations:
- BigDecimal/BigInteger arithmetic (Java operators unsupported)
- BigInteger bitwise operations
- Float-to-double widening in arithmetic
- instanceof expression compilation
- Method calls on auto-boxed primitives

Refs: #18

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud
Copy link

@lukaszlenart lukaszlenart marked this pull request as ready for review February 21, 2026 18:31
@lukaszlenart lukaszlenart merged commit e5c1908 into main Feb 21, 2026
5 checks passed
@lukaszlenart lukaszlenart deleted the fix/issue-18-dual-mode-test-coverage branch February 21, 2026 18:31
@lukaszlenart lukaszlenart added this to the 3.5.0 milestone Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit tests don't work if expressions are not compiled

1 participant