Giter Club home page Giter Club logo

juniversal's People

Contributors

bretjohnson avatar speedypenguin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

juniversal's Issues

State of C++ translation?

I see the website says

You’ll see a lot of C++ code get generated, but it’s only partially baked at this point, so don’t expect it to work.

so maybe I'm trying this too early. I build a "hello world" app from Java to C++, then tried to compile that using clang, but I get errors in the support headers,

clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated
In file included from hello.h:4:
In file included from ../juniversal/cpp-archive/cpplib/src/juniversal.h:7:
../juniversal/cpp-archive/cpplib/src/juniversal_defs.h:28:33: error: reinterpret_cast from 'char' to 'unsigned char' is not allowed
        return reinterpret_cast<char>( reinterpret_cast<unsigned char>(value) >> bits );
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../juniversal/cpp-archive/cpplib/src/juniversal_defs.h:32:34: error: reinterpret_cast from 'short' to 'unsigned short' is not allowed
        return reinterpret_cast<short>( reinterpret_cast<unsigned short>(value) >> bits );
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../juniversal/cpp-archive/cpplib/src/juniversal_defs.h:36:32: error: reinterpret_cast from 'int' to 'unsigned int' is not allowed
        return reinterpret_cast<int>( reinterpret_cast<unsigned int>(value) >> bits );
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../juniversal/cpp-archive/cpplib/src/juniversal_defs.h:40:35: error: reinterpret_cast from 'long64' (aka 'long long') to 'ulong64' (aka 'unsigned long long') is not allowed
        return reinterpret_cast<long64>( reinterpret_cast<ulong64>(value) >> bits );
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Turning those into static casts, it gets past those and into some other errors. (I see the same error on gcc, so it doesn't look like a clang bug.)

I can submit a pull request with those fixes, if that would be helpful?

Overall, what is the state of C++ support? Is it too early to test and file bugs/submit pull requests?

Proposal : Reflection and don't stop translating by unsupported Java thing.

I have two proposal.

  1. Support reflection on C#
    We are using Refrection to realize class import from external file for Dependency Injection.
    And another developer said.
    "Id like a refrection to use a type safe cast in a method of generic type. Because, "Instanceof" operator doesnt work well in generic type.
    So. we are using .Class "
  2. Don't stop translating by unsupported Java thing.
    Please don't stop by unsupported Java thing.(Ex Generics wildcard).
    We'd like to do something by post-process and know a overall percentage of translate.

Question on how is translation working?

Just found this library and it sounds very promising before I give it a try I have some question I couldn't find answers on the website:

How is translation of java to c# working?
If transpiled what java packages from jdk are supported or are they also transpiled on the fly?

No visitor found for class org.eclipse.jdt.core.dom.TypeLiteral Error

This was reported by someone using JUniversal (Satoshi), but I'm adding it here just for tracking purposes.

  1. No visitor found for class org.eclipse.jdt.core.dom.TypeLiteral Error In this code as below, we have an error as above.

--- This is sample code to reproduce the error.

package main.java.test

public class TestClass {
     static public String test(){
         return testKey( SomeClass.class );
     }

     public static interface SomeClass  {
     }

     protected static String testKey( Class<?> key ) {
         return key.getName();
     }
}

We can't resolve this error.
Of course, it works well on Java.

Any commercial app using this tool.

It looks promising. J2OBJC takes care of java to objective-c. has it reached the same level of maturity like juniversal?
We are evaluating this kind of tools for writing business logic in common language and UI in platform specific.
J2OBJC is quite good but doesn't support windows platform.
DJINNI by dropbox does good job but learning curve(CPP is daunting ) and will not find many open source libraries like java.

Gradle build Error:Could not find org.juniversal:juniversal-gradle-plugins:0.8-SNAPSHOT

I'm trying to config Gradle file to use JUniversal plugin
this link : http://juniversal.org/getting-started/
At Running the translators on your code–Gradle plugins
In Android Studio Open Gradle File (app build.gredle)
it is >
apply plugin: 'com.android.application'
apply plugin: 'javaToObjectiveC'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.emaar.app.testbuild"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven{
            url "${System.env.HOME}/env/maven/repository"
        /    / url "https://maven-repository.dev.java.net/nonav/repository"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath group: 'org.juniversal', name: 'juniversal-gradle-plugins', version: '0.8-SNAPSHOT'
    }
}
javaToObjectiveC {
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    // compile 'org.juniversal:juniversal-gradle-plugins:0.8.3'
}

when I Sync project it shows me >

    Error:Could not find org.juniversal:juniversal-gradle-plugins:0.8-SNAPSHOT.
    Searched in the following locations:
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/maven-metadata.xml
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/juniversal-gradle-plugins-0.8-SNAPSHOT.pom
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/juniversal-gradle-plugins-0.8-SNAPSHOT.jar
    https://jcenter.bintray.com/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/maven-metadata.xml
    https://jcenter.bintray.com/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/juniversal-gradle-plugins-0.8-SNAPSHOT.pom
    https://jcenter.bintray.com/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/juniversal-gradle-plugins-0.8-SNAPSHOT.jar
    https://repo1.maven.org/maven2/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/maven-metadata.xml
    https://repo1.maven.org/maven2/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/juniversal-gradle-plugins-0.8-SNAPSHOT.pom
    https://repo1.maven.org/maven2/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/juniversal-gradle-plugins-0.8-SNAPSHOT.jar
    file:/Users/emaar/env/maven/repository/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/maven-metadata.xml
    file:/Users/emaar/env/maven/repository/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/juniversal-gradle-plugins-0.8-SNAPSHOT.pom
    file:/Users/emaar/env/maven/repository/org/juniversal/juniversal-gradle-plugins/0.8-SNAPSHOT/juniversal-gradle-plugins-0.8-SNAPSHOT.jar
Required by:
    TestBuild:app:unspecified

How to fix it ?

String Translation errors

Most String methods seem to be unsupported by the translator (toLowerCase, replaceAll, and matches are a few I've found after a brief look). Also, it throws an error explaining that it's not supported, yet still shows BUILD SUCCESSFUL after the script runs. The output files are all blank so it wasn't actually successful with just warnings or the like.

OS: Mac OSX Yosemite
Action: javaToCSharp
IDE: Intellij14

Jsimple libraries are imported as JARs in the library. The IDE has no problem with those String methods even with them being imported from JSimple and not anywhere else, so it's strange that the error doesn't appear until compile time with gradle.

sample output:

./gradlew javaToCSharp
:javaToCSharp
/Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/src/main/java
Translating /Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/src/main/java/Base32String.java
Error: Java method String.replaceAll isn't supported by the translator
File /Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/src/main/java/Base32String.java
80:43: encoded = encoded.trim().replaceAll(sSeparator, "")
^
Translating /Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/src/main/java/DataValidation.java
Error: Java method String.matches isn't supported by the translator
File /Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/src/main/java/DataValidation.java
37:26: if(!domain.matches(
^
Translating /Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/src/main/java/HelloWorld.java
Warning: -classpath path entry /Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/build/resources/main does not exist; ignoring
Warning: -sourcepath path entry /Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/src/test/java does not exist; ignoring
Error: Directory doesn't exist: /Users/hans.reichenbach/okta/hackathon/HackathonJUniversal/src/test/java

BUILD SUCCESSFUL

Total time: 3.585 secs

Translate Error :

Hi
When I want to Translate Java codes to Objective-C with Command inc Mac Termnal >>

java -jar juniversal/juniversal-translator/build/libs/juniversal-translator-0.8.3.jar -o $HOME/javaoutput/objectivec/testbuild -l objectivec -classpath  jsimple/libraries/jsimple-util/build/libs/jsimple-util-0.9.3.jar  -sourcepath $HOME/androidstudioprojects/testbuild/app/src/main/java  $HOME/androidstudioprojects/testbuild/app/src/test/java

Shows me error >>

Error: 'objectivec' is not a valid target language

I think it's Opening Ceremony Level 👍

Proposal: Support JVM bytecode translation via decompiler

JetBrains released their decompiler a while ago (seems to be a vastly improved version of fernflower):
https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine

When the decompiled code is functionally identical to the original it might be worth a try to use it for the translation into other languages via JUniversal. This would probably require a mapper that maps certain type references to JSimple classes.

How to handle the UI part in Juniversal?

I felt happy to hear the news about JUniversal.
I have gone through the Juniversal page and I have same clarifications in that,
can any one please clear me on that?

  1. For example, I developed one simple "HelloWorld" android application and build the .apk file.
  2. Using the JUniversal libraries I can able to convert the Java classes into C#.
    My Queries are,
  3. How to handle the UI part here?
  4. How to integrate the UI with the source code?

Please clarify my questions.

The import android cannot be resolved

Hello , am following this post to translate my android code to c# http://juniversal.org/getting-started/ , in the tutorial, the jar file had a snapshot "juniversal-translator-0.8-SNAPSHOT.jar" , I renamed that to "juniversal-translator-0.8.3.jar" , when I enter the command below , I get the output directory and empty file .

java -jar juniversal/juniversal-translator/build/libs/juniversal-translator-0.8.3.jar -o cSharpEdaura -l c# -classpath jsimple/libraries/jsimple-util/build/libs/jsimple-util-0.9.3.jar EdauraApp/edauramobileandroid/app/src/main/java/com/edaura/edauramobile/Courses

The result has a huge amount of errors of "cannot be resolved"
here is the first one :
Error: The import android cannot be resolved
File C:\Users\yahya\Downloads\EdauraApp\edauramobileandroid\app\src\main\java\com\edaura\edauramobile\Courses\ChooseMajorTeacherActivity.java
3:7: import android.content.Context;
^
Error: The import android cannot be resolved
File C:\Users\yahya\Downloads\EdauraApp\edauramobileandroid\app\src\main\java\com\edaura\edauramobile\Courses\ChooseMajorTeacherActivity.java
4:7: import android.content.Intent;

What am I missing?

gradlew build install javaToObjectiveC finished with non-zero exit value 4

Hi, I am using JUniversal to translate Java classes of android project to Objective-C after installing J2Objc And clone juniversal and jsimple on Mac OS X (Yosemite), when i run below command into terminal (build failed on test , so test excluded from build):

./gradlew build install javaToObjectiveC -x test

it shows me error :

:libraries:jsimple-io:javaToObjectiveC FAILED

FAILURE: Build failed with an exception.

    What went wrong: Execution failed for task ':libraries:jsimple-io:javaToObjectiveC'. Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/java'' finished with non-zero exit value 4

    Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Also the file .bash_profile in $HOME directory is defined :

export ANDROID_HOME=/usr/local/opt/android-sdk
export GRADLE_HOME=/Users/emaar/env/gradle
export M2_HOME=$HOME/env/maven
export JAVA_HOME2=/usr/libexec/java_home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home
export J2OBJC_HOME=/Users/emaar/env/j2objc
export PATH=$PATH:$M2_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$GRADLE_HOME:$J2OBJC_HOME:$JAVA_HOME

when i use :

$ ./gradlew build install javaToCSharp -x test

it shows BUILD SUCCESSFUL with Nzo Error what did i wrong ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.