Skip to content

Modern Java support#325

Merged
flsobral merged 74 commits into
masterfrom
topic/support-lambda-expressions
Jul 9, 2026
Merged

Modern Java support#325
flsobral merged 74 commits into
masterfrom
topic/support-lambda-expressions

Conversation

@flsobral

@flsobral flsobral commented Mar 29, 2021

Copy link
Copy Markdown
Member

Related Issue:

#324
#398

@flsobral flsobral added help wanted Extra attention is needed feature New feature or request All platforms Issue related to the all platforms labels Mar 29, 2021
@flsobral flsobral added this to the 8.0 milestone Mar 29, 2021
@flsobral flsobral self-assigned this Mar 29, 2021
@flsobral flsobral linked an issue Mar 29, 2021 that may be closed by this pull request
12 tasks
@flsobral flsobral marked this pull request as draft March 29, 2021 16:57
@flsobral flsobral force-pushed the topic/support-lambda-expressions branch from e08756c to 7aaa3f9 Compare July 1, 2026 22:35
flsobral added 8 commits July 1, 2026 21:03
Add the first invokedynamic parser support needed for Java 8 class files.
Add bytecode parsing support for invokedynamic call sites.
Fix class name resolution for invokedynamic call sites.
Convert invokedynamic call sites into TCVM instructions during deploy.
Document the staged plan for expanding class file support from Java 8
through current Java releases, including incremental invokedynamic lowering
and Retrolambda removal criteria.
Add a modern Java class file test harness that generates roadmap fixtures
for Java 8 through Java 26 and compiles release-specific fixtures when the
local javac supports them.

Exclude unrelated local preview, launcher, and SSL sources so the focused
converter tests can run in the current worktree.
Add a class file version policy that accepts supported modern majors through
Java 26 and rejects preview or future versions with clear errors.

Parse modern constant pool tags for dynamic constants, modules, and packages,
and skip class-level attributes by length so newer metadata does not break
basic class parsing.
Parse BootstrapMethods and method handles from Java class files so
invokedynamic call sites can be inspected without treating them as normal
method calls.

Model opcode 186 separately from MethodCall and fail with an explicit
lowering error until LambdaMetafactory adapter generation is implemented.
@flsobral flsobral force-pushed the topic/support-lambda-expressions branch from de37bd4 to 3d4f7a2 Compare July 2, 2026 00:14
flsobral added 12 commits July 1, 2026 21:19
Exclude .agent/PLANS.md from copyright header validation because it is an
external ExecPlan template, not original TotalCross source.
Generate synthetic adapter classes for LambdaMetafactory stateless lambdas
backed by static implementation methods, enqueue them during deploy, and
lower the original invokedynamic site to a normal factory call.
Store captured lambda arguments in generated adapter fields and pass them
through the lowered LambdaMetafactory factory call.

Update modern Java tests and the ExecPlan to cover the captured lambda
lowering slice.
Support LambdaMetafactory lowering for common static, unbound virtual, and
bound virtual method references by generating adapter calls with the
appropriate receiver and invoke opcode.

Update modern Java fixtures, tests, and the ExecPlan for the method
reference slice.
Support LambdaMetafactory constructor references backed by
REF_newInvokeSpecial when the constructed type exactly matches the SAM
return type.

Add modern Java fixtures and tests for Box::new and update the ExecPlan.
Refresh the ExecPlan branch evidence after rebasing the original
invokedynamic commits with corrected messages and copyright headers.
Parse LambdaMetafactory altMetafactory flags and add marker interfaces to
generated lambda adapters, including serializable markers.

Add modern Java fixtures and tests for marker-interface lambdas, and keep
bridge methods rejected with a clear diagnostic.
Generate direct bridge methods for altMetafactory adapters when bridge
arguments match the SAM arguments and the return type is exact or
reference-covariant.

Add modern Java fixtures and tests for bridge-producing intersection
method references, and update the ExecPlan.
Allow Java 8 lambda lowering to accept reference-covariant implementation
returns when SAM and instantiated arguments match exactly.

Add javac fixtures and tests for method references whose implementation
returns a more specific reference type than the functional interface.
Update the ExecPlan with the remaining descriptor-adaptation slices.
Insert CHECKCAST instructions in generated Java 8 lambda adapters when
erased SAM reference arguments need to be narrowed to the instantiated
method type before invoking the implementation handle.

Add javac fixtures and tests for generic method references backed by
static and virtual String implementations, and update the ExecPlan.
Lower common Java 8 lambda descriptor adaptations through generated
adapter bytecode, including wrapper unboxing, primitive widening, and
wrapper valueOf boxing before returning through erased SAM descriptors.

Add javac fixtures and tests for generic method references that require
Integer.intValue() and Integer.valueOf(int), and mark the Java 8 lambda
lowering milestone complete in the ExecPlan.
Add a javac-produced Java 8 fixture that keeps invokedynamic in the
original class and verifies the deployer converts it plus all generated
lambda adapters through J2TC.

Cover captured lambdas, method references, altMetafactory markers,
primitive adaptation, and constructor references, and update the ExecPlan
with the Retrolambda removal proof.
flsobral added 17 commits July 8, 2026 15:26
Reduce doclint noise in network and regex documentation, remove
deprecated boxed constructors from the JSON/SQLite/regex converter
paths, and update repository-owned copyright headers on the touched
SDK files. Also record the latest progress in the ExecPlan.
Resolve runtime dispatch for Java 8 and Java 9 interface methods in TCVM,
including static interface calls and default/private interface fallbacks.

Also use public record accessors for generated record equality helpers and
update the Java 17 ExecPlan with the runtime smoke results.
Implement Java 8 predicate default helpers in the compatibility runtime without
using lambdas inside the base APIs. Add aggregate smoke coverage for Predicate,
BiPredicate, and primitive predicate helpers, then update the Java 17 ExecPlan
with the runtime validation results.
Deploy Java 8 serializable lambda markers while keeping lambda
deserialization explicitly unsupported. Skip javac's synthetic
$deserializeLambda$ method and generate a clear writeReplace diagnostic for
serializable adapters.

Add focused lowering tests, aggregate smoke coverage, and update the Java 17
ExecPlan with the validation results.
Implement common Java 11 String helpers in the compatibility runtime and
extend the aggregate smoke app to cover String.isBlank, strip variants,
repeat, and Predicate.not.

Update the Java 17 ExecPlan with the Java 11 runtime validation results.
Allow module-info class files without a superclass to pass through conversion
as metadata-only classes. Keep CONSTANT_Dynamic ldc handling explicitly
unsupported with precise diagnostics and update the Java 17 ExecPlan.
Mark the modern Java 17 class-file support ExecPlan validation as complete
after the modern converter suite, SDK dist build, aggregate smoke deploy, and
generated smoke app runtime all passed.
@flsobral flsobral force-pushed the topic/support-lambda-expressions branch from 27265d3 to 8e45e46 Compare July 9, 2026 00:27
@flsobral flsobral modified the milestones: 8.0, 7.3.0 Jul 9, 2026
@flsobral flsobral moved this from Backlog to In progress in Feature release Jul 9, 2026
@flsobral flsobral moved this from In progress to In review in Feature release Jul 9, 2026
@flsobral flsobral marked this pull request as ready for review July 9, 2026 13:45
@flsobral flsobral merged commit 414ab2f into master Jul 9, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Feature release Jul 9, 2026
@flsobral flsobral deleted the topic/support-lambda-expressions branch July 9, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

All platforms Issue related to the all platforms feature New feature or request help wanted Extra attention is needed

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Modern Java support Native support for lambda expressions

1 participant