René's URL Explorer Experiment


Title: Else if conversion fails · Issue #70 · natural/java2python · GitHub

Open Graph Title: Else if conversion fails · Issue #70 · natural/java2python

X Title: Else if conversion fails · Issue #70 · natural/java2python

Description: When converting an existing code base I found that else-if apparently is not supported. Here's an example: public static void main(String[] args) { int a = 0; if (a == 1) { System.out.println("a=1"); } else if (a == 2) { System.out.print...

Open Graph Description: When converting an existing code base I found that else-if apparently is not supported. Here's an example: public static void main(String[] args) { int a = 0; if (a == 1) { System.out.println("a=1"...

X Description: When converting an existing code base I found that else-if apparently is not supported. Here's an example: public static void main(String[] args) { int a = 0; if (a == 1) { System.out.println(&...

Opengraph URL: https://github.com/natural/java2python/issues/70

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Else if conversion fails","articleBody":"When converting an existing code base I found that else-if apparently is not supported. Here's an example:\r\n\r\n```java\r\n   public static void main(String[] args) {\r\n        int a = 0;\r\n        if (a == 1) {\r\n                System.out.println(\"a=1\");\r\n        } else if (a == 2) {\r\n                System.out.println(\"a=2\");\r\n        }\r\n    }\r\n```\r\nwhich fails with the output\r\n```\r\n$ j2py HelloWorld.java\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/j2py\", line 258, in \u003cmodule\u003e\r\n    sys.exit(runMain(configScript(sys.argv[1:])))\r\n  File \"/usr/local/bin/j2py\", line 57, in runMain\r\n    return runOneOrMany(options)\r\n  File \"/usr/local/bin/j2py\", line 82, in runOneOrMany\r\n    return runTransform(options)\r\n  File \"/usr/local/bin/j2py\", line 134, in runTransform\r\n    module.walk(tree)\r\n  File \"/usr/local/lib/python2.7/dist-packages/java2python/compiler/visitor.py\", line 86, in walk\r\n    visitor.walk(child, memo)\r\n  File \"/usr/local/lib/python2.7/dist-packages/java2python/compiler/visitor.py\", line 86, in walk\r\n    visitor.walk(child, memo)\r\n  File \"/usr/local/lib/python2.7/dist-packages/java2python/compiler/visitor.py\", line 86, in walk\r\n    visitor.walk(child, memo)\r\n  File \"/usr/local/lib/python2.7/dist-packages/java2python/compiler/visitor.py\", line 86, in walk\r\n    visitor.walk(child, memo)\r\n  File \"/usr/local/lib/python2.7/dist-packages/java2python/compiler/visitor.py\", line 86, in walk\r\n    visitor.walk(child, memo)\r\n  File \"/usr/local/lib/python2.7/dist-packages/java2python/compiler/visitor.py\", line 83, in walk\r\n    visitor = self.accept(tree, memo)\r\n  File \"/usr/local/lib/python2.7/dist-packages/java2python/compiler/visitor.py\", line 43, in accept\r\n    return call(node, memo)\r\n  File \"/usr/local/lib/python2.7/dist-packages/java2python/compiler/visitor.py\", line 474, in acceptIf\r\n    nextNode = nextNode.children[2]\r\n```\r\n\r\nWith the obvious workaround of separating the if statements, the conversion is successful:\r\n```java\r\n    public static void main(String[] args) {\r\n        int a = 0;\r\n        if (a == 1) {\r\n                System.out.println(\"a=1\");\r\n        }\r\n        if (a == 2) {\r\n                System.out.println(\"a=2\");\r\n        }\r\n    }\r\n```\r\nconverts to\r\n```python\r\n\r\n#!/usr/bin/env python\r\n\"\"\" generated source for module HelloWorld \"\"\"\r\nclass HelloWorld(object):\r\n    \"\"\" generated source for class HelloWorld \"\"\"\r\n    @classmethod\r\n    def main(cls, args):\r\n        \"\"\" generated source for method main \"\"\"\r\n        a = 0\r\n        if a == 1:\r\n            print \"a=1\"\r\n        if a == 2:\r\n            print \"a=2\"\r\n\r\n\r\nif __name__ == '__main__':\r\n    import sys\r\n    HelloWorld.main(sys.argv)\r\n```\r\n","author":{"url":"https://github.com/ferchault","@type":"Person","name":"ferchault"},"datePublished":"2020-12-04T15:59:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/70/java2python/issues/70"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:65f36bfd-0543-1180-7040-e255aba46c89
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA0EA:2E3F95:13D2A63:1B698B0:696A94F7
html-safe-nonce45dac89c9aaffaa3649cf09bfb4e6fe5bcf309a92855be5e6b13f6830642d006
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMEVBOjJFM0Y5NToxM0QyQTYzOjFCNjk4QjA6Njk2QTk0RjciLCJ2aXNpdG9yX2lkIjoiMjUyMjk5MzU0MjQwMTAwNDc5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac797511cffe71de10077965f0660e04fe476c81734c76c3bc5638b2374de03a09
hovercard-subject-tagissue:757210542
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/natural/java2python/70/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7a133fa2b6dad014ae50a50dc3996f527d262dcb4dd46bed1a74175d4b620e5a/natural/java2python/issues/70
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7a133fa2b6dad014ae50a50dc3996f527d262dcb4dd46bed1a74175d4b620e5a/natural/java2python/issues/70
og:image:altWhen converting an existing code base I found that else-if apparently is not supported. Here's an example: public static void main(String[] args) { int a = 0; if (a == 1) { System.out.println("a=1"...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameferchault
hostnamegithub.com
expected-hostnamegithub.com
None4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7
turbo-cache-controlno-preview
go-importgithub.com/natural/java2python git https://github.com/natural/java2python.git
octolytics-dimension-user_id146692
octolytics-dimension-user_loginnatural
octolytics-dimension-repository_id3298542
octolytics-dimension-repository_nwonatural/java2python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3298542
octolytics-dimension-repository_network_root_nwonatural/java2python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release31496a13b80a2f6ad77d6c617ee2255a3545b539
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/natural/java2python/issues/70#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnatural%2Fjava2python%2Fissues%2F70
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnatural%2Fjava2python%2Fissues%2F70
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=natural%2Fjava2python
Reloadhttps://github.com/natural/java2python/issues/70
Reloadhttps://github.com/natural/java2python/issues/70
Reloadhttps://github.com/natural/java2python/issues/70
natural https://github.com/natural
java2pythonhttps://github.com/natural/java2python
Notifications https://github.com/login?return_to=%2Fnatural%2Fjava2python
Fork 247 https://github.com/login?return_to=%2Fnatural%2Fjava2python
Star 579 https://github.com/login?return_to=%2Fnatural%2Fjava2python
Code https://github.com/natural/java2python
Issues 41 https://github.com/natural/java2python/issues
Pull requests 10 https://github.com/natural/java2python/pulls
Actions https://github.com/natural/java2python/actions
Projects 0 https://github.com/natural/java2python/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/natural/java2python/security
Please reload this pagehttps://github.com/natural/java2python/issues/70
Insights https://github.com/natural/java2python/pulse
Code https://github.com/natural/java2python
Issues https://github.com/natural/java2python/issues
Pull requests https://github.com/natural/java2python/pulls
Actions https://github.com/natural/java2python/actions
Projects https://github.com/natural/java2python/projects
Security https://github.com/natural/java2python/security
Insights https://github.com/natural/java2python/pulse
New issuehttps://github.com/login?return_to=https://github.com/natural/java2python/issues/70
New issuehttps://github.com/login?return_to=https://github.com/natural/java2python/issues/70
Else if conversion failshttps://github.com/natural/java2python/issues/70#top
https://github.com/ferchault
https://github.com/ferchault
ferchaulthttps://github.com/ferchault
on Dec 4, 2020https://github.com/natural/java2python/issues/70#issue-757210542
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.