Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
87edf8c
init java implementation
carlosmiei Oct 8, 2025
dd7fc8d
init helpers
carlosmiei Oct 8, 2025
329aa69
init java version
carlosmiei Oct 8, 2025
6b3886b
add helpers. prefix
carlosmiei Oct 8, 2025
63483af
add java to integration
carlosmiei Oct 8, 2025
9c5ef77
fix literal body
carlosmiei Oct 9, 2025
88d48c1
fix property types
carlosmiei Oct 9, 2025
200122e
fix build
carlosmiei Oct 9, 2025
97869bf
add replace all to demo
carlosmiei Oct 9, 2025
3c0c77b
mute gradlew info
carlosmiei Oct 9, 2025
d9a5096
java integration tests should pass
carlosmiei Oct 9, 2025
1f1a6b5
update command
carlosmiei Oct 9, 2025
3a715ce
add tsx to dev dependencies
carlosmiei Oct 9, 2025
e636f46
add package.lock
carlosmiei Oct 9, 2025
d2a6955
rm test from app.java
carlosmiei Oct 9, 2025
21d825f
add try catch
carlosmiei Oct 9, 2025
6a932a0
rethrow error
carlosmiei Oct 9, 2025
5e7a8c4
try running java command ignoring warnings
carlosmiei Oct 10, 2025
a8a928a
add transpileJava methods
carlosmiei Oct 10, 2025
1ea5be9
java optional args
carlosmiei Oct 14, 2025
f41286e
add element access expr
carlosmiei Oct 14, 2025
27a2cc9
add element access tests to integration
carlosmiei Oct 15, 2025
df3495f
update helpers
carlosmiei Oct 16, 2025
4010b61
parse float and parseInt
carlosmiei Oct 16, 2025
6e57aa9
fix scope issue inside put
carlosmiei Oct 30, 2025
b6f3c94
opNeg and catch exc
carlosmiei Oct 30, 2025
6eebb2f
create final wrappers for async contexts
carlosmiei Nov 17, 2025
f851162
fix objects printing
carlosmiei Nov 20, 2025
fa0bdf8
first version compiling binance
carlosmiei Nov 21, 2025
09c2966
capitalize className and register reassigned vars in [a,b] = this.x()
carlosmiei Nov 26, 2025
737fa9e
get vars from nested object literals
carlosmiei Nov 26, 2025
e3da538
getVarListFromObjectLiteralAndUpdateInPlace transverse recursively to…
carlosmiei Nov 27, 2025
759f5fe
return type
carlosmiei Nov 27, 2025
1dc22cd
un pack wait to get prefixes
carlosmiei Nov 27, 2025
56b6866
print async functions no args
carlosmiei Nov 27, 2025
4a1d1a3
missing helpers
carlosmiei Nov 27, 2025
0c9e8ca
fix java integration tests
carlosmiei Nov 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
746 changes: 746 additions & 0 deletions helpers/java/helpers.java

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions java-demo/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary

5 changes: 5 additions & 0 deletions java-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
43 changes: 43 additions & 0 deletions java-demo/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java application project to get you started.
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.12/userguide/building_java_projects.html in the Gradle documentation.
*/

plugins {
// Apply the application plugin to add support for building a CLI application in Java.
application
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

dependencies {
// Use JUnit Jupiter for testing.
testImplementation(libs.junit.jupiter)

testRuntimeOnly("org.junit.platform:junit-platform-launcher")

// This dependency is used by the application.
implementation(libs.guava)
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

application {
// Define the main class for the application.
mainClass = "org.example.App"
}

tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
151 changes: 151 additions & 0 deletions java-demo/app/src/main/java/org/example/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/*
* This source file was generated by the Gradle 'init' task
*/
package org.example;

import java.util.concurrent.CompletableFuture;


public class App {

public String a = "a";
public String b = "b";
public boolean c = false;

public void aa()
{
var a = 1;
Object b = 2;
System.out.println("HEREEEE::" + a);
var data = new java.util.HashMap<String, Object>() {{
put( "1", 1 );
put( "2", 2 );
}};
var lista = new java.util.ArrayList<Object>(java.util.Arrays.asList(1, 3, 4, "5"));
Helpers.GetValue(data, "1");
Aux.fix();
// System.out.println(a);
// System.out.println(data["1"]);
// System.out.println(lista[2]);
// for (var i = 0; isLessThan(i, getArrayLength(lista)); i++)
// {
// System.out.println(lista[i]);
// }
}

public void test() {
System.out.println("test");
}

public void retryingTask(int... retries) {
int n = (retries.length == 0) ? 3 : retries[0]; // default = 3
System.out.println("n: " + n);
// ...
}

public String getGreeting() {
var i = 1;
i += 1;
var a = "aaa";
a += "bbb";
// var c = new HashMap<String, String>();
return "Hello World222!" + String.valueOf(i) + a;
}

public CompletableFuture<Object> testAsync() {
return CompletableFuture.supplyAsync(() -> {
try {
Thread.sleep(1000); // Simulate a delay
throw new RuntimeException("Simulated exception");
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return "Async Result";
});
}

public void teste()
{
Object aaa = (this.fWithParams(3)).join();
System.out.println(aaa);
var c = this.fWithParams(5);
}

public java.util.concurrent.CompletableFuture<Object> fWithParams(Object a)
{
return java.util.concurrent.CompletableFuture.supplyAsync(() -> {
return 42;
});

}

public java.util.concurrent.CompletableFuture teste(Object a)
{
return java.util.concurrent.CompletableFuture.supplyAsync(() -> {
System.out.println(a);
throw new Error("test") ;
});

}

public Object getVar(Object v) {
return v;
}

public void teste33(String a)
{
var x = 1;
x = 2;
Object newObj = new java.util.HashMap<String, Object>() {{
put( "a", App.this.getVar(x) );
put( "a", a );
// put( "b", this.getValue(this.getValue(this.getValue(2))) );
}};
throw new Error("test") ;
}

public java.util.concurrent.CompletableFuture<Object> fetchData(Object input3)
{
final Object input2 = input3;
return java.util.concurrent.CompletableFuture.supplyAsync(() -> {
Object input = input2;
input = 3;
return Helpers.add(input, 2);
});

}

public java.util.concurrent.CompletableFuture<Object> fetchData(Object input2, Object... optionalArgs)
{
final Object input3 = input2;
return java.util.concurrent.CompletableFuture.supplyAsync(() -> {
Object input = input3;
System.out.println(input);
return null;
});

}

public static void main(String[] args) {
// this.retryingTask();

var base = 3;
System.out.println(new App().getGreeting());
var app = new App();
app.teste33("example");
// app.retryingTask();
try {
var res = app.testAsync().join();
System.out.println("res: " + res);
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}

// System.out.println(app.getGreeting());
// app.test();
// app.aa();
// for (var i = 0; i < 5; ((int) i)++) {
// System.out.println("i: " + i);
// }
}
}
8 changes: 8 additions & 0 deletions java-demo/app/src/main/java/org/example/Aux.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.example;

public class Aux {

public static void fix() {
System.out.println("fix");
}
}
Loading