Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Implemented Lock and ReentrantLock APIs in JavaAPI.
Added TimeUnit and updated Thread class.
Added integration tests for concurrency primitives.


PR created automatically by Jules for task 9759936952414147110 started by @shai-almog

Implemented `java.util.concurrent.locks.Lock` and `java.util.concurrent.locks.ReentrantLock` interfaces and classes in `vm/JavaAPI`.
Added `java.util.concurrent.TimeUnit`.
Updated `java.lang.Thread` with `interrupt0`, `sleep(long, int)` and updated `join` implementation.
Added integration tests in `vm/tests` to verify locking behavior using the BytecodeTranslator.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@github-actions
Copy link

github-actions bot commented Dec 24, 2025

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

- Added `java.util.concurrent.locks.Lock` and `java.util.concurrent.locks.ReentrantLock`.
- Added `java.util.concurrent.TimeUnit`.
- Updated `java.lang.Thread` with `interrupt0`, `sleep(long, int)` and improved `join` logic.
- Created `vm/tests/src/test/java/com/codename1/tools/translator/LockIntegrationTest.java` to verify concurrency primitives using ByteCodeTranslator integration tests.
- Provided native stubs for missing JavaSE methods in the test environment to ensure linker success.
- Added `java.util.concurrent.locks.Lock` interface.
- Added `java.util.concurrent.locks.ReentrantLock` implementation.
- Added `java.util.concurrent.locks.Condition` interface.
- Added `java.util.concurrent.TimeUnit` enum.
- Updated `java.lang.Thread` with `interrupt0`, `sleep`, `join` support.
- Added `LockIntegrationTest` in `vm/tests` to verify bytecode translation of new APIs.
- Added `java.util.concurrent.locks.Lock` interface.
- Added `java.util.concurrent.locks.ReentrantLock` implementation.
- Added `java.util.concurrent.locks.Condition` interface.
- Added `java.util.concurrent.TimeUnit` enum.
- Updated `java.lang.Thread` with `interrupt0`, `sleep`, `join` support.
- Added `LockIntegrationTest` in `vm/tests` to verify bytecode translation of new APIs.
- Added `java.util.concurrent.locks.Lock` interface.
- Added `java.util.concurrent.locks.ReentrantLock` implementation.
- Added `java.util.concurrent.locks.Condition` interface.
- Added `java.util.concurrent.TimeUnit` enum.
- Updated `java.lang.Thread` with `interrupt0`, `sleep`, `join` support.
- Added `LockIntegrationTest` in `vm/tests` to verify bytecode translation of new APIs.
- Fixed spin loop in `ReentrantLock.lock()` when interrupted.
- Fixed integration test setup to avoid conflicting native stubs.
@github-actions
Copy link

github-actions bot commented Dec 24, 2025

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • Tests: 135 total, 0 failed, 0 skipped

Benchmark Results

  • Execution Time: 9801 ms

  • Hotspots (Top 20 sampled methods):

    • 22.97% java.lang.String.indexOf (399 samples)
    • 17.16% com.codename1.tools.translator.Parser.isMethodUsed (298 samples)
    • 15.77% com.codename1.tools.translator.Parser.addToConstantPool (274 samples)
    • 9.27% java.util.ArrayList.indexOf (161 samples)
    • 4.84% java.lang.Object.hashCode (84 samples)
    • 3.22% com.codename1.tools.translator.ByteCodeClass.calcUsedByNative (56 samples)
    • 2.48% java.lang.System.identityHashCode (43 samples)
    • 2.36% com.codename1.tools.translator.ByteCodeClass.fillVirtualMethodTable (41 samples)
    • 1.32% com.codename1.tools.translator.BytecodeMethod.optimize (23 samples)
    • 1.32% java.lang.StringBuilder.append (23 samples)
    • 1.27% java.lang.Integer.getChars (22 samples)
    • 1.27% java.io.FileOutputStream.writeBytes (22 samples)
    • 1.21% com.codename1.tools.translator.Parser.cullMethods (21 samples)
    • 1.04% java.io.FileOutputStream.open0 (18 samples)
    • 0.92% com.codename1.tools.translator.ByteCodeClass.markDependent (16 samples)
    • 0.69% java.util.TreeMap.getEntry (12 samples)
    • 0.69% com.codename1.tools.translator.Parser.generateClassAndMethodIndexHeader (12 samples)
    • 0.63% com.codename1.tools.translator.BytecodeMethod.appendCMethodPrefix (11 samples)
    • 0.63% java.io.UnixFileSystem.getBooleanAttributes0 (11 samples)
    • 0.63% com.codename1.tools.translator.BytecodeMethod.isMethodUsedByNative (11 samples)
  • ⚠️ Coverage report not generated.

Static Analysis

  • ✅ SpotBugs: no findings (report was not generated by the build).
  • ⚠️ PMD report not generated.
  • ⚠️ Checkstyle report not generated.

Generated automatically by the PR CI workflow.

- Added `java.util.concurrent.locks.Lock` interface.
- Added `java.util.concurrent.locks.ReentrantLock` implementation.
- Added `java.util.concurrent.locks.Condition` interface.
- Added `java.util.concurrent.TimeUnit` enum.
- Updated `java.lang.Thread` with `interrupt0`, `sleep`, `join` support.
- Added `LockIntegrationTest` in `vm/tests` to verify bytecode translation of new APIs.
- Fixed spin loop in `ReentrantLock.lock()` when interrupted.
- Fixed integration test setup to avoid conflicting native stubs.
- Implemented `java_lang_Thread_interrupt0__` and `java_lang_Thread_isInterrupted` in `vm/ByteCodeTranslator/src/nativeMethods.m` to resolve iOS linker errors.
- Added `interrupted` field to `ThreadLocalData` struct in `cn1_globals.h`.
@shai-almog
Copy link
Collaborator

shai-almog commented Dec 24, 2025

iOS screenshot updates

Compared 30 screenshots: 23 matched, 6 updated, 1 missing reference.

  • BrowserComponent — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    BrowserComponent
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as BrowserComponent.png in workflow artifacts.

  • graphics-draw-arc — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-arc
    Preview info: JPEG preview quality 20; JPEG preview quality 20; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-arc.png in workflow artifacts.

  • graphics-draw-gradient — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-gradient
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-gradient.png in workflow artifacts.

  • graphics-draw-round-rect — missing reference. Reference screenshot missing at /Users/runner/work/CodenameOne/CodenameOne/scripts/ios/screenshots/graphics-draw-round-rect.png.

    graphics-draw-round-rect
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-round-rect.png in workflow artifacts.

  • graphics-draw-string — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 422x918.
    Full-resolution PNG saved as graphics-draw-string.png in workflow artifacts.

  • graphics-draw-string-decorated — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string-decorated
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-string-decorated.png in workflow artifacts.

  • kotlin — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    kotlin
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as kotlin.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 324 seconds
  • Compilation Time: 81 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 29278 ms
Extract Extensions 22 ms
Google Services Setup 2 ms
Scan Classes 883 ms
Extract Libs 1372 ms
Inject Build Hints 54 ms
Generate Unit Tests 3 ms
Generate Stubs 1382 ms
Compile Stubs 3512 ms
Generate Icons 1014 ms
Prepare ParparVM 158 ms
ParparVM Execution 188310 ms
Post-VM Setup 151 ms
CocoaPods 6961 ms
Finalize 23 ms
Total Time 233125 msMaven Overhead : 91000 ms
CocoaPods Install (Script) 2000 ms
Simulator Boot (Run) 73000 ms
App Install 26000 ms
App Launch 13000 ms
Test Execution 183000 ms

@shai-almog shai-almog marked this pull request as ready for review December 24, 2025 16:28
@shai-almog shai-almog merged commit b799800 into master Dec 24, 2025
11 checks passed
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.

2 participants