Modern Java support#325
Merged
Merged
Conversation
12 tasks
e08756c to
7aaa3f9
Compare
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.
de37bd4 to
3d4f7a2
Compare
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.
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.
27265d3 to
8e45e46
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue:
#324#398